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)
12 #include <Riostream.h>
13 #include "AliRsnDaughter.h"
14 #include "AliRsnPairDef.h"
15 #include "AliRsnMother.h"
17 ClassImp(AliRsnMother)
19 //_____________________________________________________________________________
20 AliRsnMother::AliRsnMother() :
30 // Initializes all variables to meaningless values.
34 for (i = 0; i < 2; i++) fDaughter[i] = 0x0;
37 //_____________________________________________________________________________
38 AliRsnMother::AliRsnMother(const AliRsnMother &obj) :
41 fDefaultMass(obj.fDefaultMass),
49 // Initializes all variables to copy values.
50 // Does not duplicate pointers.
54 for (i = 0; i < 2; i++) fDaughter[i] = obj.fDaughter[i];
57 //_____________________________________________________________________________
58 AliRsnMother& AliRsnMother::operator=(const AliRsnMother &obj)
61 // Assignment operator.
62 // Initializes all variables to copy values.
63 // Does not duplicate pointers.
68 fDefaultMass = obj.fDefaultMass;
74 for (i = 0; i < 2; i++) fDaughter[i] = obj.fDaughter[i];
79 //_____________________________________________________________________________
80 AliRsnMother::~AliRsnMother()
84 // Does nothing, since pointers are not created in this class.
88 //_____________________________________________________________________________
89 Int_t AliRsnMother::CommonMother() const
92 // Checks if the two tracks in the pair have the same mother.
93 // This can be known if MC info is present.
94 // If the mother label is the same, rhe PDG code of the mother is returned,
95 // otherwise the method returns 0.
98 // if MC info is not available, the pairs is not true by default
99 if (!fDaughter[0]->GetRefMC() || !fDaughter[1]->GetRefMC())
101 AliInfo("Cannot know if the pairs is true or not because MC Info is not present");
105 // check that labels are the same
106 if (fDaughter[0]->GetParticle()->GetFirstMother() != fDaughter[1]->GetParticle()->GetFirstMother())
109 // if we reach this point, the two tracks have the same mother
110 // let's check now the PDG code of this common mother
111 return TMath::Abs(fDaughter[0]->GetMotherPDG());
114 //_____________________________________________________________________________
115 void AliRsnMother::SetDaughters
116 (AliRsnDaughter *d0, Double_t mass0, AliRsnDaughter *d1, Double_t mass1)
119 // Sets the pair defined in this usind tso passed daughters and two masses
120 // which will be assigned to them, in order to recompute their 4-momenta
121 // and sum them into the datamembers of this object.
124 if (d0) fDaughter[0] = d0;
125 if (d1) fDaughter[1] = d1;
127 if (!d0 || !d1) return;
129 fDaughter[0]->SetMass(mass0);
130 fDaughter[1]->SetMass(mass1);
132 fSum = fDaughter[0]->P(kFALSE) + fDaughter[1]->P(kFALSE);
133 fSumMC = fDaughter[0]->P(kTRUE) + fDaughter[1]->P(kTRUE);
135 fRef .SetXYZM(fSum .X(), fSum .Y(), fSum .Z(), fDefaultMass);
136 fRefMC.SetXYZM(fSumMC.X(), fSumMC.Y(), fSumMC.Z(), fDefaultMass);
139 //_____________________________________________________________________________
140 void AliRsnMother::ResetPair()
143 // Resets the mother, nullifying all data members
147 for (i = 0; i < 2; i++) fDaughter[i] = 0x0;
149 fSum .SetXYZM(0.0, 0.0, 0.0, 0.0);
150 fRef .SetXYZM(0.0, 0.0, 0.0, 0.0);
151 fSumMC.SetXYZM(0.0, 0.0, 0.0, 0.0);
152 fRefMC.SetXYZM(0.0, 0.0, 0.0, 0.0);
155 //_____________________________________________________________________________
156 void AliRsnMother::PrintInfo(const Option_t * /*option*/) const
159 // Print some info of the pair.
160 // The options are passed to the AliRsnDaughter::Print() method
163 AliInfo("======== BEGIN PAIR INFO ===========");
165 fDaughter[0]->Print();
167 fDaughter[1]->Print();
168 AliInfo("========= END PAIR INFO ===========");
171 //_____________________________________________________________________________
172 Bool_t AliRsnMother::CheckPair() const
175 // Checks that the pair is well initialized:
176 // - both daughters are good pointers
177 // - if MC is required, both daughters have a MC reference
180 if (!fDaughter[0] || !fDaughter[1])
182 AliError("One of the two tracks is NULL in this pair!");
188 if (fDaughter[0]->GetRefMC() == 0x0 || fDaughter[1]->GetRefMC() == 0x0)
190 AliError("Required MC info but not all MC refs are available");
198 //_____________________________________________________________________________
199 Bool_t AliRsnMother::MatchesDef(AliRsnPairDef *def)
202 // Checks if the daughters, in any order, do match a given decay channel,
203 // using the specified identification method, which can be the 'true' one
204 // or the 'realistic' one only.
207 if (!def) return kFALSE;
208 if (!fDaughter[0]->GetRefMC()) return kFALSE;
209 if (!fDaughter[1]->GetRefMC()) return kFALSE;
211 Bool_t decayMatch = kFALSE;
212 Int_t pdg[2], ref[2];
213 pdg[0] = fDaughter[0]->GetRefMC()->Particle()->GetPdgCode();
214 pdg[1] = fDaughter[1]->GetRefMC()->Particle()->GetPdgCode();
215 ref[0] = TMath::Abs(AliPID::ParticleCode(def->GetPID(0)));
216 ref[1] = TMath::Abs(AliPID::ParticleCode(def->GetPID(1)));
219 // if first member of pairDef has same sign as first member of this,
220 // daughter[0] perfect PID must match first member of pairDef
221 // daughter[1] perfect PID must march second member of pairDef
222 if (fDaughter[0]->IsSign(def->GetCharge(0)) && fDaughter[1]->IsSign(def->GetCharge(1)))
224 decayMatch = (pdg[0] == ref[0] && pdg[1] == ref[1]);
228 // if first member of pairDef has same sign as second member of this,
229 // daughter[0] perfect PID must match second member of pairDef
230 // daughter[1] perfect PID must march first member of pairDef
231 if (fDaughter[1]->IsSign(def->GetCharge(0)) && fDaughter[0]->IsSign(def->GetCharge(1)))
233 decayMatch = (pdg[0] == ref[1] && pdg[1] == ref[0]);
236 return (decayMatch && (CommonMother() == def->GetMotherPDG()));