New Class AliITSTrackleterSPDEff:
[u/mrichter/AliRoot.git] / ITS / AliITSTrackleterSPDEff.h
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
6/* $Id$ */
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:
24#include "AliITSMultReconstructor.h"
25#include "AliITSPlaneEffSPD.h"
27class AliStack;
29class AliITSTrackleterSPDEff : public AliITSMultReconstructor
32 AliITSTrackleterSPDEff();
33 virtual ~AliITSTrackleterSPDEff();
35 void Reconstruct(TTree* tree, Float_t* vtx, Float_t* vtxRes, AliStack* pStack=0x0);
37 void SetPhiWindowL1(Float_t w=0.08) {fPhiWindowL1=w;}
38 void SetZetaWindowL1(Float_t w=1.) {fZetaWindowL1=w;}
39 void SetOnlyOneTrackletPerC1(Bool_t b = kTRUE) {fOnlyOneTrackletPerC1 = b;}
41 AliITSPlaneEffSPD* GetPlaneEff() const {return fPlaneEffSPD;}
43 void SetMC(Bool_t mc=kTRUE) {fMC=mc; InitPredictionMC(); return;}
44 Bool_t GetMC() const {return fMC;}
45 void SetUseOnlyPrimaryForPred(Bool_t flag=kTRUE) {CallWarningMC(); fUseOnlyPrimaryForPred = flag; }
46 void SetUseOnlySecondaryForPred(Bool_t flag=kTRUE) {CallWarningMC(); fUseOnlySecondaryForPred = flag;}
47 void SetUseOnlySameParticle(Bool_t flag=kTRUE) {CallWarningMC(); fUseOnlySameParticle = flag;}
48 void SetUseOnlyDifferentParticle(Bool_t flag=kTRUE) {CallWarningMC(); fUseOnlyDifferentParticle = flag;}
49 void SetUseOnlyStableParticle(Bool_t flag=kTRUE) {CallWarningMC(); fUseOnlyStableParticle = flag;}
50 Bool_t GetUseOnlyPrimaryForPred() const {CallWarningMC(); return fUseOnlyPrimaryForPred; }
51 Bool_t GetUseOnlySecondaryForPred() const {CallWarningMC(); return fUseOnlySecondaryForPred;}
52 Bool_t GetUseOnlySameParticle() const {CallWarningMC(); return fUseOnlySameParticle;}
53 Bool_t GetUseOnlyDifferentParticle() const {CallWarningMC(); return fUseOnlyDifferentParticle;}
54 Bool_t GetUseOnlyStableParticle() const {CallWarningMC(); return fUseOnlyStableParticle;}
55 Int_t GetPredictionPrimary(const UInt_t key) const;
56 Int_t GetPredictionSecondary(const UInt_t key) const;
57 Int_t GetClusterPrimary(const UInt_t key) const;
58 Int_t GetClusterSecondary(const UInt_t key) const;
59 Int_t GetPredictionPrimary(const UInt_t mod, const UInt_t chip) const
60 {return GetPredictionPrimary(fPlaneEffSPD->GetKey(mod,chip));};
61 Int_t GetPredictionSecondary(const UInt_t mod, const UInt_t chip) const
62 {return GetPredictionSecondary(fPlaneEffSPD->GetKey(mod,chip));};
63 Int_t GetClusterPrimary(const UInt_t mod, const UInt_t chip) const
64 {return GetClusterPrimary(fPlaneEffSPD->GetKey(mod,chip));};
65 Int_t GetClusterSecondary(const UInt_t mod, const UInt_t chip) const
66 {return GetClusterSecondary(fPlaneEffSPD->GetKey(mod,chip));};
67 void SavePredictionMC(TString filename="TrackletsMCpred.txt") const;
68 void ReadPredictionMC(TString filename="TrackletsMCpred.txt");
69 // Print some class info in ascii form to stream (cut values and MC statistics)
70 virtual void PrintAscii(ostream *os)const;
71 // Read some class info in ascii form from stream (cut values and MC statistics)
72 virtual void ReadAscii(istream *is);
73 Bool_t GetHistOn() const {return fHistOn;}; // return status of histograms
74 Bool_t WriteHistosToFile(TString filename="TrackleterSPDHistos.root",Option_t* option = "RECREATE");
75 void SetHistOn(Bool_t his=kTRUE) {AliITSMultReconstructor::SetHistOn(his);
76 if(GetHistOn()) {DeleteHistos(); BookHistos();} else DeleteHistos(); return;}
79 AliITSTrackleterSPDEff(const AliITSTrackleterSPDEff& mr);
80 AliITSTrackleterSPDEff& operator=(const AliITSTrackleterSPDEff& mr);
82 Bool_t* fAssociationFlag1; // flag for the associations (Layer 1)
83 UInt_t* fChipPredOnLay2; // prediction for the chip traversed by the tracklet
84 // based on vtx and ClusterLay1 (to be used in extrapolation)
85 UInt_t* fChipPredOnLay1; // prediction for the chip traversed by the tracklet
86 // based on vtx and ClusterLay2 (to be used in interpolation)
87 Int_t fNTracklets1; // Number of tracklets layer 1
88 Float_t fPhiWindowL1; // Search window in phi (Layer 1)
89 Float_t fZetaWindowL1; // SEarch window in zeta (Layer 1)
90 Bool_t fOnlyOneTrackletPerC1; // only one tracklet per cluster in L. 1
91 AliITSPlaneEffSPD* fPlaneEffSPD; // pointer to SPD plane efficiency class
92 Bool_t fMC; // Boolean to access Kinematics (only for MC events )
93 Bool_t fUseOnlyPrimaryForPred; // Only for MC: if this is true, build tracklet prediction using only primary particles
94 Bool_t fUseOnlySecondaryForPred; // Only for MC: if this is true build tracklet prediction using only secondary particles
95 Bool_t fUseOnlySameParticle; // Only for MC: if this is true, assign a success only if clusters from same particles
96 // (i.e. PP or SS) otherwise ignore the combination
97 Bool_t fUseOnlyDifferentParticle; // Only for MC: if this is true, assign a success only if clusters from different particles
98 // (i.e. PP' or PS or SS') otherwise ignore the combination
99 Bool_t fUseOnlyStableParticle; // Only for MC: if this is kTRUE then method PrimaryTrackChecker return kTRUE only
100 // for particles decaying (eventually) after pixel layers
101 Int_t *fPredictionPrimary; // those for correction of bias from secondaries
102 Int_t *fPredictionSecondary; // chip_by_chip: number of Prediction built with primaries/secondaries
103 Int_t *fClusterPrimary; // number of clusters on a given chip fired by (at least) a primary
104 Int_t *fClusterSecondary; // number of clusters on a given chip fired by (only) secondaries
105 // extra histograms with respect to the base class AliITSMultReconstructor
106 TH1F* fhClustersDPhiInterpAcc; // Phi2 - Phi1 for tracklets (interpolation phase)
107 TH1F* fhClustersDThetaInterpAcc; // Theta2 - Theta1 for tracklets (interpolation phase)
108 TH1F* fhClustersDZetaInterpAcc; // z2 - z1projected for tracklets (interpolation phase)
109 TH1F* fhClustersDPhiInterpAll; // Phi2 - Phi1 all the combinations (interpolation phase)
110 TH1F* fhClustersDThetaInterpAll; // Theta2 - Theta1 all the combinations (interpolation phase)
111 TH1F* fhClustersDZetaInterpAll; // z2 - z1projected all the combinations (interpolation phase)
112 TH2F* fhDPhiVsDThetaInterpAll; // 2D plot for all the combinations
113 TH2F* fhDPhiVsDThetaInterpAcc; // same plot for tracklets
114 TH2F* fhDPhiVsDZetaInterpAll; // 2d plot for all the combination
115 TH2F* fhDPhiVsDZetaInterpAcc; // same plot for tracklets
116 TH1F* fhetaClustersLay2; // Pseudorapidity distr. for Clusters L. 2
117 TH1F* fhphiClustersLay2; // Azimuthal (Phi) distr. for Clusters L. 2
119 Double_t GetRLayer(Int_t layer); // return average radius of layer (0,1) from Geometry
120 Bool_t PrimaryTrackChecker(Int_t ipart,AliStack* stack=0x0); // check if a MC particle is primary (need AliStack)
121 Int_t DecayingTrackChecker(Int_t ipart,AliStack* stack=0x0); // For a primary particle, check if it is stable (see cxx)
122 void InitPredictionMC();
123 // method to locate a chip using current vtx and polar coordinate od tracklet w.r.t. to vtx (zVtx may not be given)
124 Bool_t FindChip(UInt_t &key, Int_t layer, Float_t* vtx, Float_t thetaVtx, Float_t phiVtx, Float_t zVtx=999.);
125 // method to transform from Global Cilindrical coordinate to local (module) Cartesian coordinate
126 Bool_t FromGloCilToLocCart(Int_t ilayer,Int_t idet, Double_t r, Double_t phi, Double_t z,
127 Float_t &xloc, Float_t &zloc);
128 // method to obtain the module (detector) index using global coordinates
129 Int_t FindDetectorIndex(Int_t layer, Double_t phi, Double_t z);
130 // this method gives you the intersections between a line and a circle (centred in the origin)
131 // using polar coordinates
132 Bool_t FindIntersectionPolar(Double_t vtx[2],Double_t phiVtx, Double_t R,Double_t &phi);
133 Bool_t SetAngleRange02Pi(Double_t &angle); // set the range of angle in [0,2pi[
134 Bool_t SetAngleRange02Pi(Float_t &angle)
135 {Double_t tmp=(Double_t)angle; Bool_t ret=SetAngleRange02Pi(tmp);angle=(Float_t)tmp;return ret;};
136 void CallWarningMC() const {if(!fMC) AliWarning("You can use this method only for MC! Call SetMC() first");}
137 Bool_t SaveHists();
138 void BookHistos(); // booking of extra histograms w.r.t. base class
139 void DeleteHistos(); //delete histos from memory
141 ClassDef(AliITSTrackleterSPDEff,1)
143// Input and output function for standard C++ input/output (for the cut values and MC statistics).
144ostream &operator<<(ostream &os,const AliITSTrackleterSPDEff &s);
145istream &operator>>(istream &is, AliITSTrackleterSPDEff &s);