#include #include #include #include #include #include using namespace std; void sp_test() { TFile *f= new TFile("SPRTree_mc_iso_14.root"); f->ReadAll(); gROOT->SetStyle("Plain"); gStyle->SetPalette(1); gStyle->SetOptStat(1); gStyle->SetOptFit(1); gStyle->SetLineWidth(1); gStyle->SetTextFont(63); gStyle->SetTextSize(15); gStyle->SetLabelSize(20,"xy"); gStyle->SetLabelFont(63,"xy"); gStyle->SetOptTitle(0); gStyle->SetPadTopMargin(0.5); gStyle->SetPadBottomMargin(0.3); gStyle->SetPadLeftMargin(0.15); int num = 0; char histname[1000]; int iiso = 3; // 0 to 3 int iemf = 9; // 0 to 4, 9 = no cut string cal = "cal"; string prj = "prj"; string spr = "spr"; string etrk = "etrk"; string ptrk = "ptrk"; string data = "MinBias"; string lat = "lateral"; string lon = "longitudinal"; int const neta = 4; int const ncone = 6; int const ncal = 11; int const ncut = 7; // number of cuts plots string str_eta[neta]; str_eta[0] = "CC1"; str_eta[1] = "CC2"; str_eta[2] = "ICR"; str_eta[3] = "EC1"; string str_cone[ncone]; str_cone[0] = "#Deltar=0.1"; str_cone[1] = "#Deltar=0.2"; str_cone[2] = "#Deltar=0.3"; str_cone[3] = "#Deltar=0.4"; str_cone[4] = "#Deltar=0.5"; str_cone[5] = "#Deltar=0.7"; string str_cal[ncal]; str_cal[0] = "EM1"; str_cal[1] = "EM2"; str_cal[2] = "EM3"; str_cal[3] = "EM4"; str_cal[4] = "FH1"; str_cal[5] = "FH2"; str_cal[6] = "FH3"; str_cal[7] = "FH4"; str_cal[8] = "CH1"; str_cal[9] = "CH2"; str_cal[10]= "CH3"; string str_cut[ncut]; str_cut[0] = "no cuts"; str_cut[1] = "after dca,smt,cft"; str_cut[2] = "after pt,p,e030_cal"; str_cut[3] = "after trk_dr"; str_cut[4] = "after mc_dr"; str_cut[5] = "after mc_iso"; str_cut[6] = "after iso_cal (all cuts)"; time_t rawtime; struct tm * timeinfo; time ( &rawtime ); timeinfo = localtime ( &rawtime ); // printf ( "Current date and time are: %s", asctime (timeinfo) ); //---------------------------------------------------------------------------- // spr mean //---------------------------------------------------------------------------- int ieta = 0; double fitf_mean[ncone][ncal]; double fitf_mean_err[ncone][ncal]; ostringstream ostr_title(""); ostr_title<<"single pion response, "<Draw();//<========================= SPRC->cd();//<========================= //SPRC->Range(0,0,100,100); // SPRC->SetLeftMargin(0.2); // SPRTotC->SetRightMargin(0.15); // SPRC->SetTopMargin(0.91); // SPRC->SetBottomMargin(0.25); SPRC->Divide(ncone,ncal,0,0); TPaveLabel *pl = new TPaveLabel(10,96,90,100,ostr_title.str().c_str(),"0"); pl->SetTextFont(63); pl->SetTextSize(25); pl->SetFillColor(0); pl->Draw(); TPaveLabel *p2 = new TPaveLabel(80,96,100,100, asctime (timeinfo),"0"); p2->SetTextFont(63); p2->SetTextSize(15); p2->SetFillColor(0); p2->Draw(); num = 0; for (int ical = 0; ical < ncal; ical++) { for (int icone = 0; icone < ncone; icone++) { num++; SPRC->cd(num); gPad->SetTicks(1,1); sprintf(histname, "ha_erg_eta%d_cone%d_ly%d", ieta, icone, ical); TH1F* hist = (TH1F*)gROOT->FindObject(histname); hist->GetXaxis()->SetRangeUser(0.0,2.0); hist->GetXaxis()->SetNdivisions(202,0); hist->GetXaxis()->SetLabelFont(63); hist->GetXaxis()->SetLabelSize(10); hist->GetXaxis()->SetTitleFont(63); hist->GetXaxis()->SetTitleSize(10); hist->GetXaxis()->SetTitleOffset(6.0); // hist->GetYaxis()->SetRangeUser(0.0,0.6); hist->GetYaxis()->SetNdivisions(202,0); hist->GetYaxis()->SetLabelFont(63); hist->GetYaxis()->SetLabelSize(10); hist->GetYaxis()->SetTitleFont(63); hist->GetYaxis()->SetTitleSize(10); hist->GetYaxis()->SetTitleOffset(2.5); fitf_mean[icone][ical] = hist->GetMean(); fitf_mean_err[icone][ical] = hist->GetMeanError(); hist->Draw(); l = new TLine(fitf_mean[icone][ical],0.0,fitf_mean[icone][ical],100.0); l->SetLineColor(2); l->SetLineWidth(2); l->Draw(); double errl = fitf_mean[icone][ical] - fitf_mean_err[icone][ical]; lerrl = new TLine(errl,0.0,errl,100.0); lerrl->SetLineColor(2); lerrl->SetLineWidth(2); lerrl->SetLineStyle(2); lerrl->Draw(); double errh = fitf_mean[icone][ical] + fitf_mean_err[icone][ical]; lerrh = new TLine(errh,0.0,errh,100.0); lerrh->SetLineColor(2); lerrh->SetLineWidth(2); lerrh->SetLineStyle(2); lerrh->Draw(); ostringstream ostr_plot(""); ostr_plot << str_cone[icone] <<", " << str_cal[ical]; char const *cstr_plot = ostr_plot.str().c_str(); // cout << cstr_plot <SetNDC(); det->SetTextFont(63); det->SetTextColor(2); det->SetTextSize(15); det->SetTextAlign(22); det->DrawLatex(0.5,0.5,cstr_plot); c1->Update(); //<========================= } } // SPRC->Print(ostr_file.str().c_str()); }