CbmRoot
CbmKresTemperature.cxx
Go to the documentation of this file.
1 
15 #include "CbmKresTemperature.h"
16 
17 #include "CbmGlobalTrack.h"
18 #include "CbmMCTrack.h"
19 #include "CbmStsTrack.h"
20 #include "FairRootManager.h"
21 
22 #include "TH1.h"
23 #include "TH1D.h"
24 
25 
26 using namespace std;
27 
29  : fMcTracks(nullptr)
30  , fGlobalTracks(nullptr)
31  , fStsTracks(nullptr)
32  , fHistoList_MC()
33  , MC_pi_minus_Tempr(nullptr)
34  , MC_pi_plus_Tempr(nullptr)
35  , MC_pi_zero_Tempr(nullptr)
36  , MC_proton_Tempr(nullptr)
37  , MC_kaon_zero_Tempr(nullptr)
38  , MC_kaon_plus_Tempr(nullptr)
39  , MC_kaon_minus_Tempr(nullptr)
40  , MC_direct_photons_Tempr(nullptr) {}
41 
43 
46 
47  FairRootManager* ioman = FairRootManager::Instance();
48  if (nullptr == ioman) {
49  Fatal("CbmKresTemperature::Init", "RootManager not instantised!");
50  }
51 
52  fMcTracks = (TClonesArray*) ioman->GetObject("MCTrack");
53  if (nullptr == fMcTracks) {
54  Fatal("CbmKresTemperature::Init", "No MCTrack array!");
55  }
56 
57  fGlobalTracks = (TClonesArray*) ioman->GetObject("GlobalTrack");
58  if (nullptr == fGlobalTracks) {
59  Fatal("CbmKresTemperature::Init", "No GlobalTrack array!");
60  }
61 
62  fStsTracks = (TClonesArray*) ioman->GetObject("StsTrack");
63  if (nullptr == fStsTracks) {
64  Fatal("CbmKresTemperature::Init", "No StsTrack array!");
65  }
66 }
67 
68 void CbmKresTemperature::Exec(int fEventNumTempr) {
69  cout << "CbmKresTemperature, event No. " << fEventNumTempr << endl;
70 
71  // ========================================================================================
73  Int_t nofMcTracks = fMcTracks->GetEntriesFast();
74  for (int i = 0; i < nofMcTracks; i++) {
75  CbmMCTrack* mctrack = (CbmMCTrack*) fMcTracks->At(i);
76  if (mctrack == nullptr) continue;
77 
78 
79  TVector3 v, momentum;
80 
81  if (mctrack->GetMotherId() == -1 && mctrack->GetRapidity() > 1.2
82  && mctrack->GetRapidity() < 4.0 && mctrack->GetPt() < 2.0) {
83 
84  //***** pi0 analysis
85  //if (TMath::Abs(mctrack->GetPdgCode()) == 111 && mctrack->GetMotherId() == -1) {
86  if (mctrack->GetPdgCode() == 111) {
87  mctrack->GetStartVertex(v);
88  mctrack->GetMomentum(momentum);
89  double m0 = 0.1349766; // Gev/c^2
90  double pt = mctrack->GetPt();
91  double mt = TMath::Sqrt(pt * pt + m0 * m0);
92  MC_pi_zero_Tempr->Fill(mt - m0);
93  }
94 
95  //***** direct photons analysis
96  if (mctrack->GetPdgCode() == 22) {
97  mctrack->GetStartVertex(v);
98  mctrack->GetMomentum(momentum);
99  double pt = mctrack->GetPt();
100  MC_direct_photons_Tempr->Fill(pt);
101  }
102 
103  //***** pi+ analysis
104  //if (mctrack->GetPdgCode() == 211 && mctrack->GetMotherId() == -1) {
105  if (mctrack->GetPdgCode() == 211) {
106  mctrack->GetStartVertex(v);
107  mctrack->GetMomentum(momentum);
108  double m0 = 0.13957018; // Gev/c^2
109  double pt = mctrack->GetPt();
110  double mt = TMath::Sqrt(pt * pt + m0 * m0);
111  MC_pi_plus_Tempr->Fill(mt - m0);
112  }
113 
114  //***** pi- analysis
115  //if (mctrack->GetPdgCode() == -211 && mctrack->GetMotherId() == -1) {
116  if (mctrack->GetPdgCode() == -211) {
117  mctrack->GetStartVertex(v);
118  mctrack->GetMomentum(momentum);
119  double m0 = 0.13957018; // Gev/c^2
120  double pt = mctrack->GetPt();
121  double mt = TMath::Sqrt(pt * pt + m0 * m0);
122  MC_pi_minus_Tempr->Fill(mt - m0);
123  }
124 
125  //***** proton analysis
126  //if (mctrack->GetPdgCode() == 2212 && mctrack->GetMotherId() == -1) {
127  if (mctrack->GetPdgCode() == 2212) {
128  mctrack->GetStartVertex(v);
129  mctrack->GetMomentum(momentum);
130  double m0 = 0.9382720813; // Gev/c^2
131  double pt = mctrack->GetPt();
132  double mt = TMath::Sqrt(pt * pt + m0 * m0);
133  MC_proton_Tempr->Fill(mt - m0);
134  }
135 
136  //***** kaon0_S analysis
137  //if (mctrack->GetPdgCode() == 310 && mctrack->GetMotherId() == -1) {
138  if (mctrack->GetPdgCode() == 310) {
139  mctrack->GetStartVertex(v);
140  mctrack->GetMomentum(momentum);
141  double m0 = 0.497614; // Gev/c^2
142  double pt = mctrack->GetPt();
143  double mt = TMath::Sqrt(pt * pt + m0 * m0);
144  MC_kaon_zero_Tempr->Fill(mt - m0);
145  }
146 
147  //***** kaon+ analysis
148  //if (mctrack->GetPdgCode() == 321 && mctrack->GetMotherId() == -1) {
149  if (mctrack->GetPdgCode() == 321) {
150  mctrack->GetStartVertex(v);
151  mctrack->GetMomentum(momentum);
152  double m0 = 0.493677; // Gev/c^2
153  double pt = mctrack->GetPt();
154  double mt = TMath::Sqrt(pt * pt + m0 * m0);
155  MC_kaon_plus_Tempr->Fill(mt - m0);
156  }
157 
158  //***** kaon- analysis
159  //if (mctrack->GetPdgCode() == -321 && mctrack->GetMotherId() == -1) {
160  if (mctrack->GetPdgCode() == -321) {
161  mctrack->GetStartVertex(v);
162  mctrack->GetMomentum(momentum);
163  double m0 = 0.493677; // Gev/c^2
164  double pt = mctrack->GetPt();
165  double mt = TMath::Sqrt(pt * pt + m0 * m0);
166  MC_kaon_minus_Tempr->Fill(mt - m0);
167  }
168  }
169  }
170 }
171 
173  MC_pi_minus_Tempr->SetOption("P");
174  MC_pi_minus_Tempr->SetMarkerStyle(20);
175  MC_pi_plus_Tempr->SetOption("P");
176  MC_pi_plus_Tempr->SetMarkerStyle(20);
177  MC_pi_zero_Tempr->SetOption("P");
178  MC_pi_zero_Tempr->SetMarkerStyle(20);
179  MC_direct_photons_Tempr->SetOption("P");
180  MC_direct_photons_Tempr->SetMarkerStyle(20);
181 
182  MC_proton_Tempr->SetOption("P");
183  MC_proton_Tempr->SetMarkerStyle(20);
184  MC_kaon_zero_Tempr->SetOption("P");
185  MC_kaon_zero_Tempr->SetMarkerStyle(20);
186  MC_kaon_plus_Tempr->SetOption("P");
187  MC_kaon_plus_Tempr->SetMarkerStyle(20);
188  MC_kaon_minus_Tempr->SetOption("P");
189  MC_kaon_minus_Tempr->SetMarkerStyle(20);
190 
191  gDirectory->mkdir("temperature");
192  gDirectory->cd("temperature");
193 
194  gDirectory->mkdir("MC");
195  gDirectory->cd("MC");
196  for (UInt_t i = 0; i < fHistoList_MC.size(); i++) {
197  fHistoList_MC[i]->Write();
198  }
199  gDirectory->cd("..");
200 
201  gDirectory->cd("..");
202 }
203 
206  new TH1D("MC_pi_minus_Tempr",
207  "Monte Carlo, primary #pi^{-}; m_{t}-m_{0} distribution",
208  100,
209  0,
210  2);
211  fHistoList_MC.push_back(MC_pi_minus_Tempr);
212 
214  new TH1D("MC_pi_plus_Tempr",
215  "Monte Carlo, primary #pi^{+}; m_{t}-m_{0} distribution",
216  100,
217  0,
218  2);
219  fHistoList_MC.push_back(MC_pi_plus_Tempr);
220 
222  new TH1D("MC_pi_zero_Tempr",
223  "Monte Carlo, primary #pi^{0}; m_{t}-m_{0} distribution",
224  100,
225  0,
226  2);
227  fHistoList_MC.push_back(MC_pi_zero_Tempr);
228 
230  new TH1D("MC_direct_photons_Tempr",
231  "Monte Carlo, direct #gamma; m_{t}-m_{0} distribution",
232  100,
233  0,
234  2);
236 
238  new TH1D("MC_proton_Tempr",
239  "Monte Carlo, primary #p; m_{t}-m_{0} distribution",
240  100,
241  0,
242  2);
243  fHistoList_MC.push_back(MC_proton_Tempr);
244 
246  new TH1D("MC_kaon_zero_Tempr",
247  "Monte Carlo, primary #kaon^{S0}; m_{t}-m_{0} distribution",
248  100,
249  0,
250  2);
252 
254  new TH1D("MC_kaon_plus_Tempr",
255  "Monte Carlo, primary #kaon^{+}; m_{t}-m_{0} distribution",
256  100,
257  0,
258  2);
260 
262  new TH1D("MC_kaon_minus_Tempr",
263  "Monte Carlo, primary #kaon^{-}; m_{t}-m_{0} distribution",
264  100,
265  0,
266  2);
268 }
CbmMCTrack::GetMotherId
Int_t GetMotherId() const
Definition: CbmMCTrack.h:71
CbmMCTrack::GetMomentum
void GetMomentum(TVector3 &momentum) const
Definition: CbmMCTrack.h:172
CbmKresTemperature::fHistoList_MC
vector< TH1 * > fHistoList_MC
Definition: CbmKresTemperature.h:36
CbmKresTemperature::Init
void Init()
Definition: CbmKresTemperature.cxx:44
CbmKresTemperature::Exec
void Exec(int fEventNumTempr)
Definition: CbmKresTemperature.cxx:68
CbmMCTrack::GetPdgCode
Int_t GetPdgCode() const
Definition: CbmMCTrack.h:70
CbmKresTemperature.h
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmKresTemperature::fGlobalTracks
TClonesArray * fGlobalTracks
Definition: CbmKresTemperature.h:31
CbmGlobalTrack.h
CbmKresTemperature::MC_pi_minus_Tempr
TH1D * MC_pi_minus_Tempr
Definition: CbmKresTemperature.h:37
CbmKresTemperature::Finish
void Finish()
Definition: CbmKresTemperature.cxx:172
CbmKresTemperature::MC_proton_Tempr
TH1D * MC_proton_Tempr
Definition: CbmKresTemperature.h:40
CbmKresTemperature::MC_pi_plus_Tempr
TH1D * MC_pi_plus_Tempr
Definition: CbmKresTemperature.h:38
CbmStsTrack.h
Data class for STS tracks.
CbmKresTemperature::MC_direct_photons_Tempr
TH1D * MC_direct_photons_Tempr
Definition: CbmKresTemperature.h:44
CbmKresTemperature::MC_pi_zero_Tempr
TH1D * MC_pi_zero_Tempr
Definition: CbmKresTemperature.h:39
CbmKresTemperature::MC_kaon_plus_Tempr
TH1D * MC_kaon_plus_Tempr
Definition: CbmKresTemperature.h:42
CbmMCTrack::GetStartVertex
void GetStartVertex(TVector3 &vertex) const
Definition: CbmMCTrack.h:182
CbmKresTemperature::fStsTracks
TClonesArray * fStsTracks
Definition: CbmKresTemperature.h:32
CbmKresTemperature::fMcTracks
TClonesArray * fMcTracks
Definition: CbmKresTemperature.h:30
CbmMCTrack::GetPt
Double_t GetPt() const
Definition: CbmMCTrack.h:99
CbmMCTrack::GetRapidity
Double_t GetRapidity() const
Definition: CbmMCTrack.cxx:177
CbmKresTemperature::~CbmKresTemperature
virtual ~CbmKresTemperature()
Definition: CbmKresTemperature.cxx:42
CbmKresTemperature::InitHistograms
void InitHistograms()
Definition: CbmKresTemperature.cxx:204
CbmMCTrack.h
v
__m128 v
Definition: L1/vectors/P4_F32vec4.h:1
CbmMCTrack
Definition: CbmMCTrack.h:34
CbmKresTemperature::MC_kaon_zero_Tempr
TH1D * MC_kaon_zero_Tempr
Definition: CbmKresTemperature.h:41
CbmKresTemperature::CbmKresTemperature
CbmKresTemperature()
Definition: CbmKresTemperature.cxx:28
CbmKresTemperature::MC_kaon_minus_Tempr
TH1D * MC_kaon_minus_Tempr
Definition: CbmKresTemperature.h:43