1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 ////////////////////////////////////////////////////////////////////////////////
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.
24 // authors: A. Pulvirenti (alberto.pulvirenti@ct.infn.it)
25 // M. Vala (martin.vala@cern.ch)
27 ////////////////////////////////////////////////////////////////////////////////
29 #include <Riostream.h>
32 #include "AliAODMCParticle.h"
33 #include "AliMCParticle.h"
34 #include "AliRsnDaughter.h"
35 #include "AliRsnMother.h"
37 ClassImp(AliRsnMother)
39 //_____________________________________________________________________________
40 AliRsnMother::AliRsnMother() :
46 // Initializes all variables to meaningless values.
50 for (i = 0; i < 2; i++) fDaughter[i] = 0x0;
53 //_____________________________________________________________________________
54 AliRsnMother::AliRsnMother(const AliRsnMother &obj) :
61 // Does not duplicate pointers.
65 for (i = 0; i < 2; i++) fDaughter[i] = obj.fDaughter[i];
68 //_____________________________________________________________________________
69 AliRsnMother& AliRsnMother::operator=(const AliRsnMother &obj)
72 // Assignment operator.
73 // Does not duplicate pointers.
81 for (i = 0; i < 2; i++) fDaughter[i] = obj.fDaughter[i];
86 //_____________________________________________________________________________
87 AliRsnMother::~AliRsnMother()
91 // Does nothing, since pointers are not created in this class.
95 //_____________________________________________________________________________
96 Int_t AliRsnMother::CommonMother(Int_t &m0, Int_t &m1) const
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.
107 // if MC info is not available, the check can't be done
108 if (!fDaughter[0]->GetRefMC() || !fDaughter[1]->GetRefMC()) {
109 AliDebug(AliLog::kDebug, "MC Info absent --> cannot check common mother");
113 // check that labels are the same
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();
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();
129 // decide the answer depending on the two mother labels
133 return TMath::Abs(fDaughter[0]->GetMotherPDG());
136 //_____________________________________________________________________________
137 void AliRsnMother::SetDaughters
138 (AliRsnDaughter *d0, Double_t mass0, AliRsnDaughter *d1, Double_t mass1)
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.
150 if (d0) fDaughter[0] = d0;
151 if (d1) fDaughter[1] = d1;
153 if (!d0 || !d1) return;
155 fDaughter[0]->SetMass(mass0);
156 fDaughter[1]->SetMass(mass1);
158 fSum = fDaughter[0]->Prec() + fDaughter[1]->Prec();
159 fSumMC = fDaughter[0]->Psim() + fDaughter[1]->Psim();
162 //_____________________________________________________________________________
163 void AliRsnMother::ResetPair()
166 // Resets the mother, zeroing all data members.
170 for (i = 0; i < 2; i++) fDaughter[i] = 0x0;
172 fSum .SetXYZM(0.0, 0.0, 0.0, 0.0);
173 fSumMC.SetXYZM(0.0, 0.0, 0.0, 0.0);
176 //_____________________________________________________________________________
177 Double_t AliRsnMother::CosThetaStar(Bool_t first, Bool_t useMC)
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]
187 TLorentzVector mother = (useMC ? fSumMC : fSum);
188 TLorentzVector daughter0 = (first ? fDaughter[0]->P(useMC) : fDaughter[1]->P(useMC));
189 TLorentzVector daughter1 = (first ? fDaughter[1]->P(useMC) : fDaughter[0]->P(useMC));
190 TVector3 momentumM(mother.Vect());
191 TVector3 normal(mother.Y() / momentumM.Mag(), -mother.X() / momentumM.Mag(), 0.0);
193 // Computes first the invariant mass of the mother
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));
201 MotherMass = fSum.M();
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();
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();
213 Double_t cosThetaStar = normal.Dot(momentumD) / momentumD.Mag();
218 //_____________________________________________________________________________
219 void AliRsnMother::PrintInfo(const Option_t * /*option*/) const
222 // Print some info of the pair.
223 // The options are passed to the AliRsnDaughter::Print() method
226 AliInfo("======== BEGIN PAIR INFO ===========");
228 fDaughter[0]->Print();
230 fDaughter[1]->Print();
231 AliInfo("========= END PAIR INFO ===========");
234 //_____________________________________________________________________________
235 Bool_t AliRsnMother::CheckPair(Bool_t checkMC) const
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
243 if (!fDaughter[0] || !fDaughter[1]) {
244 AliError("One of the two tracks is NULL in this pair!");
249 if (fDaughter[0]->GetRefMC() == 0x0 || fDaughter[1]->GetRefMC() == 0x0) {
250 AliError("Required MC info but not all MC refs are available");