Belle II Software development
HadronBgPrep Class Reference

Class to prepare sample for fitting in beta gamma bins. More...

#include <HadronBgPrep.h>

Public Member Functions

 HadronBgPrep ()
 Constructor: Sets the description, the properties and the parameters of the algorithm.
 
virtual ~HadronBgPrep ()
 Destructor.
 
 HadronBgPrep (int bgbins, double upperbg, double lowerbg, int cosbins, double uppercos, double lowercos, int injbins, double lowerinj, double upperinj, int nhitbins, double lowernhit, double uppernhit, double cut)
 Constructor: set the input variables.
 
void prepareSample (std::shared_ptr< TTree > hadron, TFile *&outfile, const std::string &suffix, const std::string &bgcurvefile, const std::string &bgsigmafile, const std::string &pdg, bool ismakePlots)
 function to prepare sample for monitoring plots, bg curve fitting and sigma vs ionz fitting
 
void defineHisto (std::vector< TH1F * > &htemp, const std::string &svar, const std::string &stype, const std::string &pdg)
 function to define histograms
 
void plotDist (std::map< int, std::vector< TH1F * > > &hist, const std::string &suffix, int bins)
 function to plot the map of histograms
 
void plotDist (std::vector< TH1F * > &hist, const std::string &suffix, int nbins)
 function to plot the histograms
 
void setPars (TFile *&outfile, std::string pdg, std::vector< TH1F * > &hdedx_bg, std::vector< TH1F * > &hchi_bg, std::vector< TH1F * > &hionzsigma_bg, std::map< int, std::vector< TH1F * > > &hchi_inj)
 function to fill the parameters like mean and reso in the tree
 
void fitGaussianWRange (TH1F *&temphist, gstatus &status, double sigmaR)
 function to perform gauss fit for input histogram
 
void fit (TH1F *&hist, const std::string &pdg, gstatus &status)
 function to fit the histograms
 
void printCanvasCos (std::map< int, std::vector< TH1F * > > &hchicos_allbg, std::map< int, std::vector< TH1F * > > &hchicos_1by3bg, std::map< int, std::vector< TH1F * > > &hchicos_2by3bg, std::map< int, std::vector< TH1F * > > &hchicos_3by3bg, const std::string &particle, const std::string &suffix)
 function to draw the dedx vs costh histograms
 
void FormatGraph (TGraphErrors &gr, int flag, const std::string &name="")
 function to set graph cosmetics
 
void clearVars ()
 function to clear the variables
 
void deleteHistos (std::vector< TH1F * > &htemp)
 function to delete the histograms
 
double getParticleMass (const std::string &particle)
 function to get the particle mass
 

Private Attributes

std::vector< double > m_sumcos
 variables to add cos values
 
std::vector< double > m_sumbg
 variables to add bg values
 
std::vector< double > m_sumres_square
 variables to add square of resolution
 
std::vector< double > m_suminj
 variables to add injection time
 
std::vector< double > m_means
 mean variable
 
std::vector< double > m_errors
 error variable
 
std::vector< int > m_sumsize
 size of the bg bins
 
std::vector< int > m_injsize
 size of the injection bins
 
int m_bgBins
 bins for bg
 
double m_bgMin
 min range of bg
 
double m_bgMax
 max range of bg
 
int m_injBins
 bins for injection time
 
double m_injMin
 min range of injection time
 
double m_injMax
 max range of injection time
 
int m_cosBins
 bins for cosine
 
double m_cosMin
 min range of cosine
 
double m_cosMax
 max range of cosine
 
int m_nhitBins
 bins for nhits
 
double m_nhitMin
 min range of nhits
 
double m_nhitMax
 max range of nhits
 
double m_cut
 cut to clean protons
 

Detailed Description

Class to prepare sample for fitting in beta gamma bins.

Definition at line 43 of file HadronBgPrep.h.

Constructor & Destructor Documentation

◆ HadronBgPrep() [1/2]

Constructor: Sets the description, the properties and the parameters of the algorithm.

Definition at line 12 of file HadronBgPrep.cc.

13{
14 m_bgBins = 15;
15 m_bgMin = 0.1;
16 m_bgMax = 40;
17 m_cosBins = 18;
18 m_cosMin = -1.0;
19 m_cosMax = 1.0;
20 m_injBins = 20;
21 m_injMin = 0;
22 m_injMax = 80000;
23 m_nhitBins = 10;
24 m_nhitMin = 7;
25 m_nhitMax = 39;
26 m_cut = 0.5;
27}
int m_nhitBins
bins for nhits
int m_injBins
bins for injection time
int m_cosBins
bins for cosine
double m_cosMax
max range of cosine
int m_bgBins
bins for bg
double m_injMax
max range of injection time
double m_nhitMax
max range of nhits
double m_injMin
min range of injection time
double m_bgMax
max range of bg
double m_bgMin
min range of bg
double m_cosMin
min range of cosine
double m_cut
cut to clean protons
double m_nhitMin
min range of nhits

◆ ~HadronBgPrep()

virtual ~HadronBgPrep ( )
inlinevirtual

Destructor.

Definition at line 55 of file HadronBgPrep.h.

55{};

◆ HadronBgPrep() [2/2]

HadronBgPrep ( int bgbins,
double upperbg,
double lowerbg,
int cosbins,
double uppercos,
double lowercos,
int injbins,
double lowerinj,
double upperinj,
int nhitbins,
double lowernhit,
double uppernhit,
double cut )

Constructor: set the input variables.

Definition at line 28 of file HadronBgPrep.cc.

30{
31 m_bgBins = bgbins;
32 m_bgMin = lowerbg;
33 m_bgMax = upperbg;
34 m_cosBins = cosbins;
35 m_cosMin = lowercos;
36 m_cosMax = uppercos;
37 m_injBins = injbins;
38 m_injMin = lowerinj;
39 m_injMax = upperinj;
40 m_nhitBins = nhitbins;
41 m_nhitMin = lowernhit;
42 m_nhitMax = uppernhit;
43 m_cut = cut;
44}

Member Function Documentation

◆ clearVars()

void clearVars ( )
inline

function to clear the variables

Definition at line 138 of file HadronBgPrep.h.

139 {
140 m_sumcos.clear();
141 m_sumbg.clear();
142 m_sumres_square.clear();
143 m_sumsize.clear();
144 m_means.clear();
145 m_errors.clear();
146 m_suminj.clear();
147 }

◆ defineHisto()

void defineHisto ( std::vector< TH1F * > & htemp,
const std::string & svar,
const std::string & stype,
const std::string & pdg )

function to define histograms

Definition at line 249 of file HadronBgPrep.cc.

250{
251 int nbdEdx = 200, nbchi = 200;
252 double dedxMax = 20.0;
253
254 if (pdg == "pion") {
255 nbdEdx = 400, dedxMax = 4.0;
256 } else if (pdg == "kaon") {
257 nbdEdx = 500, dedxMax = 5.0;
258 } else if (pdg == "proton") {
259 nbdEdx = 1500, dedxMax = 30.0;
260 nbchi = 350;
261 } else if (pdg == "muon") {
262 nbdEdx = 300, dedxMax = 3.0;
263 } else if (pdg == "electron") {
264 nbdEdx = 200, dedxMax = 2.0;
265 }
266
267 int bins;
268 double min, max;
269
270 if (stype == "bg") bins = m_bgBins, min = m_bgMin, max = m_bgMax ;
271 else if (stype == "inj_0" || stype == "inj_1") bins = m_injBins, min = m_injMin, max = m_injMax ;
272 else if (stype == "nhit") bins = m_nhitBins, min = m_nhitMin, max = m_nhitMax ;
273 else bins = m_cosBins, min = m_cosMin, max = m_cosMax ;
274
275 double step = (max - min) / bins;
276 if (stype == "nhit") step = (max - min + 1) / bins;
277
278 for (int j = 0; j < bins; ++j) {
279
280 double start = min + j * step;
281 double end = start + step;
282 if (stype == "nhit") end = int((start + step) * 0.99999);
283
284 // initialize the histograms
285 std::string histname = Form("%s_%s_%s_%d", pdg.data(), svar.data(), stype.data(), j);
286 std::string title = Form("%s_%s_%s (%.02f, %.02f)", pdg.data(), svar.data(), stype.data(), start, end);
287
288 if (svar == "dedx")
289 htemp.push_back(new TH1F(histname.data(), title.data(), nbdEdx, 0, dedxMax));
290 else if (svar == "chi")
291 htemp.push_back(new TH1F(histname.data(), title.data(), nbchi, -10.0, 10.0));
292 else
293 htemp.push_back(new TH1F(histname.data(), title.data(), 300, -3.0, 3.0));
294
295 htemp[j]->GetXaxis()->SetTitle(Form("%s", svar.data()));
296 htemp[j]->GetYaxis()->SetTitle("Entries");
297 }
298}

◆ deleteHistos()

void deleteHistos ( std::vector< TH1F * > & htemp)
inline

function to delete the histograms

Definition at line 152 of file HadronBgPrep.h.

153 {
154 for (auto& hist : htemp) hist->Delete();
155 }

◆ fit()

void fit ( TH1F *& hist,
const std::string & pdg,
gstatus & status )

function to fit the histograms

Definition at line 495 of file HadronBgPrep.cc.

496{
497
498 if (pdg == "pion") fitGaussianWRange(hist, status, 1.0);
499 else fitGaussianWRange(hist, status, 2.0);
500
501 hist->SetFillColorAlpha(kAzure + 1, 0.30);
502
503 if (status == OK) {
504 double mean = hist->GetFunction("gaus")->GetParameter(1);
505 double meanerr = hist->GetFunction("gaus")->GetParError(1);
506 double width = hist->GetFunction("gaus")->GetParameter(2);
507
508 std::string title = Form("#mu_{fit}: %0.03f #pm %0.03f, #sigma_{fit}: %0.03f", mean, meanerr, width);
509 hist->SetTitle(Form("%s, %s", hist->GetTitle(), title.data()));
510 }
511
512}
void fitGaussianWRange(TH1F *&temphist, gstatus &status, double sigmaR)
function to perform gauss fit for input histogram

◆ fitGaussianWRange()

void fitGaussianWRange ( TH1F *& temphist,
gstatus & status,
double sigmaR )

function to perform gauss fit for input histogram

Definition at line 515 of file HadronBgPrep.cc.

516{
517 double histmean = temphist->GetMean();
518 double histrms = temphist->GetRMS();
519 temphist->GetXaxis()->SetRangeUser(histmean - 5.0 * histrms, histmean + 5.0 * histrms);
520
521 int fs = temphist->Fit("gaus", "Q");
522 if (fs != 0) {
523 B2INFO(Form("\tFit (round 1) for hist (%s) failed (status = %d)", temphist->GetName(), fs));
524 status = Failed;
525 return;
526 } else {
527 double mean = temphist->GetFunction("gaus")->GetParameter(1);
528 double width = temphist->GetFunction("gaus")->GetParameter(2);
529 temphist->GetXaxis()->SetRangeUser(mean - 5.0 * width, mean + 5.0 * width);
530 fs = temphist->Fit("gaus", "QR", "", mean - sigmaR * width, mean + sigmaR * width);
531 if (fs != 0) {
532 B2INFO(Form("\tFit (round 2) for hist (%s) failed (status = %d)", temphist->GetName(), fs));
533 status = Failed;
534 return;
535 } else {
536 temphist->GetXaxis()->SetRangeUser(mean - 5.0 * width, mean + 5.0 * width);
537 B2INFO(Form("\tFit for hist (%s) successful (status = %d)", temphist->GetName(), fs));
538 status = OK;
539 }
540 }
541}

◆ FormatGraph()

void FormatGraph ( TGraphErrors & gr,
int flag,
const std::string & name = "" )
inline

function to set graph cosmetics

Definition at line 110 of file HadronBgPrep.h.

111 {
112 if (flag == 0) {
113 gr.SetTitle(Form("%s;cos(#theta);#chi_{mean}", name.data()));
114 gr.SetMarkerStyle(24);
115 gr.SetMarkerColor(2);
116 gr.SetMarkerSize(.7);
117 gr.SetMaximum(1.0);
118 gr.SetMinimum(-1.0);
119 gr.GetXaxis()->SetRangeUser(-1, 1);
120 } else if (flag == 1) {
121 gr.SetMarkerStyle(22);
122 gr.SetMarkerColor(9);
123 gr.SetMarkerSize(.7);
124 } else if (flag == 2) {
125 gr.SetTitle(Form("%s;cos(#theta);#sigma", name.data()));
126 gr.SetMarkerStyle(24);
127 gr.SetMarkerColor(2);
128 gr.SetMarkerSize(.7);
129 gr.SetMaximum(2);
130 gr.SetMinimum(0);
131 gr.GetXaxis()->SetRangeUser(-1, 1);
132 }
133 }

◆ getParticleMass()

double getParticleMass ( const std::string & particle)
inline

function to get the particle mass

Definition at line 160 of file HadronBgPrep.h.

161 {
162 double mass;
163 if (particle == "pion") mass = Const::pion.getMass();
164 else if (particle == "kaon") mass = Const::kaon.getMass();
165 else if (particle == "proton") mass = Const::proton.getMass();
166 else if (particle == "muon") mass = Const::muon.getMass();
167 else if (particle == "electron") mass = Const::electron.getMass();
168 else mass = 0.0;
169 return mass;
170 }

◆ plotDist() [1/2]

void plotDist ( std::map< int, std::vector< TH1F * > > & hist,
const std::string & suffix,
int bins )

function to plot the map of histograms

Definition at line 301 of file HadronBgPrep.cc.

302{
303
304 TCanvas ctmp(Form("cdcdedx_%s", sname.data()), "", 1200, 600);
305 ctmp.Divide(2, 1);
306 ctmp.SetBatch(kTRUE);
307
308 std::stringstream psname;
309 psname << Form("plots/HadronPrep/%s.pdf[", sname.data());
310 ctmp.Print(psname.str().c_str());
311 psname.str("");
312 psname << Form("plots/HadronPrep/%s.pdf", sname.data());
313 for (int j = 0; j < bins; ++j) {
314
315 for (int i = 0 ; i < 2; ++i) {
316 ctmp.cd(i + 1);
317 hist[i][j]->SetFillColorAlpha(i + 5, 0.25);
318 hist[i][j]->Draw();
319 }
320 ctmp.Print(psname.str().c_str());
321 }
322 psname.str("");
323 psname << Form("plots/HadronPrep/%s.pdf]", sname.data());
324 ctmp.Print(psname.str().c_str());
325}

◆ plotDist() [2/2]

void plotDist ( std::vector< TH1F * > & hist,
const std::string & suffix,
int nbins )

function to plot the histograms

Definition at line 328 of file HadronBgPrep.cc.

329{
330
331 TCanvas ctmp(Form("cdcdedx_%s", sname.data()), "", 1200, 1200);
332 ctmp.Divide(2, 2);
333 ctmp.SetBatch(kTRUE);
334
335 std::stringstream psname;
336 psname << Form("plots/HadronPrep/%s.pdf[", sname.data());
337 ctmp.Print(psname.str().c_str());
338 psname.str("");
339 psname << Form("plots/HadronPrep/%s.pdf", sname.data());
340
341 for (int i = 0 ; i < nbins; ++i) {
342 ctmp.cd(i % 4 + 1);
343 hist[i]->SetFillColor(kYellow - 9);
344 hist[i]->Draw();
345
346 if ((i + 1) % 4 == 0 || (i + 1) == nbins) {
347 ctmp.Print(psname.str().c_str());
348 ctmp.Clear("D");
349 }
350 }
351 psname.str("");
352 psname << Form("plots/HadronPrep/%s.pdf]", sname.data());
353 ctmp.Print(psname.str().c_str());
354}

◆ prepareSample()

void prepareSample ( std::shared_ptr< TTree > hadron,
TFile *& outfile,
const std::string & suffix,
const std::string & bgcurvefile,
const std::string & bgsigmafile,
const std::string & pdg,
bool ismakePlots )

function to prepare sample for monitoring plots, bg curve fitting and sigma vs ionz fitting

Definition at line 46 of file HadronBgPrep.cc.

49{
50
51 std::vector<TH1F*> hdedx_bg, hchi_bg, hionzsigma_bg;
52 std::map<int, std::vector<TH1F*>> hchi_inj, hchicos_allbg, hchicos_1by3bg, hchicos_2by3bg, hchicos_3by3bg;
53
54 //define histograms
55 defineHisto(hdedx_bg, "dedx", "bg", pdg.data());
56 defineHisto(hchi_bg, "chi", "bg", pdg.data());
57 defineHisto(hionzsigma_bg, "ionzsigma", "bg", pdg.data());
58 for (int i = 0; i < 2; ++i) {
59
60 defineHisto(hchi_inj[i], "chi", Form("inj_%d", i), pdg.data());
61
62 std::string charge = "pos";
63 if (i == 1) charge = "neg";
64
65 defineHisto(hchicos_allbg[i], "chi", Form("%s_allbg_cos", charge.data()), pdg.data());
66 defineHisto(hchicos_1by3bg[i], "chi", Form("%s_1b3bg_cos", charge.data()), pdg.data());
67 defineHisto(hchicos_2by3bg[i], "chi", Form("%s_2b3bg_cos", charge.data()), pdg.data());
68 defineHisto(hchicos_3by3bg[i], "chi", Form("%s_3b3bg_cos", charge.data()), pdg.data());
69 }
70
71
72 // Create some containers to calculate averages
73 for (int i = 0; i < m_bgBins; ++i) {
74 m_sumcos.push_back(0.);
75 m_sumbg.push_back(0.);
76 m_sumres_square.push_back(0.);
77 m_sumsize.push_back(0.);
78 m_means.push_back(0.);
79 m_errors.push_back(0.);
80 }
81
82 for (int i = 0; i < m_injBins; ++i) {
83 m_injsize.push_back(0.);
84 m_suminj.push_back(0.);
85 }
86
87 // --------------------------------------------------
88 // LOOP OVER EVENTS AND FILL CONTAINERS
89 // --------------------------------------------------
90 // Fill the histograms to be fitted
91
92 double dedxnosat; // dE/dx w/o HS correction (use to get new parameters)
93 double p; // track momentum
94 double costh; // cosine of track polar angle
95 double timereso;
96 int nhit; // number of hits on this track
97 double injtime; //injection time
98 double isher;
99 int charge;
100
101 hadron->SetBranchAddress("dedxnosat", &dedxnosat); //must be without any HS correction
102 hadron->SetBranchAddress("p", &p);
103 hadron->SetBranchAddress("costh", &costh);
104 hadron->SetBranchAddress("timereso", &timereso);
105 hadron->SetBranchAddress("nhits", &nhit);
106 hadron->SetBranchAddress("injtime", &injtime);
107 hadron->SetBranchAddress("injring", &isher);
108 hadron->SetBranchAddress("charge", &charge);
109
110 double mass = getParticleMass(pdg);
111 if (mass == 0.0) B2FATAL("Mass of particle " << pdg.data() << " is zero");
112
113 const double cosstep = (m_cosMax - m_cosMin) / m_cosBins;
114 const double tstep = (m_injMax - m_injMin) / m_injBins;
115
116 CDCDedxMeanPred mbg;
117 mbg.setParameters(bgcurvefile);
118 CDCDedxSigmaPred sbg;
119 sbg.setParameters(bgsigmafile);
120
121 CDCDedxHadSat had;
122 had.setParameters("sat-pars.fit.txt");
123
124 unsigned int entries = hadron->GetEntries();
125
126 for (unsigned int index = 0; index < entries; ++index) {
127
128 hadron->GetEntry(index);
129
130 int chg = (charge < 0) ? 1 : 0;
131 double bg = fabs(p) / mass;
132
133 // clean up bad events and restrict the momentum range
134 if (nhit < 0 || nhit > 100)continue;
135 if (injtime <= 0 || isher < 0)continue;
136
137 if (dedxnosat <= 0)continue;
138 if (costh != costh)continue;
139 if (bg < m_bgMin || bg > m_bgMax)continue;
140
141 if (fabs(p) > 7.0)continue;
142
143 if (pdg == "proton") if ((dedxnosat - 0.45) * abs(p) * abs(p) < m_cut)continue;
144
145 int bgBin = static_cast<int>((bg - m_bgMin) / (m_bgMax - m_bgMin) * m_bgBins);
146 bgBin = std::min(m_bgBins - 1, std::max(0, bgBin));
147
148 if (bgBin >= m_bgBins) {
149 B2WARNING("bgBin out of range: " << bgBin
150 << " (valid range: 0-" << (m_bgBins - 1) << ")");
151 }
152
153 double dedx_new = had.D2I(costh, had.I2D(costh, 1.0) * dedxnosat);
154
155 hdedx_bg[bgBin]->Fill(dedx_new);
156
157 //get predicted value of dEdx mean
158 double dedx_cur = mbg.getMean(bg);
159 double dedx_res = sbg.getSigma(dedx_new, nhit, costh, timereso);
160
161 if (dedx_res == 0) {
162 B2INFO("RESOLUTION IS ZERO!!!");
163 continue;
164 }
165
166 //Modified chi_new values
167 double chi_new = (dedx_new - dedx_cur) / dedx_res;
168
169 hchi_bg[bgBin]->Fill(chi_new);
170
171 double ionz_res = sbg.cosPrediction(costh) * sbg.nhitPrediction(nhit) * timereso;
172
173 if (ionz_res == 0) {
174 B2INFO("RESOLUTION costh * nhit * timereso IS ZERO!!!");
175 continue;
176 }
177
178 hionzsigma_bg[bgBin]->Fill((dedx_new - dedx_cur) / ionz_res);
179
180 m_sumcos[bgBin] += costh;
181 m_sumbg[bgBin] += bg;
182 m_sumres_square[bgBin] += pow(dedx_res, 2);
183 m_sumsize[bgBin] += 1;
184
185 // make histograms of dE/dx vs. cos(theta) for validation
186 int icos = static_cast<int>((costh + 1) / cosstep);
187 if (icos >= m_cosBins) {
188 B2WARNING("cosBin (icos) out of range: " << icos
189 << " (valid range: 0-" << (m_cosBins - 1) << ")");
190 }
191 icos = std::min(m_cosBins - 1, icos);
192
193 hchicos_allbg[chg][icos]->Fill(chi_new);
194
195 if (bgBin <= int(m_bgBins / 3)) hchicos_1by3bg[chg][icos]->Fill(chi_new);
196 else if (bgBin <= int(2 * m_bgBins / 3)) hchicos_2by3bg[chg][icos]->Fill(chi_new);
197 else hchicos_3by3bg[chg][icos]->Fill(chi_new);
198
199 if (injtime > m_injMax) injtime = m_injMax - 10.0;
200 int wr = 0;
201 if (isher > 0.5) wr = 1;
202 int injBin = static_cast<int>((injtime - m_injMin) / tstep);
203 if (injBin >= m_injBins) {
204 B2WARNING("injBin out of range: " << injBin
205 << " (valid range: 0-" << (m_injBins - 1) << ")");
206 }
207 injBin = std::min(m_injBins - 1, std::max(0, injBin));
208 hchi_inj[wr][injBin]->Fill(chi_new);
209
210 m_suminj[injBin] += injtime;
211 m_injsize[injBin] += 1;
212
213 } // end of event loop
214
215 // --------------------------------------------------
216 // FIT IN BINS OF BETA-GAMMA AND COS(THETA)
217 // --------------------------------------------------
218 // fit the histograms with Gaussian functions
219 // and extract the means and errors
220
221 setPars(outfile, pdg, hdedx_bg, hchi_bg, hionzsigma_bg, hchi_inj);
222
223 // Plot the histograms
224 if (ismakePlots) {
225
226 plotDist(hdedx_bg, Form("fits_dedx_inbg_%s_%s", suffix.data(), pdg.data()), m_bgBins);
227 plotDist(hchi_bg, Form("fits_chi_inbg_%s_%s", suffix.data(), pdg.data()), m_bgBins);
228 plotDist(hionzsigma_bg, Form("fits_ionzreso_inbg_%s_%s", suffix.data(), pdg.data()), m_bgBins);
229 plotDist(hchi_inj, Form("fits_chi_ininj_%s_%s", suffix.data(), pdg.data()), m_injBins);
230 printCanvasCos(hchicos_allbg, hchicos_1by3bg, hchicos_2by3bg, hchicos_3by3bg, pdg, suffix);
231 }
232
233 // delete histograms
234 clearVars();
235 deleteHistos(hdedx_bg);
236 deleteHistos(hchi_bg);
237 deleteHistos(hionzsigma_bg);
238 for (int i = 0; i < 2; ++i) {
239 deleteHistos(hchi_inj[i]);
240 deleteHistos(hchicos_allbg[i]);
241 deleteHistos(hchicos_1by3bg[i]);
242 deleteHistos(hchicos_2by3bg[i]);
243 deleteHistos(hchicos_3by3bg[i]);
244 }
245
246}
double I2D(double cosTheta, double I) const
hadron saturation parameterization part 2
double D2I(double cosTheta, double D) const
hadron saturation parameterization part 1
void setParameters()
set the parameters
double getMean(double bg)
Return the predicted mean value as a function of beta-gamma (bg)
void setParameters(std::string infile)
set the parameters from file
double getSigma(double dedx, double nhit, double cos, double timereso)
Return the predicted resolution depending on dE/dx, nhit, and cos(theta)
double cosPrediction(double cos)
Return sigma from the cos parameterization.
double nhitPrediction(double nhit)
Return sigma from the nhit parameterization.
void setParameters(std::string infile)
set the parameters from file
void clearVars()
function to clear the variables
void defineHisto(std::vector< TH1F * > &htemp, const std::string &svar, const std::string &stype, const std::string &pdg)
function to define histograms
std::vector< double > m_sumcos
variables to add cos values
std::vector< double > m_suminj
variables to add injection time
double getParticleMass(const std::string &particle)
function to get the particle mass
void deleteHistos(std::vector< TH1F * > &htemp)
function to delete the histograms
void printCanvasCos(std::map< int, std::vector< TH1F * > > &hchicos_allbg, std::map< int, std::vector< TH1F * > > &hchicos_1by3bg, std::map< int, std::vector< TH1F * > > &hchicos_2by3bg, std::map< int, std::vector< TH1F * > > &hchicos_3by3bg, const std::string &particle, const std::string &suffix)
function to draw the dedx vs costh histograms
std::vector< double > m_means
mean variable
std::vector< double > m_errors
error variable
std::vector< int > m_sumsize
size of the bg bins
void plotDist(std::map< int, std::vector< TH1F * > > &hist, const std::string &suffix, int bins)
function to plot the map of histograms
std::vector< double > m_sumres_square
variables to add square of resolution
void setPars(TFile *&outfile, std::string pdg, std::vector< TH1F * > &hdedx_bg, std::vector< TH1F * > &hchi_bg, std::vector< TH1F * > &hionzsigma_bg, std::map< int, std::vector< TH1F * > > &hchi_inj)
function to fill the parameters like mean and reso in the tree
std::vector< int > m_injsize
size of the injection bins
std::vector< double > m_sumbg
variables to add bg values

◆ printCanvasCos()

void printCanvasCos ( std::map< int, std::vector< TH1F * > > & hchicos_allbg,
std::map< int, std::vector< TH1F * > > & hchicos_1by3bg,
std::map< int, std::vector< TH1F * > > & hchicos_2by3bg,
std::map< int, std::vector< TH1F * > > & hchicos_3by3bg,
const std::string & particle,
const std::string & suffix )

function to draw the dedx vs costh histograms

Definition at line 547 of file HadronBgPrep.cc.

550{
551
552 std::vector<std::vector<double>> chicos(2, std::vector<double>(m_cosBins));
553 std::vector<std::vector<double>> sigmacos(2, std::vector<double>(m_cosBins));
554 std::vector<std::vector<double>> chicoserr(2, std::vector<double>(m_cosBins));
555 std::vector<std::vector<double>> sigmacoserr(2, std::vector<double>(m_cosBins));
556
557 std::vector<std::vector<double>> chicos_1b3bg(2, std::vector<double>(m_cosBins));
558 std::vector<std::vector<double>> sigmacos_1b3bg(2, std::vector<double>(m_cosBins));
559 std::vector<std::vector<double>> chicos_1b3bgerr(2, std::vector<double>(m_cosBins));
560 std::vector<std::vector<double>> sigmacos_1b3bgerr(2, std::vector<double>(m_cosBins));
561
562 std::vector<std::vector<double>> chicos_2b3bg(2, std::vector<double>(m_cosBins));
563 std::vector<std::vector<double>> sigmacos_2b3bg(2, std::vector<double>(m_cosBins));
564 std::vector<std::vector<double>> chicos_2b3bgerr(2, std::vector<double>(m_cosBins));
565 std::vector<std::vector<double>> sigmacos_2b3bgerr(2, std::vector<double>(m_cosBins));
566
567 std::vector<std::vector<double>> chicos2(2, std::vector<double>(m_cosBins));
568 std::vector<std::vector<double>> sigmacos2(2, std::vector<double>(m_cosBins));
569 std::vector<std::vector<double>> chicos2err(2, std::vector<double>(m_cosBins));
570 std::vector<std::vector<double>> sigmacos2err(2, std::vector<double>(m_cosBins));
571
572 for (int c = 0; c < 2; ++c) {
573 for (int i = 0; i < m_cosBins; ++i) {
574 if (hchicos_allbg[c][i]->Integral() > 100) {
575 gstatus allbgstat;
576 fit(hchicos_allbg[c][i], pdg.data(), allbgstat);
577 if (allbgstat == OK) {
578 chicos[c][i] = hchicos_allbg[c][i]->GetFunction("gaus")->GetParameter(1);
579 chicoserr[c][i] = hchicos_allbg[c][i]->GetFunction("gaus")->GetParError(1);
580 sigmacos[c][i] = hchicos_allbg[c][i]->GetFunction("gaus")->GetParameter(2);
581 sigmacoserr[c][i] = hchicos_allbg[c][i]->GetFunction("gaus")->GetParError(2);
582 } else { chicos[c][i] = 0.0; chicoserr[c][i] = 0.0; sigmacos[c][i] = 0.0; sigmacoserr[c][i] = 0.0;}
583 }
584
585 if (hchicos_1by3bg[c][i]->Integral() > 100) {
586 gstatus all1bgstat;
587
588 fit(hchicos_1by3bg[c][i], pdg.data(), all1bgstat);
589 if (all1bgstat == OK) {
590 chicos_1b3bg[c][i] = hchicos_1by3bg[c][i]->GetFunction("gaus")->GetParameter(1);
591 chicos_1b3bgerr[c][i] = hchicos_1by3bg[c][i]->GetFunction("gaus")->GetParError(1);
592 sigmacos_1b3bg[c][i] = hchicos_1by3bg[c][i]->GetFunction("gaus")->GetParameter(2);
593 sigmacos_1b3bgerr[c][i] = hchicos_1by3bg[c][i]->GetFunction("gaus")->GetParError(2);
594 } else { chicos_1b3bg[c][i] = 0.0; chicos_1b3bgerr[c][i] = 0.0; sigmacos_1b3bg[c][i] = 0.0; sigmacos_1b3bgerr[c][i] = 0.0;}
595
596 }
597
598 if (hchicos_2by3bg[c][i]->Integral() > 100) {
599 gstatus all2bgstat;
600 fit(hchicos_2by3bg[c][i], pdg.data(), all2bgstat);
601 if (all2bgstat == OK) {
602 chicos_2b3bg[c][i] = hchicos_2by3bg[c][i]->GetFunction("gaus")->GetParameter(1);
603 chicos_2b3bgerr[c][i] = hchicos_2by3bg[c][i]->GetFunction("gaus")->GetParError(1);
604 sigmacos_2b3bg[c][i] = hchicos_2by3bg[c][i]->GetFunction("gaus")->GetParameter(2);
605 sigmacos_2b3bgerr[c][i] = hchicos_2by3bg[c][i]->GetFunction("gaus")->GetParError(2);
606 } else { chicos_2b3bg[c][i] = 0.0; chicos_2b3bgerr[c][i] = 0.0; sigmacos_2b3bg[c][i] = 0.0; sigmacos_2b3bgerr[c][i] = 0.0;}
607
608 }
609
610 if (hchicos_3by3bg[c][i]->Integral() > 100) {
611 gstatus all3bgstat;
612 fit(hchicos_3by3bg[c][i], pdg.data(), all3bgstat);
613 if (all3bgstat == OK) {
614 chicos2[c][i] = hchicos_3by3bg[c][i]->GetFunction("gaus")->GetParameter(1);
615 chicos2err[c][i] = hchicos_3by3bg[c][i]->GetFunction("gaus")->GetParError(1);
616 sigmacos2[c][i] = hchicos_3by3bg[c][i]->GetFunction("gaus")->GetParameter(2);
617 sigmacos2err[c][i] = hchicos_3by3bg[c][i]->GetFunction("gaus")->GetParError(2);
618 } else { chicos2[c][i] = 0.0; chicos2err[c][i] = 0.0; sigmacos2[c][i] = 0.0; sigmacos2err[c][i] = 0.0;}
619
620 }
621 }
622 }
623
624 plotDist(hchicos_allbg, Form("fits_chi_vscos_allbg_%s_%s", pdg.data(), suffix.data()), m_cosBins);
625 plotDist(hchicos_1by3bg, Form("fits_chi_vscos_1by3bg_%s_%s", pdg.data(), suffix.data()), m_cosBins);
626 plotDist(hchicos_2by3bg, Form("fits_chi_vscos_2by3bg_%s_%s", pdg.data(), suffix.data()), m_cosBins);
627 plotDist(hchicos_3by3bg, Form("fits_chi_vscos_3by3bg_%s_%s", pdg.data(), suffix.data()), m_cosBins);
628
629 const double cosstep = 2.0 / m_cosBins;
630 std::vector<double> cosArray(m_cosBins), cosArrayErr(m_cosBins);
631 for (int i = 0; i < m_cosBins; ++i) {
632 cosArray[i] = -1.0 + (i * cosstep + cosstep / 2.0); //finding bin centre
633 cosArrayErr[i] = 0.0;
634 }
635
636 TGraphErrors grchicos(m_cosBins, cosArray.data(), chicos[0].data(), cosArrayErr.data(), chicoserr[0].data());
637 TGraphErrors grchicos_1b3bg(m_cosBins, cosArray.data(), chicos_1b3bg[0].data(), cosArrayErr.data(), chicos_1b3bgerr[0].data());
638 TGraphErrors grchicos_2b3bg(m_cosBins, cosArray.data(), chicos_2b3bg[0].data(), cosArrayErr.data(), chicos_2b3bgerr[0].data());
639 TGraphErrors grchicos2(m_cosBins, cosArray.data(), chicos2[0].data(), cosArrayErr.data(), chicos2err[0].data());
640
641 TGraphErrors grchicosn(m_cosBins, cosArray.data(), chicos[1].data(), cosArrayErr.data(), chicoserr[1].data());
642 TGraphErrors grchicos_1b3bgn(m_cosBins, cosArray.data(), chicos_1b3bg[1].data(), cosArrayErr.data(), chicos_1b3bgerr[1].data());
643 TGraphErrors grchicos_2b3bgn(m_cosBins, cosArray.data(), chicos_2b3bg[1].data(), cosArrayErr.data(), chicos_2b3bgerr[1].data());
644 TGraphErrors grchicos2n(m_cosBins, cosArray.data(), chicos2[1].data(), cosArrayErr.data(), chicos2err[1].data());
645
646 TGraphErrors grsigmacos(m_cosBins, cosArray.data(), sigmacos[0].data(), cosArrayErr.data(), sigmacoserr[0].data());
647 TGraphErrors grsigmacos_1b3bg(m_cosBins, cosArray.data(), sigmacos_1b3bg[0].data(), cosArrayErr.data(),
648 sigmacos_1b3bgerr[0].data());
649 TGraphErrors grsigmacos_2b3bg(m_cosBins, cosArray.data(), sigmacos_2b3bg[0].data(), cosArrayErr.data(),
650 sigmacos_2b3bgerr[0].data());
651 TGraphErrors grsigmacos2(m_cosBins, cosArray.data(), sigmacos2[0].data(), cosArrayErr.data(), sigmacos2err[0].data());
652
653 TGraphErrors grsigmacosn(m_cosBins, cosArray.data(), sigmacos[1].data(), cosArrayErr.data(), sigmacoserr[1].data());
654 TGraphErrors grsigmacos_1b3bgn(m_cosBins, cosArray.data(), sigmacos_1b3bg[1].data(), cosArrayErr.data(),
655 sigmacos_1b3bgerr[1].data());
656 TGraphErrors grsigmacos_2b3bgn(m_cosBins, cosArray.data(), sigmacos_2b3bg[1].data(), cosArrayErr.data(),
657 sigmacos_2b3bgerr[1].data());
658 TGraphErrors grsigmacos2n(m_cosBins, cosArray.data(), sigmacos2[1].data(), cosArrayErr.data(), sigmacos2err[1].data());
659
660 TLine line0(-1, 0, 1, 0);
661 line0.SetLineStyle(kDashed);
662 line0.SetLineColor(kRed);
663
664 TLine line1(-1, 1, 1, 1);
665 line1.SetLineStyle(kDashed);
666 line1.SetLineColor(kRed);
667
668 TString ptype("");
669 double mass = 0.0;
670 if (pdg == "pion") {ptype += "#pi"; mass = Const::pion.getMass();}
671 else if (pdg == "kaon") {ptype += "K"; mass = Const::kaon.getMass();}
672 else if (pdg == "proton") { ptype += "p"; mass = Const::proton.getMass();}
673 else if (pdg == "muon") {ptype += "#mu"; mass = Const::muon.getMass();}
674 else if (pdg == "electron") {ptype += "e"; mass = Const::electron.getMass();}
675 if (mass == 0.0) B2FATAL("Mass of particle " << pdg.data() << " is zero");
676
677 int bglow = 0, bghigh = 0;
678 double bgstep = (m_bgMax - m_bgMin) / m_bgBins;
679
680 TLegend lchi(0.7, 0.75, 0.8, 0.85);
681 lchi.SetBorderSize(0);
682 lchi.SetFillColor(kYellow);
683 lchi.AddEntry(&grchicos, ptype + "^{+}", "pc");
684 lchi.AddEntry(&grchicosn, ptype + "^{-}", "pc");
685
686 TCanvas cchi(Form("cchi_%s", suffix.data()), "cchi", 700, 600);
687 cchi.Divide(2, 2);
688 cchi.cd(1);
689 FormatGraph(grchicos, 0, Form("all (%s) bg bins, p =(%0.02f, %0.02f)", pdg.data(), m_bgMin * mass, m_bgMax * mass));
690 FormatGraph(grchicosn, 1);
691 grchicos.Draw("AP");
692 grchicosn.Draw("P,same");
693 line0.Draw("same");
694 lchi.Draw("same");
695
696 cchi.cd(2);
697 bghigh = int(m_bgBins / 3);
698 FormatGraph(grchicos_1b3bg, 0, Form("first 1/3 bg bins, p =(%0.02f, %0.02f)", m_bgMin * mass, bghigh * bgstep * mass));
699 FormatGraph(grchicos_1b3bgn, 1);
700 grchicos_1b3bg.Draw("AP");
701 grchicos_1b3bgn.Draw("P,same");
702 line0.Draw("same");
703 lchi.Draw("same");
704
705 cchi.cd(3);
706 bglow = int(m_bgBins / 3);
707 bghigh = int(2 * m_bgBins / 3);
708 FormatGraph(grchicos_2b3bg, 0, Form("second 1/3 bg bins, p =(%0.02f, %0.02f)", bglow * bgstep * mass, bghigh * bgstep * mass));
709 FormatGraph(grchicos_2b3bgn, 1);
710 grchicos_2b3bg.Draw("AP");
711 grchicos_2b3bgn.Draw("P,same");
712 line0.Draw("same");
713 lchi.Draw("same");
714
715 cchi.cd(4);
716 bglow = int(2 * m_bgBins / 3);
717 FormatGraph(grchicos2, 0, Form("third 1/3 bg bins, p =(%0.02f, %0.02f)", bglow * bgstep * mass, m_bgMax * mass));
718 FormatGraph(grchicos2n, 1);
719 grchicos2.Draw("AP");
720 grchicos2n.Draw("P,same");
721 line0.Draw("same");
722 lchi.Draw("same");
723 cchi.SaveAs(Form("plots/HadronCal/Monitoring/mean_chi_vscos_inbg_%s_%s.pdf", pdg.data(), suffix.data()));
724
725 cchi.cd(1);
726 FormatGraph(grsigmacos, 2, Form("all (%s) bg bins, p =(%0.02f, %0.02f)", pdg.data(), m_bgMin * mass, m_bgMax * mass));
727 FormatGraph(grsigmacosn, 1);
728 grsigmacos.Draw("AP");
729 grsigmacosn.Draw("P,same");
730 line1.Draw("same");
731 lchi.Draw("same");
732
733 cchi.cd(2);
734 bghigh = int(m_bgBins / 3);
735 FormatGraph(grsigmacos_1b3bg, 2, Form("first 1/3 bg bins, p =(%0.02f, %0.02f)", m_bgMin * mass, bghigh * bgstep * mass));
736 FormatGraph(grsigmacos_1b3bgn, 1);
737 grsigmacos_1b3bg.Draw("AP");
738 grsigmacos_1b3bgn.Draw("P,same");
739 line1.Draw("same");
740 lchi.Draw("same");
741
742 cchi.cd(3);
743 bglow = int(m_bgBins / 3);
744 bghigh = int(2 * m_bgBins / 3);
745 FormatGraph(grsigmacos_2b3bg, 2, Form("second 1/3 bg bins, p =(%0.02f, %0.02f)", bglow * bgstep * mass, bghigh * bgstep * mass));
746 FormatGraph(grsigmacos_2b3bgn, 1);
747 grsigmacos_2b3bg.Draw("AP");
748 grsigmacos_2b3bgn.Draw("P,same");
749 line1.Draw("same");
750 lchi.Draw("same");
751
752 cchi.cd(4);
753 bglow = int(2 * m_bgBins / 3);
754 FormatGraph(grsigmacos2, 2, Form("third 1/3 bg bins, p =(%0.02f, %0.02f)", bglow * bgstep * mass, m_bgMax * mass));
755 FormatGraph(grsigmacos2n, 1);
756 grsigmacos2.Draw("AP");
757 grsigmacos2n.Draw("P,same");
758 line1.Draw("same");
759 lchi.Draw("same");
760 cchi.SaveAs(Form("plots/HadronCal/Monitoring/sigma_chi_vscos_inbg_%s_%s.pdf", pdg.data(), suffix.data()));
761
762}
double getMass() const
Particle mass.
Definition UnitConst.cc:353
static const ChargedStable muon
muon particle
Definition Const.h:660
static const ChargedStable pion
charged pion particle
Definition Const.h:661
static const ChargedStable proton
proton particle
Definition Const.h:663
static const ChargedStable kaon
charged kaon particle
Definition Const.h:662
static const ChargedStable electron
electron particle
Definition Const.h:659
void fit(TH1F *&hist, const std::string &pdg, gstatus &status)
function to fit the histograms
void FormatGraph(TGraphErrors &gr, int flag, const std::string &name="")
function to set graph cosmetics

◆ setPars()

void setPars ( TFile *& outfile,
std::string pdg,
std::vector< TH1F * > & hdedx_bg,
std::vector< TH1F * > & hchi_bg,
std::vector< TH1F * > & hionzsigma_bg,
std::map< int, std::vector< TH1F * > > & hchi_inj )

function to fill the parameters like mean and reso in the tree

Definition at line 357 of file HadronBgPrep.cc.

359{
360 outfile->cd();
361
362 TTree* satTree = new TTree(Form("%s", pdg.data()), "dE/dx m_means and m_errors");
363 double satbg; // beta-gamma value for this bin
364 double satcosth; // cos(theta) value for this bin
365 double satdedx; // mean dE/dx value for this bin
366 double satdedxerr; // error on ^
367 double satdedxwidth;// width of ^ distribution
368
369 double satchi; // mean chi value for this bin
370 double satchierr; // error on ^
371 double satchiwidth; // width of ^ distribution
372 double satchiwidth_err;
373 double sationzres; // width of dedx reso
374
375 double satbg_avg; // average beta-gamma value for this sample
376 double satcosth_avg; // average cos(theta) value for this sample
377 double satdedxres_avg; // average dE/dx error squared for this sample
378
379 satTree->Branch("bg", &satbg, "bg/D");
380 satTree->Branch("costh", &satcosth, "costh/D");
381
382 //dEdx related variables
383 satTree->Branch("dedx", &satdedx, "dedx/D");
384 satTree->Branch("dedxerr", &satdedxerr, "dedxerr/D");
385 satTree->Branch("dedxwidth", &satdedxwidth, "dedxwidth/D");
386
387 // Chi related variables
388 satTree->Branch("chimean", &satchi, "chimean/D");
389 satTree->Branch("chimean_err", &satchierr, "chimean_err/D");
390 satTree->Branch("chisigma", &satchiwidth, "chisigma/D");
391 satTree->Branch("chisigma_err", &satchiwidth_err, "chisigma_err/D");
392
393 satTree->Branch("ionzres", &sationzres, "ionzres/D");
394
395 // Other variables
396 satTree->Branch("bg_avg", &satbg_avg, "bg_avg/D");
397 satTree->Branch("costh_avg", &satcosth_avg, "costh_avg/D");
398 satTree->Branch("dedxres_avg", &satdedxres_avg, "dedxres_avg/D");
399
400 double bgstep = (m_bgMax - m_bgMin) / m_bgBins;
401
402 for (int i = 0; i < m_bgBins; ++i) {
403
404 // fill some details for this bin
405 satbg = m_bgMin + 0.5 * bgstep + i * bgstep;
406 satcosth = 0.0;
407
408 satbg_avg = (m_sumsize[i] > 0) ? m_sumbg[i] / m_sumsize[i] : 0.0;
409 satcosth_avg = (m_sumsize[i] > 0) ? m_sumcos[i] / m_sumsize[i] : 0.0;
410 satdedxres_avg = (m_sumsize[i] > 0) ? m_sumres_square[i] / m_sumsize[i] : 0.0;
411
412 //1. -------------------------
413 // fit the dE/dx distribution in bins of beta-gamma
414 gstatus bgstat;
415 fit(hdedx_bg[i], pdg.data(), bgstat);
416 if (bgstat == OK) {
417 satdedx = m_means[i] = hdedx_bg[i]->GetFunction("gaus")->GetParameter(1);
418 satdedxerr = m_errors[i] = hdedx_bg[i]->GetFunction("gaus")->GetParError(1);
419 satdedxwidth = hdedx_bg[i]->GetFunction("gaus")->GetParameter(2);
420 } else { satdedx = 0.0; satdedxerr = 0.0; satdedxwidth = 0.0;}
421
422 //2. -------------------------
423 // fit the chi distribution in bins of beta-gamma
424 gstatus chistat;
425 fit(hchi_bg[i], pdg.data(), chistat);
426 if (bgstat == OK) {
427 satchi = hchi_bg[i]->GetFunction("gaus")->GetParameter(1);
428 satchierr = hchi_bg[i]->GetFunction("gaus")->GetParError(1);
429 satchiwidth = hchi_bg[i]->GetFunction("gaus")->GetParameter(2);
430 satchiwidth_err = hchi_bg[i]->GetFunction("gaus")->GetParError(2);
431 } else { satchi = 0.0; satchierr = 0.0; satchiwidth = 0.0; satchiwidth_err = 0.0;}
432
433
434 //3. -------------------------
435 // fit the chi distribution in bins of beta-gamma
436 gstatus ionstat;
437 fit(hionzsigma_bg[i], pdg.data(), ionstat);
438 if (ionstat == OK) {
439 sationzres = hionzsigma_bg[i]->GetFunction("gaus")->GetParameter(2);
440 } else sationzres = 0.0;
441
442 // fill the tree for this bin
443 satTree->Fill();
444 }
445 // write out the data to file
446 satTree->Write();
447
448 // --------------------------------------------------
449 // FIT IN BINS OF INJECTION TIME FOR VALIDATION
450 // --------------------------------------------------
451
452 std::string svar = "ler";
453 for (int ir = 0; ir < 2; ir++) {
454
455 if (ir == 1) svar = "her";
456
457 TTree* injTree = new TTree(Form("%s_%s", pdg.data(), svar.data()), "chi m_means and m_errors");
458 double inj_avg;
459 double mean;
460 double mean_err;
461 double sigma;
462 double sigma_err;
463
464 injTree->Branch("inj_avg", &inj_avg, "inj_avg/D");
465 injTree->Branch("chimean", &mean, "chimean/D");
466 injTree->Branch("chimean_err", &mean_err, "chimean_err/D");
467 injTree->Branch("chisigma", &sigma, "chisigma/D");
468 injTree->Branch("chisigma_err", &sigma_err, "chisigma_err/D");
469
470 for (int i = 0; i < m_injBins; ++i) {
471
472 inj_avg = (m_injsize[i] > 0) ? m_suminj[i] / m_injsize[i] : 0.0;
473
474
475 // fit the dE/dx distribution in bins of injection time'
476 gstatus injstat;
477 fit(hchi_inj[ir][i], pdg.data(), injstat);
478 if (injstat == OK) {
479 mean = hchi_inj[ir][i]->GetFunction("gaus")->GetParameter(1);
480 mean_err = hchi_inj[ir][i]->GetFunction("gaus")->GetParError(1);
481 sigma = hchi_inj[ir][i]->GetFunction("gaus")->GetParameter(2);
482 sigma_err = hchi_inj[ir][i]->GetFunction("gaus")->GetParError(2);
483 } else {
484 mean = 0.0; mean_err = 0.0; sigma = 0.0; sigma_err = 0.0;
485 }
486 injTree->Fill();
487 }
488
489 injTree->Write();
490 }
491 outfile->Write();
492}

Member Data Documentation

◆ m_bgBins

int m_bgBins
private

bins for bg

Definition at line 184 of file HadronBgPrep.h.

◆ m_bgMax

double m_bgMax
private

max range of bg

Definition at line 186 of file HadronBgPrep.h.

◆ m_bgMin

double m_bgMin
private

min range of bg

Definition at line 185 of file HadronBgPrep.h.

◆ m_cosBins

int m_cosBins
private

bins for cosine

Definition at line 192 of file HadronBgPrep.h.

◆ m_cosMax

double m_cosMax
private

max range of cosine

Definition at line 194 of file HadronBgPrep.h.

◆ m_cosMin

double m_cosMin
private

min range of cosine

Definition at line 193 of file HadronBgPrep.h.

◆ m_cut

double m_cut
private

cut to clean protons

Definition at line 200 of file HadronBgPrep.h.

◆ m_errors

std::vector<double> m_errors
private

error variable

Definition at line 179 of file HadronBgPrep.h.

◆ m_injBins

int m_injBins
private

bins for injection time

Definition at line 188 of file HadronBgPrep.h.

◆ m_injMax

double m_injMax
private

max range of injection time

Definition at line 190 of file HadronBgPrep.h.

◆ m_injMin

double m_injMin
private

min range of injection time

Definition at line 189 of file HadronBgPrep.h.

◆ m_injsize

std::vector<int> m_injsize
private

size of the injection bins

Definition at line 182 of file HadronBgPrep.h.

◆ m_means

std::vector<double> m_means
private

mean variable

Definition at line 178 of file HadronBgPrep.h.

◆ m_nhitBins

int m_nhitBins
private

bins for nhits

Definition at line 196 of file HadronBgPrep.h.

◆ m_nhitMax

double m_nhitMax
private

max range of nhits

Definition at line 198 of file HadronBgPrep.h.

◆ m_nhitMin

double m_nhitMin
private

min range of nhits

Definition at line 197 of file HadronBgPrep.h.

◆ m_sumbg

std::vector<double> m_sumbg
private

variables to add bg values

Definition at line 175 of file HadronBgPrep.h.

◆ m_sumcos

std::vector<double> m_sumcos
private

variables to add cos values

Definition at line 174 of file HadronBgPrep.h.

◆ m_suminj

std::vector<double> m_suminj
private

variables to add injection time

Definition at line 177 of file HadronBgPrep.h.

◆ m_sumres_square

std::vector<double> m_sumres_square
private

variables to add square of resolution

Definition at line 176 of file HadronBgPrep.h.

◆ m_sumsize

std::vector<int> m_sumsize
private

size of the bg bins

Definition at line 181 of file HadronBgPrep.h.


The documentation for this class was generated from the following files: