1 #ifndef ALIANALYSISTRACK_H
2 #define ALIANALYSISTRACK_H
6 #include "TLorentzVector.h"
7 #include "AliTOFGeometry.h"
8 #include "AliTOFcalibHisto.h"
9 #include "AliTPCPIDResponse.h"
10 #include "AliTOFPIDResponse.h"
11 #include "AliAnalysisEvent.h"
12 #include "AliESDtrack.h"
21 class AliAnalysisTrack :
27 AliAnalysisTrack(); // default constructor
28 AliAnalysisTrack(const AliAnalysisTrack &source); // copy constructor
29 AliAnalysisTrack &operator=(const AliAnalysisTrack &source); // operator=
30 virtual ~AliAnalysisTrack(); // default destructor
32 Float_t GetP() const {return fP;}; // get p
33 Float_t GetPt() const {return fPt;}; // get pt
34 Float_t GetEta() const {return fEta;}; // get eta
35 Float_t GetPhi() const {return fPhi;}; // get phi
36 Float_t GetY(Float_t mass) const; // get Y
37 Double_t GetSign() const {return fSign;}; // get sign
38 ULong_t GetStatus() const {return fStatus;}; // get status
39 Int_t GetLabel() const {return fLabel;}; // get label
40 Float_t GetImpactParameter(Int_t i) const {return fImpactParameter[i];}; // get impact parameter
41 Float_t GetImpactParameterCov(Int_t i) const {return fImpactParameterCov[i];}; // get impact parameter covariance
42 Float_t GetTPCmomentum() const {return fTPCmomentum;}; // get TPC inner wall momentum
43 Float_t GetTPCdEdx() const {return fTPCdEdx;}; // get TPC dEdx
44 UShort_t GetTPCdEdxN() const {return fTPCdEdxN;}; // get TPC dEdx clusters
45 UShort_t GetTPCNcls() const {return fTPCNcls;}; // get number of clusters TPC
46 UShort_t GetTPCNclsF() const {return fTPCNclsF;}; // get number of findable clusters TPC
47 Float_t GetTPCnc() const {return fTPCNcr;}; // get number of crossed rows TPC
48 Int_t GetTOFIndex() const {return fTOFIndex;}; // get TOF index
49 Float_t GetTOFTime() const {return fTOFTime;}; // get TOF time
50 Float_t GetTOFExpTime(Int_t i) const {return fTOFExpTime[i];}; // get TOF integrated times
51 Float_t GetTOFExpTimeCorrection(Int_t i, Int_t chargeCorr = 0) const; // get TOF integrated times correction
52 Float_t GetTOFExpTimeSigma(Int_t i) const; // get TOF integrated times sigma
53 Float_t GetTOFExpectedSigma(Int_t i) const; // get TOF expected sigma
54 Float_t GetTOFLength() const {return fTOFLength;}; // get TOF length
55 Int_t GetTOFLabel(Int_t i) const {return fTOFLabel[i];}; // get TOF label
56 Float_t GetTOFDeltaX() const {return fTOFDeltaX;}; // get TOF deltaX
57 Float_t GetTOFDeltaZ() const {return fTOFDeltaZ;}; // get TOF deltaZ
58 Bool_t IsMCPrimary() const {return fMCPrimary;}; // is MC primary
59 Bool_t IsMCSecondaryWeakDecay() const {return fMCSecondaryWeak;}; // is MC weak decay
60 Bool_t IsMCSecondaryMaterial() const {return fMCSecondaryMaterial;}; // is MC material
61 Bool_t IsMCPrimary(Int_t ipart) const {return (fMCPrimary && TMath::Abs(fMCPdgCode) == AliPID::ParticleCode(ipart));}; // is MC primary
62 Int_t GetMCPdgCode() const {return fMCPdgCode;}; // get MC PDG code
63 Int_t GetMCMotherPdgCode() const {return fMCMotherPdgCode;}; // get MC mother PDG code
64 Int_t GetMCMotherPrimary() const {return fMCMotherPrimary;}; // get MC mother primary
66 Bool_t IsMCTOFMatchPrimary() const {return fMCTOFMatchPrimary;};
67 Int_t GetMCTOFMatchPdgCode() const {return fMCTOFMatchPdgCode;};
68 Int_t GetMCTOFMatchLevel() const {return fMCTOFMatchLevel;};
69 Float_t GetMCTOFTime() const {return fMCTOFTime;};
70 Float_t GetMCTOFLength() const {return fMCTOFLength;};
72 Bool_t IsInTOFPad() const {return ((TMath::Abs(fTOFDeltaX) < 1.25) && (TMath::Abs(fTOFDeltaZ) < 1.75));}; // is in TOF pad
74 Int_t GetTOFVolumeIndex(Int_t i); // get TOF volume index
75 Float_t GetTOFBeta() const {return HasTOFPID() ? fTOFLength / (2.99792457999999984e-02 * (fTOFTime - fgTOFResponse->GetStartTime(fP))) : 0.;}; // get TOF beta
76 Float_t GetTOFBetaSigma() const; // get TOF beta sigma
77 Float_t GetTOFExpBeta(Int_t ipart) const {return HasTOFPID() ? fTOFLength / (2.99792457999999984e-02 * fTOFExpTime[ipart]) : 0.;}; // get TOF beta
78 Float_t GetTOFBetaTh(Int_t ipart) const {return GetTOFBetaTh(AliPID::ParticleMass(ipart));}; // get TOF beta th
79 Float_t GetTOFBetaTPCin(Int_t ipart) const {return GetTOFBetaTPCin(AliPID::ParticleMass(ipart));}; // get TOF beta th
80 Float_t GetTOFBetaTh(Float_t mass) const {return TMath::Sqrt(1. / (1. + mass * mass / (fP * fP)));}; // get TOF beta th
81 Float_t GetTOFBetaTPCin(Float_t mass) const {return TMath::Sqrt(1. / (1. + mass * mass / (fTPCmomentum * fTPCmomentum)));}; // get TOF beta th
82 Float_t GetTOFMass2() const {return fP * fP * (1. / (GetTOFBeta() * GetTOFBeta()) - 1.);}; // get TOF mass^2
83 Float_t GetTOFMass() const {return GetTOFMass2() > 0. ? TMath::Sqrt(TMath::Abs(GetTOFMass2())) : -TMath::Sqrt(TMath::Abs(GetTOFMass2()));}; // get TOF mass
84 Float_t GetTPCdEdxTh(Float_t betagamma) const; // get TPC dEdx th
85 Float_t GetTOFExpTimeTh(Int_t ipart) const {return fTOFLength / 2.99792457999999984e-02 / GetTOFBetaTh(ipart);}; // get TOF exp time th
86 Float_t GetTOFExpTimeTPCin(Int_t ipart) const {return fTOFLength / 2.99792457999999984e-02 / GetTOFBetaTPCin(ipart);}; // get TOF exp time th
87 Float_t GetTuningExpTimeTh(Int_t ipart) const; // get tuning exp time th
88 Float_t GetTPCBetaGamma(Int_t ipart) const {return fTPCmomentum / AliPID::ParticleMass(ipart);}; // get TPC beta-gamma
90 void Reset(); // reset
91 void Update(AliESDtrack *track, AliStack *stack, AliMCEvent *mcevent); // update
92 Bool_t HasTOFMatch() const {return (fStatus & AliESDtrack::kTOFout);}; // has TOF match
93 Bool_t HasIntegratedTimes() const{ return (fStatus & AliESDtrack::kTIME);}; // has integrated times
94 Bool_t HasTPCPID() const; // has TPC PID
95 Bool_t HasTOFPID(TH1 *henabled = NULL) const; // has TOF PID
96 Bool_t MakeTPCPID(Float_t *nSigma) const; // make TPC PID
97 Bool_t MakeTOFPID(Float_t *nSigma) const; // make TOF PID
98 Bool_t IsMismatchMC() const {return (fMCTOFMatchLevel != 0);}; // is mismatch MC
99 Int_t GetMCPID() const; // get MC PID
100 Int_t GetMCCharge() const; // get MC charge
101 Bool_t IsUncorrelatedMismatchMC() const {return (fMCTOFMatchLevel < 0);}; // is uncorreltaed mismatch MC
102 Bool_t IsMismatch(Float_t cutTPC = 5., Float_t cutTOF = 5.) const; // is mismatch
103 Bool_t IsMismatch(const Float_t *nSigmaTPC, const Float_t *nSigmaTOF, Float_t cutTPC = 5., Float_t cutTOF = 5.) const; // is mismatch
104 Bool_t IsBetaGammaCompatible(Float_t cutTPC = 5., Float_t cutTOF = 5.) const; // is beta-gamma compatible
105 Bool_t IsHeavyAndCompatible(const Float_t *nSigmaTOF, Float_t cutTPC = 5., Float_t cutTOF = 5.) const; // is heavy and compatible
106 void RemoveTimeZero(const AliAnalysisEvent *analysisEvent); // remove time-zero
107 Bool_t IsTPCPID(Int_t ipart, Float_t cutTPC = 5.) const; // is TPC PID
108 Bool_t IsTPCDeuton() const; // is TPC deuton
109 Bool_t IsTPCTriton() const; // is TPC deuton
110 Bool_t IsTPCHeavy() const; // is TPC heavy
111 Bool_t HasPrimaryDCA(Float_t nSigmaXY = 7., Float_t nSigmaZ = 5.) const; // has primary DCA
112 Bool_t IsTRDin() const {return fStatus & AliESDtrack::kTRDin;}; // is TRD in
113 Bool_t IsTRDout() const {return fStatus & AliESDtrack::kTRDout;}; // is TRD out
114 Bool_t IsTRDrefit() const {return fStatus & AliESDtrack::kTRDrefit;}; // is TRD refit
115 Bool_t IsTOFout() const {return fStatus & AliESDtrack::kTOFout;}; // is TOF out
117 static Bool_t LoadTuningExpTimeTh(const Char_t *filename); // load tuning exp time th
119 Int_t GetTOFCalibIndex(Int_t imap) {return (Int_t)fgTOFcalibHisto.GetCalibMap(imap, fTOFIndex);}; // get TOF calib index
121 static AliTOFPIDResponse *GetTOFResponse() {return fgTOFResponse;}; // getter
122 static AliTPCPIDResponse *GetTPCResponse() {return fgTPCResponse;}; // getter
123 static void SetTOFResponse(AliTOFPIDResponse *value) {fgTOFResponse = value;}; // setter
124 static void SetTPCResponse(AliTPCPIDResponse *value) {fgTPCResponse = value;}; // setter
126 static void UpdateTOFResponse(AliAnalysisEvent *analysisEvent); // update TOF response
128 void ApplyTOFExpectedTimeCorrection(Int_t chargeCorr = 0); // apply expected time correction
130 Bool_t AcceptTrack(Bool_t selPrimaries = kTRUE); // accept track
131 static void SetAcceptTrackMinNClustersTPC(UShort_t value) {fgMinNClustersTPC = value;}; // setter
132 static void SetAcceptTrackClusterCut(Int_t value) {fgAcceptTrackClusterCut = value;}; // setter
133 static void SetAcceptTrackMaxDCAToVertexXYPtDepFormula(TFormula *formula) {fgMaxDCAToVertexXYPtDepFormula = formula;}; // setter
134 static void SetAcceptTrackEtaCut(Float_t value) {fgEtaCut = value;}; // setter
135 static void SetAcceptTrackEtaReject(Float_t value) {fgEtaReject = value;}; // setter
136 static void SetAcceptTrackStatusCut(ULong_t value) {fgAcceptTrackStatusCut = value;}; // setter
137 static void SetRejectTrackStatusCut(ULong_t value) {fgRejectTrackStatusCut = value;}; // setter
138 static void SetAcceptTrackMaxDCAToVertexZCut(Float_t value) {fgMaxDCAToVertexZCut = value;}; // setter
139 static void SetAcceptTrackMaxChi2PerClusterTPC(Float_t value) {fgMaxChi2PerClusterTPC = value;}; // setter
140 static void SetRejectITSFakes(Bool_t value) {fgRejectITSFakes = value;}; // setter
141 static void SetMatchTrackDeltaX(Float_t value) {fgMatchTrackDeltaX = value;}; // setter
142 static void SetMatchTrackDeltaZ(Float_t value) {fgMatchTrackDeltaZ = value;}; // setter
146 /*** global track info ***/
151 Double_t fSign; // sign
152 ULong_t fStatus; // status
153 Int_t fLabel; // label
154 Float_t fImpactParameter[2]; // impact parameters
155 Float_t fImpactParameterCov[3]; // impact parameters covariance
156 /*** TPC PID info ***/
157 Float_t fTPCmomentum; // TPC inner wall momentum
158 Float_t fTPCdEdx; // dEdx
159 UShort_t fTPCdEdxN; // dEdx clusters
160 UShort_t fTPCNcls; // number of clusters TPC
161 UShort_t fTPCNclsF; // number of findable clusters TPC
162 Float_t fTPCNcr; // number of crossed rows TPC
163 /*** TOF PID info ***/
164 Int_t fTOFIndex; // index
165 Float_t fTOFTime; // time
166 Float_t fTOFExpTime[AliPID::kSPECIES]; // integrated time array
167 Float_t fTOFLength; // track length
168 Float_t fTOFDeltaX; // TOF deltaX
169 Float_t fTOFDeltaZ; // TOF deltaZ
170 Int_t fTOFLabel[3]; // TOF label
172 Bool_t fMCPrimary; // MC primary flag
173 Int_t fMCPdgCode; // MC PDG code
174 Bool_t fMCMotherPrimary; // MC mother primary flag
175 Int_t fMCMotherPdgCode; // MC mother PDG code
176 Bool_t fMCTOFMatchPrimary; // MC TOF match primary flag
177 Int_t fMCTOFMatchPdgCode; // MC TOF match PDG code
178 Short_t fMCTOFMatchLevel; // MC TOF match level
179 Float_t fMCTOFTime; // MC TOF time
180 Float_t fMCTOFLength; // MC TOF length
181 Bool_t fMCSecondaryWeak;
182 Bool_t fMCSecondaryMaterial;
183 /*** HMPID PID info ***/
184 Float_t fHMPIDmomentum;
185 Float_t fHMPIDsignal;
187 Float_t fTPCchi2; // TPC chi2
188 Bool_t fITSFakeFlag; // ITS fake flag
190 /*** cut paramters */
191 static Float_t fgEtaCut; // eta cut
192 static Float_t fgEtaReject; // eta reject
193 static TFormula *fgMaxDCAToVertexXYPtDepFormula; // DCA-xy cut formula
194 static UShort_t fgMinNClustersTPC; // cut
195 static UShort_t fgMinNCrossedRowsTPC; // cut
196 static Float_t fgMinRatioCrossedRowsOverFindableClustersTPC; // cut
197 static Int_t fgAcceptTrackClusterCut; // cluster cut
198 static ULong_t fgAcceptTrackStatusCut; // accept track status cut
199 static ULong_t fgRejectTrackStatusCut; // reject track status cut
200 static Float_t fgMaxDCAToVertexZCut; // DCA-z cut
201 static Float_t fgMaxChi2PerClusterTPC; // max chi2 per cluster TPC cut
202 static Bool_t fgRejectITSFakes; // reject ITS fakes cut
203 static Float_t fgMatchTrackDeltaX; // match track deltaX
204 static Float_t fgMatchTrackDeltaZ; // match track deltaZ
207 static TLorentzVector fgLorentzVector;
208 static AliTOFGeometry fgTOFGeometry;
209 static AliTOFcalibHisto fgTOFcalibHisto;
210 static Bool_t fgTOFcalibHistoFlag;
211 static AliTPCPIDResponse *fgTPCResponse;
212 static AliTOFPIDResponse *fgTOFResponse;
213 static TH2F *hTOFtuned_th[AliPID::kSPECIES];
215 Float_t fTimeZeroSigma; //!
217 ClassDef(AliAnalysisTrack, 9);
220 #endif /* ALIANALYSISTRACK_H */