eic-smear  1.0.3
A collection of ROOT classes for Monte Carlo events and a fast-smearing code simulating detector effects for the Electron-Ion Collider task force
Smear.cxx
Go to the documentation of this file.
1 
10 #include "eicsmear/smear/Smear.h"
11 
12 #include <iostream>
13 
14 #include <TString.h>
15 
16 namespace Smear {
17 
18 int ParseInputFunction(TString &s, KinType &kin1, KinType &kin2) {
19  int d = 0;
20  if (s.Contains("E")) {
21  s.ReplaceAll("E", "x");
22  d++;
23  kin1 = kE;
24  } // if
25  if (s.Contains("P")) {
26  d++;
27  if (d == 2) {
28  s.ReplaceAll("P", "y");
29  kin2 = kP;
30  } else {
31  s.ReplaceAll("P", "x");
32  kin1 = kP;
33  } // if
34  } // if
35  if (s.Contains("theta") || s.Contains("Theta")) {
36  d++;
37  if (d == 2) {
38  s.ReplaceAll("theta", "y"); s.ReplaceAll("Theta", "y");
39  kin2 = kTheta;
40  } else {
41  s.ReplaceAll("theta", "x"); s.ReplaceAll("Theta", "x");
42  kin1 = kTheta;
43  } // if
44  } // if
45  if (s.Contains("phi")) {
46  d++;
47  if (d == 2) {
48  s.ReplaceAll("phi", "y");
49  kin2 = kPhi;
50  } else {
51  s.ReplaceAll("phi", "x");
52  kin1 = kPhi;
53  } // if
54  } // if
55  if (s.Contains("pT")) {
56  d++;
57  if (d == 2) {
58  s.ReplaceAll("pT", "y");
59  kin2 = kPt;
60  } else {
61  s.ReplaceAll("pT", "x");
62  kin1 = kPt;
63  } // if
64  } // if
65  if (s.Contains("pZ")) {
66  d++;
67  if (d == 2) {
68  s.ReplaceAll("pZ", "y");
69  kin2 = kPz;
70  } else {
71  s.ReplaceAll("pZ", "x");
72  kin1 = kPz;
73  } // if
74  } // if
75  if (d > 2 || d < 0) {
76  std::cout << "!WARNING! Not enough, or too many parameters "
77  << "detected in parametrization (d=";
78  std::cout << d << ").\n";
79  } // if
80  if (d == 0) {
81  d++;
82  } // if
83  return d;
84 }
85 
86 } // namespace Smear