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