]>
Commit | Line | Data |
---|---|---|
7356f978 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | //////////////////////////////////////////////////////////////////////////////// | |
17 | // | |
18 | // This class implements a candidate resonance. It has two pointers to its | |
19 | // two candidate daughters, whose 4-momenta are combined to obtain the mother | |
20 | // invariant mass and other kinematical quantities. | |
21 | // This class contains also some methods used to compute kinematical relations | |
22 | // between the candidate resonance and other particles. | |
23 | // | |
24 | // authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it) | |
25 | // M. Vala (martin.vala@cern.ch) | |
26 | // | |
27 | //////////////////////////////////////////////////////////////////////////////// | |
747592c1 | 28 | |
2dab9030 | 29 | #include <Riostream.h> |
4820b1ae | 30 | #include <TVector3.h> |
747592c1 | 31 | |
ec927a7d | 32 | #include "AliAODMCParticle.h" |
33 | #include "AliMCParticle.h" | |
2dab9030 | 34 | #include "AliRsnDaughter.h" |
2dab9030 | 35 | #include "AliRsnMother.h" |
36 | ||
37 | ClassImp(AliRsnMother) | |
38 | ||
39 | //_____________________________________________________________________________ | |
2a1c7696 | 40 | AliRsnMother::AliRsnMother() : |
2a1c7696 | 41 | fSum(), |
42 | fSumMC() | |
2dab9030 | 43 | { |
44 | // | |
45 | // Constructor. | |
46 | // Initializes all variables to meaningless values. | |
47 | // | |
48 | ||
2a1c7696 | 49 | Int_t i; |
50 | for (i = 0; i < 2; i++) fDaughter[i] = 0x0; | |
2dab9030 | 51 | } |
52 | ||
53 | //_____________________________________________________________________________ | |
2a1c7696 | 54 | AliRsnMother::AliRsnMother(const AliRsnMother &obj) : |
55 | TObject(obj), | |
2a1c7696 | 56 | fSum(obj.fSum), |
57 | fSumMC(obj.fSumMC) | |
2dab9030 | 58 | { |
59 | // | |
60 | // Copy constructor. | |
2dab9030 | 61 | // Does not duplicate pointers. |
62 | // | |
63 | ||
2a1c7696 | 64 | Int_t i; |
65 | for (i = 0; i < 2; i++) fDaughter[i] = obj.fDaughter[i]; | |
2dab9030 | 66 | } |
67 | ||
68 | //_____________________________________________________________________________ | |
69 | AliRsnMother& AliRsnMother::operator=(const AliRsnMother &obj) | |
70 | { | |
71 | // | |
72 | // Assignment operator. | |
2dab9030 | 73 | // Does not duplicate pointers. |
74 | // | |
75 | ||
2a1c7696 | 76 | Int_t i; |
2dab9030 | 77 | |
2a1c7696 | 78 | fSum = obj.fSum; |
79 | fSumMC = obj.fSumMC; | |
80 | ||
81 | for (i = 0; i < 2; i++) fDaughter[i] = obj.fDaughter[i]; | |
82 | ||
83 | return (*this); | |
2dab9030 | 84 | } |
85 | ||
86 | //_____________________________________________________________________________ | |
87 | AliRsnMother::~AliRsnMother() | |
88 | { | |
89 | // | |
90 | // Desctructor. | |
91 | // Does nothing, since pointers are not created in this class. | |
92 | // | |
93 | } | |
94 | ||
95 | //_____________________________________________________________________________ | |
d0282f3d | 96 | Int_t AliRsnMother::CommonMother(Int_t &m0, Int_t &m1) const |
2dab9030 | 97 | { |
98 | // | |
7356f978 | 99 | // If MC info is available, checks if the two tracks in the pair have the same mother. |
100 | // If the mother label is the same, the function returns the PDG code of mother, | |
101 | // otherwise it returns 0. | |
102 | // The two arguments passed by reference contain the GEANT labels of the mother | |
103 | // of the two particles to which the two daughters point. This is for being able | |
104 | // to check if they are really coming from a resonance (indexes >= 0) or not. | |
2dab9030 | 105 | // |
106 | ||
7356f978 | 107 | // if MC info is not available, the check can't be done |
2a1c7696 | 108 | if (!fDaughter[0]->GetRefMC() || !fDaughter[1]->GetRefMC()) { |
7356f978 | 109 | AliDebug(AliLog::kDebug, "MC Info absent --> cannot check common mother"); |
2a1c7696 | 110 | return 0; |
111 | } | |
112 | ||
113 | // check that labels are the same | |
114 | m0 = -1; | |
115 | m1 = -2; | |
116 | if (fDaughter[0]->IsESD() && fDaughter[1]->IsESD()) { | |
117 | if (fDaughter[0]->GetRefMCESD() && fDaughter[1]->GetRefMCESD()) { | |
118 | m0 = fDaughter[0]->GetRefMCESD()->Particle()->GetFirstMother(); | |
119 | m1 = fDaughter[1]->GetRefMCESD()->Particle()->GetFirstMother(); | |
120 | } | |
121 | } | |
122 | if (fDaughter[0]->IsAOD() && fDaughter[1]->IsAOD()) { | |
123 | if (fDaughter[0]->GetRefMCAOD() && fDaughter[1]->GetRefMCAOD()) { | |
124 | m0 = fDaughter[0]->GetRefMCAOD()->GetMother(); | |
125 | m1 = fDaughter[1]->GetRefMCAOD()->GetMother(); | |
126 | } | |
127 | } | |
7356f978 | 128 | |
129 | // decide the answer depending on the two mother labels | |
130 | if (m0 != m1) | |
131 | return 0; | |
132 | else | |
133 | return TMath::Abs(fDaughter[0]->GetMotherPDG()); | |
2dab9030 | 134 | } |
135 | ||
136 | //_____________________________________________________________________________ | |
137 | void AliRsnMother::SetDaughters | |
138 | (AliRsnDaughter *d0, Double_t mass0, AliRsnDaughter *d1, Double_t mass1) | |
139 | { | |
140 | // | |
7356f978 | 141 | // Define both the two candidate daughters to use, and the mass hypothesis |
142 | // to be assigned to each of them. | |
143 | // This calls the 'SetMass()' function of each daughter, which defines | |
144 | // their 4-momenta, and then sums them to obtain the total 4-momentum | |
145 | // of the mother (and then invariant mass, also). | |
146 | // The computation is done always for both the reconstructed and the MC, | |
147 | // when it is available. | |
2dab9030 | 148 | // |
149 | ||
2a1c7696 | 150 | if (d0) fDaughter[0] = d0; |
151 | if (d1) fDaughter[1] = d1; | |
152 | ||
153 | if (!d0 || !d1) return; | |
154 | ||
155 | fDaughter[0]->SetMass(mass0); | |
156 | fDaughter[1]->SetMass(mass1); | |
157 | ||
0206329d | 158 | fSum = fDaughter[0]->Prec() + fDaughter[1]->Prec(); |
159 | fSumMC = fDaughter[0]->Psim() + fDaughter[1]->Psim(); | |
2dab9030 | 160 | } |
161 | ||
162 | //_____________________________________________________________________________ | |
163 | void AliRsnMother::ResetPair() | |
164 | { | |
165 | // | |
7356f978 | 166 | // Resets the mother, zeroing all data members. |
2dab9030 | 167 | // |
168 | ||
2a1c7696 | 169 | Int_t i; |
170 | for (i = 0; i < 2; i++) fDaughter[i] = 0x0; | |
171 | ||
172 | fSum .SetXYZM(0.0, 0.0, 0.0, 0.0); | |
173 | fSumMC.SetXYZM(0.0, 0.0, 0.0, 0.0); | |
2dab9030 | 174 | } |
175 | ||
cadcd9e0 | 176 | //_____________________________________________________________________________ |
2e521c29 | 177 | Double_t AliRsnMother::CosThetaStar(Bool_t first, Bool_t useMC) |
cadcd9e0 | 178 | { |
7356f978 | 179 | // |
180 | // Computes the cosine of theta*, which is the angle of one of the daughters | |
181 | // with respect to the total momentum of the resonance, in its rest frame. | |
182 | // The arguments are needed to choose which of the daughters one want to use | |
183 | // and if reconstructed or MC momentum must be used. | |
184 | // [Contribution from Z. Feckova] | |
185 | // | |
186 | ||
2a1c7696 | 187 | TLorentzVector mother = (useMC ? fSumMC : fSum); |
747592c1 | 188 | TLorentzVector daughter0 = (first ? fDaughter[0]->P(useMC) : fDaughter[1]->P(useMC)); |
189 | TLorentzVector daughter1 = (first ? fDaughter[1]->P(useMC) : fDaughter[0]->P(useMC)); | |
2a1c7696 | 190 | TVector3 momentumM(mother.Vect()); |
191 | TVector3 normal(mother.Y() / momentumM.Mag(), -mother.X() / momentumM.Mag(), 0.0); | |
192 | ||
193 | // Computes first the invariant mass of the mother | |
7356f978 | 194 | Double_t mass0 = fDaughter[0]->P(useMC).M(); |
195 | Double_t mass1 = fDaughter[1]->P(useMC).M(); | |
196 | Double_t p0 = daughter0.Vect().Mag(); | |
197 | Double_t p1 = daughter1.Vect().Mag(); | |
198 | Double_t E0 = TMath::Sqrt(mass0 * mass0 + p0 * p0); | |
199 | Double_t E1 = TMath::Sqrt(mass1 * mass1 + p1 * p1); | |
200 | Double_t MotherMass = TMath::Sqrt((E0 + E1) * (E0 + E1) - (p0 * p0 + 2.0 * daughter0.Vect().Dot(daughter1.Vect()) + p1 * p1)); | |
2a1c7696 | 201 | MotherMass = fSum.M(); |
202 | ||
203 | // Computes components of beta | |
204 | Double_t betaX = -mother.X() / mother.E(); | |
205 | Double_t betaY = -mother.Y() / mother.E(); | |
206 | Double_t betaZ = -mother.Z() / mother.E(); | |
207 | ||
208 | // Computes Lorentz transformation of the momentum of the first daughter | |
209 | // into the rest frame of the mother and theta* | |
210 | daughter0.Boost(betaX, betaY, betaZ); | |
211 | TVector3 momentumD = daughter0.Vect(); | |
212 | ||
213 | Double_t cosThetaStar = normal.Dot(momentumD) / momentumD.Mag(); | |
214 | ||
215 | return cosThetaStar; | |
cadcd9e0 | 216 | } |
217 | ||
2dab9030 | 218 | //_____________________________________________________________________________ |
219 | void AliRsnMother::PrintInfo(const Option_t * /*option*/) const | |
220 | { | |
221 | // | |
222 | // Print some info of the pair. | |
223 | // The options are passed to the AliRsnDaughter::Print() method | |
224 | // | |
225 | ||
2a1c7696 | 226 | AliInfo("======== BEGIN PAIR INFO ==========="); |
227 | AliInfo("Track #1"); | |
228 | fDaughter[0]->Print(); | |
229 | AliInfo("Track #2"); | |
230 | fDaughter[1]->Print(); | |
231 | AliInfo("========= END PAIR INFO ==========="); | |
2dab9030 | 232 | } |
233 | ||
234 | //_____________________________________________________________________________ | |
0206329d | 235 | Bool_t AliRsnMother::CheckPair(Bool_t checkMC) const |
2dab9030 | 236 | { |
237 | // | |
238 | // Checks that the pair is well initialized: | |
239 | // - both daughters are good pointers | |
240 | // - if MC is required, both daughters have a MC reference | |
241 | // | |
242 | ||
2a1c7696 | 243 | if (!fDaughter[0] || !fDaughter[1]) { |
244 | AliError("One of the two tracks is NULL in this pair!"); | |
2dab9030 | 245 | return kFALSE; |
2a1c7696 | 246 | } |
247 | ||
0206329d | 248 | if (checkMC) { |
2a1c7696 | 249 | if (fDaughter[0]->GetRefMC() == 0x0 || fDaughter[1]->GetRefMC() == 0x0) { |
250 | AliError("Required MC info but not all MC refs are available"); | |
251 | return kFALSE; | |
252 | } | |
253 | } | |
254 | ||
255 | return kTRUE; | |
2dab9030 | 256 | } |