Added new methods
[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//
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.
16
17//
18//
19// Author : Giuseppe Eugenio Bruno, based on the skeleton of Reconstruct method provided by Tiziano Virgili
20// email: giuseppe.bruno@ba.infn.it
21//
22//____________________________________________________________________
23
84161aec 24class AliStack;
275a301c 25#include "AliITSMultReconstructor.h"
26#include "AliITSPlaneEffSPD.h"
27
275a301c 28class AliITSTrackleterSPDEff : public AliITSMultReconstructor
29{
30public:
31 AliITSTrackleterSPDEff();
32 virtual ~AliITSTrackleterSPDEff();
84161aec 33 // Main method to perform the trackleter and the SPD efficiency evaluation
275a301c 34 void Reconstruct(TTree* tree, Float_t* vtx, Float_t* vtxRes, AliStack* pStack=0x0);
35
84161aec 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
275a301c 40
84161aec 41 AliITSPlaneEffSPD* GetPlaneEff() const {return fPlaneEffSPD;} // return a pointer to the AliITSPlaneEffSPD
275a301c 42
84161aec 43 void SetMC(Bool_t mc=kTRUE) {fMC=mc; InitPredictionMC(); return;} // switch on access to MC true
44 Bool_t GetMC() const {return fMC;} // check the access to MC true
45 // Only for MC: use only "primary" particles (according to PrimaryTrackChecker) for the tracklet prediction
46 void SetUseOnlyPrimaryForPred(Bool_t flag=kTRUE) {CallWarningMC(); fUseOnlyPrimaryForPred = flag; }
47 // Only for MC: use only "secondary" particles (according to PrimaryTrackChecker) for the tracklet prediction
275a301c 48 void SetUseOnlySecondaryForPred(Bool_t flag=kTRUE) {CallWarningMC(); fUseOnlySecondaryForPred = flag;}
84161aec 49 // Only for MC: associate a cluster to the tracklet prediction if from the same particle
275a301c 50 void SetUseOnlySameParticle(Bool_t flag=kTRUE) {CallWarningMC(); fUseOnlySameParticle = flag;}
84161aec 51 // Only for MC: associate a cluster to the tracklet prediction if from different particles
275a301c 52 void SetUseOnlyDifferentParticle(Bool_t flag=kTRUE) {CallWarningMC(); fUseOnlyDifferentParticle = flag;}
84161aec 53 // Only for MC: re-define "primary" a particle if it is also "stable" (according to definition in method DecayingTrackChecker)
275a301c 54 void SetUseOnlyStableParticle(Bool_t flag=kTRUE) {CallWarningMC(); fUseOnlyStableParticle = flag;}
84161aec 55 // only for MC: Getters relative to the above setters
275a301c 56 Bool_t GetUseOnlyPrimaryForPred() const {CallWarningMC(); return fUseOnlyPrimaryForPred; }
57 Bool_t GetUseOnlySecondaryForPred() const {CallWarningMC(); return fUseOnlySecondaryForPred;}
58 Bool_t GetUseOnlySameParticle() const {CallWarningMC(); return fUseOnlySameParticle;}
59 Bool_t GetUseOnlyDifferentParticle() const {CallWarningMC(); return fUseOnlyDifferentParticle;}
60 Bool_t GetUseOnlyStableParticle() const {CallWarningMC(); return fUseOnlyStableParticle;}
84161aec 61 // Getters for the data members related to MC true statisitcs (see below)
275a301c 62 Int_t GetPredictionPrimary(const UInt_t key) const;
63 Int_t GetPredictionSecondary(const UInt_t key) const;
64 Int_t GetClusterPrimary(const UInt_t key) const;
65 Int_t GetClusterSecondary(const UInt_t key) const;
66 Int_t GetPredictionPrimary(const UInt_t mod, const UInt_t chip) const
67 {return GetPredictionPrimary(fPlaneEffSPD->GetKey(mod,chip));};
68 Int_t GetPredictionSecondary(const UInt_t mod, const UInt_t chip) const
69 {return GetPredictionSecondary(fPlaneEffSPD->GetKey(mod,chip));};
70 Int_t GetClusterPrimary(const UInt_t mod, const UInt_t chip) const
71 {return GetClusterPrimary(fPlaneEffSPD->GetKey(mod,chip));};
72 Int_t GetClusterSecondary(const UInt_t mod, const UInt_t chip) const
73 {return GetClusterSecondary(fPlaneEffSPD->GetKey(mod,chip));};
84161aec 74 // methods to write/reas cuts and MC statistics into/from file
275a301c 75 void SavePredictionMC(TString filename="TrackletsMCpred.txt") const;
76 void ReadPredictionMC(TString filename="TrackletsMCpred.txt");
77 // Print some class info in ascii form to stream (cut values and MC statistics)
78 virtual void PrintAscii(ostream *os)const;
79 // Read some class info in ascii form from stream (cut values and MC statistics)
80 virtual void ReadAscii(istream *is);
81 Bool_t GetHistOn() const {return fHistOn;}; // return status of histograms
84161aec 82 // write histograms into a root file on disk
275a301c 83 Bool_t WriteHistosToFile(TString filename="TrackleterSPDHistos.root",Option_t* option = "RECREATE");
84161aec 84 // switch on/off the extra histograms
275a301c 85 void SetHistOn(Bool_t his=kTRUE) {AliITSMultReconstructor::SetHistOn(his);
86 if(GetHistOn()) {DeleteHistos(); BookHistos();} else DeleteHistos(); return;}
87
88protected:
84161aec 89 AliITSTrackleterSPDEff(const AliITSTrackleterSPDEff& mr); // protected method: no copy allowed from outside
275a301c 90 AliITSTrackleterSPDEff& operator=(const AliITSTrackleterSPDEff& mr);
91
92 Bool_t* fAssociationFlag1; // flag for the associations (Layer 1)
93 UInt_t* fChipPredOnLay2; // prediction for the chip traversed by the tracklet
94 // based on vtx and ClusterLay1 (to be used in extrapolation)
95 UInt_t* fChipPredOnLay1; // prediction for the chip traversed by the tracklet
96 // based on vtx and ClusterLay2 (to be used in interpolation)
97 Int_t fNTracklets1; // Number of tracklets layer 1
98 Float_t fPhiWindowL1; // Search window in phi (Layer 1)
99 Float_t fZetaWindowL1; // SEarch window in zeta (Layer 1)
100 Bool_t fOnlyOneTrackletPerC1; // only one tracklet per cluster in L. 1
101 AliITSPlaneEffSPD* fPlaneEffSPD; // pointer to SPD plane efficiency class
102 Bool_t fMC; // Boolean to access Kinematics (only for MC events )
103 Bool_t fUseOnlyPrimaryForPred; // Only for MC: if this is true, build tracklet prediction using only primary particles
104 Bool_t fUseOnlySecondaryForPred; // Only for MC: if this is true build tracklet prediction using only secondary particles
105 Bool_t fUseOnlySameParticle; // Only for MC: if this is true, assign a success only if clusters from same particles
106 // (i.e. PP or SS) otherwise ignore the combination
107 Bool_t fUseOnlyDifferentParticle; // Only for MC: if this is true, assign a success only if clusters from different particles
108 // (i.e. PP' or PS or SS') otherwise ignore the combination
109 Bool_t fUseOnlyStableParticle; // Only for MC: if this is kTRUE then method PrimaryTrackChecker return kTRUE only
110 // for particles decaying (eventually) after pixel layers
111 Int_t *fPredictionPrimary; // those for correction of bias from secondaries
112 Int_t *fPredictionSecondary; // chip_by_chip: number of Prediction built with primaries/secondaries
113 Int_t *fClusterPrimary; // number of clusters on a given chip fired by (at least) a primary
114 Int_t *fClusterSecondary; // number of clusters on a given chip fired by (only) secondaries
115 // extra histograms with respect to the base class AliITSMultReconstructor
116 TH1F* fhClustersDPhiInterpAcc; // Phi2 - Phi1 for tracklets (interpolation phase)
117 TH1F* fhClustersDThetaInterpAcc; // Theta2 - Theta1 for tracklets (interpolation phase)
118 TH1F* fhClustersDZetaInterpAcc; // z2 - z1projected for tracklets (interpolation phase)
119 TH1F* fhClustersDPhiInterpAll; // Phi2 - Phi1 all the combinations (interpolation phase)
120 TH1F* fhClustersDThetaInterpAll; // Theta2 - Theta1 all the combinations (interpolation phase)
121 TH1F* fhClustersDZetaInterpAll; // z2 - z1projected all the combinations (interpolation phase)
122 TH2F* fhDPhiVsDThetaInterpAll; // 2D plot for all the combinations
123 TH2F* fhDPhiVsDThetaInterpAcc; // same plot for tracklets
124 TH2F* fhDPhiVsDZetaInterpAll; // 2d plot for all the combination
125 TH2F* fhDPhiVsDZetaInterpAcc; // same plot for tracklets
126 TH1F* fhetaClustersLay2; // Pseudorapidity distr. for Clusters L. 2
127 TH1F* fhphiClustersLay2; // Azimuthal (Phi) distr. for Clusters L. 2
128//
129 Double_t GetRLayer(Int_t layer); // return average radius of layer (0,1) from Geometry
130 Bool_t PrimaryTrackChecker(Int_t ipart,AliStack* stack=0x0); // check if a MC particle is primary (need AliStack)
131 Int_t DecayingTrackChecker(Int_t ipart,AliStack* stack=0x0); // For a primary particle, check if it is stable (see cxx)
132 void InitPredictionMC();
133 // method to locate a chip using current vtx and polar coordinate od tracklet w.r.t. to vtx (zVtx may not be given)
134 Bool_t FindChip(UInt_t &key, Int_t layer, Float_t* vtx, Float_t thetaVtx, Float_t phiVtx, Float_t zVtx=999.);
135 // method to transform from Global Cilindrical coordinate to local (module) Cartesian coordinate
136 Bool_t FromGloCilToLocCart(Int_t ilayer,Int_t idet, Double_t r, Double_t phi, Double_t z,
137 Float_t &xloc, Float_t &zloc);
138 // method to obtain the module (detector) index using global coordinates
139 Int_t FindDetectorIndex(Int_t layer, Double_t phi, Double_t z);
140 // this method gives you the intersections between a line and a circle (centred in the origin)
141 // using polar coordinates
142 Bool_t FindIntersectionPolar(Double_t vtx[2],Double_t phiVtx, Double_t R,Double_t &phi);
143 Bool_t SetAngleRange02Pi(Double_t &angle); // set the range of angle in [0,2pi[
144 Bool_t SetAngleRange02Pi(Float_t &angle)
145 {Double_t tmp=(Double_t)angle; Bool_t ret=SetAngleRange02Pi(tmp);angle=(Float_t)tmp;return ret;};
146 void CallWarningMC() const {if(!fMC) AliWarning("You can use this method only for MC! Call SetMC() first");}
147 Bool_t SaveHists();
148 void BookHistos(); // booking of extra histograms w.r.t. base class
149 void DeleteHistos(); //delete histos from memory
150
151 ClassDef(AliITSTrackleterSPDEff,1)
152};
153// Input and output function for standard C++ input/output (for the cut values and MC statistics).
154ostream &operator<<(ostream &os,const AliITSTrackleterSPDEff &s);
155istream &operator>>(istream &is, AliITSTrackleterSPDEff &s);
156#endif