CbmRoot
PairAnalysisPair.cxx
Go to the documentation of this file.
1 //
3 //
4 // Authors:
5 // Julian Book <Julian.Book@cern.ch>
6 /*
7 
8  PairAnalysis pair interface class.
9 
10 */
11 // //
13 
14 
15 #include <TDatabasePDG.h>
16 
17 #include "CbmVertex.h"
18 
19 #include "PairAnalysisPair.h"
20 #include "PairAnalysisTrack.h"
21 
23 
24  Double_t PairAnalysisPair::fBeamEnergy = -1.;
25 
26 PairAnalysisPair::PairAnalysisPair() : PairAnalysisTrack(), fRefD1(), fRefD2() {
27  //
28  // Default Constructor
29  //
30 }
31 
32 //______________________________________________
34  : PairAnalysisTrack(pair)
35  , fType(pair.GetType())
36  , fCharge(pair.Charge())
37  , fLabel(pair.GetLabel())
38  , fWeight(pair.GetWeight())
39  , fPdgCode(pair.PdgCode())
40  , fRefD1(pair.GetFirstDaughter())
41  , fRefD2(pair.GetSecondDaughter())
42  , fPid1(pair.GetFirstDaughterPid())
43  , fPid2(pair.GetSecondDaughterPid())
44  , fKFUsage(pair.GetKFUsage()) {
45  //
46  // Copy Constructor
47  //
48 }
49 
50 //______________________________________________
52  : fType(type), fRefD1(), fRefD2() {
53  //
54  // Constructor with type
55  //
56 }
57 
58 //______________________________________________
60  //
61  // Default Destructor
62  //
63 }
64 
65 //______________________________________________
66 void PairAnalysisPair::GetThetaPhiCM(TLorentzVector& motherMom,
67  TLorentzVector& p1Mom,
68  TLorentzVector& p2Mom,
69  Double_t& thetaHE,
70  Double_t& phiHE,
71  Double_t& thetaCS,
72  Double_t& phiCS) const {
73  //
74  // Calculate theta and phi in helicity and Collins-Soper coordinate frame
75  //
76 
77  const Double_t proMass = TDatabasePDG::Instance()->GetParticle(2212)->Mass();
78  TLorentzVector projMom(
79  0.,
80  0.,
82  TMath::Sqrt(fBeamEnergy * fBeamEnergy + proMass * proMass));
83  TLorentzVector targMom(0., 0., 0., TMath::Sqrt(0. * 0 + proMass * proMass));
84 
85  // boost all the 4-mom vectors to the mother rest frame
86  TVector3 beta = (-1.0 / motherMom.E()) * motherMom.Vect();
87  p1Mom.Boost(beta);
88  p2Mom.Boost(beta);
89  projMom.Boost(beta);
90  targMom.Boost(beta);
91 
92  // x,y,z axes
93  TVector3 zAxisHE = (motherMom.Vect()).Unit();
94  TVector3 zAxisCS = ((projMom.Vect()).Unit() - (targMom.Vect()).Unit()).Unit();
95  TVector3 yAxis = ((projMom.Vect()).Cross(targMom.Vect())).Unit();
96  TVector3 xAxisHE = (yAxis.Cross(zAxisHE)).Unit();
97  TVector3 xAxisCS = (yAxis.Cross(zAxisCS)).Unit();
98 
99  // fill theta and phi
100  if (static_cast<PairAnalysisTrack*>(fRefD1.GetObject())->Charge() > 0) {
101  thetaHE = zAxisHE.Dot((p1Mom.Vect()).Unit());
102  thetaCS = zAxisCS.Dot((p1Mom.Vect()).Unit());
103  phiHE =
104  TMath::ATan2((p1Mom.Vect()).Dot(yAxis), (p1Mom.Vect()).Dot(xAxisHE));
105  phiCS =
106  TMath::ATan2((p1Mom.Vect()).Dot(yAxis), (p1Mom.Vect()).Dot(xAxisCS));
107  } else {
108  thetaHE = zAxisHE.Dot((p2Mom.Vect()).Unit());
109  thetaCS = zAxisCS.Dot((p2Mom.Vect()).Unit());
110  phiHE =
111  TMath::ATan2((p2Mom.Vect()).Dot(yAxis), (p2Mom.Vect()).Dot(xAxisHE));
112  phiCS =
113  TMath::ATan2((p2Mom.Vect()).Dot(yAxis), (p2Mom.Vect()).Dot(xAxisCS));
114  }
115 }
116 
117 //______________________________________________
118 Double_t PairAnalysisPair::GetCosPointingAngle(const CbmVertex* primVtx) const {
119  //
120  // Calculate the poiting angle of the pair to the primary vertex and take the cosine
121  //
122  if (!primVtx) return -1.;
123 
124  TVector3 pairPos(Xv(), Yv(), Zv());
125  TVector3 pvtxPos;
126  primVtx->Position(pvtxPos);
127  pairPos -= pvtxPos; //vector between the reference point and the V0 vertex
128 
129  TVector3 pairMom(Px(), Py(), Pz());
130  Double_t pointingAngle = pairMom.Angle(pairPos);
131  return TMath::Abs(TMath::Cos(pointingAngle));
132 }
133 
134 //______________________________________________
136  Double_t d0z0[2]) const {
137  //
138  // Calculate the dca of the mother with respect to the primary vertex
139  //
140  if (!primVtx) return;
141 
142  d0z0[0] = TMath::Sqrt(TMath::Power(Xv() - primVtx->GetX(), 2)
143  + TMath::Power(Yv() - primVtx->GetY(), 2));
144 
145  d0z0[1] = Zv() - primVtx->GetZ();
146  return;
147 }
148 
149 //______________________________________________
150 void PairAnalysisPair::SetBeamEnergy(Double_t beamEbyHand) {
151  //
152  // set the beam energy by hand
153  //
154  fBeamEnergy = beamEbyHand;
155 }
PairAnalysisPair::GetDCA
void GetDCA(const CbmVertex *primVtx, Double_t d0z0[2]) const
Definition: PairAnalysisPair.cxx:135
CbmVertex.h
PairAnalysisPair::Zv
virtual Double_t Zv() const
Definition: PairAnalysisPair.h:56
PairAnalysisPair::GetThetaPhiCM
virtual void GetThetaPhiCM(Double_t &thetaHE, Double_t &phiHE, Double_t &thetaCS, Double_t &phiCS) const =0
PairAnalysisPair::fRefD1
TRef fRefD1
beam energy
Definition: PairAnalysisPair.h:164
PairAnalysisTrack
Definition: PairAnalysisTrack.h:37
PairAnalysisPair
Definition: PairAnalysisPair.h:25
CbmVertex::GetX
Double_t GetX() const
Definition: CbmVertex.h:68
PairAnalysisPair::Yv
virtual Double_t Yv() const
Definition: PairAnalysisPair.h:55
PairAnalysisPair::Charge
Short_t Charge() const
Definition: PairAnalysisPair.h:79
PairAnalysisPair::Py
virtual Double_t Py() const
Definition: PairAnalysisPair.h:43
PairAnalysisPair::SetBeamEnergy
static void SetBeamEnergy(Double_t beamEbyHand=-1.)
Definition: PairAnalysisPair.cxx:150
CbmVertex::Position
void Position(TVector3 &pos) const
Definition: CbmVertex.h:74
CbmVertex
Definition: CbmVertex.h:26
CbmVertex::GetZ
Double_t GetZ() const
Definition: CbmVertex.h:70
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
PairAnalysisPair::fBeamEnergy
static Double_t fBeamEnergy
Definition: PairAnalysisPair.h:162
PairAnalysisPair::PairAnalysisPair
PairAnalysisPair()
PairAnalysisTrack.h
PairAnalysisPair::~PairAnalysisPair
virtual ~PairAnalysisPair()
Definition: PairAnalysisPair.cxx:59
PairAnalysisPair::Pz
virtual Double_t Pz() const
Definition: PairAnalysisPair.h:44
CbmVertex::GetY
Double_t GetY() const
Definition: CbmVertex.h:69
PairAnalysisPair.h
PairAnalysisPair::Px
virtual Double_t Px() const
Definition: PairAnalysisPair.h:42
PairAnalysisPair::Xv
virtual Double_t Xv() const
Definition: PairAnalysisPair.h:54
PairAnalysisPair::GetCosPointingAngle
virtual Double_t GetCosPointingAngle(const CbmVertex *primVtx) const
Definition: PairAnalysisPair.cxx:118