]>
Commit | Line | Data |
---|---|---|
a62a2d82 | 1 | #ifndef ALIRSNDAUGHTER_H |
2 | #define ALIRSNDAUGHTER_H | |
3 | ||
7356f978 | 4 | // |
5 | // Interface to single daughter candidate. | |
6 | // | |
7356f978 | 7 | |
f34f960b | 8 | #include <TMath.h> |
2dab9030 | 9 | #include <TLorentzVector.h> |
7c2974c8 | 10 | |
7356f978 | 11 | #include "AliPID.h" |
5f1c287d | 12 | #include "AliVTrack.h" |
4fbb2459 | 13 | #include "AliESDtrack.h" |
2dab9030 | 14 | #include "AliESDv0.h" |
32992791 | 15 | #include "AliESDcascade.h" |
4fbb2459 | 16 | #include "AliMCParticle.h" |
a378358c | 17 | #include "AliAODTrack.h" |
18 | #include "AliAODv0.h" | |
32992791 | 19 | #include "AliAODcascade.h" |
ec927a7d | 20 | #include "AliAODMCParticle.h" |
a62a2d82 | 21 | |
d7712d44 | 22 | class AliRsnEvent; |
23 | ||
2dab9030 | 24 | typedef AliPID::EParticleType EPARTYPE; |
25 | ||
2a1c7696 | 26 | class AliRsnDaughter : public TObject { |
27 | public: | |
28 | ||
29 | enum ERefType { | |
d7712d44 | 30 | kTrack, |
2dab9030 | 31 | kV0, |
32992791 | 32 | kCascade, |
2dab9030 | 33 | kNoType |
2a1c7696 | 34 | }; |
7356f978 | 35 | |
36 | enum ESpecies { | |
37 | kElectron, | |
38 | kMuon, | |
39 | kPion, | |
40 | kKaon, | |
41 | kProton, | |
42 | kKaon0, | |
43 | kLambda, | |
44 | kXi, | |
45 | kOmega, | |
46 | kUnknown | |
47 | }; | |
2a1c7696 | 48 | |
f34f960b | 49 | AliRsnDaughter() : fOK(kFALSE), fLabel(-1), fMotherPDG(0), fRsnID(-1), |
50 | fPrec(), fPsim(), fRef(0x0), fRefMC(0x0), fOwnerEvent(0x0) { } | |
2a1c7696 | 51 | AliRsnDaughter(const AliRsnDaughter ©); |
52 | AliRsnDaughter& operator= (const AliRsnDaughter& copy); | |
5f1c287d | 53 | virtual ~AliRsnDaughter() { /*empty, since pointers must not be deleted*/ } |
2a1c7696 | 54 | |
f34f960b | 55 | // basic getters |
56 | Bool_t IsOK() const {return fOK;} | |
57 | Int_t GetLabel() const {return fLabel;} | |
58 | Int_t GetMotherPDG() const {return fMotherPDG;} | |
59 | Int_t GetRsnID() const {return fRsnID;} | |
60 | AliVParticle* GetRef() {return fRef;} | |
61 | AliVParticle* GetRefMC() {return fRefMC;} | |
62 | AliRsnEvent* GetOwnerEvent() {return fOwnerEvent;} | |
63 | TLorentzVector& P(Bool_t mc) {return (mc ? fPsim : fPrec);} | |
64 | TLorentzVector& Prec() {return fPrec;} | |
65 | TLorentzVector& Psim() {return fPsim;} | |
66 | Int_t GetPDG(); | |
67 | Int_t GetPDGAbs() {return TMath::Abs(GetPDG());} | |
68 | Int_t GetID(); | |
69 | Int_t GetMother(); | |
2a1c7696 | 70 | |
71 | // basic setters (for data members) | |
f34f960b | 72 | void Reset(); |
73 | void SetOK(Bool_t ok) {fOK = ok;} | |
74 | void SetBad() {fOK = kFALSE;} | |
75 | void SetGood() {fOK = kTRUE;} | |
76 | void SetLabel(Int_t label) {fLabel = label;} | |
77 | void SetMotherPDG(Int_t value) {fMotherPDG = value;} | |
78 | void SetRsnID(Int_t id) {fRsnID = id;} | |
79 | void SetRef(AliVParticle *p) {fRef = p;} | |
80 | void SetRefMC(AliVParticle *p) {fRefMC = p;} | |
81 | void SetOwnerEvent(AliRsnEvent *e) {fOwnerEvent = e;} | |
d7712d44 | 82 | |
f34f960b | 83 | // additional functions |
84 | void FillP(Double_t mass); | |
85 | void Print(Option_t *o = "") const; | |
86 | ||
87 | // getters related to charge | |
88 | Bool_t IsPos() const {if (fRef) return (fRef->Charge() > 0); return kFALSE;} | |
89 | Bool_t IsNeg() const {if (fRef) return (fRef->Charge() < 0); return kFALSE;} | |
90 | Bool_t IsCharged() const {if (fRef) return (IsPos() || IsNeg()); return kFALSE;} | |
91 | Bool_t IsNeutral() const {if (fRef) return (!IsCharged()); return kFALSE;} | |
92 | Short_t ChargeS() const {if (IsPos()) return 1 ; else if (IsNeg()) return -1 ; else return 0 ;} | |
93 | Char_t ChargeC() const {if (IsPos()) return '+'; else if (IsNeg()) return '-'; else return '0';} | |
94 | ||
95 | // getters which automatically convert refs into allowed types | |
96 | static Bool_t Match(AliVParticle *p, TClass *ref) {if (p) return (p->InheritsFrom(ref)); return kFALSE;} | |
97 | Bool_t MatchRef(TClass *ref) {return Match(fRef, ref);} | |
98 | Bool_t MatchRefMC(TClass *ref) {return Match(fRefMC, ref);} | |
d7712d44 | 99 | ERefType RefType(); |
100 | Bool_t IsESD(); | |
101 | Bool_t IsAOD(); | |
f34f960b | 102 | |
103 | AliVTrack* Ref2Vtrack() {if (Match(fRef, AliVTrack ::Class())) return static_cast<AliVTrack*> (fRef); return 0x0;} | |
104 | AliESDtrack* Ref2ESDtrack() {if (Match(fRef, AliESDtrack ::Class())) return static_cast<AliESDtrack*> (fRef); return 0x0;} | |
105 | AliAODTrack* Ref2AODtrack() {if (Match(fRef, AliAODTrack ::Class())) return static_cast<AliAODTrack*> (fRef); return 0x0;} | |
106 | AliMCParticle* Ref2MCparticle() {if (Match(fRef, AliMCParticle::Class())) return static_cast<AliMCParticle*> (fRef); return 0x0;} | |
107 | AliAODMCParticle* Ref2AODMCparticle() {if (Match(fRef, AliMCParticle::Class())) return static_cast<AliAODMCParticle*>(fRef); return 0x0;} | |
108 | ||
109 | AliESDv0* Ref2ESDv0() {if (Match(fRef, AliESDv0 ::Class())) return static_cast<AliESDv0*>(fRef); return 0x0;} | |
110 | AliAODv0* Ref2AODv0() {if (Match(fRef, AliAODv0 ::Class())) return static_cast<AliAODv0*>(fRef); return 0x0;} | |
111 | ||
112 | AliESDcascade* Ref2ESDcascade() {if (Match(fRef, AliESDcascade::Class())) return static_cast<AliESDcascade*>(fRef); return 0x0;} | |
113 | AliAODcascade* Ref2AODcascade() {if (Match(fRef, AliAODcascade::Class())) return static_cast<AliAODcascade*>(fRef); return 0x0;} | |
114 | ||
115 | AliMCParticle* RefMC2ESD() {if (Match(fRefMC, AliMCParticle ::Class())) return static_cast<AliMCParticle*> (fRef) ; return 0x0;} | |
116 | AliAODMCParticle* RefMC2AOD() {if (Match(fRefMC, AliAODMCParticle::Class())) return static_cast<AliAODMCParticle*>(fRefMC); return 0x0;} | |
7356f978 | 117 | |
f34f960b | 118 | // static functions related to internal ESpecies enum |
7356f978 | 119 | static ERefType RefType(ESpecies species); |
120 | static Bool_t IsCharged(ESpecies species) {return (species <= kProton);} | |
121 | static const char* SpeciesName(ESpecies species); | |
122 | static Int_t SpeciesPDG(ESpecies species); | |
123 | static Double_t SpeciesMass(ESpecies species); | |
124 | static EPARTYPE ToAliPID(ESpecies species); | |
125 | static ESpecies FromAliPID(EPARTYPE species); | |
2a1c7696 | 126 | |
127 | private: | |
128 | ||
129 | Bool_t fOK; // internal utility flag which is kFALSE when this object should not be used | |
f34f960b | 130 | Int_t fLabel; // index of MC particle |
2a1c7696 | 131 | Int_t fMotherPDG; // PDG code of mother (makes sense only if fRefMC is defined) |
7356f978 | 132 | Int_t fRsnID; // internal ID for monitoring purposes |
f34f960b | 133 | |
134 | TLorentzVector fPrec; // 4-momentum for rec | |
135 | TLorentzVector fPsim; // 4-momentum for MC | |
2a1c7696 | 136 | |
7356f978 | 137 | AliVParticle *fRef; // reference to reconstructed object |
2a1c7696 | 138 | AliVParticle *fRefMC; // reference to corresponding MC particle |
d7712d44 | 139 | AliRsnEvent *fOwnerEvent; // pointer to owner event |
2a1c7696 | 140 | |
f34f960b | 141 | ClassDef(AliRsnDaughter, 12) |
a62a2d82 | 142 | }; |
143 | ||
f34f960b | 144 | //__________________________________________________________________________________________________ |
d7712d44 | 145 | inline AliRsnDaughter::ERefType AliRsnDaughter::RefType() |
146 | { | |
147 | // | |
148 | // Returns the enum value corresponding to the real nature | |
149 | // of the object pointed by the fRef data member | |
150 | // | |
151 | ||
f34f960b | 152 | if (Match(fRef, AliESDtrack ::Class())) return kTrack; |
153 | if (Match(fRef, AliESDv0 ::Class())) return kV0; | |
154 | if (Match(fRef, AliESDcascade::Class())) return kCascade; | |
155 | if (Match(fRef, AliAODTrack ::Class())) return kTrack; | |
156 | if (Match(fRef, AliAODv0 ::Class())) return kV0; | |
157 | if (Match(fRef, AliAODcascade::Class())) return kCascade; | |
158 | if (Match(fRef, AliMCParticle::Class())) return kTrack; | |
d7712d44 | 159 | |
160 | return kNoType; | |
161 | } | |
162 | ||
f34f960b | 163 | //__________________________________________________________________________________________________ |
d7712d44 | 164 | inline Bool_t AliRsnDaughter::IsESD() |
165 | { | |
166 | // | |
167 | // Tells if the object pointed by fRef data member is ESD | |
f34f960b | 168 | // NOTE: it is true even when fRef is the MC corresponding |
169 | // object (= AliMCParticle) | |
d7712d44 | 170 | // |
171 | ||
f34f960b | 172 | if (Match(fRef, AliESDtrack ::Class())) return kTRUE; |
173 | if (Match(fRef, AliESDv0 ::Class())) return kTRUE; | |
174 | if (Match(fRef, AliESDcascade::Class())) return kTRUE; | |
175 | if (Match(fRef, AliMCParticle::Class())) return kTRUE; | |
d7712d44 | 176 | |
177 | return kFALSE; | |
178 | } | |
179 | ||
f34f960b | 180 | //__________________________________________________________________________________________________ |
d7712d44 | 181 | inline Bool_t AliRsnDaughter::IsAOD() |
182 | { | |
183 | // | |
184 | // Tells if the object pointed by fRef data member is AOD | |
f34f960b | 185 | // NOTE: it is true even when fRef is the MC corresponding |
186 | // object (= AliAODMCParticle) | |
d7712d44 | 187 | // |
188 | ||
f34f960b | 189 | if (Match(fRef, AliAODTrack ::Class())) return kTRUE; |
190 | if (Match(fRef, AliAODv0 ::Class())) return kTRUE; | |
191 | if (Match(fRef, AliAODcascade ::Class())) return kTRUE; | |
192 | if (Match(fRef, AliAODMCParticle::Class())) return kTRUE; | |
d7712d44 | 193 | |
194 | return kFALSE; | |
195 | } | |
125c0528 | 196 | |
f34f960b | 197 | //__________________________________________________________________________________________________ |
198 | inline AliRsnDaughter::ERefType AliRsnDaughter::RefType(ESpecies species) | |
199 | { | |
200 | // | |
201 | // Returns the expected object type for a candidate daughter | |
202 | // of the given species. | |
203 | // | |
204 | ||
205 | switch (species) { | |
206 | case kElectron: | |
207 | case kMuon: | |
208 | case kPion: | |
209 | case kKaon: | |
210 | case kProton: | |
211 | return kTrack; | |
212 | case kKaon0: | |
213 | case kLambda: | |
214 | return kV0; | |
215 | case kXi: | |
216 | case kOmega: | |
217 | return kCascade; | |
218 | default: | |
219 | return kNoType; | |
220 | } | |
221 | } | |
222 | ||
223 | //__________________________________________________________________________________________________ | |
224 | inline void AliRsnDaughter::FillP(Double_t mass) | |
225 | { | |
226 | // | |
227 | // Fills the 4-momentum data member using the values in the | |
228 | // AliVParticle pointer data members, choosing according to arguments | |
229 | // | |
230 | ||
231 | if (fRefMC) fPsim.SetXYZM(fRefMC->Px(), fRefMC->Py(), fRefMC->Pz(), mass); | |
232 | if (fRef) fPrec.SetXYZM(fRef ->Px(), fRef ->Py(), fRef ->Pz(), mass); | |
233 | } | |
125c0528 | 234 | |
a62a2d82 | 235 | #endif |