]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/RESONANCES/AliRsnMiniPair.cxx
Corrected guard
[u/mrichter/AliRoot.git] / PWGLF / RESONANCES / AliRsnMiniPair.cxx
CommitLineData
03d23846 1#include "AliRsnMiniParticle.h"
2#include "AliRsnMiniPair.h"
3
4ClassImp(AliRsnMiniPair)
5
6//__________________________________________________________________________________________________
7void AliRsnMiniPair::Fill
8(AliRsnMiniParticle *p1, AliRsnMiniParticle *p2, Double_t m1, Double_t m2, Double_t refMass)
9{
10//
11// Fill this object with data coming
12// from arguments
13//
03d23846 14 p1->Set4Vector(fP1[0], m1, kFALSE);
15 p2->Set4Vector(fP2[0], m2, kFALSE);
16 p1->Set4Vector(fP1[1], m1, kTRUE );
17 p2->Set4Vector(fP2[1], m2, kTRUE );
213adb92 18
19 fDCA1 = p1->DCA();
20 fDCA2 = p2->DCA();
61f275d1 21
03d23846 22 fMother = -1;
31dbef4e 23 fIsFromB = kFALSE;
24 fIsQuarkFound = kFALSE;
35b36c39 25 fPmother[0] = -1.0;
26 fPmother[1] = -1.0;
27 fPmother[2] = -1.0;
03d23846 28 if (p1->Mother() == p2->Mother()) {
29 fMother = p1->Mother();
30 fMotherPDG = p1->MotherPDG();
35b36c39 31 fPmother[0] = p1->PmotherX();
32 fPmother[1] = p1->PmotherY();
33 fPmother[2] = p1->PmotherZ();
31dbef4e 34 fIsFromB = p1->IsFromB();
35 fIsQuarkFound = p1->IsQuarkFound();
03d23846 36 }
61f275d1 37
03d23846 38 Int_t i;
39 for (i = 0; i < 2; i++) {
40 fSum[i] = fP1[i] + fP2[i];
41 fRef[i].SetXYZM(fSum[i].X(), fSum[i].Y(), fSum[i].Z(), refMass);
42 }
088ca370 43
44 fNSisters=-1;
45 if (p1->NTotSisters()==p2->NTotSisters()) fNSisters = p1->NTotSisters();
03d23846 46}
47
48//__________________________________________________________________________________________________
49Double_t AliRsnMiniPair::CosThetaStar(Bool_t useMC)
50{
51//
52// Return cosine of angle of one daughter to the resonance momentum in its rest frame
53//
61f275d1 54
03d23846 55 TLorentzVector &mother = fSum[ID(useMC)];
56 TLorentzVector &daughter0 = fP1[ID(useMC)];
74d60285 57// TLorentzVector &daughter1 = fP2[ID(useMC)];
03d23846 58 TVector3 momentumM(mother.Vect());
59 TVector3 normal(mother.Y() / momentumM.Mag(), -mother.X() / momentumM.Mag(), 0.0);
60
61 // Computes first the invariant mass of the mother
74d60285 62// Double_t mass0 = daughter0.M();
63// Double_t mass1 = daughter1.M();
64// Double_t p0 = daughter0.Vect().Mag();
65// Double_t p1 = daughter1.Vect().Mag();
66// Double_t E0 = TMath::Sqrt(mass0 * mass0 + p0 * p0);
67// Double_t E1 = TMath::Sqrt(mass1 * mass1 + p1 * p1);
68// Double_t MotherMass = TMath::Sqrt((E0 + E1) * (E0 + E1) - (p0 * p0 + 2.0 * daughter0.Vect().Dot(daughter1.Vect()) + p1 * p1));
69// MotherMass = mother.M();
03d23846 70
71 // Computes components of beta
72 Double_t betaX = -mother.X() / mother.E();
73 Double_t betaY = -mother.Y() / mother.E();
74 Double_t betaZ = -mother.Z() / mother.E();
75
76 // Computes Lorentz transformation of the momentum of the first daughter
77 // into the rest frame of the mother and theta*
78 daughter0.Boost(betaX, betaY, betaZ);
79 TVector3 momentumD = daughter0.Vect();
80
81 Double_t cosThetaStar = normal.Dot(momentumD) / momentumD.Mag();
82
83 return cosThetaStar;
84}
6aaeb33c 85
86//__________________________________________________________________________________________________
87void AliRsnMiniPair::InvertP(Bool_t first)
88{
89//
90// Inverts one 4-momentum and recompute sum
91//
92
93 Int_t i;
94 for (i = 0; i < 2; i++) {
80389b68 95 if (first) fP1[i].SetVect(fP1[i].Vect() *= -1.0);
96 else fP2[i].SetVect(fP2[i].Vect() *= -1.0);
6aaeb33c 97 fSum[i] = fP1[i] + fP2[i];
98 fRef[i].SetXYZM(fSum[i].X(), fSum[i].Y(), fSum[i].Z(), fRef[i].M());
99 }
100}
397c0062 101
102//__________________________________________________________________________________________________
103void AliRsnMiniPair::FillRef(Double_t mass)
104{
105//
106// Fill ref 4-vectors using the passed mass and the values in 'sum'
107//
108
109 Int_t i;
110 for (i = 0; i < 2; i++) {
111 fRef[i].SetXYZM(fSum[i].X(), fSum[i].Y(), fSum[i].Z(), mass);
112 }
113}
114
115//__________________________________________________________________________________________________
116Double_t AliRsnMiniPair::InvMassRes() const
117{
118//
119// Return invariant mass resolution
120//
121
122 if (fSum[1].M() <= 0.0) return 1E20;
123
124 return (fSum[0].M() - fSum[1].M()) / fSum[1].M();
125}
126
127//__________________________________________________________________________________________________
128Double_t AliRsnMiniPair::InvMassDiff() const
129{
130//
131// Return invariant mass resolution
132//
133
134 if (fSum[1].M() <= 0.0) return 1E20;
135
136 return (fSum[0].M() - fSum[1].M());
137}
138
139//__________________________________________________________________________________________________
140Double_t AliRsnMiniPair::PtRatio(Bool_t mc) const
141{
142//
143// Return ratio of transverse momenta of daughters
144//
145
146 Double_t num = TMath::Abs(fP1[ID(mc)].Perp() - fP2[ID(mc)].Perp());
147 Double_t den = TMath::Abs(fP1[ID(mc)].Perp() + fP2[ID(mc)].Perp());
148
149 if (den <= 0.0) return 1E20;
150
151 return num / den;
152}
153
154//__________________________________________________________________________________________________
155Double_t AliRsnMiniPair::DipAngle(Bool_t mc) const
156{
157//
158// Opening angle in a Z-T space
159//
160
161 const TLorentzVector &p1 = fP1[ID(mc)];
162 const TLorentzVector &p2 = fP2[ID(mc)];
163
164 return ((p1.Perp() * p2.Perp() + p1.Z() * p2.Z()) / p1.Mag() / p2.Mag());
165}
166
167//__________________________________________________________________________________________________
168Double_t AliRsnMiniPair::DaughterPt(Int_t daughterId, Bool_t mc)
169{
170 //returns pt of the <id> daughter
171 // if MC returns generated momenta
172 if (daughterId==0)
173 return fP1[ID(mc)].Pt();
174 else
175 return fP2[ID(mc)].Pt();
176}
177
213adb92 178//__________________________________________________________________________________________________
179Double_t AliRsnMiniPair::DaughterDCA(Int_t daughterId)
180{
181 //
182 //returns dca to Primary Vertex of the <id> daughter
183 //
184
185 if (daughterId==0)
186 return fDCA1;
187 else
188 return fDCA2;
189}
190
191//__________________________________________________________________________________________________
192Double_t AliRsnMiniPair::DCAProduct()
193{
194 //
195 //returns products of the DCA of the 2 daughters
196 //
197
198 return fDCA1*fDCA2;
199}
200
397c0062 201//__________________________________________________________________________________________________
202void AliRsnMiniPair::DaughterPxPyPz(Int_t daughterId, Bool_t mc, Double_t *pxpypz)
203{
204 //returns px,py,pz of the <id> daughter by saving them into pxpypz
205 // if MC returns generated momenta
206 if (!pxpypz) return;
207
208 if (daughterId==0){
209 pxpypz[0]=fP1[ID(mc)].Px();
210 pxpypz[1]=fP1[ID(mc)].Py();
211 pxpypz[2]=fP1[ID(mc)].Pz();
212 } else {
213 pxpypz[0]=fP2[ID(mc)].Px();
214 pxpypz[1]=fP2[ID(mc)].Py();
215 pxpypz[2]=fP2[ID(mc)].Pz();
216 }
217 return;
218}