EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ParticleID.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ParticleID.h
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_