]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnDaughter.h
dd5eb738c3e58aca97ee4903d80a00fc5b06b4d7
[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 <TLorentzVector.h>
20
21 #include "AliESDtrack.h"
22 #include "AliAODTrack.h"
23 #include "AliESDv0.h"
24 #include "AliAODv0.h"
25 #include "AliMCParticle.h"
26
27 typedef AliPID::EParticleType EPARTYPE;
28
29 class AliStack;
30 class AliVEvent;
31 class AliMCEvent;
32 class AliRsnPIDDefESD;
33
34 class AliRsnDaughter : public TObject
35 {
36   public:
37     
38     enum ERefType
39     {
40       kTrack = 0,
41       kV0,
42       kNoType
43     };
44
45     AliRsnDaughter();
46     AliRsnDaughter(const AliRsnDaughter &copy);
47     virtual ~AliRsnDaughter();
48     AliRsnDaughter& operator= (const AliRsnDaughter& copy);
49     
50     // utilities
51     void    Reset();
52     void    Print(Option_t* const option = "") const;
53     
54     // flags and labels
55     Int_t   GetID() const;
56     Int_t   GetLabel() const {return fLabel;}
57     Bool_t  HasFlag(ULong_t flag) const;
58     Bool_t  IsOK() const {return fOK;}
59     void    SetBad() {fOK = kFALSE;}
60     void    SetGood() {fOK = kTRUE;}
61     void    SetLabel(Int_t label) {fLabel = label;}
62
63     // 4-momentum
64     TLorentzVector& P(Bool_t mc = kFALSE) {return (mc ? fPMC : fP);}
65     Bool_t          SetMass(Double_t mass);
66     
67     // charge
68     Bool_t  IsPos()             const {return (fRef->Charge() > 0);}
69     Bool_t  IsNeg()             const {return (fRef->Charge() < 0);}
70     Bool_t  IsNeutral()         const {return (!IsPos() && !IsNeg());}
71     Bool_t  IsSign(Char_t sign) const {if (sign=='+') return IsPos(); else if (sign=='-') return IsNeg(); else return IsNeutral();}
72     Short_t Charge()            const {if (IsPos()) return  1 ; else if (IsNeg()) return -1 ; else return  0 ;}
73     Char_t  ChargeChar()        const {if (IsPos()) return '+'; else if (IsNeg()) return '-'; else return '0';}
74
75     // MC info & references
76     AliVParticle*  GetRef()         const {return fRef;}
77     AliESDtrack*   GetRefESDtrack() const {return dynamic_cast<AliESDtrack*>(fRef);}
78     AliAODTrack*   GetRefAODtrack() const {return dynamic_cast<AliAODTrack*>(fRef);}
79     AliESDv0*      GetRefESDv0()    const {return dynamic_cast<AliESDv0*>(fRef);}
80     AliAODv0*      GetRefAODv0()    const {return dynamic_cast<AliAODv0*>(fRef);}
81     AliMCParticle* GetRefMC()       const {return fRefMC;}
82     TParticle*     GetParticle()    const {if (fRefMC) return fRefMC->Particle(); else return 0x0;}
83     Int_t          GetMotherPDG()   const {return fMotherPDG;}
84     Bool_t         IsAOD()          const {if (GetRefAODtrack() || GetRefAODv0()) return kTRUE; return kFALSE;}
85     Bool_t         IsESD()          const {if (GetRefESDtrack() || GetRefESDv0()) return kTRUE; return kFALSE;}
86     Bool_t         IsTrack()        const {if (GetRefESDtrack() || GetRefAODtrack()) return kTRUE; return kFALSE;}
87     Bool_t         IsV0()           const {if (GetRefESDv0() || GetRefAODv0()) return kTRUE; return kFALSE;}
88     ERefType       RefType()        const {if (IsTrack()) return kTrack; if (IsV0()) return kV0; return kNoType;}
89     void           SetRef(AliVParticle *ref) {fRef = ref;}
90     void           SetRefMC(AliMCParticle *refMC) {fRefMC = refMC;}
91     void           SetMotherPDG(Int_t value) {fMotherPDG = value;}
92
93   private:
94
95     Bool_t         fOK;                // internal utility flag which is kFALSE when this object should not be used
96     Int_t          fLabel;             // GEANT label of corresponding MC (not trivial for V0s)
97     Int_t          fMotherPDG;         // PDG code of mother (makes sense only if fRefMC is defined)
98     
99     TLorentzVector fP;                 // 4-vector filled with track info from default ref (if present)
100     TLorentzVector fPMC;               // 4-vector filled with track info from MC ref (if present)
101     
102     AliVParticle  *fRef;               // reference to track in ESD/AOD/MC (all info are taken from this object)
103     AliMCParticle *fRefMC;             // reference to corresponding MC particle
104
105     ClassDef(AliRsnDaughter, 8)
106 };
107
108 #endif