]>
Commit | Line | Data |
---|---|---|
e2bafbbc | 1 | // |
7356f978 | 2 | // This class works as generic interface to each candidate resonance daughter. |
3 | // Its main purpose is to provide a unique reference which includes all the | |
4 | // facilities available in the AliVParticle generic base class, plus all info | |
5 | // which could be needed during analysis, which are not in AliVParticle but | |
6 | // need to be accessed from ESD or AOD objects, usually in different ways. | |
7 | // When MC is available, AliRsnDaughter matches each reconstructed object with | |
8 | // its corresponding MC particle. | |
61f275d1 | 9 | // |
7356f978 | 10 | // Currently, this interface can point to all kinds of single-particle object |
61f275d1 | 11 | // which one can have in the reconstructed event: charged tracks, V0s and |
7356f978 | 12 | // cascades. It is care of the user to treat each of them in the correct way, |
13 | // regarding cuts, functions to be computed, etc. | |
06351446 | 14 | // |
7356f978 | 15 | // authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it) |
16 | // M. Vala (martin.vala@cern.ch) | |
e2bafbbc | 17 | // |
7c2974c8 | 18 | |
a62a2d82 | 19 | #include <TParticle.h> |
7356f978 | 20 | #include <TDatabasePDG.h> |
5f1c287d | 21 | |
a62a2d82 | 22 | #include "AliRsnDaughter.h" |
23 | ||
24 | ClassImp(AliRsnDaughter) | |
25 | ||
7c2974c8 | 26 | //_____________________________________________________________________________ |
27 | AliRsnDaughter::AliRsnDaughter(const AliRsnDaughter ©) : | |
2a1c7696 | 28 | TObject(copy), |
29 | fOK(copy.fOK), | |
30 | fLabel(copy.fLabel), | |
31 | fMotherPDG(copy.fMotherPDG), | |
5f1c287d | 32 | fRsnID(copy.fRsnID), |
2a1c7696 | 33 | fPrec(copy.fPrec), |
34 | fPsim(copy.fPsim), | |
35 | fRef(copy.fRef), | |
d7712d44 | 36 | fRefMC(copy.fRefMC), |
37 | fOwnerEvent(copy.fOwnerEvent) | |
7c2974c8 | 38 | { |
06351446 | 39 | // |
7c2974c8 | 40 | // Copy constructor. |
2dab9030 | 41 | // Pointers are NOT duplicated, since they don't come from a 'new' |
42 | // statement, but from just referencing something in the data source. | |
06351446 | 43 | // |
7c2974c8 | 44 | } |
45 | ||
7c2974c8 | 46 | //_____________________________________________________________________________ |
61f275d1 | 47 | AliRsnDaughter &AliRsnDaughter::operator=(const AliRsnDaughter ©) |
7c2974c8 | 48 | { |
06351446 | 49 | // |
7c2974c8 | 50 | // Assignment operator. |
2dab9030 | 51 | // Pointers are NOT duplicated, since they don't come from a 'new' |
52 | // statement, but from just referencing something in the data source. | |
06351446 | 53 | // |
61f275d1 | 54 | if (this == ©) |
55 | return *this; | |
06351446 | 56 | |
d7712d44 | 57 | fOK = copy.fOK; |
58 | fLabel = copy.fLabel; | |
59 | fMotherPDG = copy.fMotherPDG; | |
60 | fRsnID = copy.fRsnID; | |
d7712d44 | 61 | fPsim = copy.fPsim; |
f34f960b | 62 | fPrec = copy.fPrec; |
d7712d44 | 63 | fRef = copy.fRef; |
64 | fRefMC = copy.fRefMC; | |
65 | fOwnerEvent = copy.fOwnerEvent; | |
aec0ec32 | 66 | |
2a1c7696 | 67 | return (*this); |
7c2974c8 | 68 | } |
69 | ||
5eb970a4 | 70 | //_____________________________________________________________________________ |
71 | void AliRsnDaughter::Reset() | |
72 | { | |
73 | // | |
2dab9030 | 74 | // Reset this track to meaningless values and to a 'bad' status. |
75 | // After this has been done, this object should not be used | |
76 | // for analysis unless initialized properly. | |
5eb970a4 | 77 | // |
78 | ||
2a1c7696 | 79 | fOK = kFALSE; |
80 | fLabel = -1; | |
5f1c287d | 81 | fMotherPDG = 0; |
82 | fRsnID = -1; | |
61f275d1 | 83 | |
f34f960b | 84 | fPsim.SetXYZT(0.0, 0.0, 0.0, 0.0); |
85 | fPrec.SetXYZT(0.0, 0.0, 0.0, 0.0); | |
2a1c7696 | 86 | |
f34f960b | 87 | fRef = fRefMC = 0x0; |
88 | fOwnerEvent = 0x0; | |
e2bafbbc | 89 | } |
90 | ||
7c2974c8 | 91 | //_____________________________________________________________________________ |
f34f960b | 92 | Int_t AliRsnDaughter::GetPDG() |
4c2fda1e | 93 | { |
06351446 | 94 | // |
a378358c | 95 | // Return the PDG code of the particle from MC ref (if any). |
96 | // If argument is kTRUE, returns its absolute value. | |
06351446 | 97 | // |
7c2974c8 | 98 | |
f34f960b | 99 | if (Match(fRefMC, AliMCParticle::Class())) |
61f275d1 | 100 | return ((AliMCParticle *)fRefMC)->Particle()->GetPdgCode(); |
f34f960b | 101 | else if (Match(fRefMC, AliAODMCParticle::Class())) |
61f275d1 | 102 | return ((AliAODMCParticle *)fRefMC)->GetPdgCode(); |
f34f960b | 103 | else { |
104 | AliWarning("Cannot retrieve PDG"); | |
105 | return 0; | |
106 | } | |
ec927a7d | 107 | } |
108 | ||
7c2974c8 | 109 | //_____________________________________________________________________________ |
a378358c | 110 | Int_t AliRsnDaughter::GetID() |
4fbb2459 | 111 | { |
06351446 | 112 | // |
2dab9030 | 113 | // Return reference index, using the "GetID" method |
114 | // of the possible source object. | |
5f1c287d | 115 | // When this method is unsuccessful (e.g.: V0s), return the label. |
06351446 | 116 | // |
4fbb2459 | 117 | |
2a1c7696 | 118 | // ESD tracks |
f34f960b | 119 | AliESDtrack *esd = Ref2ESDtrack(); |
2a1c7696 | 120 | if (esd) return esd->GetID(); |
5eb970a4 | 121 | |
2a1c7696 | 122 | // AOD tracks |
f34f960b | 123 | AliAODTrack *aod = Ref2AODtrack(); |
2a1c7696 | 124 | if (aod) return aod->GetID(); |
2dab9030 | 125 | |
2a1c7696 | 126 | // whatever else |
127 | return GetLabel(); | |
e2bafbbc | 128 | } |
4fbb2459 | 129 | |
32992791 | 130 | //_____________________________________________________________________________ |
f34f960b | 131 | Int_t AliRsnDaughter::GetMother() |
32992791 | 132 | { |
133 | // | |
f34f960b | 134 | // Return index of the first mother of the MC reference, if any. |
135 | // Otherwise, returns -1 (the same as for primary tracks) | |
32992791 | 136 | // |
137 | ||
f34f960b | 138 | if (!fRefMC) return -1; |
2a1c7696 | 139 | |
f34f960b | 140 | if (fRefMC->InheritsFrom(AliMCParticle::Class())) { |
61f275d1 | 141 | AliMCParticle *mc = (AliMCParticle *)fRefMC; |
f34f960b | 142 | return mc->Particle()->GetFirstMother(); |
143 | } else if (fRefMC->InheritsFrom(AliAODMCParticle::Class())) { | |
61f275d1 | 144 | AliAODMCParticle *mc = (AliAODMCParticle *)fRefMC; |
f34f960b | 145 | return mc->GetMother(); |
7356f978 | 146 | } |
f34f960b | 147 | else |
148 | return -1; | |
7356f978 | 149 | } |
61f275d1 | 150 | |
151 | ||
7356f978 | 152 | |
d7712d44 | 153 | //______________________________________________________________________________ |
110620ce | 154 | void AliRsnDaughter::Print(Option_t *) const |
d7712d44 | 155 | { |
156 | // | |
157 | // Override of TObject::Print() | |
158 | // | |
159 | ||
160 | AliInfo("=== DAUGHTER INFO ======================================================================"); | |
f34f960b | 161 | AliInfo(Form(" (sim) px,py,pz = %6.2f %6.2f %6.2f", fPsim.X(), fPsim.Y(), fPsim.Z())); |
162 | AliInfo(Form(" (rec) px,py,pz = %6.2f %6.2f %6.2f", fPrec.X(), fPrec.Y(), fPrec.Z())); | |
d7712d44 | 163 | AliInfo(Form(" OK, RsnID, Label, MotherPDG = %s, %5d, %5d, %4d", (fOK ? "true " : "false"), fRsnID, fLabel, fMotherPDG)); |
164 | AliInfo("========================================================================================"); | |
165 | } | |
166 | ||
7356f978 | 167 | //______________________________________________________________________________ |
61f275d1 | 168 | const char *AliRsnDaughter::SpeciesName(ESpecies species) |
7356f978 | 169 | { |
170 | // | |
171 | // Return a string with the short name of the particle | |
172 | // | |
173 | ||
174 | switch (species) { | |
175 | case kElectron: return "E"; | |
176 | case kMuon: return "Mu"; | |
177 | case kPion: return "Pi"; | |
178 | case kKaon: return "K"; | |
179 | case kProton: return "P"; | |
180 | case kKaon0: return "K0s"; | |
181 | case kLambda: return "Lambda"; | |
182 | case kXi: return "Xi"; | |
183 | case kOmega: return "Omega"; | |
184 | default: return "Undef"; | |
185 | } | |
186 | } | |
187 | ||
188 | //______________________________________________________________________________ | |
189 | Int_t AliRsnDaughter::SpeciesPDG(ESpecies species) | |
190 | { | |
191 | // | |
192 | // Return the PDG code of a particle species (abs value) | |
193 | // | |
194 | ||
195 | switch (species) { | |
196 | case kElectron: return 11; | |
197 | case kMuon: return 13; | |
198 | case kPion: return 211; | |
199 | case kKaon: return 321; | |
200 | case kProton: return 2212; | |
860b7705 | 201 | case kKaon0: return 311; |
7356f978 | 202 | case kLambda: return 3122; |
203 | case kXi: return 3312; | |
204 | case kOmega: return 3334; | |
205 | default: return 0; | |
206 | } | |
207 | } | |
208 | ||
209 | //______________________________________________________________________________ | |
210 | Double_t AliRsnDaughter::SpeciesMass(ESpecies species) | |
211 | { | |
212 | // | |
213 | // Return the mass of a particle species | |
214 | // | |
215 | ||
216 | TDatabasePDG *db = TDatabasePDG::Instance(); | |
217 | TParticlePDG *part = 0x0; | |
61f275d1 | 218 | |
7356f978 | 219 | Int_t pdg = SpeciesPDG(species); |
220 | if (pdg) { | |
221 | part = db->GetParticle(pdg); | |
222 | return part->Mass(); | |
223 | } | |
224 | else | |
225 | return 0.0; | |
226 | } | |
227 | ||
228 | //______________________________________________________________________________ | |
229 | EPARTYPE AliRsnDaughter::ToAliPID(ESpecies species) | |
230 | { | |
231 | // | |
232 | // Convert an enum element from this object | |
233 | // into the enumeration of AliPID. | |
234 | // If no match are cound 'kUnknown' is returned. | |
235 | // | |
236 | ||
237 | switch (species) { | |
238 | case kElectron: return AliPID::kElectron; | |
239 | case kMuon: return AliPID::kMuon; | |
240 | case kPion: return AliPID::kPion; | |
241 | case kKaon: return AliPID::kKaon; | |
242 | case kProton: return AliPID::kProton; | |
243 | case kKaon0: return AliPID::kKaon0; | |
244 | default: return AliPID::kUnknown; | |
245 | } | |
246 | } | |
247 | ||
248 | //______________________________________________________________________________ | |
249 | AliRsnDaughter::ESpecies AliRsnDaughter::FromAliPID(EPARTYPE pid) | |
250 | { | |
251 | // | |
252 | // Convert an enum element from AliPID | |
253 | // into the enumeration of this object. | |
254 | // If no match are cound 'kUnknown' is returned. | |
255 | // | |
256 | ||
257 | switch (pid) { | |
258 | case AliPID::kElectron: return kElectron; | |
259 | case AliPID::kMuon: return kMuon; | |
260 | case AliPID::kPion: return kPion; | |
261 | case AliPID::kKaon: return kKaon; | |
262 | case AliPID::kProton: return kProton; | |
263 | case AliPID::kKaon0: return kKaon0; | |
264 | default: return kUnknown; | |
265 | } | |
266 | } |