]>
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]; | |
131 | if (IsTrack()) sprintf(type, "track"); | |
132 | else if (IsV0()) sprintf(type, "V0"); | |
133 | else sprintf(type, "none"); | |
134 | ||
135 | if (IsESD()) sprintf(source, "ESD"); | |
136 | else if (IsAOD()) sprintf(source, "AOD"); | |
137 | else if (fRefMC != 0x0) sprintf(source, "MC only"); | |
138 | else sprintf(source, "none"); | |
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 | { | |
148 | AliInfo(Form(".......Px, Py, Pz, Pt (ref) : %d %d %d %d", fP.X(), fP.Y(), fP.Z(), fP.Perp())); | |
149 | } else AliInfo("....... absent REF"); | |
150 | ||
151 | if (fRefMC) | |
152 | { | |
153 | AliInfo(Form(".......Px, Py, Pz, Pt (ref MC): %d %d %d %d", fP.X(), fP.Y(), fP.Z(), fP.Perp())); | |
154 | AliInfo(Form(".......PDG code : %d", fRefMC->Particle()->GetPdgCode())); | |
155 | AliInfo(Form(".......Mother (label) : %d", fRefMC->Particle()->GetFirstMother())); | |
156 | AliInfo(Form(".......Mother (PDG code) : %d", fMotherPDG)); | |
157 | } else AliInfo("....... absent REF MC"); | |
158 | ||
159 | AliInfo("===== END ALIRSNDAUGHTER INFORMATION =========================================="); | |
4c2fda1e | 160 | } |
7c2974c8 | 161 | |
7c2974c8 | 162 | //_____________________________________________________________________________ |
2dab9030 | 163 | Int_t AliRsnDaughter::GetID() const |
4fbb2459 | 164 | { |
06351446 | 165 | // |
2dab9030 | 166 | // Return reference index, using the "GetID" method |
167 | // of the possible source object. | |
168 | // In case of V0s, since this method is unsuccessful, return the label. | |
06351446 | 169 | // |
4fbb2459 | 170 | |
2dab9030 | 171 | const AliESDtrack *esd = GetRefESDtrack(); |
172 | if (esd) return esd->GetID(); | |
5eb970a4 | 173 | |
2dab9030 | 174 | const AliAODTrack *aod = GetRefAODtrack(); |
175 | if (aod) return aod->GetID(); | |
176 | ||
177 | return GetLabel(); | |
e2bafbbc | 178 | } |
4fbb2459 | 179 | |
180 | //_____________________________________________________________________________ | |
2dab9030 | 181 | Bool_t AliRsnDaughter::HasFlag(ULong_t flag) const |
4fbb2459 | 182 | { |
183 | // | |
2dab9030 | 184 | // Checks that the 'status' flag of the source object has one or |
185 | // a combination of status flags combined with the bitwise OR. | |
186 | // Works only with track-like objects. | |
4fbb2459 | 187 | // |
188 | ||
2dab9030 | 189 | if (IsTrack()) |
4fbb2459 | 190 | { |
2dab9030 | 191 | AliVTrack *track = dynamic_cast<AliVTrack*>(fRef); |
192 | ULong_t status = (ULong_t)track->GetStatus(); | |
193 | return ((status & flag) != 0); | |
4fbb2459 | 194 | } |
2dab9030 | 195 | |
196 | return kTRUE; | |
197 | } | |
198 | ||
199 | //_____________________________________________________________________________ | |
200 | Bool_t AliRsnDaughter::SetMass(Double_t mass) | |
201 | { | |
202 | // | |
203 | // The argument defines a mass to be assigned to the 4-momentum. | |
204 | // This value is not stored as a data-member, but serves just to modify | |
205 | // the energy of the 4-momentum both in the MC and non-MC objects, | |
206 | // while the vector momentum is taken from the respective references. | |
207 | // The method returns a BOOL outcome which is kFALSE in the case that | |
208 | // mass is meaningless or when both references are NULL or the goodness | |
209 | // flag is not positive. | |
210 | // | |
211 | ||
212 | if (!fOK) return kFALSE; | |
213 | if (mass < 0.) return kFALSE; | |
214 | if (!fRef && !fRefMC) return kFALSE; | |
215 | ||
216 | if (fRef) fP .SetXYZM(fRef ->Px(), fRef ->Py(), fRef ->Pz(), mass); | |
217 | if (fRefMC) fPMC.SetXYZM(fRefMC->Px(), fRefMC->Py(), fRefMC->Pz(), mass); | |
218 | ||
219 | return kTRUE; | |
4fbb2459 | 220 | } |