EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Smear.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Smear.h
1 
10 #ifndef INCLUDE_EICSMEAR_SMEAR_SMEAR_H_
11 #define INCLUDE_EICSMEAR_SMEAR_SMEAR_H_
12 
13 #include <cmath>
14 #include <fstream>
15 #include <iostream>
16 #include <memory>
17 #include <sstream>
18 
19 #include <TF1.h>
20 #include <TF2.h>
21 #include <TLorentzVector.h>
22 #include <TMath.h>
23 #include <TRandom3.h>
24 #include <TROOT.h>
25 #include <TString.h>
26 #include <TSystem.h>
27 #include <TVector2.h>
28 
35 
36 namespace Smear {
37 
49 inline int PGenre(const erhic::VirtualParticle& prt) {
50  int genre(kAll);
51  const int id = abs(prt.Id()); // Sign doesn't matter
52  if (1 == prt.GetStatus()) { // Only check stable particles.
53  if (id == 11 || id == 22) {
54  genre = kElectromagnetic;
55  } else if (id >110) {
56  genre = kHadronic;
57  } // if
58  } // if
59  return genre;
60 }
61 
66 inline double FixTheta(double theta) {
67  // std::cout << theta << std::endl;
68  while (theta < 0. || theta > TMath::Pi()) {
69  if (theta < 0.) {
70  theta = -theta;
71  } // if
72  if (theta > TMath::Pi()) {
73  theta = TMath::TwoPi() - theta;
74  } // if
75  }
76  return theta;
77 }
78 
83 inline double FixPhi(double phi) {
84  return TVector2::Phi_0_2pi(phi);
85 }
86 
90 inline double GetVariable(const erhic::VirtualParticle& prt, KinType kin) {
91  double z(0.);
92  switch (kin) {
93  case kE:
94  z = prt.GetE(); break;
95  case kP:
96  z = prt.GetP(); break;
97  case kTheta:
98  z = prt.GetTheta(); break;
99  case kPhi:
100  z = prt.GetPhi(); break;
101  case kPz:
102  z = prt.GetPz(); break;
103  case kPt:
104  z = prt.GetPt(); break;
105  default:
106  break;
107  } // switch
108  return z;
109 }
110 
111 inline bool IsCoreType(KinType kin) {
112  if (kin == kE || kin == kP || kin == kTheta || kin == kPhi) return true;
113  return false;
114 }
115 
116 int ParseInputFunction(TString &s, KinType &kin1, KinType &kin2);
117 
118 } // namespace Smear
119 
120 #endif // INCLUDE_EICSMEAR_SMEAR_SMEAR_H_