EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Acceptance.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Acceptance.h
1 
10 #ifndef INCLUDE_EICSMEAR_SMEAR_ACCEPTANCE_H_
11 #define INCLUDE_EICSMEAR_SMEAR_ACCEPTANCE_H_
12 
13 #include <set>
14 #include <vector>
15 
16 #include <TFormula.h>
17 #include <TMath.h>
18 
19 #include "eicsmear/smear/Smear.h" // Definition of KinType
20 
21 typedef bool (*cutfunc)(const erhic::VirtualParticle&);
22 
23 class TString;
24 
25 namespace erhic {
26 
27 class VirtualParticle;
28 
29 } // namespace erhic
30 
31 namespace Smear {
32 
38 class Acceptance {
39  public:
46  class CustomCut {
47  public:
48  virtual ~CustomCut();
49  CustomCut();
50  CustomCut(const TString&, double min, double max);
51  virtual bool Contains(const erhic::VirtualParticle&) const;
52  protected:
53  TFormula mFormula;
54  int dim;
57  double Min;
58  double Max;
59  };
60 
61  // Allows any function that takes a VirtualParticle
62  // and a parameter vectior (mins and maxes, e.g.) and returns a boolean
64  // typedef bool (*cutfunc)(const erhic::VirtualParticle& p, std::vector<double> params);
65  public:
66  virtual ~CustomCutFunction();
68  // bool Contains(const erhic::VirtualParticle& p) const;
69  protected:
70  // std::vector<double> params;
72  };
73 
77  class Zone {
78  public:
80  virtual ~Zone();
81 
88  Zone(double theta = 0., double = TMath::Pi(),
89  double phi = 0., double = TMath::TwoPi(),
90  double E = 0., double = TMath::Infinity(),
91  double p = 0., double = TMath::Infinity(),
92  double pt = 0., double = TMath::Infinity(),
93  double pz = -TMath::Infinity(), double = TMath::Infinity());
94 
98  virtual void Add(const CustomCut&);
99 
103  virtual Bool_t Contains(const erhic::VirtualParticle&) const;
104 
105  protected:
106  double thetaMin;
107  double thetaMax;
108  double phiMin;
109  double phiMax;
110  double EMin;
111  double EMax;
112  double PMin;
113  double PMax;
114  double pTMin;
115  double pTMax;
116  double pZMin;
117  double pZMax;
118  std::vector<Smear::Acceptance::CustomCut> CustomCuts;
119  // We want to be able to write Acceptance objects to a ROOT file,
120  // so nested classes need a dictionary as well.
121  ClassDef(Smear::Acceptance::Zone, 1)
122  };
123 
125  virtual ~Acceptance();
126 
133  explicit Acceptance(int genre = kAll);
134 
139  void AddZone(const Zone&);
140 
144  UInt_t GetNZones() const;
145 
149  Int_t GetGenre() const;
150 
154  void SetGenre(int genre);
155 
159  void SetCharge(ECharge charge);
160 
164  ECharge GetCharge() const;
165 
172  void AddParticle(int particle);
173 
182  bool Is(const erhic::VirtualParticle& prt) const;
183 
184  protected:
185  int mGenre;
186  ECharge mCharge; // Particle charges accepted (neutral, charged or all)
187  std::vector<Zone> mZones;
188  std::set<int> mParticles;
189 
190  ClassDef(Smear::Acceptance, 1)
191 };
192 
193 inline UInt_t Acceptance::GetNZones() const {
194  return mZones.size();
195 }
196 
197 inline Int_t Acceptance::GetGenre() const {
198  return mGenre;
199 }
200 
202  return mCharge;
203 }
204 
205 } // namespace Smear
206 
207 #endif // INCLUDE_EICSMEAR_SMEAR_ACCEPTANCE_H_