Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
TwoTrack3DCFCut.cxx
1/*
2 * TwoTrack3DCFCut.cxx
3 *
4 * Created on: 4 sty 2021
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9#include "TwoTrack3DCFCut.h"
10
11#include "Package.h"
12#include "Parameter.h"
13#include "Track.h"
14#include "TwoTrack.h"
15
16#include <TDatabasePDG.h>
17#include <TLorentzVector.h>
18#include <TMath.h>
19#include <TParticlePDG.h>
20
21namespace Hal {
22 TwoTrack3DCFCut::TwoTrack3DCFCut() :
23 TwoTrackCut(1), fMap(nullptr), fPID1(211), fPID2(211), fFrame(0), fAbs(kTRUE), fM12(0), fM22(0) {
24 SetUnitName("Pair type [AU]");
25 SetMinAndMax(1);
26 }
27
28 TwoTrack3DCFCut::~TwoTrack3DCFCut() {
29 if (fMap) delete fMap;
30 }
31
32 TwoTrack3DCFCut::TwoTrack3DCFCut(const TwoTrack3DCFCut& other) : TwoTrackCut(other) {
33 if (other.fMap) fMap = (TH3D*) other.fMap->Clone();
34 fPID1 = other.fPID1;
35 fPID2 = other.fPID2;
36 fM12 = other.fM12;
37 fM22 = other.fM22;
38 fFrame = other.fFrame;
39 fAbs = other.fAbs;
40 }
41
42 void TwoTrack3DCFCut::SetHistogram(const TH3D& histo) {
43 fMap = (TH3D*) histo.Clone();
44 fMap->SetDirectory(0x0);
45 }
46
47 Bool_t TwoTrack3DCFCut::Pass(TwoTrack* pair) {
48 const TLorentzVector& tr1 = pair->GetTrack1()->GetMomentum();
49 const TLorentzVector& tr2 = pair->GetTrack2()->GetMomentum();
50 Double_t px1 = tr1.Px();
51 Double_t py1 = tr1.Py();
52 Double_t pz1 = tr1.Pz();
53 Double_t px2, py2, pz2;
54 switch (pair->GetPairType()) {
55 case TwoTrack::kHemishpere:
56 px2 = -tr2.Px();
57 py2 = -tr2.Py();
58 pz2 = -tr2.Pz();
59 break;
60 case TwoTrack::kRotated:
61 px2 = -tr2.Px();
62 py2 = -tr2.Py();
63 pz2 = tr2.Pz();
64 break;
65 default:
66 px2 = tr2.Px();
67 py2 = tr2.Py();
68 pz2 = tr2.Pz();
69 break;
70 }
71 Double_t e1 = TMath::Sqrt(fM12 + px1 * px1 + py1 * py1 + pz1 * pz1);
72 Double_t e2 = TMath::Sqrt(fM22 + px2 * px2 + py2 * py2 + pz2 * pz2);
73
74 Double_t X, Y, Z;
75 Double_t tPx = px1 + px2;
76 Double_t tPy = py1 + py2;
77 Double_t tPz = pz1 + pz2;
78 Double_t tE = e1 + e2;
79 Double_t tPt = tPx * tPx + tPy * tPy;
80 Double_t tMt = tE * tE - tPz * tPz; // mCVK;
81 Double_t tM = TMath::Sqrt(tMt - tPt);
82 tMt = TMath::Sqrt(tMt);
83 tPt = TMath::Sqrt(tPt);
84 Double_t tBeta = tPz / tE;
85 Double_t tGamma = tE / tMt;
86 if (fFrame == 0) { // use LCMS
87 Double_t particle1lcms_pz = tGamma * (pz1 - tBeta * e1);
88 // Double_t particle1lcms_e = tGamma * (e1 - tBeta * pz1);
89 Double_t particle2lcms_pz = tGamma * (pz2 - tBeta * e2);
90 // Double_t particle2lcms_e = tGamma * (e2 - tBeta * pz2);
91
92 Double_t particle1lcms_px = (px1 * tPx + py1 * tPy) / tPt;
93 Double_t particle1lcms_py = (-px1 * tPy + py1 * tPx) / tPt;
94
95 Double_t particle2lcms_px = (px2 * tPx + py2 * tPy) / tPt;
96 Double_t particle2lcms_py = (-px2 * tPy + py2 * tPx) / tPt;
97
98 X = particle1lcms_px - particle2lcms_px;
99 Y = particle1lcms_py - particle2lcms_py;
100 Z = particle1lcms_pz - particle2lcms_pz;
101 } else { // use PRF
102 // {
103 // Boost to LCMS
104 Z = tGamma * (pz1 - tBeta * e1);
105 Double_t tE1L = tGamma * (e1 - tBeta * pz1);
106 X = (px1 * tPx + py1 * tPy) / tPt;
107 Y = (-px1 * tPy + py1 * tPx) / tPt;
108 X = tMt / tM * (X - tPt / tMt * tE1L);
109 }
110 if (fAbs) {
111 X = TMath::Abs(X);
112 Y = TMath::Abs(Y);
113 Z = TMath::Abs(Z);
114 }
115 Int_t binX = fMap->GetXaxis()->FindBin(X);
116 Int_t binY = fMap->GetYaxis()->FindBin(Y);
117 Int_t binZ = fMap->GetZaxis()->FindBin(Z);
118 SetValue(fMap->GetBinContent(binX, binY, binZ));
119 return Validate();
120 }
121
122 TwoTrack3DCFCut& TwoTrack3DCFCut::operator=(const TwoTrack3DCFCut& other) {
123 if (this == &other) return *this;
124 TwoTrackCut::operator=(other);
125 if (other.fMap) {
126 fMap = (TH3D*) other.fMap->Clone();
127 fMap->SetDirectory(0x0);
128 }
129 fPID1 = other.fPID1;
130 fPID2 = other.fPID2;
131 fM12 = other.fM12;
132 fM22 = other.fM22;
133 fFrame = other.fFrame;
134 fAbs = other.fAbs;
135 return *this;
136 }
137
138 Bool_t TwoTrack3DCFCut::Init(Int_t /*int1*/) {
139 if (fMap == nullptr) return kFALSE;
140 TDatabasePDG* db = TDatabasePDG::Instance();
141 TParticlePDG* p1 = db->GetParticle(fPID1);
142 TParticlePDG* p2 = db->GetParticle(fPID2);
143 if (p1 == nullptr || p2 == nullptr) return kFALSE;
144 fM12 = p1->Mass() * p1->Mass();
145 fM22 = p2->Mass() * p2->Mass();
146 return kTRUE;
147 }
148
149 Cut* TwoTrack3DCFCut::MakeCopy() const { return new TwoTrack3DCFCut(*this); }
150
151 Package* TwoTrack3DCFCut::Report() const {
152 Package* pack = TwoTrackCut::Report();
153 if (fFrame == 0) {
154 pack->AddObject(new ParameterString("Frame", "LCMS", '='));
155 } else {
156 pack->AddObject(new ParameterString("Frame", "PRF", '='));
157 }
158 pack->AddObject(new ParameterBool("Abs", fAbs, '='));
159 pack->AddObject(new ParameterInt("PID 1 ", fPID1, '='));
160 pack->AddObject(new ParameterInt("PID 2 ", fPID2, '='));
161 return pack;
162 }
163} // namespace Hal
Definition Cut.h:40
void AddObject(TObject *object)
Definition Package.cxx:209
const TLorentzVector & GetMomentum() const
Definition Track.h:118
PairType GetPairType() const
Definition TwoTrack.h:70
Track * GetTrack1() const
Definition TwoTrack.h:75
Track * GetTrack2() const
Definition TwoTrack.h:80