]>
Commit | Line | Data |
---|---|---|
e2bafbbc | 1 | // |
06351446 | 2 | // Class AliRsnDaughter |
3 | // | |
5eb970a4 | 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. | |
2dab9030 | 8 | // It contains a useful TLorentzVector data-member which, provided that a meaningful mass was assigned, |
9 | // eases a lot the computation of invariant masses from summing up several of these objects. | |
06351446 | 10 | // |
e0baff8c | 11 | // authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it) |
12 | // M. Vala (martin.vala@cern.ch) | |
e2bafbbc | 13 | // |
7c2974c8 | 14 | |
a62a2d82 | 15 | #include <TParticle.h> |
a62a2d82 | 16 | |
5eb970a4 | 17 | #include "AliStack.h" |
2dab9030 | 18 | #include "AliMCEvent.h" |
19 | #include "AliESDEvent.h" | |
20 | #include "AliAODEvent.h" | |
a62a2d82 | 21 | #include "AliESDtrack.h" |
5eb970a4 | 22 | #include "AliAODEvent.h" |
23 | #include "AliAODVertex.h" | |
7c2974c8 | 24 | #include "AliAODTrack.h" |
7c2974c8 | 25 | |
a62a2d82 | 26 | #include "AliRsnDaughter.h" |
27 | ||
28 | ClassImp(AliRsnDaughter) | |
29 | ||
7c2974c8 | 30 | //_____________________________________________________________________________ |
2dab9030 | 31 | AliRsnDaughter::AliRsnDaughter() : |
32 | fOK(kFALSE), | |
33 | fLabel(-1), | |
34 | fMotherPDG(0), | |
35 | fP(0.0, 0.0, 0.0, 0.0), | |
36 | fPMC(0.0, 0.0, 0.0, 0.0), | |
37 | fRef(0x0), | |
38 | fRefMC(0x0) | |
2f769150 | 39 | { |
06351446 | 40 | // |
a62a2d82 | 41 | // Default constructor. |
06351446 | 42 | // |
7c2974c8 | 43 | } |
44 | ||
45 | //_____________________________________________________________________________ | |
46 | AliRsnDaughter::AliRsnDaughter(const AliRsnDaughter ©) : | |
2dab9030 | 47 | TObject(copy), |
48 | fOK(copy.fOK), | |
49 | fLabel(copy.fLabel), | |
50 | fMotherPDG(copy.fMotherPDG), | |
51 | fP(copy.fP), | |
52 | fPMC(copy.fPMC), | |
53 | fRef(copy.fRef), | |
54 | fRefMC(copy.fRefMC) | |
7c2974c8 | 55 | { |
06351446 | 56 | // |
7c2974c8 | 57 | // Copy constructor. |
2dab9030 | 58 | // Pointers are NOT duplicated, since they don't come from a 'new' |
59 | // statement, but from just referencing something in the data source. | |
06351446 | 60 | // |
7c2974c8 | 61 | } |
62 | ||
7c2974c8 | 63 | //_____________________________________________________________________________ |
64 | AliRsnDaughter& AliRsnDaughter::operator=(const AliRsnDaughter ©) | |
65 | { | |
06351446 | 66 | // |
7c2974c8 | 67 | // Assignment operator. |
2dab9030 | 68 | // Pointers are NOT duplicated, since they don't come from a 'new' |
69 | // statement, but from just referencing something in the data source. | |
06351446 | 70 | // |
71 | ||
2dab9030 | 72 | fOK = copy.fOK; |
73 | fLabel = copy.fLabel; | |
5eb970a4 | 74 | fMotherPDG = copy.fMotherPDG; |
2dab9030 | 75 | fP = copy.fP; |
76 | fPMC = copy.fPMC; | |
77 | fRef = copy.fRef; | |
78 | fRefMC = copy.fRefMC; | |
aec0ec32 | 79 | |
80 | return (*this); | |
7c2974c8 | 81 | } |
82 | ||
83 | //_____________________________________________________________________________ | |
84 | AliRsnDaughter::~AliRsnDaughter() | |
85 | { | |
06351446 | 86 | // |
5eb970a4 | 87 | // Destructor. |
2dab9030 | 88 | // Since pointers do not allocate new objects, no 'delete' is done. |
5eb970a4 | 89 | // |
5eb970a4 | 90 | } |
91 | ||
92 | //_____________________________________________________________________________ | |
93 | void AliRsnDaughter::Reset() | |
94 | { | |
95 | // | |
2dab9030 | 96 | // Reset this track to meaningless values and to a 'bad' status. |
97 | // After this has been done, this object should not be used | |
98 | // for analysis unless initialized properly. | |
5eb970a4 | 99 | // |
100 | ||
2dab9030 | 101 | fOK = kFALSE; |
102 | fLabel = -1; | |
5eb970a4 | 103 | fMotherPDG = 0; |
2dab9030 | 104 | fRef = 0x0; |
105 | fRefMC = 0x0; | |
106 | ||
107 | fP .SetXYZM(0.0, 0.0, 0.0, 0.0); | |
108 | fPMC.SetXYZM(0.0, 0.0, 0.0, 0.0); | |
e2bafbbc | 109 | } |
110 | ||
7c2974c8 | 111 | //_____________________________________________________________________________ |
2dab9030 | 112 | void AliRsnDaughter::Print(Option_t * const /*option*/) const |
4c2fda1e | 113 | { |
06351446 | 114 | // |
7c2974c8 | 115 | // Prints the values of data members, using the options: |
116 | // - P --> momentum | |
117 | // - V --> DCA vertex | |
118 | // - C --> electric charge | |
119 | // - F --> flags | |
120 | // - I --> identification (PID, probability and mass) | |
121 | // - W --> PID weights | |
e79f56bd | 122 | // - M --> Montecarlo |
e2bafbbc | 123 | // - L --> index & label |
0ef90328 | 124 | // - A --> angles |
7c2974c8 | 125 | // - ALL --> All oprions switched on |
4c2fda1e | 126 | // |
7c2974c8 | 127 | // Index and label are printed by default. |
06351446 | 128 | // |
2dab9030 | 129 | |
130 | Char_t type[50], source[50]; | |
96e9d35d | 131 | if (IsTrack()) snprintf(type, 5, "track"); |
132 | else if (IsV0()) snprintf(type, 2, "V0"); | |
133 | else snprintf(type, 4, "none"); | |
2dab9030 | 134 | |
96e9d35d | 135 | if (IsESD()) snprintf(source, 3, "ESD"); |
136 | else if (IsAOD()) snprintf(source, 3, "AOD"); | |
137 | else if (fRefMC != 0x0) snprintf(source, 7, "MC only"); | |
138 | else snprintf(source, 4, "none"); | |
2dab9030 | 139 | |
140 | AliInfo("===== ALIRSNDAUGHTER INFORMATION =============================================="); | |
141 | AliInfo(Form(".......Index : %d", GetID())); | |
142 | AliInfo(Form(".......Label : %d", GetLabel())); | |
143 | AliInfo(Form(".......Type, source : %s %s", type, source)); | |
144 | AliInfo(Form(".......Charge : %c", ChargeChar())); | |
145 | ||
146 | if (fRef) | |
147 | { | |
2467e7c3 | 148 | AliInfo(Form(".......Px, Py, Pz, Pt (ref) : %f %f %f %f", fP.X(), fP.Y(), fP.Z(), fP.Perp())); |
2dab9030 | 149 | } else AliInfo("....... absent REF"); |
150 | ||
151 | if (fRefMC) | |
152 | { | |
2467e7c3 | 153 | AliInfo(Form(".......Px, Py, Pz, Pt (ref MC): %f %f %f %f", fP.X(), fP.Y(), fP.Z(), fP.Perp())); |
ec927a7d | 154 | |
155 | AliInfo(Form(".......PDG code : %d", GetPDG())); | |
2dab9030 | 156 | } else AliInfo("....... absent REF MC"); |
157 | ||
158 | AliInfo("===== END ALIRSNDAUGHTER INFORMATION =========================================="); | |
4c2fda1e | 159 | } |
7c2974c8 | 160 | |
ec927a7d | 161 | //_____________________________________________________________________________ |
162 | Int_t AliRsnDaughter::GetPDG(Bool_t abs) const | |
163 | { | |
164 | // | |
165 | // Return the PDG code of the particle from MC ref (if any) | |
166 | // | |
167 | ||
168 | AliMCParticle *esdPart = GetRefMCESD(); | |
169 | AliAODMCParticle *aodPart = GetRefMCAOD(); | |
170 | ||
171 | Int_t pdg = 0; | |
172 | if (esdPart) pdg = esdPart->Particle()->GetPdgCode(); | |
173 | if (aodPart) pdg = aodPart->GetPdgCode(); | |
174 | ||
175 | if (abs) pdg = TMath::Abs(pdg); | |
176 | ||
177 | return pdg; | |
178 | } | |
179 | ||
7c2974c8 | 180 | //_____________________________________________________________________________ |
2dab9030 | 181 | Int_t AliRsnDaughter::GetID() const |
4fbb2459 | 182 | { |
06351446 | 183 | // |
2dab9030 | 184 | // Return reference index, using the "GetID" method |
185 | // of the possible source object. | |
186 | // In case of V0s, since this method is unsuccessful, return the label. | |
06351446 | 187 | // |
4fbb2459 | 188 | |
2dab9030 | 189 | const AliESDtrack *esd = GetRefESDtrack(); |
190 | if (esd) return esd->GetID(); | |
5eb970a4 | 191 | |
2dab9030 | 192 | const AliAODTrack *aod = GetRefAODtrack(); |
193 | if (aod) return aod->GetID(); | |
194 | ||
195 | return GetLabel(); | |
e2bafbbc | 196 | } |
4fbb2459 | 197 | |
198 | //_____________________________________________________________________________ | |
2dab9030 | 199 | Bool_t AliRsnDaughter::HasFlag(ULong_t flag) const |
4fbb2459 | 200 | { |
201 | // | |
2dab9030 | 202 | // Checks that the 'status' flag of the source object has one or |
203 | // a combination of status flags combined with the bitwise OR. | |
204 | // Works only with track-like objects. | |
4fbb2459 | 205 | // |
206 | ||
2dab9030 | 207 | if (IsTrack()) |
4fbb2459 | 208 | { |
2dab9030 | 209 | AliVTrack *track = dynamic_cast<AliVTrack*>(fRef); |
210 | ULong_t status = (ULong_t)track->GetStatus(); | |
211 | return ((status & flag) != 0); | |
4fbb2459 | 212 | } |
2dab9030 | 213 | |
214 | return kTRUE; | |
215 | } | |
216 | ||
217 | //_____________________________________________________________________________ | |
218 | Bool_t AliRsnDaughter::SetMass(Double_t mass) | |
219 | { | |
220 | // | |
221 | // The argument defines a mass to be assigned to the 4-momentum. | |
222 | // This value is not stored as a data-member, but serves just to modify | |
223 | // the energy of the 4-momentum both in the MC and non-MC objects, | |
224 | // while the vector momentum is taken from the respective references. | |
225 | // The method returns a BOOL outcome which is kFALSE in the case that | |
226 | // mass is meaningless or when both references are NULL or the goodness | |
227 | // flag is not positive. | |
228 | // | |
229 | ||
230 | if (!fOK) return kFALSE; | |
231 | if (mass < 0.) return kFALSE; | |
232 | if (!fRef && !fRefMC) return kFALSE; | |
233 | ||
234 | if (fRef) fP .SetXYZM(fRef ->Px(), fRef ->Py(), fRef ->Pz(), mass); | |
235 | if (fRefMC) fPMC.SetXYZM(fRefMC->Px(), fRefMC->Py(), fRefMC->Pz(), mass); | |
236 | ||
237 | return kTRUE; | |
4fbb2459 | 238 | } |