#include #include #include #include #include #include "TFile.h" #include "TF1.h" #include "TH1.h" #include "TH2.h" #include "TCanvas.h" #include "TDirectory.h" #include "TMarker.h" #include "TPaveText.h" #include "THStack.h" #include "TLegend.h" #include "TROOT.h" #include "TStyle.h" #include "TGaxis.h" #include "TLatex.h" #include "TColor.h" #include "TLorentzVector.h" #include "TGraphErrors.h" #include "TFile.h" using namespace std; #define numberOfSituations 5 #define numberOfPeriods 8 #define targetType 3 #define numberOfWBins 23 #define numberOfWpartBins 4 #define numberOfParticles 4 #define SQR(a) ((a)*(a)) #define M_PI 3.14159265358979323846 void NewTitle(char *,double ,int, double ,double ,double ,double ); void GetHist_FromROOT_Run_3pi() { // // // // // // // // // // // // // // // // // // Setting gStyle // gROOT->SetBatch(); gROOT->SetStyle("Plain"); gStyle -> SetOptStat(0); //gStyle -> SetOptStat(1111); gStyle -> SetPalette(1); gStyle -> SetHistLineWidth(3); //gStyle -> SetPadGridX(1); //gStyle -> SetPadGridY(1); gStyle -> SetPalette(1); // // // // // // // // // // // // // // // // // // Variables // char name[300]; char yaxis_name[300]; TCanvas *Can_Name; TLegend *leg_Name; TPad *Pad_Name; int RUN = 63510; //TFile *fout; //TFile *f[Run_Num]; TFile *f; TLine *line; TLatex Name_Title; char pull_sit04[11][20]={"proton (mom)", "proton (#lambda)", "proton (#phi)", "#pi^{+} (mom)","#pi^{+} (#lambda)","#pi^{+} (#phi)", "#pi^{-} (mom)", "#pi^{-} (#lambda)", "#pi^{-} (#phi)", "photon (mom)", "CL"}; TDirectoryFile *FitDir[100]; // // // // // // // // // // // // // // // // // // Call the root-file // sprintf(name,"/d/grid9/pedersen/sim/ppippimp0/working/auto/t_0_new/omega350.root"); cout<<" Call the root-file "<Get("cl_2pi"); cl_3pi = (TH1F*)f->Get("cl_3pi"); pull_3pi[9] = (TH1F*)f->Get("pull_photon_3pi"); pull_3pi[3] = (TH1F*)f->Get("pull_pip_mom_3pi"); pull_3pi[4] = (TH1F*)f->Get("pull_pip_lambda_3pi"); pull_3pi[5] = (TH1F*)f->Get("pull_pip_phi_3pi"); pull_3pi[6] = (TH1F*)f->Get("pull_pim_mom_3pi"); pull_3pi[7] = (TH1F*)f->Get("pull_pim_lambda_3pi"); pull_3pi[8] = (TH1F*)f->Get("pull_pim_phi_3pi"); pull_3pi[0] = (TH1F*)f->Get("pull_proton_mom_3pi"); pull_3pi[1] = (TH1F*)f->Get("pull_proton_lambda_3pi"); pull_3pi[2] = (TH1F*)f->Get("pull_proton_phi_3pi"); Can_Name = new TCanvas("Check_KinF_mean_sigma","Check_KinF_mean_sigma",0,0,700,600); Can_Name -> Divide(3,4); for (int i=0; i<10; i++) { Can_Name -> cd(i+1); TGaxis::SetMaxDigits(4); // this will set axis label to exponential form if // the max value on the axis has more than 4 digits. pull_3pi[i] -> SetTitle(0); pull_3pi[i] -> SetLabelSize(0.07,"x"); pull_3pi[i] -> SetLabelSize(0.07,"y"); pull_3pi[i] -> SetLineColor(4); pull_3pi[i] -> SetFillStyle(0); pull_3pi[i] -> SetLineWidth(2); pull_3pi[i] -> SetLineStyle(1); double Mean = pull_3pi[i] -> GetMean(); TF1* fitGaus = new TF1("fitGaus","gaus",Mean-2,Mean+2); pull_3pi[i] -> Fit("fitGaus","R"); pull_3pi[i] -> Draw(); pull_3pi[i] -> SetMinimum(0); double max = pull_3pi[i] -> GetMaximum(); pull_3pi[i] -> SetMaximum(1.15*max); NewTitle(pull_sit04[i], 0.09, 1, 0.35, 0.92, 0.60,0.99); sprintf(name,"Mean %.3f",fitGaus->GetParameter(1)); NewTitle(name, 0.10, 1, 0.55, 0.75, 0.85,0.88); sprintf(name,"Sigma %.3f",fitGaus->GetParameter(2)); NewTitle(name, 0.10, 1, 0.55, 0.62, 0.85,0.75); } Can_Name -> cd(11); TGaxis::SetMaxDigits(4); // this will set axis label to exponential form if // the max value on the axis has more than 4 digits. cl_3pi -> SetTitle(0); cl_3pi -> SetLabelSize(0.07,"x"); cl_3pi -> SetLabelSize(0.07,"y"); cl_3pi -> SetLineColor(4); cl_3pi -> SetFillStyle(0); cl_3pi -> SetLineWidth(2); cl_3pi -> SetLineStyle(1); cl_3pi -> SetMinimum(0); cl_3pi -> SetMaximum(75); cl_3pi -> Draw(); NewTitle(pull_sit04[10], 0.09, 1, 0.35, 0.92, 0.60,0.99); Can_Name -> cd(12); leg_Name = new TLegend(0.10,0.50,0.80,0.80); //leg_Name -> AddEntry(pull[1][situation][target][3],"w/ ELoss & MomC","lepf"); //leg_Name -> AddEntry(pull[1][situation][target][2],"w/ ELoss","lepf"); //leg_Name -> AddEntry(pull[1][situation][target][1],"w/o ELoss","lepf"); //leg_Name -> SetFillStyle(0); //leg_Name -> SetTextSize(0.10); //leg_Name -> SetFillColor(0); //leg_Name -> SetLineColor(0); //leg_Name -> Draw(); NewTitle("Topology : #gamma p -> p #pi^{+} #pi^{-} (#pi^{0})", 0.10, 1, 0.10, 0.32, 0.80,0.45); //if (target==1) NewTitle("Butanol target ", 0.10, 1, 0.10, 0.19, 0.80,0.32); //else if (target==2) NewTitle("Carbon target ", 0.10, 1, 0.10, 0.19, 0.80,0.32); //else if (target==3) NewTitle("CH_{2} target ", 0.10, 1, 0.10, 0.19, 0.80,0.32); Can_Name -> Print("3pi.eps"); cout<<" Bye Bye "<Close(); } void NewTitle(char *title,double Tsize, int Color, double x1, double y1, double x2, double y2) { TPaveText *pt; TText *tx; pt = new TPaveText(x1,y1,x2,y2,"NDC"); pt -> SetFillColor(0); pt -> SetTextSize(Tsize); pt -> SetTextColor(Color); pt -> SetBorderSize(0); pt -> SetTextAlign(12); tx = pt -> AddText(title); pt -> Draw(); }