#include #include #include #include #include #include #include "TLatex.h" #include "TH1.h" #include "TH2.h" #include "TFile.h" #include "TBranch.h" #include "TTree.h" #include "TCanvas.h" #include "TObject.h" #include "TGraph2D.h" #include "TPaveText.h" #include "TF1.h" #include "TGraph.h" #include "TGraphQQ.h" #include "TCanvas.h" #include "TStyle.h" #include "TMath.h" #include "TFitResult.h" #include "TLine.h" #include "TColor.h" #include "TROOT.h" #include "TStyle.h" #include "TLegend.h" //#include "./Safe.h" #include "RooRealVar.h" #include "RooDataSet.h" #include "RooGaussian.h" #include "RooChebychev.h" #include "RooAddPdf.h" #include "RooMCStudy.h" #include "RooPlot.h" #include "TCanvas.h" #include "TAxis.h" #include "TH2.h" #include "RooFitResult.h" #include "TStyle.h" #include "TDirectory.h" using namespace RooFit; using namespace std; gROOT->SetBatch(true); gStyle->SetOptStat(0); TFile *file = TFile::Open("PrCheckerPlots_newconds.root"); //file->cd("downstream_composite_validator/"); //TTree *mcp_tree = (TTree*)file->Get("addut_validator/add_ut_mcp_tree"); TCanvas * canv = new TCanvas("C","",1200,800);//another option: pass the canvas as argument and only create it once. Usually better not to. canv->cd();//usually do not need that auto * h_Signal = static_cast(file->Get("downstream_validator/noVelo+UT+T_fromSignal_P>5GeV_PT>500MeV_P_reconstructible")); auto * h_Lambda = static_cast(file->Get("downstream_validator/noVelo+UT+T_fromLambda_P>5GeV_PT>500MeV_P_reconstructible")); auto * h_Ks0 = static_cast(file->Get("downstream_validator/noVelo+UT+T_fromKs0_P>5GeV_PT>500MeV_P_reconstructible")); h_Signal->Scale(1./h_Signal->Integral()); h_Lambda->Scale(1./h_Lambda->Integral()); h_Ks0-> Scale(1./h_Ks0-> Integral()); cout << h_Signal->Integral() << endl; cout << h_Lambda->Integral() << endl; cout << h_Ks0->Integral() << endl; h_Signal->SetMarkerStyle(kFullCircle); h_Signal->SetMarkerSize(1); h_Signal->SetMarkerColor(kRed); h_Signal->SetLineColor(kRed); h_Lambda->SetMarkerStyle(kFullCircle); h_Lambda->SetMarkerSize(1); h_Lambda->SetMarkerColor(kBlue); h_Lambda->SetLineColor(kBlue); h_Ks0->SetMarkerStyle(kFullCircle); h_Ks0->SetMarkerSize(1); h_Ks0->SetMarkerColor(kBlack); h_Ks0->SetLineColor(kBlack); auto hs = new THStack("hs",""); hs->Add(h_Signal); hs->Add(h_Lambda); hs->Add(h_Ks0); hs->Draw(); hs->SetTitle(";P [MeV]; Events"); auto leg = new TLegend(0.7,0.6,0.82,0.85); leg->AddEntry(h_Signal,"From Signal","LP"); leg->AddEntry(h_Lambda,"From Lambda","LP"); leg->AddEntry(h_Ks0,"From Ks0","LP"); leg->SetFillStyle(0); leg->SetBorderSize(0); leg->SetTextFont(132); leg->SetTextSize(0.04); leg->Draw(); canv->Update();//usually do not need that canv->SaveAs("UThits_all_layers.png"); delete canv,hs