-
Notifications
You must be signed in to change notification settings - Fork 0
/
FT2.h
276 lines (262 loc) · 12.7 KB
/
FT2.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
#ifndef FT2_H
#define FT2_H
#include <TObject.h>
#include <TBits.h>
#include "AliExternalTrackParam.h"
#include "AliITSUAux.h"
#include "AliESDpid.h"
#include "AliPIDResponse.h"
#include "AliITSURecoLayer.h"
#include "AliNDLocalRegression.h"
#include "AliTPCParam.h"
#include "AliTPCRecoParam.h"
//#define DEBUG 11
//#define DEBUG 1
class AliITSUReconstructor;
class AliITSURecoDet;
class AliITSURecoSens;
class TParticle;
class AliVertex;
class TF3;
const float kRidiculous = 999999;
const float kMaxZTPC = 220; // 250
const double kTrackToler = 1.e-6; // tracking tolerance
class FTProbe : public AliExternalTrackParam
{
public:
FTProbe();
virtual ~FTProbe(){};
virtual Double_t GetTPCmomentum() const {return fTPCmomentum;}
virtual Double_t GetTPCsignal() const {return fTPCSignal;}
virtual UShort_t GetTPCsignalN() const {return fTPCSignalN;}
virtual Int_t GetTPCTrackingPID() const {return fAbsPdgCodeForTracking;}
virtual Double_t GetDecayInfo() const {return fIsDecayed;}
virtual Double_t GetAbsorbtionInfo() const {return fIsAbsorbed;}
virtual void GetInnerTrackParam(Double_t iTP[7]) const {
for(Int_t i=0;i<7;i++){
iTP[i]=fInnerTrackParameters[i];
}
}
protected:
Double_t fProbeMass; // true mass
Double_t fTPCmomentum; // momentum after TPC reconstruction
Double_t fTPCSignal; // TPC signal
UShort_t fTPCSignalN;
Int_t fAbsPdgCode; // |pdg code| of particle
Int_t fPdgCode; // pdg code of particle
Int_t fAbsPdgCodeForTracking; // |pdg code| used for tracking of particle
Double_t fTrueMass; // true mass of the particle
Double_t fInnerTrackParameters[7]; // (fAlpha,fX,fP[5]) at inner TPC radius
Double_t fProbeITSClusterIsCls[8]; // (ITScluster?,x,y,z)
Double_t fProbeITSClusterX[8]; // (ITScluster?,x,y,z)
Double_t fProbeITSClusterY[8]; // (ITScluster?,x,y,z)
Double_t fProbeITSClusterZ[8]; // (ITScluster?,x,y,z)
Double_t fProbeTPCClusterIsCls[160]; // (TPCcluster?,x,y,z)
Double_t fProbeTPCClusterX[160]; // (TPCcluster?,x,y,z)
Double_t fProbeTPCClusterY[160]; // (TPCcluster?,x,y,z)
Double_t fProbeTPCClusterZ[160]; // (TPCcluster?,x,y,z)
Int_t fProbeNClTPC; // N used TPC clusters
Int_t fProbeNClITS; // N used ITS clusters
Int_t fProbeNClITSFakes; // N used ITS Fake clusters
Int_t fProbeITSPatternFake; // fakes pattern for ITS
Int_t fProbeITSPattern; // pattern for ITS clusters
Double_t fProbeChi2TPC; // total chi2 in TPC
Double_t fProbeChi2ITS; // total chi2 in ITS
Bool_t fIsDecayed; // is particle decayed?
Bool_t fIsAbsorbed; // is particle absorbed?
Double_t fDecayRadius; // radius when particle decayed
Double_t fAbsorbtionRadius; // radius when particle was absorbed
Bool_t fLostInItsTpcMatching; // was track lost due to ITS-TPC matching efficiency?
Int_t fTrackToClusterChi2CutITS; // is particle rejected by ITS track to cluster chi2?
Double_t chiwITS[7]; // chi2 for each layer of the ITS
Double_t fProbeZAtCutOffCheck; // z coordinate when the probe is check for z
ClassDef(FTProbe,1)
};
class FT2 : public TObject
{
public:
enum {kMaxITSLr=7, kMaxHitPerLr=2};
struct FT2TPCLayer {
FT2TPCLayer(int id=-1,float xr=0,float x2x=0, float pitchL =0) :
rowId(id),x(xr),x2x0(x2x),isDead(0),pitch(pitchL)/*,isDead(resRPhi>kRidiculous||resZ>kRidiculous)*/,
hitY(0),hitZ(0),hitSect(-1) {}
Int_t rowId;
Float_t x;
Float_t x2x0;
Bool_t isDead;
Float_t pitch;
//
Float_t hitY;
Float_t hitZ;
Int_t hitSect;
//
void GetXYZLab(Float_t xyz[3]) const
{
float phi = (hitSect*20+10)*TMath::DegToRad(), cs=TMath::Cos(phi), sn=TMath::Sin(phi);
xyz[0] = x*cs - hitY*sn; xyz[1] = x*sn + hitY*cs; xyz[2] = hitZ;
}
};
typedef struct FT2TPCLayer FT2TPCLayer_t;
FT2();
virtual ~FT2();
void InitEnvLocal();
void InitTPCParaFile(const char *TPCparaFile);
void InitXSectionFile(const char *XSectionFile);
void InitTPCPIDResponse();
void InitDetector(Bool_t addTPC=kTRUE,Float_t scEdge=2.0); //used to be 2.6; 2.0 determined by Marian and Johannes from 2013 data
//
void PrintLayout();
//
Bool_t ProcessTrack(TParticle* trc, AliVertex* vtx);
void SetSimMat(Bool_t v=kTRUE) {fSimMat = v;}
void SetTuneOnDataOrMC(Bool_t t=kFALSE) {fTuneOnDataOrMC = t;}
void SetAllowDecay(Bool_t d=kTRUE) {fAllowDecay = d;}
void SetMinTPCHits(int v=0) {fMinTPCHits=v;} // 60
void SetMinITSLrHit(int v=0) {fMinITSLrHit=v;}
void SetUsePIDForTracking(Bool_t usePID) {fUsePIDForTracking=usePID;}
void SetRunNumber( TString runnumber) {fRunNumber = runnumber;}
Int_t ProbeDecayAbsorb(double* posIni);
//
Int_t GetNClITSFakes() const {return fNClITSFakes;}
Int_t GetNClITS() const {return fNClITS;}
Int_t GetNClTPC() const {return fNClTPC;}
Double_t GetChi2ITS() const {return fChi2ITS;}
Double_t GetChi2TPC() const {return fChi2TPC;}
const TBits& GetTPCHitMap() const {return fTPCMap;}
FTProbe& GetProbe() const {return (FTProbe&)fProbe;}
AliExternalTrackParam& GetKalmanOut(int i) {return (AliExternalTrackParam&)fKalmanOutward[i];}
void SetUseKalmanOut(Bool_t v=kTRUE) {fUseKalmanOut = v;}
Bool_t GetUseKalmanOut() const {return fUseKalmanOut;}
//
const Double_t* GetDCA() const {return &fDCA[0];}
const Double_t* GetDCACov() const {return &fDCACov[0];}
static float GetMaxStepTGeo() {return fgMaxStepTGeo;}
static void SetMaxStepTGeo(float stp=1.) {fgMaxStepTGeo = stp;}
//
void SetAllocCorrelatedITSFakes(Bool_t v=kTRUE) {fAllocCorrelatedITSFakes=v;}
Bool_t GetAllocCorrelatedITSFakes() {return fAllocCorrelatedITSFakes;}
//
Double_t GetNCorrelITSFakes(Int_t lr) const {return fNCorrelITSFakes[lr];}
Double_t GetCorrelITSFakesSigY(Int_t lr) const {return fCorrelITSFakesSigY[lr];}
Double_t GetCorrelITSFakesSigZ(Int_t lr) const {return fCorrelITSFakesSigZ[lr];}
//
void SetNCorrelITSFakes(Int_t lr, double v) {fNCorrelITSFakes[lr] = v;}
void SetCorrelITSFakesSigY(Int_t lr, double v) {fCorrelITSFakesSigY[lr] = v;}
void SetCorrelITSFakesSigZ(Int_t lr, double v) {fCorrelITSFakesSigZ[lr] = v;}
//
void SetMCTrueTrackMultiplicity(Int_t mult) {fTrueMCtrackMult = mult;}
//
void SetdNdY(double v=-1) {fdNdY = v;}
Double_t GetdNdY() const {return fdNdY;}
Double_t HitDensity(double r2, double tgl) const;
Bool_t BiasAsFake(double yz[2], const double* extyz, const double *cov) const;
Bool_t DiagonalizeErrors(const double *cov, double &sy2d, double &sz2d);
Int_t GetITSPattern() const {return fITSPattern;}
Int_t GetITSPatternFakes() const {return fITSPatternFake;}
//
Double_t GetITSRMin() const;
Double_t ParticleDecayProbability(Double_t step);
Double_t ParticleAbsorptionProbability(Double_t length,Double_t rho, Double_t A, Double_t Z);
//
Int_t CutOnTrackToClusterChi2ITS();
protected:
void AddTPC(Float_t scEdge=2.6);
void AddTPCLayer(Int_t rowID, Float_t x, Float_t x2x0, Float_t pitch);
Bool_t InitProbe(TParticle* trc);
Bool_t MakeITSKalmanOut();
Bool_t PrepareProbe();
Bool_t ApplyMSEloss(double x2X0, double xrho);
Bool_t PropagateToX(double xTgt, int dir,Bool_t propErr,Bool_t simMat,Bool_t useTGeo);
Bool_t PropagateToR(double xTgt, int dir,Bool_t propErr,Bool_t simMat,Bool_t useTGeo);
Bool_t IsZero(double val, double tol=1e-9) const {return TMath::Abs(val)<tol;}
Bool_t PassActiveITSLayer(AliITSURecoLayer* lr);
Bool_t GetRoadWidth(AliITSURecoLayer* lrA,double *pr,Int_t nstd = 3);
void ResetCovMat(AliExternalTrackParam* trc);
Double_t UpdateKalman(AliExternalTrackParam* trc, double y,double z,double sigY,double sigZ,
Bool_t randomize=kTRUE,double scly=1.,double sclz=1.);
const AliExternalTrackParam* GetSmoothedEstimate(int ilr,const AliExternalTrackParam* trcInw, double* trPos,double* trCov);
Int_t ReconstructOnITSLayer(int ilr, double chi2Cut=70.);
Bool_t ReconstructProbe(TParticle *part);
AliPIDResponse::EDetPidStatus GetComputeTPCProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const;
//
protected:
AliITSUReconstructor* fITSRec; // interface for reconstructor
AliITSURecoDet* fITS; // interface for ITS
Bool_t fUsePIDForTracking;
TString fRunNumber;
Bool_t fIsTPC; // TPC added
AliPIDResponse* fPIDResponse;
TFile *fTPCParaFile;
TFile *fXSectionFile;
TH1F* fXSectionHp[6];
Float_t fTPCSectorEdge; // cut in cm on sector edge
Double_t fMaxSnpTPC; // stop particle if snp>fMaxSnpTPC
Int_t fTPCInnerRows;
Int_t fTPCMiddleRows;
Int_t fTPCOuterRows;
std::vector<FT2TPCLayer_t> fTPCLayers;
std::vector<int> fTPCHitLr;
Int_t fNTPCHits; //!
Int_t fMinTPCHits; // require min amount of TPC hits
Int_t fMinITSLrHit; // require min amount of ITS lr hit
Int_t fTrueMCtrackMult; // mc track multiplicity
Double_t fDCA[2],fDCACov[3]; //! dca to vertex and its covariance
//
FTProbe fProbe; // track
AliExternalTrackParam fProbeIni; //! initial probe kinematics
AliExternalTrackParam* fKalmanOutward; //! parameters of outward kalman
Bool_t fUseKalmanOut; //! use KalmanOut estimate for fakes
//Double_t fProbeMass; // probe mass
Double_t fBz; // bz
Bool_t fTuneOnDataOrMC; // used to tune some parameters on data or MC input; can only be used in second iteration
Bool_t fSimMat; // simulate material effects in probe preparation
Bool_t fAllowDecay; // necessary for standlone FT2 mode
Int_t fCurrITSLr; //! current ITS layer under tracking
Int_t fNClTPC; //! N used TPC clusters
Int_t fNClITS; //! N used ITS clusters
Int_t fNClITSFakes; //! N used ITS Fake clusters
Int_t fITSPatternFake; //! fakes pattern for ITS
Int_t fITSPattern; //! pattern for ITS clusters
Double_t fChi2TPC; //! total chi2 in TPC
Double_t fChi2ITS; //! total chi2 in ITS
TBits fTPCMap; //! tpc hit map
//
// hit info in the ITS
Double_t fSigYITS,fSigZITS; // nominal ITS layer resolution
Double_t fITSerrSclY,fITSerrSclZ; // scaling factor for assigned errors
Int_t fNITSHits[kMaxITSLr]; //! n hits per ITS layer
Int_t fNITSSensCand[kMaxITSLr]; //! n sensor candidates per ITS layer
Int_t fNITSLrHit; //! n of ITS layers whith hit
AliITSURecoSens* fITSSensHit[kMaxITSLr][2]; //! hit sensors
AliITSURecoSens* fITSSensCand[kMaxITSLr][AliITSURecoLayer::kMaxSensMatching]; //! hit sensor candidates
Double_t fITSHitYZ[kMaxITSLr][kMaxHitPerLr][2]; //! tracking Y,Z of each hit
//
Double_t fdNdY; // if positive, use it for fakes simulation
AliNDLocalRegression *fTPCClsLossProbIROC; // parameterization of the TPC cluster pick up probability in the IROC
AliNDLocalRegression *fTPCClsLossProbOROCmedium; // parameterization of the TPC cluster pick up probability in the OROC (medium)
AliNDLocalRegression *fTPCClsLossProbOROClong; // parameterization of the TPC cluster pick up probability in the OROC (long)
AliNDLocalRegression *fTpcPidSignal[5]; // parameterization of the TPC signal (e,mu,pi,K,p)
AliNDLocalRegression *fTPCDistortionRPhi; // parameterization of the TPC field distortions in rphi
AliNDLocalRegression *fTPCDistortionR; // parameterization of the TPC field distortions in r
AliNDLocalRegression *fTPCfMCChi2; // parameterization of the TPC standardized chi2
AliNDLocalRegression *fTPCft2Chi2; // parameterization of the FT2 standardized chi2
AliNDLocalRegression *fItsTpcMatchingfMC; // parameterization of the ITS+TPC matching efficiency in full MC
AliNDLocalRegression *fItsTpcMatchingft2; // parameterization of the ITS+TPC matching efficiency in FT2
TF1 *fTpcClusterAcc;
TF1 *fTPCClusterErrorParamY; // parameterization of the TPC cluster error in y and z
TF1 *fTPCClusterErrorParamZ; // parameterization of the TPC cluster error in y and z
AliTPCParam *fTPCParam; // TPC param
AliTPCRecoParam *fTPCRecoParam; // TPC reco param
Bool_t fAllocCorrelatedITSFakes; // simulate noise hits accompanying the probe
Double_t fNCorrelITSFakes[kMaxITSLr]; // av.number of accompanying hits
Double_t fCorrelITSFakesSigY[kMaxITSLr]; // their width in Y
Double_t fCorrelITSFakesSigZ[kMaxITSLr]; // their width in Z
//
Float_t fC0tr2clChi2[kMaxITSLr]; // cut on cluster to track chi2
Float_t fC0gloChi2[kMaxITSLr]; // cut on seed global norm chi2
Float_t fC0missPen[kMaxITSLr]; // missing cluster penalty
//
static float fgMaxStepTGeo; // max step for tracking accounting for TGeo materials
ClassDef(FT2,1)
};
#endif