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
ParticleID.h
Go to the documentation of this file.
1 
10 #ifndef INCLUDE_EICSMEAR_SMEAR_PARTICLEID_H_
11 #define INCLUDE_EICSMEAR_SMEAR_PARTICLEID_H_
12 
13 #include <cmath>
14 #include <fstream>
15 #include <iostream>
16 #include <sstream>
17 #include <vector>
18 
19 #include <TF1.h>
20 #include <TF2.h>
21 #include <TLorentzVector.h>
22 #include <TRandom3.h>
23 #include <TROOT.h>
24 #include <TSystem.h>
25 #include <TString.h>
26 
27 #include "eicsmear/smear/Device.h"
31 #include "eicsmear/smear/Smear.h"
32 #include "eicsmear/smear/Smearer.h"
34 
35 namespace Smear {
36 
67 struct ParticleID : public Smearer {
74  ParticleID();
75 
80  explicit ParticleID(TString filename);
81 
85  virtual ~ParticleID();
86 
91  void SetPMatrixPath(TString);
92 
98  void SetPIDUseMC(bool useMc);
99 
103  TRandom3& GetRandomGenerator();
104 
110  void SetRanSeed(int seed);
111 
117  void GetAcceptanceFromDevice(const Device&);
118 
122  void SetPMatrixSize();
123 
130  void SetupProbabilityArray();
131 
137  virtual ParticleID* Clone(const char* = "") const;
138 
143  int Wild(int pbin, int trueID);
144 
145  int InListOfTrue(int ID);
146 
147  int InListOfFalse(int ID);
148 
153  void ReadP(TString filename);
154 
165 
169  void Speak();
170 
174  virtual void Clear(Option_t* = "");
175 
179  virtual void Print(Option_t* = "") const;
180 
181  TRandom3 Ran;
182  TString PMatPath;
183  std::vector<int> TrueIdent;
184  std::vector<int> FalseIdent;
185  std::vector<double> PMin;
186  std::vector<double> PMax;
187  // Indices are for momentum bin, true ID, and false ID
188  // PMatrix[i][j][k] stores the probability for a particle of type
189  // TrueIdent[j] in the momentum bin (PMin[i], PMax[i]) to be
190  // identified as a particle of type FalseIdent[k].
191  std::vector< std::vector<std::vector<double> > > PMatrix;
192  // Range is the cumulative probability distribution of PMatrix.
193  std::vector< std::vector<std::vector<double> > > Range;
194  bool bUseMC;
195 
196  ClassDef(Smear::ParticleID, 1)
197 };
198 
199 inline void ParticleID::SetPMatrixPath(TString str) {
200  PMatPath = str;
201  ReadP(PMatPath);
202 }
203 
204 inline void ParticleID::SetPIDUseMC(bool d) {
205  bUseMC = d;
206 }
207 
208 inline TRandom3& ParticleID::GetRandomGenerator() {
209  return Ran;
210 }
211 
212 inline void ParticleID::SetRanSeed(int n) {
213  Ran.SetSeed(n);
214 }
215 
217  Accept = dev.Accept;
218 }
219 
220 inline ParticleID* ParticleID::Clone(const char*) const {
221  // const char* argument comes from TObject::Clone(), usused here.
222  return new ParticleID(*this);
223 }
224 
225 } // namespace Smear
226 
227 #endif // INCLUDE_EICSMEAR_SMEAR_PARTICLEID_H_
virtual ~ParticleID()
Definition: ParticleID.cxx:32
void SetPIDUseMC(bool useMc)
Definition: ParticleID.h:204
int Wild(int pbin, int trueID)
Definition: ParticleID.cxx:76
void Smear(const erhic::VirtualParticle &, ParticleMCS &)
Definition: ParticleID.cxx:214
void SetPMatrixPath(TString)
Definition: ParticleID.h:199
virtual ParticleID * Clone(const char *="") const
Definition: ParticleID.h:220
virtual void Print(Option_t *="") const
Definition: ParticleID.cxx:238
TRandom3 & GetRandomGenerator()
Definition: ParticleID.h:208
void GetAcceptanceFromDevice(const Device &)
Definition: ParticleID.h:216
void SetupProbabilityArray()
Definition: ParticleID.cxx:60
void SetRanSeed(int seed)
Definition: ParticleID.h:212
Abstract base class for a general particle.
virtual void Clear(Option_t *="")
Definition: ParticleID.cxx:117
void ReadP(TString filename)
Definition: ParticleID.cxx:126