BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
invMass_2d.C
Go to the documentation of this file.
1
2#include "TFile.h"
3#include "TH1F.h"
4#include "TTreeReader.h"
5#include "TTreeReaderValue.h"
6// #include "BmnParticlePair.h"
7
8// best without norming for dca2 and dca12
29
32
34
35void invMass_2d(TString inputFileName = "/zfs/store6.hydra.local/merts/h3l_pairs/h3l_pairs_8306_ev1_p9.root",
36 TString outputFileName = "/zfs/store6.hydra.local/merts/h3l_plots/h3l_plots_7830_ev0_p17.root")
37{
38
39 if (gSystem->AccessPathName(inputFileName))
40 return;
41
42 TH1F* hInvMass = new TH1F("hInvMass", "; M; Count", nBins, invMassMin, invMassMax);
43 TH2F* hM_p1 = new TH2F("hM_p1", "; Mom1; M", nBins, mom1Min, mom1Max, nBins, invMassMin, invMassMax);
44 TH2F* hM_p2 = new TH2F("hM_p2", "; Mom2; M", nBins, mom2Min, mom2Max, nBins, invMassMin, invMassMax);
45 TH2F* hM_dca0 = new TH2F("hM_dca0", "; DCA0; M", nBins, dca0Min, dca0Max, nBins, invMassMin, invMassMax);
46 TH2F* hM_dca12 = new TH2F("hM_dca12", "; DCA12; M", nBins, 0, 1, nBins, invMassMin, invMassMax);
47 TH2F* hM_dca1 = new TH2F("hM_dca1", "; DCA1; M", nBins, 0, 3, nBins, invMassMin, invMassMax);
48 TH2F* hM_dca2 = new TH2F("hM_dca2", "; DCA2; M", nBins, 0, 4, nBins, invMassMin, invMassMax);
49 TH2F* hM_path = new TH2F("hM_path", "; path; M", nBins, pathMin, pathMax, nBins, invMassMin, invMassMax);
50 TH2F* hM_p1p2 = new TH2F("hM_p1p2", "; Mom1/Mom2; M", nBins, m1m2Min, m1m2Max, nBins, invMassMin, invMassMax);
51 TH2F* hM_m400 = new TH2F("hM_m400", "; mass2 in tof400; M", nBins, 1.4, 2.6, nBins, invMassMin, invMassMax);
52 TH2F* hM_dedx = new TH2F("hM_dedx", "; dE/dx; M", nBins, dedxMin, dedxMax, nBins, invMassMin, invMassMax);
53 TH2F* hM_m700 = new TH2F("hM_m700", "; mass2 in tof700; M", nBins, 1.4, 2.6, nBins, invMassMin, invMassMax);
54 TH2F* hM_nH1fsd = new TH2F("hM_nH1fsd", "; N FSD hits in track1; M", 5, 0, 5, nBins, invMassMin, invMassMax);
55 TH2F* hM_nH2fsd = new TH2F("hM_nH2fsd", "; N FSD hits in track2; M", 5, 0, 5, nBins, invMassMin, invMassMax);
56 TH2F* hM_nH1gem = new TH2F("hM_nH1gem", "; N GEM hits in track1; M", 8, 0, 8, nBins, invMassMin, invMassMax);
57 TH2F* hM_nH2gem = new TH2F("hM_nH2gem", "; N GEM hits in track2; M", 8, 0, 8, nBins, invMassMin, invMassMax);
58 TH2F* hM_dca12norm =
59 new TH2F("hM_dca12norm", "; DCA12 / dDca12; M", nBins, dca12Min, dca12Max, nBins, invMassMin, invMassMax);
60 TH2F* hM_dca1norm = new TH2F("hM_dca1norm", "; DCA1 / dDca1; M", nBins, 0, 10, nBins, invMassMin, invMassMax);
61 TH2F* hM_dca2norm =
62 new TH2F("hM_dca2norm", "; DCA2 / dDca2; M", nBins, dca2Min, dca2Max, nBins, invMassMin, invMassMax);
63 TH2F* hM_chi1 = new TH2F("hM_chi1", "; #chi^{2}/NDF for track1; M", nBins, 0, 5, nBins, invMassMin, invMassMax);
64 TH2F* hM_chi2 = new TH2F("hM_chi2", "; #chi^{2}/NDF for track2; M", nBins, 0, 5, nBins, invMassMin, invMassMax);
65 TH2F* hM_v0x = new TH2F("hM_v0x", "; V0x, cm; M", nBins, -5, 5, nBins, invMassMin, invMassMax);
66 TH2F* hM_v0y = new TH2F("hM_v0y", "; V0y, cm; M", nBins, -5, 5, nBins, invMassMin, invMassMax);
67 TH2F* hM_v0z = new TH2F("hM_v0z", "; V0z, cm; M", nBins, -1, 30, nBins, invMassMin, invMassMax);
68 TH2F* hTof400m2_dedx = new TH2F("hTof400m2_dedx", "; mass2 in tof400; dE/dx", 500, 0, 10, 500, dedxMin, dedxMax);
69 TH2F* hTof700m2_dedx = new TH2F("hTof700m2_dedx", "; mass2 in tof700; dE/dx", 500, 0, 10, 500, dedxMin, dedxMax);
70 TH2F* hP1_P2 = new TH2F("hP1_P2", "; Mom2; Mom1", 200, 0, 1, 200, 0, 10);
71
72 cout << "File: " << inputFileName << endl;
73 TFile* myFile = TFile::Open(inputFileName, "READ");
74
75 TTreeReader myReader("bmndata", myFile);
76 TTreeReaderArray<BmnParticlePair> pairs(myReader, "pairs");
77
78 int evId = 0;
79
80 while (myReader.Next()) {
81 if (evId % 1000 == 0)
82 printf("evId = %d\n", evId);
83 evId++;
84 for (BmnParticlePair pair : pairs) {
85
86 Double_t m400 = pair.GetMass400Part1();
87 Double_t m700 = pair.GetMass700Part1();
88 Double_t dedx = pair.GetAlpha();
89 hTof400m2_dedx->Fill(m400, dedx);
90 hTof700m2_dedx->Fill(m700, dedx);
91 Double_t massTof = -1000.0;
92 if (m700 > 0)
93 massTof = m700;
94 else if (m400 > 0)
95 massTof = m400;
96 else
97 continue;
98
99 Double_t mass = pair.GetInvMass();
100 if (mass > invMassMax)
101 continue;
102 if (mass < invMassMin)
103 continue;
104
105 Int_t nH1fsd = pair.GetNHitsPart1("SILICON");
106 Int_t nH2fsd = pair.GetNHitsPart2("SILICON");
107 Int_t nH1gem = pair.GetNHitsPart1("GEM");
108 Int_t nH2gem = pair.GetNHitsPart2("GEM");
109 // if (nH1fsd < 0) continue;
110 if (nH2fsd < 1)
111 continue;
112 // if (nH1gem < 0) continue;
113 if (nH2gem < 3)
114 continue;
115
116 Double_t mom1 = pair.GetMomPart1();
117 Double_t mom2 = pair.GetMomPart2();
118 Double_t m1m2 = mom1 / TMath::Abs(mom2);
119 Double_t path = pair.GetPath();
120 Double_t dca0 = pair.GetDCA0();
121 Double_t dca12 = pair.GetDCA12();
122 Double_t dca1 = pair.GetDCA1();
123 Double_t dca2 = pair.GetDCA2();
124
125 Double_t dca1norm = pair.GetDCA1() / pair.GetdDCA1();
126 Double_t dca2norm = pair.GetDCA2() / pair.GetdDCA2();
127 Double_t dca12norm = pair.GetDCA12() / pair.GetdDCA12();
128 Double_t chi1 = pair.GetChi2Part1();
129 Double_t chi2 = pair.GetChi2Part2();
130 Double_t v0x = pair.GetV0X();
131 Double_t v0y = pair.GetV0Y();
132 Double_t v0z = pair.GetV0Z();
133
134 if (path < pathMin || path > pathMax)
135 continue;
136 if (dca1norm < dca1Min || dca1norm > dca1Max)
137 continue;
138 if (dca2norm < dca2Min || dca2norm > dca2Max)
139 continue;
140 if (dca12norm < dca12Min || dca12norm > dca12Max)
141 continue;
142 // if (dedx < dedxMin || dedx > dedxMax) continue;
143 if (massTof < mTOFMin || massTof > mTOFMax)
144 continue;
145 if (mom1 < mom1Min || mom1 > mom1Max)
146 continue;
147 if (mom2 < mom2Min || mom2 > mom2Max)
148 continue;
149 if (m1m2 < m1m2Min || m1m2 > m1m2Max)
150 continue;
151 if (dca0 < dca0Min || dca0 > dca0Max)
152 continue;
153
154 hInvMass->Fill(mass);
155 hM_p1->Fill(mom1, mass);
156 hM_p2->Fill(mom2, mass);
157 hM_dca0->Fill(dca0, mass);
158 hM_dca12->Fill(dca12, mass);
159 hM_dca1->Fill(dca1, mass);
160 hM_dca2->Fill(dca2, mass);
161 hM_path->Fill(path, mass);
162 hM_m400->Fill(m400, mass);
163 hM_m700->Fill(m700, mass);
164 hM_p1p2->Fill(m1m2, mass);
165 hM_nH1fsd->Fill(nH1fsd, mass);
166 hM_nH2fsd->Fill(nH2fsd, mass);
167 hM_nH1gem->Fill(nH1gem, mass);
168 hM_nH2gem->Fill(nH2gem, mass);
169 hM_dca12norm->Fill(dca12norm, mass);
170 hM_dca1norm->Fill(dca1norm, mass);
171 hM_dca2norm->Fill(dca2norm, mass);
172 hM_chi1->Fill(chi1, mass);
173 hM_chi2->Fill(chi2, mass);
174 hM_v0x->Fill(v0x, mass);
175 hM_v0y->Fill(v0y, mass);
176 hM_v0z->Fill(v0z, mass);
177 hM_dedx->Fill(dedx, mass);
178 hP1_P2->Fill(TMath::Abs(mom2), mom1);
179 }
180 }
181 myFile->Close();
182
183 TFile outFile(outputFileName, "RECREATE");
184 hInvMass->Write();
185 hM_p1->Write();
186 hM_p2->Write();
187 hM_dca0->Write();
188 hM_dca12->Write();
189 hM_dca1->Write();
190 hM_dca2->Write();
191 hM_path->Write();
192 hM_p1p2->Write();
193 hM_m400->Write();
194 hM_m700->Write();
195 hM_dedx->Write();
196 hM_nH1fsd->Write();
197 hM_nH2fsd->Write();
198 hM_nH1gem->Write();
199 hM_nH2gem->Write();
200 hM_dca12norm->Write();
201 hM_dca1norm->Write();
202 hM_dca2norm->Write();
203 hM_chi1->Write();
204 hM_chi2->Write();
205 hM_v0x->Write();
206 hM_v0y->Write();
207 hM_v0z->Write();
208 hTof400m2_dedx->Write();
209 hTof700m2_dedx->Write();
210 hP1_P2->Write();
211
212 outFile.Close();
213}
int Int_t
float Float_t
double Double_t
R__EXTERN TSystem * gSystem
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
void Close(Option_t *option="") override
virtual Int_t Fill(const char *name, Double_t w)
virtual Int_t Fill(const char *namex, const char *namey, Double_t w)
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Float_t pathMin
Definition invMass_2d.C:9
Float_t invMassMax
Definition invMass_2d.C:31
Float_t mom2Min
Definition invMass_2d.C:21
Float_t dca12Max
Definition invMass_2d.C:14
Float_t dca1Max
Definition invMass_2d.C:28
Float_t dca2Max
Definition invMass_2d.C:12
Float_t dca0Max
Definition invMass_2d.C:26
Float_t invMassMin
Definition invMass_2d.C:30
Float_t dca0Min
Definition invMass_2d.C:25
Float_t dca1Min
Definition invMass_2d.C:27
Float_t dca12Min
Definition invMass_2d.C:13
Float_t mom1Min
Definition invMass_2d.C:19
Float_t dca2Min
Definition invMass_2d.C:11
Float_t mom1Max
Definition invMass_2d.C:20
Float_t pathMax
Definition invMass_2d.C:10
Float_t mom2Max
Definition invMass_2d.C:22
Float_t m1m2Max
Definition invMass_2d.C:24
Float_t dedxMin
Definition invMass_2d.C:15
Float_t mTOFMax
Definition invMass_2d.C:18
Float_t mTOFMin
Definition invMass_2d.C:17
Float_t m1m2Min
Definition invMass_2d.C:23
Float_t dedxMax
Definition invMass_2d.C:16
void invMass_2d(TString inputFileName="/zfs/store6.hydra.local/merts/h3l_pairs/h3l_pairs_8306_ev1_p9.root", TString outputFileName="/zfs/store6.hydra.local/merts/h3l_plots/h3l_plots_7830_ev0_p17.root")
Definition invMass_2d.C:35
Double_t Abs(Double_t d)