]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSTrackleterSPDEff.h
A prototype macro for the TDR7 layout
[u/mrichter/AliRoot.git] / ITS / AliITSTrackleterSPDEff.h
CommitLineData
275a301c 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 */
5
6/* $Id$ */
7
8//____________________________________________________________________
9//
10// AliITSTrackleterSPDEff - find SPD chips efficiencies by using tracklets.
11//
58e8dc31 12// This class was originally derived from AliITSMultReconstructor (see
13// it for more details). Later on, the inheritance was changed to AliTracker
14// It is the class for the Trackleter used to estimate
275a301c 15// SPD plane efficiency.
16// The trackleter prediction is built using the vertex and 1 cluster.
17
18//
19//
20// Author : Giuseppe Eugenio Bruno, based on the skeleton of Reconstruct method provided by Tiziano Virgili
21// email: giuseppe.bruno@ba.infn.it
22//
23//____________________________________________________________________
24
84161aec 25class AliStack;
58e8dc31 26class TTree;
27class TH1F;
28class TH2F;
18562610 29class AliPlaneEff;
30
58e8dc31 31#include "AliTracker.h"
275a301c 32#include "AliITSPlaneEffSPD.h"
33
fe7d86eb 34using std::istream;
35
58e8dc31 36class AliITSTrackleterSPDEff : public AliTracker
275a301c 37{
38public:
39 AliITSTrackleterSPDEff();
40 virtual ~AliITSTrackleterSPDEff();
0ea92079 41 Int_t Clusters2Tracks(AliESDEvent *esd);
58e8dc31 42 Int_t PostProcess(AliESDEvent *);
43
44 virtual Int_t PropagateBack(AliESDEvent*) {return 0;}
45 virtual Int_t RefitInward(AliESDEvent*) {return 0;}
46 Int_t LoadClusters(TTree* cl) {LoadClusterArrays(cl); return 0;} // see implementation in AliITSMultReconstructor
47 virtual void UnloadClusters() {return;}
48 virtual AliCluster *GetCluster(Int_t) const {return NULL;}
49
84161aec 50 // Main method to perform the trackleter and the SPD efficiency evaluation
03ee9629 51 void Reconstruct(AliStack* pStack=0x0, TTree* tRef=0x0, Bool_t lbkg=kFALSE);
275a301c 52
18562610 53 void SetReflectClusterAroundZAxisForLayer(Int_t ilayer,Bool_t b=kTRUE); // method to study residual background:
54 // a rotation by 180degree around the Z axis
55 // (x->-x; y->-y) to all RecPoints on a
56 // given layer is applied. In such a way
57 // you remove all the true tracklets.
03ee9629 58 void SetLightBkgStudyInParallel(Bool_t b = kTRUE); // if you set this on, then the estimation of the
59 // SPD efficiency is done as usual for data, but in
60 // parallel a light (i.e. without control histograms, etc.)
61 // evaluation of combinatorial background is performed
62 // with the usual ReflectClusterAroundZAxisForLayer method.
63 Bool_t GetLightBkgStudyInParallel() const {return fLightBkgStudyInParallel;}
58e8dc31 64 void SetOnlyOneTrackletPerC2(Bool_t b = kTRUE) {fOnlyOneTrackletPerC2 = b;}
7284b2b2 65 void SetPhiWindowL2(Float_t w=0.08) {fPhiWindowL2=w;}
66 void SetZetaWindowL2(Float_t w=1.) {fZetaWindowL2=w;}
58e8dc31 67
84161aec 68 void SetPhiWindowL1(Float_t w=0.08) {fPhiWindowL1=w;} // method to set the cuts in the interpolation
69 void SetZetaWindowL1(Float_t w=1.) {fZetaWindowL1=w;} // phase; use method of the base class for extrap.
70 void SetOnlyOneTrackletPerC1(Bool_t b = kTRUE) {fOnlyOneTrackletPerC1 = b;} // as in the base class but
0ea92079 71 void SetMinContVtx(Int_t min=3) {fMinContVtx=min;} // set minimum n. of contributors to vertex
58e8dc31 72
73 Int_t GetNClustersLayer1() const {return fNClustersLay1;}
74 Int_t GetNClustersLayer2() const {return fNClustersLay2;}
75 Int_t GetNTracklets() const {return fNTracklets;}
76
77 Float_t* GetClusterLayer1(Int_t n) {return fClustersLay1[n];}
78 Float_t* GetClusterLayer2(Int_t n) {return fClustersLay2[n];}
79 Float_t* GetTracklet(Int_t n) {return fTracklets[n];}
84161aec 80 // for the inner layer
a3b31967 81 void SetUpdateOncePerEventPlaneEff(Bool_t b = kTRUE) {fUpdateOncePerEventPlaneEff = b;}
275a301c 82
58e8dc31 83 AliITSPlaneEffSPD* GetPlaneEffSPD() const {return fPlaneEffSPD;} // return a pointer to the AliITSPlaneEffSPD
84 AliPlaneEff *GetPlaneEff() {return (AliPlaneEff*)fPlaneEffSPD;} // return the pointer to AliPlaneEff
275a301c 85
c6a05d92 86 void SetMC(Bool_t mc=kTRUE) {fMC=mc; fMC? InitPredictionMC() : DeletePredictionMC(); return;} // switch on access to MC true
84161aec 87 Bool_t GetMC() const {return fMC;} // check the access to MC true
88 // Only for MC: use only "primary" particles (according to PrimaryTrackChecker) for the tracklet prediction
89 void SetUseOnlyPrimaryForPred(Bool_t flag=kTRUE) {CallWarningMC(); fUseOnlyPrimaryForPred = flag; }
90 // Only for MC: use only "secondary" particles (according to PrimaryTrackChecker) for the tracklet prediction
275a301c 91 void SetUseOnlySecondaryForPred(Bool_t flag=kTRUE) {CallWarningMC(); fUseOnlySecondaryForPred = flag;}
84161aec 92 // Only for MC: associate a cluster to the tracklet prediction if from the same particle
275a301c 93 void SetUseOnlySameParticle(Bool_t flag=kTRUE) {CallWarningMC(); fUseOnlySameParticle = flag;}
84161aec 94 // Only for MC: associate a cluster to the tracklet prediction if from different particles
275a301c 95 void SetUseOnlyDifferentParticle(Bool_t flag=kTRUE) {CallWarningMC(); fUseOnlyDifferentParticle = flag;}
84161aec 96 // Only for MC: re-define "primary" a particle if it is also "stable" (according to definition in method DecayingTrackChecker)
275a301c 97 void SetUseOnlyStableParticle(Bool_t flag=kTRUE) {CallWarningMC(); fUseOnlyStableParticle = flag;}
84161aec 98 // only for MC: Getters relative to the above setters
275a301c 99 Bool_t GetUseOnlyPrimaryForPred() const {CallWarningMC(); return fUseOnlyPrimaryForPred; }
100 Bool_t GetUseOnlySecondaryForPred() const {CallWarningMC(); return fUseOnlySecondaryForPred;}
101 Bool_t GetUseOnlySameParticle() const {CallWarningMC(); return fUseOnlySameParticle;}
102 Bool_t GetUseOnlyDifferentParticle() const {CallWarningMC(); return fUseOnlyDifferentParticle;}
103 Bool_t GetUseOnlyStableParticle() const {CallWarningMC(); return fUseOnlyStableParticle;}
84161aec 104 // Getters for the data members related to MC true statisitcs (see below)
275a301c 105 Int_t GetPredictionPrimary(const UInt_t key) const;
106 Int_t GetPredictionSecondary(const UInt_t key) const;
107 Int_t GetClusterPrimary(const UInt_t key) const;
108 Int_t GetClusterSecondary(const UInt_t key) const;
a3b31967 109 Int_t GetSuccessPP(const UInt_t key) const;
110 Int_t GetSuccessTT(const UInt_t key) const;
111 Int_t GetSuccessS(const UInt_t key) const;
112 Int_t GetSuccessP(const UInt_t key) const;
113 Int_t GetFailureS(const UInt_t key) const;
114 Int_t GetFailureP(const UInt_t key) const;
115 Int_t GetRecons(const UInt_t key) const;
116 Int_t GetNonRecons(const UInt_t key) const;
275a301c 117 Int_t GetPredictionPrimary(const UInt_t mod, const UInt_t chip) const
118 {return GetPredictionPrimary(fPlaneEffSPD->GetKey(mod,chip));};
119 Int_t GetPredictionSecondary(const UInt_t mod, const UInt_t chip) const
120 {return GetPredictionSecondary(fPlaneEffSPD->GetKey(mod,chip));};
121 Int_t GetClusterPrimary(const UInt_t mod, const UInt_t chip) const
122 {return GetClusterPrimary(fPlaneEffSPD->GetKey(mod,chip));};
123 Int_t GetClusterSecondary(const UInt_t mod, const UInt_t chip) const
124 {return GetClusterSecondary(fPlaneEffSPD->GetKey(mod,chip));};
a3b31967 125 Int_t GetSuccessPP(const UInt_t mod, const UInt_t chip) const
126 {return GetSuccessPP(fPlaneEffSPD->GetKey(mod,chip));};
127 Int_t GetSuccessTT(const UInt_t mod, const UInt_t chip) const
128 {return GetSuccessTT(fPlaneEffSPD->GetKey(mod,chip));};
129 Int_t GetSuccessS(const UInt_t mod, const UInt_t chip) const
130 {return GetSuccessS(fPlaneEffSPD->GetKey(mod,chip));};
131 Int_t GetSuccessP(const UInt_t mod, const UInt_t chip) const
132 {return GetSuccessP(fPlaneEffSPD->GetKey(mod,chip));};
133 Int_t GetFailureS(const UInt_t mod, const UInt_t chip) const
134 {return GetFailureS(fPlaneEffSPD->GetKey(mod,chip));};
135 Int_t GetFailureP(const UInt_t mod, const UInt_t chip) const
136 {return GetFailureP(fPlaneEffSPD->GetKey(mod,chip));};
137 Int_t GetRecons(const UInt_t mod, const UInt_t chip) const
138 {return GetRecons(fPlaneEffSPD->GetKey(mod,chip));};
139 Int_t GetNonRecons(const UInt_t mod, const UInt_t chip) const
140 {return GetNonRecons(fPlaneEffSPD->GetKey(mod,chip));};
c6a05d92 141 // methods to write/reas cuts and MC statistics into/from file
142 // if filename contains ".root", then data are stored into histograms (->root file).
17d531c2 143 void SavePredictionMC(TString filename="TrackletsMCpred.root") const;
144 void ReadPredictionMC(TString filename="TrackletsMCpred.root");
275a301c 145 // Print some class info in ascii form to stream (cut values and MC statistics)
146 virtual void PrintAscii(ostream *os)const;
147 // Read some class info in ascii form from stream (cut values and MC statistics)
148 virtual void ReadAscii(istream *is);
149 Bool_t GetHistOn() const {return fHistOn;}; // return status of histograms
84161aec 150 // write histograms into a root file on disk
275a301c 151 Bool_t WriteHistosToFile(TString filename="TrackleterSPDHistos.root",Option_t* option = "RECREATE");
84161aec 152 // switch on/off the extra histograms
58e8dc31 153 void SetHistOn(Bool_t his=kTRUE) {fHistOn=his;
275a301c 154 if(GetHistOn()) {DeleteHistos(); BookHistos();} else DeleteHistos(); return;}
155
156protected:
84161aec 157 AliITSTrackleterSPDEff(const AliITSTrackleterSPDEff& mr); // protected method: no copy allowed from outside
275a301c 158 AliITSTrackleterSPDEff& operator=(const AliITSTrackleterSPDEff& mr);
58e8dc31 159//
160//// From AliITSMultReconstructor
161//
17d531c2 162 Float_t** fClustersLay1; //! clusters in the 1st layer of ITS
163 Float_t** fClustersLay2; //! clusters in the 2nd layer of ITS
58e8dc31 164
17d531c2 165 Float_t** fTracklets; //! tracklets
166 Bool_t* fAssociationFlag; //! flag for the associations
275a301c 167
58e8dc31 168 Int_t fNClustersLay1; // Number of clusters (Layer1)
169 Int_t fNClustersLay2; // Number of clusters (Layer2)
170 Int_t fNTracklets; // Number of tracklets
171
172 // Following members are set via AliITSRecoParam
173 Bool_t fOnlyOneTrackletPerC2; // Allow only one tracklet per cluster in the outer layer
7284b2b2 174 Float_t fPhiWindowL2; // Search window in phi
175 Float_t fZetaWindowL2; // Search window in eta
58e8dc31 176 Float_t fPhiOverlapCut; // Fiducial window in phi for overlap cut
177 Float_t fZetaOverlapCut; // Fiducial window in eta for overlap cut
178
179 Bool_t fHistOn; // Option to define and fill the histograms
180
17d531c2 181 TH1F* fhClustersDPhiAcc; //! Phi2 - Phi1 for tracklets
182 TH1F* fhClustersDThetaAcc; //! Theta2 - Theta1 for tracklets
183 TH1F* fhClustersDZetaAcc; //! z2 - z1projected for tracklets
184 TH1F* fhClustersDPhiAll; //! Phi2 - Phi1 all the combinations
185 TH1F* fhClustersDThetaAll; //! Theta2 - Theta1 all the combinations
186 TH1F* fhClustersDZetaAll; //! z2 - z1projected all the combinations
58e8dc31 187
17d531c2 188 TH2F* fhDPhiVsDThetaAll; //! 2D plot for all the combinations
189 TH2F* fhDPhiVsDThetaAcc; //! same plot for tracklets
190 TH2F* fhDPhiVsDZetaAll; //! 2d plot for all the combination
191 TH2F* fhDPhiVsDZetaAcc; //! same plot for tracklets
58e8dc31 192
17d531c2 193 TH1F* fhetaTracklets; //! Pseudorapidity distr. for tracklets
194 TH1F* fhphiTracklets; //! Azimuthal (Phi) distr. for tracklets
195 TH1F* fhetaClustersLay1; //! Pseudorapidity distr. for Clusters L. 1
196 TH1F* fhphiClustersLay1; //! Azimuthal (Phi) distr. for Clusters L. 1
58e8dc31 197//
198//
17d531c2 199 Bool_t* fAssociationFlag1; //! flag for the associations (Layer 1)
200 UInt_t* fChipPredOnLay2; //! prediction for the chip traversed by the tracklet
201 // based on vtx and ClusterLay1 (to be used in extrapolation)
202 UInt_t* fChipPredOnLay1; //! prediction for the chip traversed by the tracklet
275a301c 203 // based on vtx and ClusterLay2 (to be used in interpolation)
204 Int_t fNTracklets1; // Number of tracklets layer 1
a3b31967 205 // possible cuts :
275a301c 206 Float_t fPhiWindowL1; // Search window in phi (Layer 1)
207 Float_t fZetaWindowL1; // SEarch window in zeta (Layer 1)
208 Bool_t fOnlyOneTrackletPerC1; // only one tracklet per cluster in L. 1
a3b31967 209 Bool_t fUpdateOncePerEventPlaneEff; // If this is kTRUE, then you can update the chip efficiency only once
0ea92079 210 Int_t fMinContVtx; // minimum number of contributors (tracklets) to the vertex for the event to be used
a3b31967 211 // per event in that chip. This to avoid double counting from the
212 // same tracklets which has two rec-points on one layer.
17d531c2 213 Bool_t* fChipUpdatedInEvent; //! boolean (chip by chip) to flag which chip has been updated its efficiency
a3b31967 214 // in that event
17d531c2 215 AliITSPlaneEffSPD* fPlaneEffSPD; //! pointer to SPD plane efficiency class
03ee9629 216 AliITSPlaneEffSPD* fPlaneEffBkg; //! pointer to SPD plane efficiency class for background evaluation
0fce916f 217 Bool_t fReflectClusterAroundZAxisForLayer0; // if kTRUE, then a 180degree rotation around Z is applied to all
218 Bool_t fReflectClusterAroundZAxisForLayer1; // clusters on that layer (x->-x; y->-y)
03ee9629 219 Bool_t fLightBkgStudyInParallel; // if this is kTRUE, the basic and correct evaluation of background is performed
220 // in paralell to standard SPD efficiency evaluation
275a301c 221 Bool_t fMC; // Boolean to access Kinematics (only for MC events )
222 Bool_t fUseOnlyPrimaryForPred; // Only for MC: if this is true, build tracklet prediction using only primary particles
223 Bool_t fUseOnlySecondaryForPred; // Only for MC: if this is true build tracklet prediction using only secondary particles
224 Bool_t fUseOnlySameParticle; // Only for MC: if this is true, assign a success only if clusters from same particles
225 // (i.e. PP or SS) otherwise ignore the combination
226 Bool_t fUseOnlyDifferentParticle; // Only for MC: if this is true, assign a success only if clusters from different particles
227 // (i.e. PP' or PS or SS') otherwise ignore the combination
228 Bool_t fUseOnlyStableParticle; // Only for MC: if this is kTRUE then method PrimaryTrackChecker return kTRUE only
229 // for particles decaying (eventually) after pixel layers
17d531c2 230 Int_t *fPredictionPrimary; //! those for correction of bias from secondaries
231 Int_t *fPredictionSecondary; //! chip_by_chip: number of Prediction built with primaries/secondaries
232 Int_t *fClusterPrimary; //! number of clusters on a given chip fired by (at least) a primary
233 Int_t *fClusterSecondary; //! number of clusters on a given chip fired by (only) secondaries
234 Int_t *fSuccessPP; //! number of successes by using the same primary track (vs. chip of the success)
235 Int_t *fSuccessTT; //! number of successes by using the same track (either a primary or a secondary) (vs. chip of the success)
236 Int_t *fSuccessS; //! number of successes by using a secondary for the prediction (vs. chip of the success)
237 Int_t *fSuccessP; //! number of successes by using a primary for the prediction (vs. chip of the success)
238 Int_t *fFailureS; //! number of failures by using a secondary for the prediction (vs. chip of the failure)
239 Int_t *fFailureP; //! number of failures by using a primary for the prediction (vs. chip of the failure)
240 Int_t *fRecons; //! number of particle which can be reconstructed (only for MC from TrackRef)
241 Int_t *fNonRecons; //! unmber of particle which cannot be reconstructed (only for MC from TrackRef)
275a301c 242 // extra histograms with respect to the base class AliITSMultReconstructor
17d531c2 243 TH1F* fhClustersDPhiInterpAcc; //! Phi2 - Phi1 for tracklets (interpolation phase)
244 TH1F* fhClustersDThetaInterpAcc; //! Theta2 - Theta1 for tracklets (interpolation phase)
245 TH1F* fhClustersDZetaInterpAcc; //! z2 - z1projected for tracklets (interpolation phase)
246 TH1F* fhClustersDPhiInterpAll; //! Phi2 - Phi1 all the combinations (interpolation phase)
247 TH1F* fhClustersDThetaInterpAll; //! Theta2 - Theta1 all the combinations (interpolation phase)
248 TH1F* fhClustersDZetaInterpAll; //! z2 - z1projected all the combinations (interpolation phase)
249 TH2F* fhDPhiVsDThetaInterpAll; //! 2D plot for all the combinations
250 TH2F* fhDPhiVsDThetaInterpAcc; //! same plot for tracklets
251 TH2F* fhDPhiVsDZetaInterpAll; //! 2d plot for all the combination
252 TH2F* fhDPhiVsDZetaInterpAcc; //! same plot for tracklets
253 TH1F* fhetaClustersLay2; //! Pseudorapidity distr. for Clusters L. 2
254 TH1F* fhphiClustersLay2; //! Azimuthal (Phi) distr. for Clusters L. 2
255 TH1F* fhClustersInChip; //! number of fired clusters versus chip number [0,1199]
256 TH2F** fhClustersInModuleLay1; //! distribution of cluster in the module Lay 1 (sub-chip scale)
257 TH2F** fhClustersInModuleLay2; //! distribution of cluster in the module Lay 2 (sub-chip scale)
275a301c 258//
18562610 259 void Init(); // initialize pointers and allocate memory
275a301c 260 Double_t GetRLayer(Int_t layer); // return average radius of layer (0,1) from Geometry
261 Bool_t PrimaryTrackChecker(Int_t ipart,AliStack* stack=0x0); // check if a MC particle is primary (need AliStack)
262 Int_t DecayingTrackChecker(Int_t ipart,AliStack* stack=0x0); // For a primary particle, check if it is stable (see cxx)
a3b31967 263// check if a MC particle is reconstructable
18562610 264 Bool_t IsReconstructableAt(Int_t layer,Int_t iC,Int_t ipart,const Float_t* vtx,const AliStack* stack=0x0,TTree* ref=0x0);
c6a05d92 265 void InitPredictionMC(); // allocate memory for cuts and MC data memebers
266 void DeletePredictionMC(); // deallocate memory
275a301c 267 // method to locate a chip using current vtx and polar coordinate od tracklet w.r.t. to vtx (zVtx may not be given)
18562610 268 Bool_t FindChip(UInt_t &key, Int_t layer,const Float_t* vtx, Float_t thetaVtx, Float_t phiVtx, Float_t zVtx=999.);
275a301c 269 // method to transform from Global Cilindrical coordinate to local (module) Cartesian coordinate
270 Bool_t FromGloCilToLocCart(Int_t ilayer,Int_t idet, Double_t r, Double_t phi, Double_t z,
271 Float_t &xloc, Float_t &zloc);
272 // method to obtain the module (detector) index using global coordinates
273 Int_t FindDetectorIndex(Int_t layer, Double_t phi, Double_t z);
274 // this method gives you the intersections between a line and a circle (centred in the origin)
275 // using polar coordinates
276 Bool_t FindIntersectionPolar(Double_t vtx[2],Double_t phiVtx, Double_t R,Double_t &phi);
18562610 277 Bool_t SetAngleRange02Pi(Double_t &angle) const; // set the range of angle in [0,2pi[
278 Bool_t SetAngleRange02Pi(Float_t &angle) const
275a301c 279 {Double_t tmp=(Double_t)angle; Bool_t ret=SetAngleRange02Pi(tmp);angle=(Float_t)tmp;return ret;};
280 void CallWarningMC() const {if(!fMC) AliWarning("You can use this method only for MC! Call SetMC() first");}
281 Bool_t SaveHists();
282 void BookHistos(); // booking of extra histograms w.r.t. base class
283 void DeleteHistos(); //delete histos from memory
0fce916f 284 // Method to apply a rotation by 180degree to all RecPoints (x->-x; y->-y) on a given layer
285 void ReflectClusterAroundZAxisForLayer(Int_t ilayer); // to be used for backgnd estimation on real data
275a301c 286
58e8dc31 287 void LoadClusterArrays(TTree* tree);
288
03ee9629 289 ClassDef(AliITSTrackleterSPDEff,6)
275a301c 290};
291// Input and output function for standard C++ input/output (for the cut values and MC statistics).
292ostream &operator<<(ostream &os,const AliITSTrackleterSPDEff &s);
293istream &operator>>(istream &is, AliITSTrackleterSPDEff &s);
294#endif
0ea92079 295