]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnDaughter.h
Made a general review to fix as possible most coding conventions violations.
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnDaughter.h
1 //
2 // Class AliRsnDaughter
3 //
4 // Interface to candidate daughters of a resonance (tracks).
5 // Points to the source of information, which is generally an AliVParticle-derived object
6 // and contains few internal data-members to store "on fly" some important information
7 // for the computations required during resonance analysis.
8 // ---
9 // Since the package revision, this object is not supposed to be stacked in memory
10 // but created "on fly" during analysis and used just for computations, as an interface.
11 //
12 // authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
13 //          M. Vala (martin.vala@cern.ch)
14 //
15
16 #ifndef ALIRSNDAUGHTER_H
17 #define ALIRSNDAUGHTER_H
18
19 #include <TMath.h>
20
21 #include "AliPID.h"
22 #include "AliVParticle.h"
23 #include "AliESDtrack.h"
24 #include "AliAODTrack.h"
25 #include "AliMCParticle.h"
26
27 class TParticle;
28 class AliStack;
29 class AliMCParticle;
30 // class AliESDtrack;
31 // class AliESDtrack;
32 // class AliAODTrack;
33 class AliAODEvent;
34 class AliRsnPIDDefESD;
35
36 class AliRsnDaughter : public TObject
37 {
38   public:
39
40     enum EPIDMethod {
41       kNoPID = 0,
42       kRealistic,
43       kPerfect,
44       kMethods
45     };
46
47     AliRsnDaughter(AliVParticle *ref = 0, TParticle *refMC = 0);
48     AliRsnDaughter(const AliRsnDaughter &copy);
49     virtual ~AliRsnDaughter();
50     AliRsnDaughter& operator= (const AliRsnDaughter& copy);
51
52     // momentum
53     Double_t Px() const {return fRef->Px();}
54     Double_t Py() const {return fRef->Py();}
55     Double_t Pz() const {return fRef->Pz();}
56     Double_t Pt() const {return fRef->Pt();}
57     Double_t P2() const {return Pt()*Pt() + Pz()*Pz();}
58     Double_t P()  const {return TMath::Sqrt(P2());}
59     Double_t Eta() const {return fRef->Eta();}
60     Double_t Y() const {return fRef->Y();}
61     Double_t Y(Double_t mass) const {return 0.5*TMath::Log((E(mass) + Pz()) / (E(mass) - Pz()));}
62     Double_t E() const {return fRef->E();}
63     Double_t E(Double_t mass) const {return TMath::Sqrt(mass*mass + P2());}
64     Double_t Phi() const {return fRef->Phi();}
65     Double_t Theta() const {return fRef->Theta();}
66     Double_t PhiDeg() const {return TMath::RadToDeg() * Phi();}
67     Double_t ThetaDeg() const {return TMath::RadToDeg() * Theta();}
68     void     RotateP(Double_t angle, Double_t &x, Double_t &y, Bool_t isDegrees = kTRUE);
69     Double_t AngleTo(AliRsnDaughter d, Bool_t outInDegrees = kTRUE);
70
71     // DCA vertex
72     Double_t Xv() const {return fRef->Xv();}
73     Double_t Yv() const {return fRef->Yv();}
74     Double_t Zv() const {return fRef->Zv();}
75     Double_t Dr() const {return fDr;}
76     Double_t Dz() const {return fDz;}
77     void     SetDr(Double_t value) {fDr = value;}
78     void     SetDz(Double_t value) {fDz = value;}
79
80     // PID
81     const Double_t        *PID() const {return fRef->PID();}
82     const Double_t        *ComputedWeights() const {return fPID;}
83     Bool_t                 CombineWithPriors(const Double_t* priors, AliRsnPIDDefESD* pidDef = 0x0);
84     AliPID::EParticleType  RealisticPID() const;
85     AliPID::EParticleType  PerfectPID() const;
86     Bool_t                 IsPerfectPID(const AliPID::EParticleType type) const  {return (PerfectPID() == type);}
87     Bool_t                 IsRealisticPID(const AliPID::EParticleType type) const  {return (RealisticPID() == type);}
88     Double_t               PIDProb(AliPID::EParticleType type) const {return PID()[(Int_t)type];}
89     AliPID::EParticleType  PIDType(Double_t &prob) const;
90     AliPID::EParticleType  AssignedPID() const;
91     AliPID::EParticleType  RequiredPID() const {return fReqPID;}
92     void                   SetRequiredPID(AliPID::EParticleType type) {fReqPID = type;}
93
94     // integer parameters
95     Bool_t  IsPos() const {return (fRef->Charge() > 0);}
96     Bool_t  IsNeg() const {return (fRef->Charge() < 0);}
97     Bool_t  IsNeutral() const {return (!IsPos() && !IsNeg());}
98     Bool_t  IsSign(Char_t sign) { if (sign=='+') return IsPos(); else if (sign=='-') return IsNeg(); else return IsNeutral();}
99     Short_t Charge() const {if (IsPos()) return 1; else if (IsNeg()) return -1; else return 0;}
100     Char_t  ChargeC() const {if (IsPos()) return '+'; else if (IsNeg()) return '-'; else return '0';}
101     Int_t   GetLabel() const {return fRef->GetLabel();}
102     Int_t   GetID() const;
103     void    SetStatus(ULong_t value) {fStatus = value;}
104     ULong_t GetStatus() const {return fStatus;}
105     Bool_t  CheckFlag(ULong_t flag) const {return ((fStatus & flag) > 0);}
106     void    SetGood() {fOK = kTRUE;}
107     void    SetBad() {fOK = kFALSE;}
108     Bool_t  IsOK() const { return fOK; }
109
110     // Kinkness
111     Char_t  KinkIndex() const {return fKinkIndex;}
112     Bool_t  IsKinkMother() const {return (fKinkIndex < 0);}
113     Bool_t  IsKinkDaughter() const {return (fKinkIndex > 0);}
114     Bool_t  IsKink() const {return (IsKinkMother() || IsKinkDaughter());}
115     void    SetKink(Char_t kink) {fKinkIndex = kink;}
116     void    SetKinkMother() {fKinkIndex = -1;}
117     void    SetKinkDaughter() {fKinkIndex = 1;}
118     void    SetNoKink() {fKinkIndex = 0;}
119     void    FindKinkIndex(const AliESDtrack* track);
120     void    FindKinkIndex(AliAODEvent*const event);
121
122     // MC info & references
123     AliVParticle*  GetRef() const {return fRef;}
124     AliESDtrack*   GetRefESD() {return dynamic_cast<AliESDtrack*>(fRef);}
125     AliAODTrack*   GetRefAOD() {return dynamic_cast<AliAODTrack*>(fRef);}
126     AliMCParticle* GetRefMC()  {return dynamic_cast<AliMCParticle*>(fRef);}
127     TParticle*     GetParticle() const {return fParticle;}
128     Int_t          GetMotherPDG() const {return fMotherPDG;}
129     void           SetRef(AliVParticle * const ref) {fRef = ref;}
130     void           SetParticle(TParticle * const p) {fParticle = p;}
131     void           SetMotherPDG(Int_t value) {fMotherPDG = value;}
132     void           FindMotherPDG(AliStack *const stack);
133     Double_t       GetMCEnergy(Double_t mass);
134
135     // utilities
136     void          Reset();
137     void          Print(Option_t*const option = "ALL") const;
138
139     // static functions
140     static void                   SetPIDMethod(EPIDMethod method) {fgPIDMethod = method;}
141     static AliPID::EParticleType  InternalType(Int_t pdgCode);
142     static const char*            MethodName(EPIDMethod method);
143
144   private:
145
146     Bool_t         fOK;                     // status flag for usability
147     Int_t          fKinkIndex;              // indicator of kinkness of the track
148     TParticle     *fParticle;               // pointer to (eventual) MC information
149     Int_t          fMotherPDG;              // PDG code of mother (if any)
150     ULong_t        fStatus;                 // track status (if available)
151
152     Double_t       fDr;                     // transverse impact parameter
153     Double_t       fDz;                     // longitudinal impact parameter
154     Double_t       fPID[AliPID::kSPECIES];  // PID probabilities
155     AliPID::EParticleType fReqPID;          // PID assigned by pairdef
156
157     AliVParticle  *fRef;                    // reference to read object
158
159     static EPIDMethod fgPIDMethod;          // PID method used for analysis
160
161     ClassDef(AliRsnDaughter, 7)
162 };
163
164 #endif