1 #ifndef ALIITSTRACKLETERSPDEFF_H
2 #define ALIITSTRACKLETERSPDEFF_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
8 //____________________________________________________________________
10 // AliITSTrackleterSPDEff - find SPD chips efficiencies by using tracklets.
12 // This class has been derived from AliITSMultReconstructor (see
13 // it for more details). It is the class for the Trackleter used to estimate
14 // SPD plane efficiency.
15 // The trackleter prediction is built using the vertex and 1 cluster.
19 // Author : Giuseppe Eugenio Bruno, based on the skeleton of Reconstruct method provided by Tiziano Virgili
20 // email: giuseppe.bruno@ba.infn.it
22 //____________________________________________________________________
25 #include "AliITSMultReconstructor.h"
26 #include "AliITSPlaneEffSPD.h"
28 class AliITSTrackleterSPDEff : public AliITSMultReconstructor
31 AliITSTrackleterSPDEff();
32 virtual ~AliITSTrackleterSPDEff();
33 // Main method to perform the trackleter and the SPD efficiency evaluation
34 void Reconstruct(TTree* tree, Float_t* vtx, Float_t* vtxRes, AliStack* pStack=0x0, TTree* tRef=0x0);
36 void SetPhiWindowL1(Float_t w=0.08) {fPhiWindowL1=w;} // method to set the cuts in the interpolation
37 void SetZetaWindowL1(Float_t w=1.) {fZetaWindowL1=w;} // phase; use method of the base class for extrap.
38 void SetOnlyOneTrackletPerC1(Bool_t b = kTRUE) {fOnlyOneTrackletPerC1 = b;} // as in the base class but
39 // for the inner layer
40 void SetUpdateOncePerEventPlaneEff(Bool_t b = kTRUE) {fUpdateOncePerEventPlaneEff = b;}
42 AliITSPlaneEffSPD* GetPlaneEff() const {return fPlaneEffSPD;} // return a pointer to the AliITSPlaneEffSPD
44 void SetMC(Bool_t mc=kTRUE) {fMC=mc; InitPredictionMC(); return;} // switch on access to MC true
45 Bool_t GetMC() const {return fMC;} // check the access to MC true
46 // Only for MC: use only "primary" particles (according to PrimaryTrackChecker) for the tracklet prediction
47 void SetUseOnlyPrimaryForPred(Bool_t flag=kTRUE) {CallWarningMC(); fUseOnlyPrimaryForPred = flag; }
48 // Only for MC: use only "secondary" particles (according to PrimaryTrackChecker) for the tracklet prediction
49 void SetUseOnlySecondaryForPred(Bool_t flag=kTRUE) {CallWarningMC(); fUseOnlySecondaryForPred = flag;}
50 // Only for MC: associate a cluster to the tracklet prediction if from the same particle
51 void SetUseOnlySameParticle(Bool_t flag=kTRUE) {CallWarningMC(); fUseOnlySameParticle = flag;}
52 // Only for MC: associate a cluster to the tracklet prediction if from different particles
53 void SetUseOnlyDifferentParticle(Bool_t flag=kTRUE) {CallWarningMC(); fUseOnlyDifferentParticle = flag;}
54 // Only for MC: re-define "primary" a particle if it is also "stable" (according to definition in method DecayingTrackChecker)
55 void SetUseOnlyStableParticle(Bool_t flag=kTRUE) {CallWarningMC(); fUseOnlyStableParticle = flag;}
56 // only for MC: Getters relative to the above setters
57 Bool_t GetUseOnlyPrimaryForPred() const {CallWarningMC(); return fUseOnlyPrimaryForPred; }
58 Bool_t GetUseOnlySecondaryForPred() const {CallWarningMC(); return fUseOnlySecondaryForPred;}
59 Bool_t GetUseOnlySameParticle() const {CallWarningMC(); return fUseOnlySameParticle;}
60 Bool_t GetUseOnlyDifferentParticle() const {CallWarningMC(); return fUseOnlyDifferentParticle;}
61 Bool_t GetUseOnlyStableParticle() const {CallWarningMC(); return fUseOnlyStableParticle;}
62 // Getters for the data members related to MC true statisitcs (see below)
63 Int_t GetPredictionPrimary(const UInt_t key) const;
64 Int_t GetPredictionSecondary(const UInt_t key) const;
65 Int_t GetClusterPrimary(const UInt_t key) const;
66 Int_t GetClusterSecondary(const UInt_t key) const;
67 Int_t GetSuccessPP(const UInt_t key) const;
68 Int_t GetSuccessTT(const UInt_t key) const;
69 Int_t GetSuccessS(const UInt_t key) const;
70 Int_t GetSuccessP(const UInt_t key) const;
71 Int_t GetFailureS(const UInt_t key) const;
72 Int_t GetFailureP(const UInt_t key) const;
73 Int_t GetRecons(const UInt_t key) const;
74 Int_t GetNonRecons(const UInt_t key) const;
75 Int_t GetPredictionPrimary(const UInt_t mod, const UInt_t chip) const
76 {return GetPredictionPrimary(fPlaneEffSPD->GetKey(mod,chip));};
77 Int_t GetPredictionSecondary(const UInt_t mod, const UInt_t chip) const
78 {return GetPredictionSecondary(fPlaneEffSPD->GetKey(mod,chip));};
79 Int_t GetClusterPrimary(const UInt_t mod, const UInt_t chip) const
80 {return GetClusterPrimary(fPlaneEffSPD->GetKey(mod,chip));};
81 Int_t GetClusterSecondary(const UInt_t mod, const UInt_t chip) const
82 {return GetClusterSecondary(fPlaneEffSPD->GetKey(mod,chip));};
83 Int_t GetSuccessPP(const UInt_t mod, const UInt_t chip) const
84 {return GetSuccessPP(fPlaneEffSPD->GetKey(mod,chip));};
85 Int_t GetSuccessTT(const UInt_t mod, const UInt_t chip) const
86 {return GetSuccessTT(fPlaneEffSPD->GetKey(mod,chip));};
87 Int_t GetSuccessS(const UInt_t mod, const UInt_t chip) const
88 {return GetSuccessS(fPlaneEffSPD->GetKey(mod,chip));};
89 Int_t GetSuccessP(const UInt_t mod, const UInt_t chip) const
90 {return GetSuccessP(fPlaneEffSPD->GetKey(mod,chip));};
91 Int_t GetFailureS(const UInt_t mod, const UInt_t chip) const
92 {return GetFailureS(fPlaneEffSPD->GetKey(mod,chip));};
93 Int_t GetFailureP(const UInt_t mod, const UInt_t chip) const
94 {return GetFailureP(fPlaneEffSPD->GetKey(mod,chip));};
95 Int_t GetRecons(const UInt_t mod, const UInt_t chip) const
96 {return GetRecons(fPlaneEffSPD->GetKey(mod,chip));};
97 Int_t GetNonRecons(const UInt_t mod, const UInt_t chip) const
98 {return GetNonRecons(fPlaneEffSPD->GetKey(mod,chip));};
99 // methods to write/reas cuts and MC statistics into/from file
100 void SavePredictionMC(TString filename="TrackletsMCpred.txt") const;
101 void ReadPredictionMC(TString filename="TrackletsMCpred.txt");
102 // Print some class info in ascii form to stream (cut values and MC statistics)
103 virtual void PrintAscii(ostream *os)const;
104 // Read some class info in ascii form from stream (cut values and MC statistics)
105 virtual void ReadAscii(istream *is);
106 Bool_t GetHistOn() const {return fHistOn;}; // return status of histograms
107 // write histograms into a root file on disk
108 Bool_t WriteHistosToFile(TString filename="TrackleterSPDHistos.root",Option_t* option = "RECREATE");
109 // switch on/off the extra histograms
110 void SetHistOn(Bool_t his=kTRUE) {AliITSMultReconstructor::SetHistOn(his);
111 if(GetHistOn()) {DeleteHistos(); BookHistos();} else DeleteHistos(); return;}
114 AliITSTrackleterSPDEff(const AliITSTrackleterSPDEff& mr); // protected method: no copy allowed from outside
115 AliITSTrackleterSPDEff& operator=(const AliITSTrackleterSPDEff& mr);
117 Bool_t* fAssociationFlag1; // flag for the associations (Layer 1)
118 UInt_t* fChipPredOnLay2; // prediction for the chip traversed by the tracklet
119 // based on vtx and ClusterLay1 (to be used in extrapolation)
120 UInt_t* fChipPredOnLay1; // prediction for the chip traversed by the tracklet
121 // based on vtx and ClusterLay2 (to be used in interpolation)
122 Int_t fNTracklets1; // Number of tracklets layer 1
124 Float_t fPhiWindowL1; // Search window in phi (Layer 1)
125 Float_t fZetaWindowL1; // SEarch window in zeta (Layer 1)
126 Bool_t fOnlyOneTrackletPerC1; // only one tracklet per cluster in L. 1
127 Bool_t fUpdateOncePerEventPlaneEff; // If this is kTRUE, then you can update the chip efficiency only once
128 // per event in that chip. This to avoid double counting from the
129 // same tracklets which has two rec-points on one layer.
130 Bool_t* fChipUpdatedInEvent; // boolean (chip by chip) to flag which chip has been updated its efficiency
132 AliITSPlaneEffSPD* fPlaneEffSPD; // pointer to SPD plane efficiency class
133 Bool_t fMC; // Boolean to access Kinematics (only for MC events )
134 Bool_t fUseOnlyPrimaryForPred; // Only for MC: if this is true, build tracklet prediction using only primary particles
135 Bool_t fUseOnlySecondaryForPred; // Only for MC: if this is true build tracklet prediction using only secondary particles
136 Bool_t fUseOnlySameParticle; // Only for MC: if this is true, assign a success only if clusters from same particles
137 // (i.e. PP or SS) otherwise ignore the combination
138 Bool_t fUseOnlyDifferentParticle; // Only for MC: if this is true, assign a success only if clusters from different particles
139 // (i.e. PP' or PS or SS') otherwise ignore the combination
140 Bool_t fUseOnlyStableParticle; // Only for MC: if this is kTRUE then method PrimaryTrackChecker return kTRUE only
141 // for particles decaying (eventually) after pixel layers
142 Int_t *fPredictionPrimary; // those for correction of bias from secondaries
143 Int_t *fPredictionSecondary; // chip_by_chip: number of Prediction built with primaries/secondaries
144 Int_t *fClusterPrimary; // number of clusters on a given chip fired by (at least) a primary
145 Int_t *fClusterSecondary; // number of clusters on a given chip fired by (only) secondaries
146 Int_t *fSuccessPP; // number of successes by using the same primary track (vs. chip of the success)
147 Int_t *fSuccessTT; // number of successes by using the same track (either a primary or a secondary) (vs. chip of the success)
148 Int_t *fSuccessS; // number of successes by using a secondary for the prediction (vs. chip of the success)
149 Int_t *fSuccessP; // number of successes by using a primary for the prediction (vs. chip of the success)
150 Int_t *fFailureS; // number of failures by using a secondary for the prediction (vs. chip of the failure)
151 Int_t *fFailureP; // number of failures by using a primary for the prediction (vs. chip of the failure)
152 Int_t *fRecons; // number of particle which can be reconstructed (only for MC from TrackRef)
153 Int_t *fNonRecons; // unmber of particle which cannot be reconstructed (only for MC from TrackRef)
154 // extra histograms with respect to the base class AliITSMultReconstructor
155 TH1F* fhClustersDPhiInterpAcc; // Phi2 - Phi1 for tracklets (interpolation phase)
156 TH1F* fhClustersDThetaInterpAcc; // Theta2 - Theta1 for tracklets (interpolation phase)
157 TH1F* fhClustersDZetaInterpAcc; // z2 - z1projected for tracklets (interpolation phase)
158 TH1F* fhClustersDPhiInterpAll; // Phi2 - Phi1 all the combinations (interpolation phase)
159 TH1F* fhClustersDThetaInterpAll; // Theta2 - Theta1 all the combinations (interpolation phase)
160 TH1F* fhClustersDZetaInterpAll; // z2 - z1projected all the combinations (interpolation phase)
161 TH2F* fhDPhiVsDThetaInterpAll; // 2D plot for all the combinations
162 TH2F* fhDPhiVsDThetaInterpAcc; // same plot for tracklets
163 TH2F* fhDPhiVsDZetaInterpAll; // 2d plot for all the combination
164 TH2F* fhDPhiVsDZetaInterpAcc; // same plot for tracklets
165 TH1F* fhetaClustersLay2; // Pseudorapidity distr. for Clusters L. 2
166 TH1F* fhphiClustersLay2; // Azimuthal (Phi) distr. for Clusters L. 2
168 Double_t GetRLayer(Int_t layer); // return average radius of layer (0,1) from Geometry
169 Bool_t PrimaryTrackChecker(Int_t ipart,AliStack* stack=0x0); // check if a MC particle is primary (need AliStack)
170 Int_t DecayingTrackChecker(Int_t ipart,AliStack* stack=0x0); // For a primary particle, check if it is stable (see cxx)
171 // check if a MC particle is reconstructable
172 Bool_t IsReconstructableAt(Int_t layer,Int_t iC,Int_t ipart,Float_t* vtx,AliStack* stack=0x0,TTree* ref=0x0);
173 void InitPredictionMC();
174 // method to locate a chip using current vtx and polar coordinate od tracklet w.r.t. to vtx (zVtx may not be given)
175 Bool_t FindChip(UInt_t &key, Int_t layer, Float_t* vtx, Float_t thetaVtx, Float_t phiVtx, Float_t zVtx=999.);
176 // method to transform from Global Cilindrical coordinate to local (module) Cartesian coordinate
177 Bool_t FromGloCilToLocCart(Int_t ilayer,Int_t idet, Double_t r, Double_t phi, Double_t z,
178 Float_t &xloc, Float_t &zloc);
179 // method to obtain the module (detector) index using global coordinates
180 Int_t FindDetectorIndex(Int_t layer, Double_t phi, Double_t z);
181 // this method gives you the intersections between a line and a circle (centred in the origin)
182 // using polar coordinates
183 Bool_t FindIntersectionPolar(Double_t vtx[2],Double_t phiVtx, Double_t R,Double_t &phi);
184 Bool_t SetAngleRange02Pi(Double_t &angle); // set the range of angle in [0,2pi[
185 Bool_t SetAngleRange02Pi(Float_t &angle)
186 {Double_t tmp=(Double_t)angle; Bool_t ret=SetAngleRange02Pi(tmp);angle=(Float_t)tmp;return ret;};
187 void CallWarningMC() const {if(!fMC) AliWarning("You can use this method only for MC! Call SetMC() first");}
189 void BookHistos(); // booking of extra histograms w.r.t. base class
190 void DeleteHistos(); //delete histos from memory
192 ClassDef(AliITSTrackleterSPDEff,2)
194 // Input and output function for standard C++ input/output (for the cut values and MC statistics).
195 ostream &operator<<(ostream &os,const AliITSTrackleterSPDEff &s);
196 istream &operator>>(istream &is, AliITSTrackleterSPDEff &s);