CbmRoot
Loading...
Searching...
No Matches
PairAnalysisPair.cxx
Go to the documentation of this file.
1/* Copyright (C) 2015-2019 Justus-Liebig-Universitaet Giessen, Giessen
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Julian Book [committer] */
4/*
5
6 PairAnalysis pair interface class.
7
8*/
9// //
11
12
13#include "PairAnalysisPair.h"
14
15#include "CbmVertex.h"
16
17#include <TDatabasePDG.h>
18
19#include "PairAnalysisTrack.h"
20
22
23 Double_t PairAnalysisPair::fBeamEnergy = -1.;
24
26{
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 //
47 // Copy Constructor
48 //
49}
50
51//______________________________________________
52PairAnalysisPair::PairAnalysisPair(Char_t type) : fType(type), fRefD1(), fRefD2()
53{
54 //
55 // Constructor with type
56 //
57}
58
59//______________________________________________
61{
62 //
63 // Default Destructor
64 //
65}
66
67//______________________________________________
68void PairAnalysisPair::GetThetaPhiCM(TLorentzVector& motherMom, TLorentzVector& p1Mom, TLorentzVector& p2Mom,
69 Double_t& thetaHE, Double_t& phiHE, Double_t& thetaCS, Double_t& phiCS) const
70{
71 //
72 // Calculate theta and phi in helicity and Collins-Soper coordinate frame
73 //
74
75 const Double_t proMass = TDatabasePDG::Instance()->GetParticle(2212)->Mass();
76 TLorentzVector projMom(0., 0., fBeamEnergy, TMath::Sqrt(fBeamEnergy * fBeamEnergy + proMass * proMass));
77 TLorentzVector targMom(0., 0., 0., TMath::Sqrt(0. * 0 + proMass * proMass));
78
79 // boost all the 4-mom vectors to the mother rest frame
80 TVector3 beta = (-1.0 / motherMom.E()) * motherMom.Vect();
81 p1Mom.Boost(beta);
82 p2Mom.Boost(beta);
83 projMom.Boost(beta);
84 targMom.Boost(beta);
85
86 // x,y,z axes
87 TVector3 zAxisHE = (motherMom.Vect()).Unit();
88 TVector3 zAxisCS = ((projMom.Vect()).Unit() - (targMom.Vect()).Unit()).Unit();
89 TVector3 yAxis = ((projMom.Vect()).Cross(targMom.Vect())).Unit();
90 TVector3 xAxisHE = (yAxis.Cross(zAxisHE)).Unit();
91 TVector3 xAxisCS = (yAxis.Cross(zAxisCS)).Unit();
92
93 // fill theta and phi
94 if (static_cast<PairAnalysisTrack*>(fRefD1.GetObject())->Charge() > 0) {
95 thetaHE = zAxisHE.Dot((p1Mom.Vect()).Unit());
96 thetaCS = zAxisCS.Dot((p1Mom.Vect()).Unit());
97 phiHE = TMath::ATan2((p1Mom.Vect()).Dot(yAxis), (p1Mom.Vect()).Dot(xAxisHE));
98 phiCS = TMath::ATan2((p1Mom.Vect()).Dot(yAxis), (p1Mom.Vect()).Dot(xAxisCS));
99 }
100 else {
101 thetaHE = zAxisHE.Dot((p2Mom.Vect()).Unit());
102 thetaCS = zAxisCS.Dot((p2Mom.Vect()).Unit());
103 phiHE = TMath::ATan2((p2Mom.Vect()).Dot(yAxis), (p2Mom.Vect()).Dot(xAxisHE));
104 phiCS = TMath::ATan2((p2Mom.Vect()).Dot(yAxis), (p2Mom.Vect()).Dot(xAxisCS));
105 }
106}
107
108//______________________________________________
110{
111 //
112 // Calculate the poiting angle of the pair to the primary vertex and take the cosine
113 //
114 if (!primVtx) return -1.;
115
116 TVector3 pairPos(Xv(), Yv(), Zv());
117 TVector3 pvtxPos;
118 primVtx->Position(pvtxPos);
119 pairPos -= pvtxPos; //vector between the reference point and the V0 vertex
120
121 TVector3 pairMom(Px(), Py(), Pz());
122 Double_t pointingAngle = pairMom.Angle(pairPos);
123 return TMath::Abs(TMath::Cos(pointingAngle));
124}
125
126//______________________________________________
127void PairAnalysisPair::GetDCA(const CbmVertex* primVtx, Double_t d0z0[2]) const
128{
129 //
130 // Calculate the dca of the mother with respect to the primary vertex
131 //
132 if (!primVtx) return;
133
134 d0z0[0] = TMath::Sqrt(TMath::Power(Xv() - primVtx->GetX(), 2) + TMath::Power(Yv() - primVtx->GetY(), 2));
135
136 d0z0[1] = Zv() - primVtx->GetZ();
137 return;
138}
139
140//______________________________________________
141void PairAnalysisPair::SetBeamEnergy(Double_t beamEbyHand)
142{
143 //
144 // set the beam energy by hand
145 //
146 fBeamEnergy = beamEbyHand;
147}
ClassImp(CbmConverterManager)
double GetZ() const
Definition CbmVertex.h:69
void Position(TVector3 &pos) const
Definition CbmVertex.h:73
double GetY() const
Definition CbmVertex.h:68
double GetX() const
Definition CbmVertex.h:67
static Double_t fBeamEnergy
static void SetBeamEnergy(Double_t beamEbyHand=-1.)
virtual Double_t Zv() const
virtual void GetThetaPhiCM(Double_t &thetaHE, Double_t &phiHE, Double_t &thetaCS, Double_t &phiCS) const =0
virtual Double_t Py() const
virtual Double_t Xv() const
virtual Double_t Yv() const
TRef fRefD1
beam energy
virtual Double_t GetCosPointingAngle(const CbmVertex *primVtx) const
virtual Double_t Px() const
void GetDCA(const CbmVertex *primVtx, Double_t d0z0[2]) const
virtual Double_t Pz() const
Short_t Charge() const