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