Line data Source code
1 : #ifndef ALIITSMULTRECONSTRUCTOR_H
2 : #define ALIITSMULTRECONSTRUCTOR_H
3 : /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 : * See cxx source for full Copyright notice */
5 :
6 : //_________________________________________________________________________
7 : //
8 : // Implementation of the ITS-SPD trackleter class
9 : //
10 : // It retrieves clusters in the pixels (theta and phi) and finds tracklets.
11 : // These can be used to extract charged particle multiplicity from the ITS.
12 : //
13 : // A tracklet consists of two ITS clusters, one in the first pixel layer and
14 : // one in the second. The clusters are associated if the differences in
15 : // Phi (azimuth) and Theta (polar angle) are within fiducial windows.
16 : // In case of multiple candidates the candidate with minimum
17 : // distance is selected.
18 : //_________________________________________________________________________
19 : #include "AliTrackleter.h"
20 : #include "AliITSsegmentationSPD.h"
21 : #include "TMath.h"
22 :
23 : class TBits;
24 : class TTree;
25 : class TH1F;
26 : class TH2F;
27 : class TClonesArray;
28 : class AliITSDetTypeRec;
29 : class AliITSgeom;
30 : class AliESDEvent;
31 : class AliESDtrack;
32 : class AliVertex;
33 : class AliESDVertex;
34 : class AliMultiplicity;
35 : class AliRefArray;
36 : class AliITSRecPoint;
37 :
38 : class AliITSMultReconstructor : public AliTrackleter
39 : {
40 : public:
41 : //
42 : enum {kClTh,kClPh,kClZ,kClMC0,kClMC1,kClMC2,kClNPar};
43 : enum {kTrTheta,kTrPhi,kTrDPhi,kTrDTheta,kTrLab1,kTrLab2,kClID1,kClID2,kTrNPar};
44 : enum {kSCTh,kSCPh,kSCLab,kSCID,kSCNPar};
45 : enum {kITSTPC,kITSSAP,kITSTPCBit=BIT(kITSTPC),kITSSAPBit=BIT(kITSSAP)}; // RS
46 : AliITSMultReconstructor();
47 : virtual ~AliITSMultReconstructor();
48 :
49 : void Reconstruct(AliESDEvent* esd, TTree* treeRP);
50 : void Reconstruct(TTree* tree, Float_t* vtx, Float_t* vtxRes=0); // old reconstructor invocation
51 : void ReconstructMix(TTree* clusterTree, TTree* clusterTreeMix, const Float_t* vtx, Float_t* vtrRes=0);
52 : void FindTracklets(const Float_t* vtx);
53 : void LoadClusterFiredChips(TTree* tree);
54 : void FlagClustersInOverlapRegions(Int_t ic1,Int_t ic2);
55 : void FlagTrackClusters(Int_t id);
56 : void FlagIfSecondary(AliESDtrack* track, const AliVertex* vtx);
57 : void FlagV0s(const AliESDVertex *vtx);
58 : void ProcessESDTracks();
59 : Bool_t CanBeElectron(const AliESDtrack* trc) const;
60 :
61 : virtual void CreateMultiplicityObject();
62 : //
63 : // Following members are set via AliITSRecoParam
64 16 : void SetPhiWindow(Float_t w=0.08) {fDPhiWindow=w; fDPhiWindow2 = w*w;}
65 16 : void SetThetaWindow(Float_t w=0.025) {fDThetaWindow=w; fDThetaWindow2=w*w;}
66 16 : void SetPhiShift(Float_t w=0.0045) {fPhiShift=w;}
67 8 : void SetRemoveClustersFromOverlaps(Bool_t b = kFALSE) {fRemoveClustersFromOverlaps = b;}
68 16 : void SetPhiOverlapCut(Float_t w=0.005) {fPhiOverlapCut=w;}
69 16 : void SetZetaOverlapCut(Float_t w=0.05) {fZetaOverlapCut=w;}
70 16 : void SetPhiRotationAngle(Float_t w=0.0) {fPhiRotationAngle=w;}
71 :
72 0 : Int_t GetNClustersLayer1() const {return fNClustersLay[0];}
73 0 : Int_t GetNClustersLayer2() const {return fNClustersLay[1];}
74 0 : Int_t GetNClustersLayer(Int_t i) const {return fNClustersLay[i];}
75 0 : Int_t GetNTracklets() const {return fNTracklets;}
76 0 : Int_t GetNSingleClusters() const {return fNSingleCluster;}
77 0 : Int_t GetNSingleClustersLr(int lr) const {return lr==0 ? fNSingleCluster-fNSingleClusterSPD2:(GetStoreSPD2SingleCl() ? fNSingleClusterSPD2 : -1) ;}
78 0 : Short_t GetNFiredChips(Int_t layer) const {return fNFiredChips[layer];}
79 :
80 448 : Float_t* GetClusterLayer1(Int_t n) const {return &fClustersLay[0][n*kClNPar];}
81 1372 : Float_t* GetClusterLayer2(Int_t n) const {return &fClustersLay[1][n*kClNPar];}
82 292 : Float_t* GetClusterOfLayer(Int_t lr,Int_t n) const {return &fClustersLay[lr][n*kClNPar];}
83 0 : Int_t GetClusterCopyIndex(Int_t lr,Int_t n) const {return fClusterCopyIndex[lr] ? fClusterCopyIndex[lr][n] : -1;}
84 : AliITSRecPoint* GetRecPoint(Int_t lr, Int_t n) const;
85 :
86 0 : Float_t* GetTracklet(Int_t n) const {return fTracklets[n];}
87 0 : Float_t* GetCluster(Int_t n) const {return fSClusters[n];}
88 :
89 8 : void SetScaleDThetaBySin2T(Bool_t v=kTRUE) {fScaleDTBySin2T = v;}
90 0 : Bool_t GetScaleDThetaBySin2T() const {return fScaleDTBySin2T;}
91 : //
92 16 : void SetNStdDev(Float_t f=1.) {fNStdDev = f<0.01 ? 0.01 : f; fNStdDevSq=TMath::Sqrt(fNStdDev);}
93 0 : Float_t GetNStdDev() const {return fNStdDev;}
94 : //
95 16 : void SetHistOn(Bool_t b=kFALSE) {fHistOn=b;}
96 : void SaveHists();
97 : //
98 8 : void SetBuildRefs(Bool_t v=kTRUE) {fBuildRefs = v;}
99 0 : Bool_t GetBuildRefs() const {return fBuildRefs;}
100 : //
101 8 : void SetStoreSPD2SingleCl(Bool_t v) {fStoreSPD2SingleCl = v;}
102 32 : Bool_t GetStoreSPD2SingleCl() const {return fStoreSPD2SingleCl;}
103 : //
104 0 : AliITSDetTypeRec *GetDetTypeRec() const {return fDetTypeRec;}
105 16 : void SetDetTypeRec(AliITSDetTypeRec *ptr){fDetTypeRec = ptr;}
106 : //
107 16 : void SetCutPxDrSPDin(Float_t v=0.1) { fCutPxDrSPDin = v;}
108 16 : void SetCutPxDrSPDout(Float_t v=0.15) { fCutPxDrSPDout = v;}
109 16 : void SetCutPxDz(Float_t v=0.2) { fCutPxDz = v;}
110 16 : void SetCutDCArz(Float_t v=0.5) { fCutDCArz = v;}
111 16 : void SetCutMinElectronProbTPC(Float_t v=0.5) { fCutMinElectronProbTPC = v;}
112 16 : void SetCutMinElectronProbESD(Float_t v=0.1) { fCutMinElectronProbESD = v;}
113 16 : void SetCutMinP(Float_t v=0.05) { fCutMinP = v;}
114 16 : void SetCutMinRGamma(Float_t v=2.) { fCutMinRGamma = v;}
115 16 : void SetCutMinRK0(Float_t v=1.) { fCutMinRK0 = v;}
116 16 : void SetCutMinPointAngle(Float_t v=0.98) { fCutMinPointAngle = v;}
117 16 : void SetCutMaxDCADauther(Float_t v=0.5) { fCutMaxDCADauther = v;}
118 16 : void SetCutMassGamma(Float_t v=0.03) { fCutMassGamma = v;}
119 16 : void SetCutMassGammaNSigma(Float_t v=5.) { fCutMassGammaNSigma = v;}
120 16 : void SetCutMassK0(Float_t v=0.03) { fCutMassK0 = v;}
121 16 : void SetCutMassK0NSigma(Float_t v=5.) { fCutMassK0NSigma = v;}
122 16 : void SetCutChi2cGamma(Float_t v=2.) { fCutChi2cGamma = v;}
123 16 : void SetCutChi2cK0(Float_t v=2.) { fCutChi2cK0 = v;}
124 16 : void SetCutGammaSFromDecay(Float_t v=-10.) { fCutGammaSFromDecay = v;}
125 16 : void SetCutK0SFromDecay(Float_t v=-10.) { fCutK0SFromDecay = v;}
126 16 : void SetCutMaxDCA(Float_t v=1.) { fCutMaxDCA = v;}
127 : //
128 0 : Float_t GetCutPxDrSPDin() const {return fCutPxDrSPDin;}
129 0 : Float_t GetCutPxDrSPDout() const {return fCutPxDrSPDout;}
130 0 : Float_t GetCutPxDz() const {return fCutPxDz;}
131 0 : Float_t GetCutDCArz() const {return fCutDCArz;}
132 0 : Float_t GetCutMinElectronProbTPC() const {return fCutMinElectronProbTPC;}
133 0 : Float_t GetCutMinElectronProbESD() const {return fCutMinElectronProbESD;}
134 0 : Float_t GetCutMinP() const {return fCutMinP;}
135 0 : Float_t GetCutMinRGamma() const {return fCutMinRGamma;}
136 0 : Float_t GetCutMinRK0() const {return fCutMinRK0;}
137 0 : Float_t GetCutMinPointAngle() const {return fCutMinPointAngle;}
138 0 : Float_t GetCutMaxDCADauther() const {return fCutMaxDCADauther;}
139 0 : Float_t GetCutMassGamma() const {return fCutMassGamma;}
140 0 : Float_t GetCutMassGammaNSigma() const {return fCutMassGammaNSigma;}
141 0 : Float_t GetCutMassK0() const {return fCutMassK0;}
142 0 : Float_t GetCutMassK0NSigma() const {return fCutMassK0NSigma;}
143 0 : Float_t GetCutChi2cGamma() const {return fCutChi2cGamma;}
144 0 : Float_t GetCutChi2cK0() const {return fCutChi2cK0;}
145 0 : Float_t GetCutGammaSFromDecay() const {return fCutGammaSFromDecay;}
146 0 : Float_t GetCutK0SFromDecay() const {return fCutK0SFromDecay;}
147 0 : Float_t GetCutMaxDCA() const {return fCutMaxDCA;}
148 : //
149 : void InitAux();
150 : void ClusterPos2Angles(const Float_t *vtx);
151 : void ClusterPos2Angles(Float_t *clPar, const Float_t *vtx) const;
152 : Int_t AssociateClusterOfL1(Int_t iC1);
153 : Int_t StoreTrackletForL2Cluster(Int_t iC2);
154 : void StoreL1Singles();
155 0 : TClonesArray* GetClustersOfLayer(Int_t il) const {return fClArr[il];}
156 0 : void LoadClusters() {LoadClusterArrays(fTreeRP);}
157 0 : void SetTreeRP(TTree* rp) {fTreeRP = rp;}
158 0 : void SetTreeRPMix(TTree* rp=0) {fTreeRPMix = rp;}
159 16 : Bool_t AreClustersLoaded() const {return fClustersLoaded;}
160 0 : Bool_t GetCreateClustersCopy() const {return fCreateClustersCopy;}
161 0 : Bool_t IsRecoDone() const {return fRecoDone;}
162 0 : void SetCreateClustersCopy(Bool_t v=kTRUE) {fCreateClustersCopy=v;}
163 : //
164 : // Float_t* GetClustersArray(Int_t lr) const {return (Float_t*) (lr==0) ? fClustersLay[0]:fClustersLay[1];}
165 0 : Float_t* GetClustersArray(Int_t lr) const {if(lr==0){return fClustersLay[0];}
166 0 : else {return fClustersLay[1];}}
167 0 : Int_t* GetPartnersOfL2() const {return (Int_t*)fPartners;}
168 0 : Float_t* GetMinDistsOfL2() const {return (Float_t*)fMinDists;}
169 0 : Double_t GetDPhiShift() const {return fDPhiShift;}
170 0 : Double_t GetDPhiWindow2() const {return fDPhiWindow2;}
171 0 : Double_t GetDThetaWindow2() const {return fDThetaWindow2;}
172 : Double_t CalcDist(Double_t dphi, Double_t dtheta, Double_t theta) const;
173 : //
174 : protected:
175 8 : void SetClustersLoaded(Bool_t v=kTRUE) {fClustersLoaded = v;}
176 : AliITSMultReconstructor(const AliITSMultReconstructor& mr);
177 : AliITSMultReconstructor& operator=(const AliITSMultReconstructor& mr);
178 : void CalcThetaPhi(float dx,float dy,float dz,float &theta,float &phi) const;
179 : AliITSDetTypeRec* fDetTypeRec; //! pointer to DetTypeRec
180 : AliESDEvent* fESDEvent; //! pointer to ESD event
181 : TTree* fTreeRP; //! ITS recpoints
182 : TTree* fTreeRPMix; //! ITS recpoints for mixing
183 : AliRefArray* fUsedClusLay[2][2]; //! RS: clusters usage in ESD tracks
184 : //
185 : Float_t* fClustersLay[2]; //! clusters in the SPD layers of ITS
186 : Int_t* fDetectorIndexClustersLay[2]; //! module index for clusters in ITS layers
187 : Int_t* fClusterCopyIndex[2]; //! when clusters copy is requested, store here the reference on the index
188 : Bool_t* fOverlapFlagClustersLay[2]; //! flag for clusters in the overlap regions in ITS layers
189 :
190 : Float_t** fTracklets; //! tracklets
191 : Float_t** fSClusters; //! single clusters (unassociated)
192 :
193 : Int_t fNClustersLay[2]; // Number of clusters on each layer
194 : Int_t fNTracklets; // Number of tracklets
195 : Int_t fNSingleCluster; // Number of unassociated clusters
196 : Int_t fNSingleClusterSPD2; // Number of unassociated clusters on 2nd lr
197 : Short_t fNFiredChips[2]; // Number of fired chips in the two SPD layers
198 : //
199 : // Following members are set via AliITSRecoParam
200 : //
201 : Float_t fDPhiWindow; // Search window in phi
202 : Float_t fDThetaWindow; // Search window in theta
203 : Float_t fPhiShift; // Phi shift reference value (at 0.5 T)
204 : Bool_t fRemoveClustersFromOverlaps; // Option to skip clusters in the overlaps
205 : Float_t fPhiOverlapCut; // Fiducial window in phi for overlap cut
206 : Float_t fZetaOverlapCut; // Fiducial window in eta for overlap cut
207 : Float_t fPhiRotationAngle; // Angle to rotate the inner layer cluster for combinatorial reco only
208 : //
209 : Bool_t fScaleDTBySin2T; // use in distance definition
210 : Float_t fNStdDev; // number of standard deviations to keep
211 : Float_t fNStdDevSq; // sqrt of number of standard deviations to keep
212 : //
213 : // cuts for secondaries identification
214 : Float_t fCutPxDrSPDin; // max P*DR for primaries involving at least 1 SPD
215 : Float_t fCutPxDrSPDout; // max P*DR for primaries not involving any SPD
216 : Float_t fCutPxDz; // max P*DZ for primaries
217 : Float_t fCutDCArz; // max DR or DZ for primares
218 : //
219 : // cuts for flagging tracks in V0s
220 : Float_t fCutMinElectronProbTPC; // min probability for e+/e- PID involving TPC
221 : Float_t fCutMinElectronProbESD; // min probability for e+/e- PID not involving TPC
222 : //
223 : Float_t fCutMinP; // min P of V0
224 : Float_t fCutMinRGamma; // min transv. distance from ESDVertex to V0 for gammas
225 : Float_t fCutMinRK0; // min transv. distance from ESDVertex to V0 for K0s
226 : Float_t fCutMinPointAngle; // min pointing angle cosine
227 : Float_t fCutMaxDCADauther; // max DCA of daughters at V0
228 : Float_t fCutMassGamma; // max gamma mass
229 : Float_t fCutMassGammaNSigma; // max standard deviations from 0 for gamma
230 : Float_t fCutMassK0; // max K0 mass difference from PGD value
231 : Float_t fCutMassK0NSigma; // max standard deviations for K0 mass from PDG value
232 : Float_t fCutChi2cGamma; // max constrained chi2 cut for gammas
233 : Float_t fCutChi2cK0; // max constrained chi2 cut for K0s
234 : Float_t fCutGammaSFromDecay; // min path*P for gammas
235 : Float_t fCutK0SFromDecay; // min path*P for K0s
236 : Float_t fCutMaxDCA; // max DCA for V0 at ESD vertex
237 :
238 : Bool_t fHistOn; // Option to define and fill the histograms
239 :
240 : TH1F* fhClustersDPhiAcc; // Phi2 - Phi1 for tracklets
241 : TH1F* fhClustersDThetaAcc; // Theta2 - Theta1 for tracklets
242 : TH1F* fhClustersDPhiAll; // Phi2 - Phi1 all the combinations
243 : TH1F* fhClustersDThetaAll; // Theta2 - Theta1 all the combinations
244 :
245 : TH2F* fhDPhiVsDThetaAll; // 2D plot for all the combinations
246 : TH2F* fhDPhiVsDThetaAcc; // same plot for tracklets
247 :
248 : TH1F* fhetaTracklets; // Pseudorapidity distr. for tracklets
249 : TH1F* fhphiTracklets; // Azimuthal (Phi) distr. for tracklets
250 : TH1F* fhetaClustersLay1; // Pseudorapidity distr. for Clusters L. 1
251 : TH1F* fhphiClustersLay1; // Azimuthal (Phi) distr. for Clusters L. 1
252 :
253 : // temporary stuff for single event trackleting
254 : Double_t fDPhiShift; // shift in dphi due to the curvature
255 : Double_t fDPhiWindow2; // phi window^2
256 : Double_t fDThetaWindow2; // theta window^2
257 : Int_t* fPartners; //! L2 partners of L1
258 : Int_t* fAssociatedLay1; //! association flag
259 : Float_t* fMinDists; //! smallest distances for L2->L1
260 : AliRefArray* fBlackList; //! blacklisted cluster references
261 : Bool_t fStoreRefs[2][2]; //! which cluster to track refs to store
262 : //
263 : // this is for the analysis mode only
264 : TClonesArray *fClArr[2]; //! original clusters
265 : Bool_t fCreateClustersCopy; // read and clone clusters directly from the tree
266 : Bool_t fClustersLoaded; // flag of clusters loaded
267 : Bool_t fRecoDone; // flag that reconstruction is done
268 : Bool_t fBuildRefs; // build cluster to tracks references
269 : Bool_t fStoreSPD2SingleCl; // do we store SPD2 singles
270 : //
271 : AliITSsegmentationSPD fSPDSeg; // SPD segmentation model
272 : //
273 : void LoadClusterArrays(TTree* tree, TTree* treeMix=0);
274 : void LoadClusterArrays(TTree* tree,int il);
275 :
276 614 : ClassDef(AliITSMultReconstructor,11)
277 : };
278 :
279 : //____________________________________________________________________
280 : inline void AliITSMultReconstructor::ClusterPos2Angles(Float_t *clPar, const Float_t *vtx) const
281 : {
282 : // convert cluster coordinates to angles wrt vertex
283 0 : Float_t x = clPar[kClTh] - vtx[0];
284 0 : Float_t y = clPar[kClPh] - vtx[1];
285 0 : Float_t z = clPar[kClZ] - vtx[2];
286 0 : Float_t r = TMath::Sqrt(x*x + y*y + z*z);
287 0 : clPar[kClTh] = TMath::ACos(z/r); // Store Theta
288 0 : clPar[kClPh] = TMath::Pi() + TMath::ATan2(-y,-x); // Store Phi
289 : //
290 0 : }
291 :
292 : //____________________________________________________________________
293 : inline Double_t AliITSMultReconstructor::CalcDist(Double_t dphi, Double_t dtheta, Double_t theta) const
294 : {
295 : // calculate eliptical distance. theta is the angle of cl1, dtheta = tht(cl1)-tht(cl2)
296 1276 : dphi = TMath::Abs(dphi) - fDPhiShift;
297 638 : if (fScaleDTBySin2T) {
298 0 : double sinTI = TMath::Sin(theta-dtheta/2);
299 0 : sinTI *= sinTI;
300 0 : dtheta /= sinTI>1.e-6 ? sinTI : 1.e-6;
301 0 : }
302 638 : return dphi*dphi/fDPhiWindow2 + dtheta*dtheta/fDThetaWindow2;
303 : }
304 :
305 : //____________________________________________________________________
306 : inline void AliITSMultReconstructor::CalcThetaPhi(float x, float y,float z,float &theta,float &phi) const
307 : {
308 : // get theta and phi in tracklet convention
309 292 : theta = TMath::ACos(z/TMath::Sqrt(x*x + y*y + z*z));
310 146 : phi = TMath::Pi() + TMath::ATan2(-y,-x);
311 146 : }
312 :
313 :
314 : #endif
|