21#include <TGraphErrors.h>
24#include <calibration/CalibrationAlgorithm.h>
25#include <framework/database/DBObjPtr.h>
26#include <cdc/utilities/CDCDedxMeanPred.h>
27#include <cdc/utilities/CDCDedxSigmaPred.h>
28#include <cdc/utilities/CDCDedxHadSat.h>
30#include <framework/gearbox/Const.h>
32enum gstatus {OK, Failed};
60 HadronBgPrep(
int bgbins,
double upperbg,
double lowerbg,
int cosbins,
double uppercos,
double lowercos,
int injbins,
61 double lowerinj,
double upperinj,
int nhitbins,
double lowernhit,
double uppernhit,
double cut);
66 void prepareSample(std::shared_ptr<TTree> hadron, TFile*& outfile,
const std::string& suffix,
const std::string& bgcurvefile,
67 const std::string& bgsigmafile,
const std::string& pdg,
bool ismakePlots);
72 void defineHisto(std::vector<TH1F*>& htemp,
const std::string& svar,
const std::string& stype,
const std::string& pdg);
77 void plotDist(std::map<
int, std::vector<TH1F*>>& hist,
const std::string& suffix,
int bins);
82 void plotDist(std::vector<TH1F*>& hist,
const std::string& suffix,
int nbins);
87 void setPars(TFile*& outfile, std::string pdg, std::vector<TH1F*>& hdedx_bg, std::vector<TH1F*>& hchi_bg,
88 std::vector<TH1F*>& hionzsigma_bg, std::map<
int, std::vector<TH1F*>>& hchi_inj);
98 void fit(TH1F*& hist,
const std::string& pdg);
103 void printCanvasCos(std::map<
int, std::vector<TH1F*>>& hchicos_allbg, std::map<
int, std::vector<TH1F*>>& hchicos_1by3bg,
104 std::map<
int, std::vector<TH1F*>>& hchicos_2by3bg, std::map<
int, std::vector<TH1F*>>& hchicos_3by3bg,
const std::string& particle,
105 const std::string& suffix);
110 void FormatGraph(TGraphErrors& gr,
int flag,
const std::string& name =
"")
113 gr.SetTitle(Form(
"%s;cos(#theta);#chi_{mean}", name.data()));
114 gr.SetMarkerStyle(24);
115 gr.SetMarkerColor(2);
116 gr.SetMarkerSize(.7);
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);
131 gr.GetXaxis()->SetRangeUser(-1, 1);
154 for (
auto& hist : htemp) hist->Delete();
double getMass() const
Particle mass.
static const ChargedStable muon
muon particle
static const ChargedStable pion
charged pion particle
static const ChargedStable proton
proton particle
static const ChargedStable kaon
charged kaon particle
static const ChargedStable electron
electron particle
Class to prepare sample for fitting in beta gamma bins.
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
int m_nhitBins
bins for nhits
int m_injBins
bins for injection time
int m_cosBins
bins for cosine
double getParticleMass(const std::string &particle)
function to get the particle mass
void deleteHistos(std::vector< TH1F * > &htemp)
function to delete the histograms
double m_cosMax
max range of cosine
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 fit(TH1F *&hist, const std::string &pdg)
function to fit the histograms
std::vector< double > m_means
mean variable
std::vector< double > m_errors
error variable
virtual ~HadronBgPrep()
Destructor.
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
HadronBgPrep()
Constructor: Sets the description, the properties and the parameters of the algorithm.
void FormatGraph(TGraphErrors &gr, int flag, const std::string &name="")
function to set graph cosmetics
double m_injMax
max range of injection time
double m_nhitMax
max range of nhits
std::vector< double > m_sumres_square
variables to add square of resolution
double m_injMin
min range of injection time
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
double m_bgMax
max range of bg
std::vector< int > m_injsize
size of the injection bins
double m_bgMin
min range of bg
double m_cosMin
min range of cosine
double m_cut
cut to clean protons
std::vector< double > m_sumbg
variables to add bg values
void fitGaussianWRange(TH1F *&temphist, gstatus &status, double sigmaR)
function to perform gauss fit for input histogram
double m_nhitMin
min range of nhits
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
Abstract base class for different kinds of events.