9 TF1* fit =
new TF1(
"fit",
"gaus");
16 std::cout <<
" E: Read hists error! " << std::endl;
23 TF1* fit =
new TF1(
"fit",
"[0]");
28 std::cout <<
" E: Read hists error! " << std::endl;
46 std::cout <<
" E: Read hists error! " << std::endl;
65 std::cout <<
" E: Read hists error! " << std::endl;
85 std::cout <<
" E: Read profile error! " << std::endl;
93 TStyle* histoStyle =
new TStyle(
"histoStyle",
"Plain Style(no colors/fill areas)");
138 TStyle* profStyle =
new TStyle(
"profStyle",
"Plain Style(no colors/fill areas)");
157 const TString fileName =
"L1_histo.root";
162 ress = fopen(
"resolution.txt",
"w");
163 pulls = fopen(
"pull.txt",
"w");
169 TString dirFitName =
"/L1/Fit";
170 dirFitName = fileName +
":" + dirFitName;
173 const int nHisto = 40;
180 const THistoData histoData[nHisto] = {
181 {
"fst_x",
"Residual (x^{reco}-x^{mc}) [#mum]"} {
"fst_y",
"Residual (y^{reco}-y^{mc}) [#mum]"} {
182 "fst_tx",
"Residual (t_{x}^{reco}-t_{x}^{mc}) [10^{-3}]"} {
183 "fst_ty",
"Residual (t_{y}^{reco}-t_{y}^{mc}) [10^{-3}]"} {
"fst_P",
"Resolution (p^{reco}-p^{mc})/p^{mc}"} {
184 "fst_px",
"Pull x"} {
"fst_py",
"Pull y"} {
"fst_ptx",
"Pull t_{x}"} {
"fst_pty",
"Pull t_{y}"} {
"fst_pQP",
187 {
"lst_pQP",
"Pull q/p"} {
"lst_ptx",
"Pull t_{x}"} {
"lst_pty",
"Pull t_{y}"} {
"lst_px",
"Pull x"} {
"lst_py",
189 "lst_P",
"Resolution (p^{reco}-p^{mc})/p^{mc}"} {
"lst_tx",
"Residual (t_{x}^{reco}-t_{x}^{mc}) [mrad]"} {
190 "lst_ty",
"Residual (t_{y}^{reco}-t_{y}^{mc}) [mrad]"} {
"lst_x",
"Residual (x^{reco}-x^{mc}) [#mum]"} {
191 "lst_y",
"Residual (y^{reco}-y^{mc}) [#mum]"} {
"svrt_pQP",
"Pull q/p"} {
"svrt_ptx",
"Pull t_{x}"} {
192 "svrt_pty",
"Pull t_{y}"} {
"svrt_px",
"Pull x"} {
"svrt_py",
"Pull y"} {
193 "svrt_P",
"Resolution (p^{reco}-p^{mc})/p^{mc}"} {
"svrt_tx",
"Residual (t_{x}^{reco}-t_{x}^{mc}) [mrad]"} {
194 "svrt_ty",
"Residual (t_{y}^{reco}-t_{y}^{mc}) [mrad]"} {
"svrt_x",
"Residual (x^{reco}-x^{mc}) [#mum]"} {
195 "svrt_y",
"Residual (y^{reco}-y^{mc}) [#mum]"} {
"pvrt_pQP",
"Pull q/p"} {
"pvrt_ptx",
"Pull t_{x}"} {
196 "pvrt_pty",
"Pull t_{y}"} {
"pvrt_px",
"Pull x"} {
"pvrt_py",
"Pull y"} {
197 "pvrt_P",
"Resolution (p^{reco}-p^{mc})/p^{mc}"} {
"pvrt_tx",
"Residual (t_{x}^{reco}-t_{x}^{mc}) [mrad]"} {
198 "pvrt_ty",
"Residual (t_{y}^{reco}-t_{y}^{mc}) [mrad]"} {
"pvrt_x",
"Residual (x^{reco}-x^{mc}) [#mum]"} {
199 "pvrt_y",
"Residual (y^{reco}-y^{mc}) [#mum]"}};
203 float charat[nHisto][2];
204 for (
int i = 0;
i < nHisto;
i++) {
205 histo[
i] = (
TH1F*)dirFit->
Get(histoData[
i].name);
211 cout.setf(std::ios::scientific, std::ios::floatfield);
213 cout << endl <<
"Name " <<
" \t" <<
" Sigma " <<
"\t" <<
" RMS " << endl;
214 for (
int i = 0;
i < nHisto;
i++) {
215 cout << histoData[
i].name <<
" \t" << charat[
i][0] <<
"\t" << charat[
i][1] << endl;
219 TString dirInputName =
"/L1/Input";
220 dirInputName = fileName +
":" + dirInputName;
223 const int nHistoInput = 4;
225 const THistoData histoDataInput[nHisto] = {{
"Px",
"Pull x"} {
"Py",
"Pull y"} {
226 "x",
"Residual (x^{hit}-x^{mc}) [#mum]"} {
"y",
"Residual (y^{hit}-y^{mc}) [#mum]"}};
228 TH1F* histoInput[nHistoInput];
230 for (
int i = 0;
i < nHistoInput;
i++) {
231 histoInput[
i] = (
TH1F*)dirInput->
Get(histoDataInput[
i].name);
239 dirOtherName = fileName +
":" + dirOtherName;
242 const int nHistoOther = 15;
244 const THistoData histoDataOther[nHisto] = {
245 {
"h_acc_MCmom",
"Momentum of tracks"} {
"h_reco_MCmom",
"Momentum of tracks"} {
246 "h_unreco_MCmom",
"Momentum of tracks"} {
"h_ghost_Rmom",
"Momentum of tracks"} {
247 "h_acc_prim_MCmom",
"Momentum of tracks"} {
"h_reco_prim_MCmom",
"Momentum of tracks"} {
248 "h_unreco_prim_MCmom",
"Momentum of tracks"} {
"h_ghost_Rmom",
"Momentum of tracks"} {
249 "h_acc_sec_MCmom",
"Momentum of tracks"} {
"h_reco_sec_MCmom",
"Momentum of tracks"} {
250 "h_unreco_sec_MCmom",
"Momentum of tracks"} {
"h_ghost_Rmom",
"Momentum of tracks"}
252 {
"h_reco_prob",
"Prob of reco track"} {
"h_ghost_prob",
"Prob of ghost track"} {
"h_rest_prob",
253 "Prob of reco rest track"}};
255 TH1F* histoOther[nHistoOther];
257 for (
int i = 0;
i < 12;
i++) {
259 histoOther[
i] = (
TH1F*)dirOther->
Get(histoDataOther[
i].name);
261 histoOther[
i] =
new TH1F(histoDataOther[
i].name,
"Not reconstructed tracks", 100, 0.0, 5.0);
262 for (j = 0; j < histoOther[
i]->
GetNbinsX(); j++) {
264 histoOther[
i - 2]->GetBinContent(j) - histoOther[
i - 1]->GetBinContent(j));
270 for (
int i = 12;
i < nHistoOther;
i++) {
271 histoOther[
i] = (
TH1F*)dirOther->
Get(histoDataOther[
i].name);
278 TString dirOther2DName =
"/L1";
279 dirOther2DName = fileName +
":" + dirOther2DName;
282 const int nHistoOther2D = 1;
284 const THistoData histoDataOther2D[nHisto] = {
285 {
"h2_reco_nhits_vs_mom_prim",
"NHits and momentum for primary"}
293 TH2F* histoOther2D[nHistoOther2D];
295 for (
int i = 0;
i < nHistoOther2D;
i++) {
296 histoOther2D[
i] = (
TH2F*)dirOther2D->
Get(histoDataOther2D[
i].name);
303 dirName = fileName +
":" + dirName;
313 const TProfData profData[nProf] = {
314 {
"p_eff_all_vs_mom",
"Momentum [GeV/c]",
"Efficiency [%]"} {
"p_eff_all_vs_nhits",
"NMCHits",
"Efficiency [%]"} {
315 "p_eff_prim_vs_nhits",
"NMCHits",
"Efficiency [%]"} {
"p_eff_sec_vs_nhits",
"NMCHits",
"Efficiency [%]"}};
319 for (
int i = 0;
i < nProf;
i++) {
338 system(
"mkdir L1_histo -p");
343 c2 =
new TCanvas(
"c2",
"c2", 0, 0, 900, 600);
344 c3 =
new TCanvas(
"c3",
"c3", 0, 0, 900, 600);
348 for (
int i = 0;
i < 10;
i++) {
355 for (
int i = 0;
i < nHisto;
i++) {
361 for (
int i = 0;
i < nHistoInput;
i++) {
362 histoInput[
i]->
Draw();
369 for (
int j = 0, iH = 0; j < 3; j++) {
375 for (
int i = 0;
i < 4;
i++, iH++) {
392 histoOther[iH]->
Draw();
394 histoOther[iH]->
Draw(
"same");
395 leg1->
AddEntry(histoOther[iH], histoOther[iH]->GetTitle());
400 c2->
SaveAs(
"MultiplicityMom.pdf");
403 c2->
SaveAs(
"MultiplicityMomPrim.pdf");
406 c2->
SaveAs(
"MultiplicityMomSec.pdf");
412 for (
int i = 12;
i < nHistoOther;
i++) {
413 histoOther[
i]->
Draw();
419 for (
int i = 0;
i < nHistoOther2D;
i++) {
420 histoOther2D[
i]->
Draw();
428 for (
int i = 0;
i < nProf;
i++) {
void makeUpProfile(TProfile *prof, TString titleX, TString titleY)
void FitHistoGaus(TH1 *hist, float *sigma=0)
void FitHistoLine(TH1 *hist)
void makeUpHisto(TH1 *hist, TString title)
virtual void SetTitleOffset(Float_t offset=1)
virtual void SetTitleFont(Style_t font=62)
virtual void SetLabelFont(Style_t font=62)
virtual void SetFillColor(Color_t fcolor)
virtual void SetLineStyle(Style_t lstyle)
virtual void SetLineWidth(Width_t lwidth)
virtual void SetLineColor(Color_t lcolor)
virtual void SetMarkerColor(Color_t mcolor=1)
virtual void SetTextFont(Font_t tfont=62)
TVirtualPad * cd(Int_t subpadnumber=0) override
T * Get(const char *namecycle)
virtual TObject * Get(const char *namecycle)
virtual Double_t GetParameter(const TString &name) const
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
virtual Int_t GetNbinsX() const
void Draw(Option_t *option="") override
Double_t GetRMS(Int_t axis=1) const
virtual void SetBinContent(Int_t bin, Double_t content)
virtual Double_t GetEntries() const
virtual void SetOption(Option_t *option=" ")
void Draw(Option_t *option="") override
TLegendEntry * AddEntry(const char *name, const char *label="", Option_t *option="lpf")
virtual void SetTitle(const char *title="")
void SetGridx(Int_t value=1) override
void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0) override
void SetGridy(Int_t value=1) override
void SaveAs(const char *filename="", Option_t *option="") const override
virtual void SetBorderSize(Int_t bordersize=4)
const char * Data() const
void SetPadBorderMode(Int_t mode=1)
void SetOptTitle(Int_t tit=1)
void SetOptStat(Int_t stat=1)
void SetStatFont(Style_t font=62)
void SetCanvasColor(Color_t color=19)
void SetStatX(Float_t x=0)
void SetFrameBorderMode(Int_t mode=1)
void SetPalette(Int_t ncolors=kBird, Int_t *colors=nullptr, Float_t alpha=1.)
void SetGridStyle(Style_t style=3)
void SetTitleColor(Color_t color=1, Option_t *axis="X")
void SetStatH(Float_t h=0.1)
void SetStatFontSize(Float_t size=0)
void SetStatColor(Color_t color=19)
void SetPadColor(Color_t color=19)
void SetStatW(Float_t w=0.19)
void SetStatY(Float_t y=0)
void SetOptFit(Int_t fit=1)