]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FLOW/Attic/AliFlowTrack.h
pass weight histograms via Task containors
[u/mrichter/AliRoot.git] / PWG2 / FLOW / Attic / AliFlowTrack.h
1 //////////////////////////////////////////////////////////////////////
2 //
3 // $Id: AliFlowTrack.h 18618 2007-05-16 15:38:22Z snelling $
4 //
5 // Author: Emanuele Simili
6 //
7 //////////////////////////////////////////////////////////////////////
8 //
9 // Description: track optimized for flow study, part of of AliFlowEvent. 
10 //                                                   Adapted from STAR 
11 // Original Authors:                 Raimond Snellings & Art Poskanzer
12 //
13 //////////////////////////////////////////////////////////////////////
14
15 #ifndef ALIFLOWTRACK_H
16 #define ALIFLOWTRACK_H
17
18 #include <string.h>
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <iostream>
22 #include "TMath.h"
23 #include "TNamed.h"
24 #include "TString.h"
25 #include "TVector.h"
26
27 #include "AliFlowConstants.h"
28
29 class AliFlowTrack : public TNamed {
30
31 public:
32
33                 AliFlowTrack();
34                 AliFlowTrack(const Char_t* name);
35   virtual       ~AliFlowTrack();
36
37  // Gets - Track variables
38   const Char_t* Pid()                const ;
39   Float_t       Mass()               const ;
40   Float_t       InvMass()            const ; 
41   Float_t       P()                  const ;
42   Float_t       Y()                  const ;
43   Float_t       PGlobal()            const ;
44   Float_t       YGlobal()            const ;
45   Bool_t        IsConstrainable()    const ;
46   Float_t       Dca()                const ;
47   Float_t       DcaError()           const ;
48   void          DcaError3(Float_t err[3]) const ;
49   Int_t         Charge()             const { return TMath::Sign(1,MostLikelihoodPID()) ; } 
50   Float_t       Phi()                const { if(IsConstrainable()) { return fPhi ; } else { return PhiGlobal() ; } }       
51   Float_t       Eta()                const { if(IsConstrainable()) { return fEta ; } else { return EtaGlobal() ; } }
52   Float_t       Pt()                 const { if(IsConstrainable()) { return fPt  ; } else { return PtGlobal()  ; } }
53   Float_t       PhiGlobal()          const { return fPhiGlobal ; }
54   Float_t       EtaGlobal()          const { return fEtaGlobal ; }
55   Float_t       PtGlobal()           const { return fPtGlobal ; }
56   Float_t       Chi2()               const { return fChi2 ; }  
57   Float_t       TrackLength()        const { return fTrackLength ; }
58   Float_t       ZFirstPoint()        const { return fZFirstPoint ; }
59   Float_t       ZLastPoint()         const { return fZLastPoint ; }
60   Int_t         Label()              const { return fLabel ; }
61   Float_t       TransDcaSigned()     const { return fDcaSigned[0] ; }
62   Float_t       TransDca()           const { return TMath::Abs(fDcaSigned[0]) ; }  
63   Float_t       ZedDca()             const { return TMath::Abs(fDcaSigned[1]) ; }  
64   Float_t       TransDcaError()      const { return TMath::Abs(fDcaError[0]) ; }
65   Float_t       ZedDcaError()        const { return TMath::Abs(fDcaError[1]) ; }
66
67  // Gets - P.id.
68   Float_t       MostLikelihoodRespFunc()       const; // detector Response Function for the most probable P.id. hypothesis
69   Float_t       PidProb(Int_t nPid)            const; // normalized probabilities or bayesian weights (using COMBINED response function & "a priori" AliFlowConstants::fgBayesian[])
70   void          PidProbs(Float_t *pidN)        const; // ... same for all the 6 hypothesis .
71   Float_t       PidProbC(Int_t nPid)           const; // normalized probabilities or bayesian weights (using CUSTOM response function & "a priori" AliFlowConstants::fgBayesian[])
72   void          PidProbsC(Float_t *pidN)       const; // ... same for all the 6 hypothesis . 
73   Float_t       ElectronPositronProb()         const { return PidProb(0) ; } 
74   Float_t       MuonPlusMinusProb()            const { return PidProb(1) ; }
75   Float_t       PionPlusMinusProb()            const { return PidProb(2) ; }
76   Float_t       KaonPlusMinusProb()            const { return PidProb(3) ; }
77   Float_t       ProtonPbarProb()               const { return PidProb(4) ; }
78   Float_t       DeuteriumAntiDeuteriumProb()   const { return PidProb(5) ; }
79   Int_t         MostLikelihoodPID()            const { return fMostLikelihoodPID ; }
80
81  // Gets - Detector response
82   Float_t       Chi2TPC()                      const { return fFitChi2[0] ; }
83   Float_t       Chi2ITS()                      const { return fFitChi2[1] ; }
84   Float_t       Chi2TRD()                      const { return fFitChi2[2] ; }
85   Float_t       Chi2TOF()                      const { return fFitChi2[3] ; }
86   Int_t         FitPtsTPC()                    const { return fFitPts[0]  ; }
87   Int_t         FitPtsITS()                    const { return fFitPts[1]  ; }
88   Int_t         NhitsTRD()                     const { return fFitPts[2]  ; }
89   Int_t         NhitsTOF()                     const { return fFitPts[3]  ; }
90   Int_t         MaxPtsTPC()                    const { return fMaxPts[0]  ; }
91   Int_t         MaxPtsITS()                    const { return fMaxPts[1]  ; }
92   Int_t         MaxPtsTRD()                    const { return fMaxPts[2]  ; }
93   Int_t         MaxPtsTOF()                    const { return fMaxPts[3]  ; }
94   Float_t       DedxTPC()                      const { return fDedx[0]    ; }
95   Float_t       DedxITS()                      const { return fDedx[1]    ; }
96   Float_t       SigTRD()                       const { return fDedx[2]    ; }
97   Float_t       TofTOF()                       const { return fDedx[3]    ; }
98   Float_t       PatTPC()                       const { return fMom[0] ; }
99   Float_t       PatITS()                       const { return fMom[1] ; }
100   Float_t       PatTRD()                       const { return fMom[2] ; }
101   Float_t       PatTOF()                       const { return fMom[3] ; }
102   void          GetRespFunTPC(Float_t *r)      const { GetRespFun(0,r) ; }
103   void          GetRespFunITS(Float_t *r)      const { GetRespFun(1,r) ; }
104   void          GetRespFunTRD(Float_t *r)      const { GetRespFun(2,r) ; }
105   void          GetRespFunTOF(Float_t *r)      const { GetRespFun(3,r) ; }
106
107   void          GetCombinedRespFun(Float_t *r) const ;
108   void          GetCustomRespFun(Float_t *r)   const ;
109
110  // Sets - Track variables
111   void SetPid(const Char_t* pid) ;
112   void SetPid(Int_t pdgCode = 211) ;
113   void SetCharge(Int_t charge)                    { fMostLikelihoodPID = TMath::Sign(TMath::Abs(fMostLikelihoodPID),charge) ; }
114   void SetPhi(Float_t phi)                        { fPhi = phi; }
115   void SetEta(Float_t eta)                        { fEta = eta; }
116   void SetPt(Float_t pt)                          { fPt = pt; }
117   void SetPhiGlobal(Float_t phi)                  { fPhiGlobal = phi; }
118   void SetEtaGlobal(Float_t eta)                  { fEtaGlobal = eta; }
119   void SetPtGlobal(Float_t pt)                    { fPtGlobal = pt; }
120   void SetDcaSigned(Float_t xy, Float_t z = 0.)   { fDcaSigned[0] = xy ; fDcaSigned[1] = z ; }
121   void SetChi2(Float_t chi2)                      { fChi2 = chi2; }
122   void SetTrackLength(Float_t tl)                 { fTrackLength = tl; }
123   void SetZFirstPoint(Float_t zFirst)             { fZFirstPoint = zFirst; }
124   void SetZLastPoint(Float_t zLast)               { fZLastPoint = zLast; }
125   void SetLabel(Int_t label)                      { fLabel = label ; }
126   void SetDcaError(Float_t xye, Float_t ze, Float_t xyze = 0.) { fDcaError[0] = xye ; fDcaError[1] = ze ; fDcaError[2] = xyze ; }
127
128  // Sets - P.id.
129   void SetMostLikelihoodPID(Int_t val)            { fMostLikelihoodPID = val ; }
130   void SetElectronPositronProb(Float_t val)       { fCombRespFun[0] = TMath::Abs(val) ; } 
131   void SetMuonPlusMinusProb(Float_t val)          { fCombRespFun[1] = TMath::Abs(val) ; } 
132   void SetPionPlusMinusProb(Float_t val)          { fCombRespFun[2] = TMath::Abs(val) ; } 
133   void SetKaonPlusMinusProb(Float_t val)          { fCombRespFun[3] = TMath::Abs(val) ; } 
134   void SetProtonPbarProb(Float_t val)             { fCombRespFun[4] = TMath::Abs(val) ; } 
135   void SetDeuteriumAntiDeuteriumProb(Float_t val) { fCombRespFun[5] = TMath::Abs(val) ; }
136
137  // Sets - Detector response
138   void SetChi2TPC(Float_t chi2)                   { fFitChi2[0] = chi2   ; }
139   void SetChi2ITS(Float_t chi2)                   { fFitChi2[1] = chi2   ; }
140   void SetChi2TRD(Float_t chi2)                   { fFitChi2[2] = chi2   ; }
141   void SetChi2TOF(Float_t chi2)                   { fFitChi2[3] = chi2   ; }
142   void SetFitPtsTPC(Int_t fitPts)                 { fFitPts[0]  = fitPts ; }
143   void SetFitPtsITS(Int_t nhits)                  { fFitPts[1]  = nhits  ; }
144   void SetNhitsTRD(Int_t fitPts)                  { fFitPts[2]  = fitPts ; }
145   void SetNhitsTOF(Int_t hits)                    { fFitPts[3]  = hits   ; }
146   void SetMaxPtsTPC(Int_t maxPts)                 { fMaxPts[0]  = maxPts ; }
147   void SetMaxPtsITS(Int_t maxPts)                 { fMaxPts[1]  = maxPts ; }
148   void SetMaxPtsTRD(Int_t maxPts)                 { fMaxPts[2]  = maxPts ; }
149   void SetMaxPtsTOF(Int_t maxPts)                 { fMaxPts[3]  = maxPts ; }
150   void SetDedxTPC(Float_t dedx)                   { fDedx[0]    = dedx   ; }
151   void SetDedxITS(Float_t dedx)                   { fDedx[1]    = dedx   ; }
152   void SetSigTRD(Float_t trd)                     { fDedx[2]    = trd    ; }
153   void SetTofTOF(Float_t tof)                     { fDedx[3]    = tof    ; }
154   void SetPatTPC(Float_t p)                       { fMom[0] = p ; }
155   void SetPatITS(Float_t p)                       { fMom[1] = p ; }
156   void SetPatTRD(Float_t p)                       { fMom[2] = p ; }
157   void SetPatTOF(Float_t p)                       { fMom[3] = p ; }
158   void SetRespFunTPC(Float_t *r)                  { SetRespFun(0,r) ; }
159   void SetRespFunITS(Float_t *r)                  { SetRespFun(1,r) ; }
160   void SetRespFunTRD(Float_t *r)                  { SetRespFun(2,r) ; }
161   void SetRespFunTOF(Float_t *r)                  { SetRespFun(3,r) ; }
162
163  // Selection methods
164   void   SetSelect(Int_t harmonic, Int_t selection)                   { fSelection[harmonic][selection] = kTRUE ; }
165   void   SetSubevent(Int_t harmonic, Int_t selection, Int_t subevent) { fSubevent[harmonic][selection] = subevent ; }
166   void   ResetSelection() ;
167   void   PrintSelection() const ;
168   Bool_t Select(Int_t harmonic, Int_t selection, Int_t subevent= -1) const ;
169
170  // TRICKY
171   void SetConstrainable();
172   void SetUnConstrainable();
173
174
175 private:
176
177  // to make the code checker happy
178   AliFlowTrack &operator=(const AliFlowTrack &flowTrack) ; // Assignment Operator (dummy)
179
180  // Used internally to set/get the detector response functions (for single detectors)
181   void     SetRespFun(Int_t det, Float_t *r) ;
182   void     GetRespFun(Int_t det, Float_t *r) const ;
183
184  // Data Members
185   Float_t  fPhi;                                 // azimuthal angle of the constrained track
186   Float_t  fEta;                                 // pseudorapidity of the constrained track
187   Float_t  fPt;                                  // transverse momentum of the constrained track 
188   Float_t  fZFirstPoint;                         // Z position at beginning of TPC
189   Float_t  fZLastPoint;                          // Z position at end of PHOS
190   Float_t  fChi2 ;                               // constrained chi2
191   Float_t  fTrackLength;                         // lenght of the track
192   Int_t    fMostLikelihoodPID;                   // PDG code of the most probable P.Id.
193   Double_t fDcaSigned[2] ;                       // positive or negative tracks -> P changes differently including vertex
194   Double_t fDcaError[3] ;                        // error over the DCA
195   Float_t  fPhiGlobal;                           // azimuthal angle of the unconstrained track
196   Float_t  fEtaGlobal;                           // pseudorapidity of the unconstrained track
197   Float_t  fPtGlobal;                            // transverse momentum of the unconstrained track 
198   Int_t    fLabel ;                              // Label of the track (link: KineTree-ESD) 
199  // -
200   Float_t  fCombRespFun[AliFlowConstants::kPid]; // Array of probabilities to be (e,mu,pi,k,p,d)
201   Int_t    fFitPts[4] ;                          // Fit Points (in: TPC,ITS,TRD,TOF)
202   Int_t    fMaxPts[4] ;                          // Foundable Clusters (in: TPC,ITS,TRD,TOF)
203   Float_t  fFitChi2[4] ;                         // Chi2 (in: TPC,ITS,TRD,TOF)
204   Float_t  fDedx[4] ;                            // dE/dx from TPC and ITS , TRD signal , time of flight (TOF)
205   Float_t  fMom[4] ;                             // Track momentum at the entrance of TPC,ITS,TRD,TOF
206   Float_t  fRespFun[4][AliFlowConstants::kPid];  // Detector response function (single detectors)
207
208  // Selection's array for R.P. & sub-event selection (not stored)  
209   Bool_t   fSelection[AliFlowConstants::kHars][AliFlowConstants::kSels]; //! 
210   Short_t  fSubevent[AliFlowConstants::kHars][AliFlowConstants::kSels];  //! 
211
212   ClassDef(AliFlowTrack,5) ;                     // macro for rootcint
213 };
214
215 #endif
216 //////////////////////////////////////////////////////////////////////