]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnMiniPair.cxx
Implemented rotated background (experimental)
[u/mrichter/AliRoot.git] / PWG2 / 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
15    p1->Set4Vector(fP1[0], m1, kFALSE);
16    p2->Set4Vector(fP2[0], m2, kFALSE);
17    p1->Set4Vector(fP1[1], m1, kTRUE );
18    p2->Set4Vector(fP2[1], m2, kTRUE );
19    
20    fMother = -1;
21    if (p1->Mother() == p2->Mother()) {
22       fMother = p1->Mother();
23       fMotherPDG = p1->MotherPDG();
24    }
25    
26    Int_t i;
27    for (i = 0; i < 2; i++) {
28       fSum[i] = fP1[i] + fP2[i];
29       fRef[i].SetXYZM(fSum[i].X(), fSum[i].Y(), fSum[i].Z(), refMass);
30    }
31 }
32
33 //__________________________________________________________________________________________________
34 Double_t AliRsnMiniPair::CosThetaStar(Bool_t useMC)
35 {
36 //
37 // Return cosine of angle of one daughter to the resonance momentum in its rest frame
38 //
39    
40    TLorentzVector &mother    = fSum[ID(useMC)];
41    TLorentzVector &daughter0 = fP1[ID(useMC)];
42    TLorentzVector &daughter1 = fP2[ID(useMC)];
43    TVector3 momentumM(mother.Vect());
44    TVector3 normal(mother.Y() / momentumM.Mag(), -mother.X() / momentumM.Mag(), 0.0);
45
46    // Computes first the invariant mass of the mother
47    Double_t mass0      = daughter0.M();
48    Double_t mass1      = daughter1.M();
49    Double_t p0         = daughter0.Vect().Mag();
50    Double_t p1         = daughter1.Vect().Mag();
51    Double_t E0         = TMath::Sqrt(mass0 * mass0 + p0 * p0);
52    Double_t E1         = TMath::Sqrt(mass1 * mass1 + p1 * p1);
53    Double_t MotherMass = TMath::Sqrt((E0 + E1) * (E0 + E1) - (p0 * p0 + 2.0 * daughter0.Vect().Dot(daughter1.Vect()) + p1 * p1));
54    MotherMass = mother.M();
55
56    // Computes components of beta
57    Double_t betaX = -mother.X() / mother.E();
58    Double_t betaY = -mother.Y() / mother.E();
59    Double_t betaZ = -mother.Z() / mother.E();
60
61    // Computes Lorentz transformation of the momentum of the first daughter
62    // into the rest frame of the mother and theta*
63    daughter0.Boost(betaX, betaY, betaZ);
64    TVector3 momentumD = daughter0.Vect();
65
66    Double_t cosThetaStar = normal.Dot(momentumD) / momentumD.Mag();
67
68    return cosThetaStar;
69 }
70
71 //__________________________________________________________________________________________________
72 void AliRsnMiniPair::InvertP(Bool_t first)
73 {
74 //
75 // Inverts one 4-momentum and recompute sum
76 //
77
78    Int_t i;
79    for (i = 0; i < 2; i++) {
80       if (first) fP1[i].Vect() *= -1.0;
81       else       fP2[i].Vect() *= -1.0;
82       fSum[i] = fP1[i] + fP2[i];
83       fRef[i].SetXYZM(fSum[i].X(), fSum[i].Y(), fSum[i].Z(), fRef[i].M());
84    }
85 }