4 // Implementation of a pair of tracks, for several purposes
5 // - computing the total 4-momentum & inv. mass for output histos filling
6 // - evaluating cut checks on the pair of particles
7 // - evaluating any kind of kinematic value over their sum
9 // authors: Martin Vala (martin.vala@cern.ch)
10 // Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
13 #include <Riostream.h>
16 #include "AliAODMCParticle.h"
17 #include "AliMCParticle.h"
18 #include "AliRsnDaughter.h"
19 #include "AliRsnPairDef.h"
20 #include "AliRsnMother.h"
22 ClassImp(AliRsnMother)
24 //_____________________________________________________________________________
25 AliRsnMother::AliRsnMother() :
31 // Initializes all variables to meaningless values.
35 for (i = 0; i < 2; i++) fDaughter[i] = 0x0;
38 //_____________________________________________________________________________
39 AliRsnMother::AliRsnMother(const AliRsnMother &obj) :
46 // Initializes all variables to copy values.
47 // Does not duplicate pointers.
51 for (i = 0; i < 2; i++) fDaughter[i] = obj.fDaughter[i];
54 //_____________________________________________________________________________
55 AliRsnMother& AliRsnMother::operator=(const AliRsnMother &obj)
58 // Assignment operator.
59 // Initializes all variables to copy values.
60 // Does not duplicate pointers.
68 for (i = 0; i < 2; i++) fDaughter[i] = obj.fDaughter[i];
73 //_____________________________________________________________________________
74 AliRsnMother::~AliRsnMother()
78 // Does nothing, since pointers are not created in this class.
82 //_____________________________________________________________________________
83 Int_t AliRsnMother::CommonMother(Int_t &m0, Int_t &m1) const
86 // Checks if the two tracks in the pair have the same mother.
87 // This can be known if MC info is present.
88 // If the mother label is the same, rhe PDG code of the mother is returned,
89 // otherwise the method returns 0.
90 // In the two arguments passed by reference, the mothers of the two daghters are stored
93 // if MC info is not available, the pair is not true by default
94 if (!fDaughter[0]->GetRefMC() || !fDaughter[1]->GetRefMC()) {
95 AliWarning("Cannot know if the pairs is true or not because MC Info is not present");
99 // check that labels are the same
102 if (fDaughter[0]->IsESD() && fDaughter[1]->IsESD()) {
103 if (fDaughter[0]->GetRefMCESD() && fDaughter[1]->GetRefMCESD()) {
104 m0 = fDaughter[0]->GetRefMCESD()->Particle()->GetFirstMother();
105 m1 = fDaughter[1]->GetRefMCESD()->Particle()->GetFirstMother();
108 if (fDaughter[0]->IsAOD() && fDaughter[1]->IsAOD()) {
109 if (fDaughter[0]->GetRefMCAOD() && fDaughter[1]->GetRefMCAOD()) {
110 m0 = fDaughter[0]->GetRefMCAOD()->GetMother();
111 m1 = fDaughter[1]->GetRefMCAOD()->GetMother();
114 if (m0 != m1) return 0;
116 // if we reach this point, the two tracks have the same mother
117 // let's check now the PDG code of this common mother
118 return TMath::Abs(fDaughter[0]->GetMotherPDG());
121 //_____________________________________________________________________________
122 void AliRsnMother::SetDaughters
123 (AliRsnDaughter *d0, Double_t mass0, AliRsnDaughter *d1, Double_t mass1)
126 // Sets the pair defined in this usind tso passed daughters and two masses
127 // which will be assigned to them, in order to recompute their 4-momenta
128 // and sum them into the datamembers of this object.
131 if (d0) fDaughter[0] = d0;
132 if (d1) fDaughter[1] = d1;
134 if (!d0 || !d1) return;
136 fDaughter[0]->SetMass(mass0);
137 fDaughter[1]->SetMass(mass1);
139 fSum = fDaughter[0]->Prec() + fDaughter[1]->Prec();
140 fSumMC = fDaughter[0]->Psim() + fDaughter[1]->Psim();
143 //_____________________________________________________________________________
144 void AliRsnMother::ResetPair()
147 // Resets the mother, nullifying all data members
151 for (i = 0; i < 2; i++) fDaughter[i] = 0x0;
153 fSum .SetXYZM(0.0, 0.0, 0.0, 0.0);
154 fSumMC.SetXYZM(0.0, 0.0, 0.0, 0.0);
157 //_____________________________________________________________________________
158 Double_t AliRsnMother::CosThetaStar(Bool_t first, Bool_t useMC)
160 TLorentzVector mother = (useMC ? fSumMC : fSum);
161 TLorentzVector daughter0 = (first ? fDaughter[0]->P(useMC) : fDaughter[1]->P(useMC));
162 TLorentzVector daughter1 = (first ? fDaughter[1]->P(useMC) : fDaughter[0]->P(useMC));
163 TVector3 momentumM(mother.Vect());
164 TVector3 normal(mother.Y() / momentumM.Mag(), -mother.X() / momentumM.Mag(), 0.0);
166 // Computes first the invariant mass of the mother
167 Double_t mass0 = fDaughter[0]->P(useMC).M();
168 Double_t mass1 = fDaughter[1]->P(useMC).M();
169 Double_t p0 = daughter0.Vect().Mag();
170 Double_t p1 = daughter1.Vect().Mag();
171 Double_t E0 = TMath::Sqrt(mass0 * mass0 + p0 * p0);
172 Double_t E1 = TMath::Sqrt(mass1 * mass1 + p1 * p1);
173 Double_t MotherMass = TMath::Sqrt((E0 + E1) * (E0 + E1) - (p0 * p0 + 2.0 * daughter0.Vect().Dot(daughter1.Vect()) + p1 * p1));
174 MotherMass = fSum.M();
176 // Computes components of beta
177 Double_t betaX = -mother.X() / mother.E();
178 Double_t betaY = -mother.Y() / mother.E();
179 Double_t betaZ = -mother.Z() / mother.E();
181 // Computes Lorentz transformation of the momentum of the first daughter
182 // into the rest frame of the mother and theta*
183 daughter0.Boost(betaX, betaY, betaZ);
184 TVector3 momentumD = daughter0.Vect();
186 Double_t cosThetaStar = normal.Dot(momentumD) / momentumD.Mag();
191 //_____________________________________________________________________________
192 void AliRsnMother::PrintInfo(const Option_t * /*option*/) const
195 // Print some info of the pair.
196 // The options are passed to the AliRsnDaughter::Print() method
199 AliInfo("======== BEGIN PAIR INFO ===========");
201 fDaughter[0]->Print();
203 fDaughter[1]->Print();
204 AliInfo("========= END PAIR INFO ===========");
207 //_____________________________________________________________________________
208 Bool_t AliRsnMother::CheckPair(Bool_t checkMC) const
211 // Checks that the pair is well initialized:
212 // - both daughters are good pointers
213 // - if MC is required, both daughters have a MC reference
216 if (!fDaughter[0] || !fDaughter[1]) {
217 AliError("One of the two tracks is NULL in this pair!");
222 if (fDaughter[0]->GetRefMC() == 0x0 || fDaughter[1]->GetRefMC() == 0x0) {
223 AliError("Required MC info but not all MC refs are available");