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