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