EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PndPidCorrelator.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PndPidCorrelator.h
1 #ifndef PID_CORRELATOR_H
2 #define PID_CORRELATOR_H
3 
4 // **************************************************************************
5 // Author: Stefano Spataro e-mail: spataro@to.infn.it
6 //
7 // pid correlator
8 //
9 // Created: 03-07-09
10 // Modified:
11 //
12 // **************************************************************************
13 
14 #include "TNtuple.h"
15 #include "TString.h"
16 #include "TClonesArray.h"
17 #include <map>
18 
19 #include "FairTask.h"
20 
21 #include "PndTrack.h"
22 #include "PndPidCandidate.h"
23 #include "PndGeoHandling.h"
24 
25 #if _TODAY_
26 #include "FairField.h"
27 #include "FairTrackParH.h"
28 #include "FairGeanePro.h"
29 #include "FairGeane.h"
30 
31 #include "PndRecoKalmanFit.h"
32 #include "PndPidCorrPar.h"
33 #include "PndEmcXClMoments.h"
34 #include "PndEmcGeoPar.h"
35 #include "PndEmcErrorMatrix.h"
36 #include "PndEmcClusterCalibrator.h"
37 #include "PndEmcErrorMatrixPar.h"
38 #include "PndGeoSttPar.h"
39 #include "PndGeoFtsPar.h"
40 
41 using std::map;
42 using std::vector;
43 
44 class TGeant3;
45 #endif
46 
47 class PndPidCorrelator : public FairTask {
48 
49 protected:
50  TClonesArray* fTrack;
51  TClonesArray* fTrackID;
52  TClonesArray* fPidChargedCand;
53  TClonesArray* fMcTrack;
54 #if _TODAY_
55  TClonesArray* fTrack2;
56  TClonesArray* fTrackID2;
57  TClonesArray* fPidNeutralCand;
58  TClonesArray* fMdtTrack;
59 
60  TClonesArray* fMvdHitsStrip;
61  TClonesArray* fMvdHitsPixel;
62  TClonesArray* fTofHit;
63  TClonesArray* fTofPoint;
64  TClonesArray* fFtofHit;
65  TClonesArray* fFtofPoint;
66  TClonesArray* fEmcCluster;
67  TClonesArray* fEmcBump;
68  TClonesArray* fEmcDigi;
69  TClonesArray* fMdtPoint;
70  TClonesArray* fMdtHit;
71  TClonesArray* fMdtTrk;
72  TClonesArray* fDrcPoint;
73  TClonesArray* fDrcHit;
74  TClonesArray* fDskParticle;
75  TClonesArray* fSttHit;
76  TClonesArray* fFtsHit;
77 
78  PndPidCorrPar* fCorrPar;
79  PndEmcGeoPar* fEmcGeoPar;
80  PndEmcErrorMatrixPar* fEmcErrorMatrixPar;
81  PndEmcErrorMatrix *fEmcErrorMatrix;
82  PndGeoSttPar* fSttParameters;
83  PndGeoFtsPar* fFtsParameters;
84  PndEmcAbsClusterCalibrator* fEmcCalibrator;
85 
86  Short_t fDebugMode; // Fill ntuples for debug
87  Short_t fMvdMode; // MVD Mode: 0 no MVD, 1 MvdPoint, (2) MvdHit
88  Short_t fSttMode; // STT Mode: 0 no STT, 1 SttPoint, (2) SttHit
89  Short_t fFtsMode; // FTS Mode: 0 no FTS, 1 FtsPoint, (2) FtsHit
90  Short_t fTofMode; // TOF Mode: 0 no TOF, 1 -empty-, (2) TofHit
91  Short_t fFtofMode; // FTOF Mode:0 no FTOF,1 -empty-, (2) FTofHit
92  Short_t fEmcMode; // EMC Mode: 0 no EMC, 1 -empty-, (2) EmcCluster, 3 EmcBumps
93  Short_t fMdtMode; // MDT Mode: 0 no MDT, 1 -empty-, (2) MdtHit
94  Short_t fDrcMode; // DRC Mode: 0 no DRC, 1 -empty-, (2) DrcHit
95  Short_t fDskMode; // DSK Mode: 0 no DSK, 1 -empty-, (2) DskParticle
96 
97  Int_t fEmcClstCount; // Number of EMC clusters
98  Int_t fFscClstCount; // Number of FSC clusters
99 
100  Double_t fMvdELoss; // Energy Loss in MVD
101  Double_t fMvdPath; // MVD path crossed by the particle
102  Int_t fMvdHitCount; // Number of mvd hits
103 
104  map<Int_t, vector<Int_t> >mapMdtBarrel; // map of MDT barrel hits
105  map<Int_t, vector<Int_t> >mapMdtEndcap; // map of MDT endcap+muon filter hits
106  map<Int_t, vector<Int_t> >mapMdtForward; // map of MDT forward hits
107  Float_t mdtLayerPos[3][20]; // position of MDT layers
108  Float_t mdtIronThickness[3][20]; // thickness of iron layers
109 
110  map<Int_t, Bool_t> fClusterList; // List of clusters correlated to tracks
111  map<Int_t, Double_t> fClusterQ; // List of emc quaity correlated to clusters
112 #endif
113  TString fTrackBranch; // options to choose PndTrack branches
114  TString fTrackIDBranch; // options to choose PndTrackID branches
115  TString fTrackOutBranch; // options to choose output branch
116 #if _TODAY_
117  TString fTrackBranch2; // options to choose 2nd PndTrack branches
118  TString fTrackIDBranch2; // options to choose 2nd PndTrackID branches
119  Bool_t fSimulation; // Switch simulation diagnostic
120  Bool_t fMdtRefit; // Use MDT Kalman refit propagation
121  Bool_t fIdeal; // Ideal Correlation
122  Bool_t fMixMode; // Mix mode flag
123  Bool_t fFast; // 0: normal; 1: no correlation/extrapolation/neutral
124  PndRecoKalmanFit *fFitter; // Refitter for MDT tracks
125  TFile *r; // File for debug ntuples
126  TNtuple *tofCorr; // Debug ntuple for tof correlation
127  TNtuple *ftofCorr; // Debug ntuple for ftof correlation
128  TNtuple *emcCorr; // Debug ntuple for emc correlation
129  TNtuple *fscCorr; // Debug ntuple for fsc correlation
130  TNtuple *mdtCorr; // Debug ntuple for mdt correlation
131  TNtuple *drcCorr; // Debug ntuple for drc correlation
132  TNtuple *dskCorr; // Debug ntuple for dsk correlation
133 #endif
134  Int_t fEventCounter; // Event number
135  Int_t fPidHyp; // particle hypothesis for propagation
136  Bool_t fIdealHyp; // Flag to use MC particle hypothesis
137  Bool_t fGeanePro; // Use GEANE propagation
138  Bool_t fCorrErrorProp; // Error propagation in correlation
139  PndGeoHandling* fGeoH; // Object to retrieve MVD geometry
140 
141  TString sDir; // Ntuple output directory
142  TString sFile; // Ntuple output file
143 
146  Bool_t GetTrackInfo(PndTrack* track, PndPidCandidate* pid);
147 
148 #if _TODAY_
149  void ConstructNeutralCandidate();
150 
151  PndPidCandidate* AddNeutralCandidate(PndPidCandidate* cand);
152  PndTrack* AddMdtTrack(PndTrack* track);
153 
154  Bool_t GetMvdInfo (PndTrack* track, PndPidCandidate* pid);
155  Bool_t GetSttInfo (PndTrack* track, PndPidCandidate* pid);
156  Bool_t GetFtsInfo (PndTrack* track, PndPidCandidate* pid);
157  Bool_t GetGemInfo (PndTrack* track, PndPidCandidate* pid);
158  Bool_t GetTofInfo (FairTrackParH* helix, PndPidCandidate* pid);
159  Bool_t GetFtofInfo (FairTrackParH* helix, PndPidCandidate* pid);
160  Bool_t GetEmcInfo (FairTrackParH* helix, PndPidCandidate* pid);
161  Bool_t GetFscInfo (FairTrackParH* helix, PndPidCandidate* pid);
162  Bool_t GetMdtInfo (PndTrack* track, PndPidCandidate* pid);
163  Bool_t GetDrcInfo (FairTrackParH* helix, PndPidCandidate* pid);
164  Bool_t GetDskInfo (FairTrackParH* helix, PndPidCandidate* pid);
165  Bool_t GetMdt2Info (FairTrackParH* helix, PndPidCandidate* pid);
166  Bool_t GetFMdtInfo (FairTrackParP* helix, PndPidCandidate* pid);
167 
168  Bool_t MdtMapping(); // Mapping of MDT hits
169  Bool_t MdtGeometry(); // Mapping of MDT geometry
170 #endif
171 public:
172 
173  virtual void Exec(Option_t * option);
174  virtual InitStatus Init(); //
175 
176  void Register();
177  void Reset();
178 #if _TODAY_
179  void ResetEmcQ();
180 
181  PndPidCorrelator(const char *name, const char *title="Pnd Task");
182 #endif
184  virtual ~PndPidCorrelator();
185 
186  void SetInputBranch(TString branch) { fTrackBranch = branch; };
187  void SetInputIDBranch(TString branch) { fTrackIDBranch = branch; };
188 
189 #if _TODAY_
190  void SetOption(Option_t *option=" ") {fOption = option; fOption.ToLower();}
191  void SetDebugMode(Bool_t debug) { fDebugMode = debug; };
192  void SetDebugFilename(TString filename) { sFile = filename; };
193  void SetMdtRefit(Bool_t mdt) { fMdtRefit = mdt; };
194  void SetMixMode(Bool_t mix) { fMixMode = mix; };
195  void SetInputBranch2(TString branch) { fTrackBranch2 = branch; };
196  void SetInputIDBranch2(TString branch) { fTrackIDBranch2 = branch; };
197  void SetOutputBranch(TString branch) { fTrackOutBranch = branch; };
198  void SetSimulation(Bool_t sim) { fSimulation = sim; };
199  void SetIdeal(Bool_t id) { fIdeal = id; };
200  void SetFast(Bool_t fast) { fFast = fast; };
201  void SetCorrErrProp(Bool_t err) { fCorrErrorProp = err; };
202  void SetGeanePro(Bool_t gea = kTRUE) { fGeanePro = gea; };
203  void SetPidHyp(Int_t pid) { fPidHyp = pid; };
204  void SetIdealHyp(Bool_t opt = kTRUE) { fIdealHyp = opt; }
205 
206  void SetMvdMode(Short_t mode) { fMvdMode = mode; }; // MVD Mode: 0 no MVD
207  void SetSttMode(Short_t mode) { fSttMode = mode; }; // STT Mode: 0 no STT
208  void SetFtsMode(Short_t mode) { fFtsMode = mode; }; // FTS Mode: 0 no FTS
209  void SetTofMode(Short_t mode) { fTofMode = mode; }; // TOF Mode: 0 no TOF
210  void SetFtofMode(Short_t mode){ fFtofMode = mode; }; // FTOF Mode:0 no FTOF
211  void SetEmcMode(Short_t mode) { fEmcMode = mode; }; // EMC Mode: 0 no EMC
212  void SetMdtMode(Short_t mode) { fMdtMode = mode; }; // MDT Mode: 0 no MDT
213  void SetDrcMode(Short_t mode) { fDrcMode = mode; }; // DRC Mode: 0 no DRC
214  void SetDskMode(Short_t mode) { fDskMode = mode; }; // DSK Mode: 0 no DSK
215 #endif
216 
218  virtual void SetParContainers();
219  virtual void Finish();
220 
221 ClassDef(PndPidCorrelator,2) // PndPidCorrelator
222 
223 };
224 
225 #endif