Check if busy before creating thread
[u/mrichter/AliRoot.git] / ITS / AliITSMultReconstructor.h
CommitLineData
ac903f1b 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
fa9ed8e9 6//_________________________________________________________________________
ac903f1b 7//
fa9ed8e9 8// Implementation of the ITS-SPD trackleter class
ac903f1b 9//
fa9ed8e9 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.
ac903f1b 12//
fa9ed8e9 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//_________________________________________________________________________
1f9831ab 19#include "AliTrackleter.h"
ac903f1b 20
1f9831ab 21class TBits;
ac903f1b 22class TTree;
23class TH1F;
3ef75756 24class TH2F;
1f9831ab 25class AliITSDetTypeRec;
ac903f1b 26class AliITSgeom;
1f9831ab 27class AliESDEvent;
28class AliESDtrack;
29class AliVertex;
6de485aa 30class AliESDVertex;
1f9831ab 31class AliMultiplicity;
ac903f1b 32
1f9831ab 33class AliITSMultReconstructor : public AliTrackleter
ac903f1b 34{
35public:
1f9831ab 36 //
37 enum {kClTh,kClPh,kClZ,kClMC0,kClMC1,kClMC2,kClNPar};
38 enum {kTrTheta,kTrPhi,kTrDPhi,kTrDTheta,kTrLab1,kTrLab2,kClID1,kClID2,kTrNPar};
d7c5c1e4 39 enum {kSCTh,kSCPh,kSCLab,kSCID,kSCNPar};
1f9831ab 40 enum {kITSTPC,kITSSAP,kITSTPCBit=BIT(kITSTPC),kITSSAPBit=BIT(kITSSAP)}; // RS
ac903f1b 41 AliITSMultReconstructor();
ddced3c8 42 virtual ~AliITSMultReconstructor();
ac903f1b 43
1f9831ab 44 void Reconstruct(AliESDEvent* esd, TTree* treeRP);
45 void Reconstruct(TTree* tree, Float_t* vtx, Float_t* vtxRes); // old reconstructor invocation
46 void FindTracklets(const Float_t* vtx);
9b373e9a 47 void LoadClusterFiredChips(TTree* tree);
7b116aa1 48 void FlagClustersInOverlapRegions(Int_t ic1,Int_t ic2);
34581d1e 49 void FlagTrackClusters(Int_t id);
6de485aa 50 void FlagIfSecondary(AliESDtrack* track, const AliVertex* vtx);
51 void FlagV0s(const AliESDVertex *vtx);
1f9831ab 52 void ProcessESDTracks();
6de485aa 53 Bool_t CanBeElectron(const AliESDtrack* trc) const;
1f9831ab 54
55 void CreateMultiplicityObject();
56 //
7b116aa1 57 // Following members are set via AliITSRecoParam
ac903f1b 58 void SetPhiWindow(Float_t w=0.08) {fPhiWindow=w;}
7284b2b2 59 void SetThetaWindow(Float_t w=0.025) {fThetaWindow=w;}
fa9ed8e9 60 void SetPhiShift(Float_t w=0.0045) {fPhiShift=w;}
7b116aa1 61 void SetRemoveClustersFromOverlaps(Bool_t b = kFALSE) {fRemoveClustersFromOverlaps = b;}
62 void SetPhiOverlapCut(Float_t w=0.005) {fPhiOverlapCut=w;}
63 void SetZetaOverlapCut(Float_t w=0.05) {fZetaOverlapCut=w;}
7c6da836 64 void SetPhiRotationAngle(Float_t w=0.0) {fPhiRotationAngle=w;}
7b116aa1 65
ac903f1b 66 Int_t GetNClustersLayer1() const {return fNClustersLay1;}
67 Int_t GetNClustersLayer2() const {return fNClustersLay2;}
68 Int_t GetNTracklets() const {return fNTracklets;}
968e8539 69 Int_t GetNSingleClusters() const {return fNSingleCluster;}
9b373e9a 70 Short_t GetNFiredChips(Int_t layer) const {return fNFiredChips[layer];}
ac903f1b 71
1f9831ab 72 Float_t* GetClusterLayer1(Int_t n) {return &fClustersLay1[n*kClNPar];}
73 Float_t* GetClusterLayer2(Int_t n) {return &fClustersLay2[n*kClNPar];}
74
ac903f1b 75 Float_t* GetTracklet(Int_t n) {return fTracklets[n];}
968e8539 76 Float_t* GetCluster(Int_t n) {return fSClusters[n];}
ac903f1b 77
78 void SetHistOn(Bool_t b=kFALSE) {fHistOn=b;}
79 void SaveHists();
3ef75756 80
1f9831ab 81 AliITSDetTypeRec *GetDetTypeRec() const {return fDetTypeRec;}
82 void SetDetTypeRec(AliITSDetTypeRec *ptr){fDetTypeRec = ptr;}
6de485aa 83 //
84 void SetCutPxDrSPDin(Float_t v=0.1) { fCutPxDrSPDin = v;}
85 void SetCutPxDrSPDout(Float_t v=0.15) { fCutPxDrSPDout = v;}
86 void SetCutPxDz(Float_t v=0.2) { fCutPxDz = v;}
87 void SetCutDCArz(Float_t v=0.5) { fCutDCArz = v;}
88 void SetCutMinElectronProbTPC(Float_t v=0.5) { fCutMinElectronProbTPC = v;}
89 void SetCutMinElectronProbESD(Float_t v=0.1) { fCutMinElectronProbESD = v;}
90 void SetCutMinP(Float_t v=0.05) { fCutMinP = v;}
91 void SetCutMinRGamma(Float_t v=2.) { fCutMinRGamma = v;}
92 void SetCutMinRK0(Float_t v=1.) { fCutMinRK0 = v;}
93 void SetCutMinPointAngle(Float_t v=0.98) { fCutMinPointAngle = v;}
94 void SetCutMaxDCADauther(Float_t v=0.5) { fCutMaxDCADauther = v;}
95 void SetCutMassGamma(Float_t v=0.03) { fCutMassGamma = v;}
96 void SetCutMassGammaNSigma(Float_t v=5.) { fCutMassGammaNSigma = v;}
97 void SetCutMassK0(Float_t v=0.03) { fCutMassK0 = v;}
98 void SetCutMassK0NSigma(Float_t v=5.) { fCutMassK0NSigma = v;}
99 void SetCutChi2cGamma(Float_t v=2.) { fCutChi2cGamma = v;}
100 void SetCutChi2cK0(Float_t v=2.) { fCutChi2cK0 = v;}
101 void SetCutGammaSFromDecay(Float_t v=-10.) { fCutGammaSFromDecay = v;}
102 void SetCutK0SFromDecay(Float_t v=-10.) { fCutK0SFromDecay = v;}
103 void SetCutMaxDCA(Float_t v=1.) { fCutMaxDCA = v;}
104 //
105 Float_t GetCutPxDrSPDin() const {return fCutPxDrSPDin;}
106 Float_t GetCutPxDrSPDout() const {return fCutPxDrSPDout;}
107 Float_t GetCutPxDz() const {return fCutPxDz;}
108 Float_t GetCutDCArz() const {return fCutDCArz;}
109 Float_t GetCutMinElectronProbTPC() const {return fCutMinElectronProbTPC;}
110 Float_t GetCutMinElectronProbESD() const {return fCutMinElectronProbESD;}
111 Float_t GetCutMinP() const {return fCutMinP;}
112 Float_t GetCutMinRGamma() const {return fCutMinRGamma;}
113 Float_t GetCutMinRK0() const {return fCutMinRK0;}
114 Float_t GetCutMinPointAngle() const {return fCutMinPointAngle;}
115 Float_t GetCutMaxDCADauther() const {return fCutMaxDCADauther;}
116 Float_t GetCutMassGamma() const {return fCutMassGamma;}
117 Float_t GetCutMassGammaNSigma() const {return fCutMassGammaNSigma;}
118 Float_t GetCutMassK0() const {return fCutMassK0;}
119 Float_t GetCutMassK0NSigma() const {return fCutMassK0NSigma;}
120 Float_t GetCutChi2cGamma() const {return fCutChi2cGamma;}
121 Float_t GetCutChi2cK0() const {return fCutChi2cK0;}
122 Float_t GetCutGammaSFromDecay() const {return fCutGammaSFromDecay;}
123 Float_t GetCutK0SFromDecay() const {return fCutK0SFromDecay;}
124 Float_t GetCutMaxDCA() const {return fCutMaxDCA;}
125 //
ac903f1b 126protected:
3ef75756 127 AliITSMultReconstructor(const AliITSMultReconstructor& mr);
7537d03c 128 AliITSMultReconstructor& operator=(const AliITSMultReconstructor& mr);
1f9831ab 129 AliITSDetTypeRec* fDetTypeRec; //! pointer to DetTypeRec
130 AliESDEvent* fESDEvent; //! pointer to ESD event
131 TTree* fTreeRP; //! ITS recpoints
ac903f1b 132
34581d1e 133 UInt_t* fUsedClusLay1; // RS: flag of clusters usage in ESD tracks: 0=unused, else ID+1 in word0=TPC/ITS+ITSSA, word1=ITSSA_Pure
134 UInt_t* fUsedClusLay2; // RS: flag of clusters usage in ESD tracks: 0=unused, else ID+1 word0=TPC/ITS+ITSSA, word1=ITSSA_Pure
1f9831ab 135
136 Float_t* fClustersLay1; // clusters in the 1st layer of ITS
137 Float_t* fClustersLay2; // clusters in the 2nd layer of ITS
7b116aa1 138 Int_t* fDetectorIndexClustersLay1; // module index for clusters 1st ITS layer
139 Int_t* fDetectorIndexClustersLay2; // module index for clusters 2nd ITS layer
140 Bool_t* fOverlapFlagClustersLay1; // flag for clusters in the overlap regions 1st ITS layer
141 Bool_t* fOverlapFlagClustersLay2; // flag for clusters in the overlap regions 2nd ITS layer
142
9b373e9a 143 Float_t** fTracklets; // tracklets
144 Float_t** fSClusters; // single clusters (unassociated)
ac903f1b 145
9b373e9a 146 Int_t fNClustersLay1; // Number of clusters (Layer1)
147 Int_t fNClustersLay2; // Number of clusters (Layer2)
148 Int_t fNTracklets; // Number of tracklets
149 Int_t fNSingleCluster; // Number of unassociated clusters
150 Short_t fNFiredChips[2]; // Number of fired chips in the two SPD layers
6de485aa 151 //
7b116aa1 152 // Following members are set via AliITSRecoParam
6de485aa 153 //
7b116aa1 154 Float_t fPhiWindow; // Search window in phi
fa9ed8e9 155 Float_t fThetaWindow; // Search window in theta
156 Float_t fPhiShift; // Phi shift reference value (at 0.5 T)
7b116aa1 157 Bool_t fRemoveClustersFromOverlaps; // Option to skip clusters in the overlaps
158 Float_t fPhiOverlapCut; // Fiducial window in phi for overlap cut
159 Float_t fZetaOverlapCut; // Fiducial window in eta for overlap cut
7c6da836 160 Float_t fPhiRotationAngle; // Angle to rotate the inner layer cluster for combinatorial reco only
ac903f1b 161
6de485aa 162 // cuts for secondaries identification
163 Float_t fCutPxDrSPDin; // max P*DR for primaries involving at least 1 SPD
164 Float_t fCutPxDrSPDout; // max P*DR for primaries not involving any SPD
165 Float_t fCutPxDz; // max P*DZ for primaries
166 Float_t fCutDCArz; // max DR or DZ for primares
167 //
168 // cuts for flagging tracks in V0s
169 Float_t fCutMinElectronProbTPC; // min probability for e+/e- PID involving TPC
170 Float_t fCutMinElectronProbESD; // min probability for e+/e- PID not involving TPC
171 //
172 Float_t fCutMinP; // min P of V0
173 Float_t fCutMinRGamma; // min transv. distance from ESDVertex to V0 for gammas
174 Float_t fCutMinRK0; // min transv. distance from ESDVertex to V0 for K0s
175 Float_t fCutMinPointAngle; // min pointing angle cosine
176 Float_t fCutMaxDCADauther; // max DCA of daughters at V0
177 Float_t fCutMassGamma; // max gamma mass
178 Float_t fCutMassGammaNSigma; // max standard deviations from 0 for gamma
179 Float_t fCutMassK0; // max K0 mass difference from PGD value
180 Float_t fCutMassK0NSigma; // max standard deviations for K0 mass from PDG value
181 Float_t fCutChi2cGamma; // max constrained chi2 cut for gammas
182 Float_t fCutChi2cK0; // max constrained chi2 cut for K0s
183 Float_t fCutGammaSFromDecay; // min path*P for gammas
184 Float_t fCutK0SFromDecay; // min path*P for K0s
185 Float_t fCutMaxDCA; // max DCA for V0 at ESD vertex
186
9b373e9a 187 Bool_t fHistOn; // Option to define and fill the histograms
ddced3c8 188
9b373e9a 189 TH1F* fhClustersDPhiAcc; // Phi2 - Phi1 for tracklets
190 TH1F* fhClustersDThetaAcc; // Theta2 - Theta1 for tracklets
9b373e9a 191 TH1F* fhClustersDPhiAll; // Phi2 - Phi1 all the combinations
192 TH1F* fhClustersDThetaAll; // Theta2 - Theta1 all the combinations
3ef75756 193
9b373e9a 194 TH2F* fhDPhiVsDThetaAll; // 2D plot for all the combinations
195 TH2F* fhDPhiVsDThetaAcc; // same plot for tracklets
9b373e9a 196
197 TH1F* fhetaTracklets; // Pseudorapidity distr. for tracklets
198 TH1F* fhphiTracklets; // Azimuthal (Phi) distr. for tracklets
199 TH1F* fhetaClustersLay1; // Pseudorapidity distr. for Clusters L. 1
200 TH1F* fhphiClustersLay1; // Azimuthal (Phi) distr. for Clusters L. 1
201
ac903f1b 202
203 void LoadClusterArrays(TTree* tree);
204
7c6da836 205 ClassDef(AliITSMultReconstructor,9)
ac903f1b 206};
207
208#endif