void Plot2DHisto(TH2D* plothist, char xTitle[200], char yTitle[200], char savename[200], char tex[200]) { TGaxis::SetMaxDigits(3); TCanvas *c1 = new TCanvas("", "", 1200, 1000); gStyle->SetPalette(1); gStyle->SetOptStat(0); gPad->SetFillColor(kWhite); gPad->SetLeftMargin(0.15); gPad->SetRightMargin(0.2); gPad->SetTopMargin(0.1); double yOffset=1.4; plothist->GetYaxis()->SetTitleOffset(yOffset); plothist->SetStats(0); plothist->SetTitle(0); plothist->GetYaxis()->SetTitle(yTitle); plothist->GetXaxis()->SetTitle(xTitle); plothist->SetMinimum(0.); plothist->Draw("colz"); double left=0.25, top=0.935, textSize=0.04; TLatex *latex=new TLatex(); latex->SetTextFont(42); latex->SetNDC(kTRUE); latex->SetTextSize(textSize); latex->DrawLatex(left,top,tex); char linlog_savename[200]; c1->SetLogz(false); sprintf(linlog_savename,"%s_lin.pdf",savename); c1->SaveAs(linlog_savename); c1->SetLogz(true); sprintf(linlog_savename,"%s_log.pdf",savename); c1->SaveAs(linlog_savename); TProfile* profileX = plothist->ProfileX("", 1, -1, "so"); TProfile* profileY = plothist->ProfileY("", 1, -1, "so"); profileX->Draw("same"); sprintf(linlog_savename,"%s_log_AddProfile.pdf",savename); c1->SaveAs(linlog_savename); profileX->Draw(); latex->DrawLatex(left,top,tex); sprintf(linlog_savename,"%s_log_ProfileX.pdf",savename); c1->SaveAs(linlog_savename); profileY->Draw(); latex->DrawLatex(left,top,tex); sprintf(linlog_savename,"%s_log_ProfileY.pdf",savename); c1->SaveAs(linlog_savename); delete c1; delete latex; }
void explore_zmass_boost() { // Tell root not to draw everything to the screen. gROOT->SetBatch(); // TString dyfilename = TString("/home/acarnes/h2mumu/samples/stage1/monte_carlo/bg/stage_1_dy_jetsToLL_asympt50_ALL.root"); TString dyfilename = TString("/home/acarnes/h2mumu/samples/stage1/monte_carlo/bg/stage_1_dy_ZToMuMu_asympt50_ALL.root"); TString datafilename = TString("/home/acarnes/h2mumu/samples/stage1/data_from_json/Cert_246908-251883_13TeV_PromptReco_Collisions15_JSON_v2/stage_1_doubleMuon_RunBPrompt_MINIAOD.root"); TString savedir = TString("../png/dy_vs_data/run1cuts_v2_golden_json/dyzmumu/"); // Initialize the DiMuPlottingSystems for MC and data DiMuPlottingSystem* dpsdata = new DiMuPlottingSystem(datafilename); DiMuPlottingSystem* dpsdy = new DiMuPlottingSystem(dyfilename); addDiMuMassPrimeBranch(dpsdata); dpsdata->applyRun1Cuts(); dpsdy->applyRun1Cuts(); // Get the 2D histos TH2F* hdataZPt = ZMassVsZPtHist2D("data_zpt", "recoCandMassPrime", "(14,0,60,30,87,95)", dpsdata); TH2F* hdyZPt = ZMassVsZPtHist2D("dy_zpt", "recoCandMass", "(14,0,60,30,87,95)", dpsdy); //overlayTProfiles(TH2F* hdata, TH2F* hdy, TString bininfo, TString savename) TProfile* p = overlayTProfiles(hdataZPt, hdyZPt, 90, 92, savedir+"z_mass_vs_z_pt.png"); gStyle->SetOptFit(0011); fitTProfileCustom(p); TCanvas* c = new TCanvas(); c->cd(); p->Draw("hist c"); p->Draw("E0 X0 same"); dpsdata->arrangeStatBox(c); c->Draw(); c->Print("blah2.png"); // Look at RMS c->Clear(); c->cd(); c->SetGridx(kTRUE); c->SetGridy(kTRUE); c->cd(); TH1F* h = dpsdata->hist1D("recoCandMass", "(100,87,95)", ""); TH1F* h2 = dpsdata->hist1D("recoCandMassPrime", "(100,87,95)", ""); h2->SetLineColor(2); h->Draw(""); h2->Draw("same"); std::cout << "mass rms: " << h->GetRMS() << std::endl; std::cout << "mass' rms: " << h2->GetRMS() << std::endl; std::cout << "mass mean: " << h->GetMean() << std::endl; std::cout << "mass' mean: " << h2->GetMean() << std::endl; std::cout << "mass num: " << h->Integral() << std::endl; std::cout << "mass' num: " << h2->Integral() << std::endl; DiMuPlottingSystem* dps = new DiMuPlottingSystem(); dps->arrangeStatBox(c); c->Draw(); c->Print("newfit.png"); }
TProfile* overlayTProfiles(TH2F* hdata, TH2F* hdy, float ymin, float ymax, TString savename) { // See how the mean of the dimumass changes vs some variable by making TProfiles of a 2D histogram with the Dimu mass as the y axis. // Compare data to MC and save the results as png files. TString dataname = TString("Golden_JSON_DoubleMuon_Data"); TString dyname = TString("Drell_Yan_Monte_Carlo_2015"); // Make TProfiles from them to see how the mean changes vs the x variable. TProfile* pdata = hdata->ProfileX(); pdata->SetLineColor(1); pdata->SetLineWidth(3); pdata->SetTitle(hdata->GetTitle()); pdata->GetYaxis()->SetTitle(hdata->GetYaxis()->GetTitle()); TProfile* pdy = hdy->ProfileX(); pdy->SetLineColor(2); pdy->SetLineWidth(3); pdy->SetTitle(hdy->GetTitle()); pdy->GetYaxis()->SetTitle(hdy->GetYaxis()->GetTitle()); std::cout<< "hdata: " << hdata << std::endl; std::cout<< "hdy: " << hdy << std::endl; std::cout<< "pdata: " << pdata << std::endl; std::cout<< "pdy: " << pdy << std::endl; TCanvas* c = new TCanvas(); c->SetGridx(kTRUE); c->SetGridy(kTRUE); // Draw data and MC on the same plot // Have to draw the same plots twice to get error bars and a curve through the error bars. c->cd(); // hdata->Draw("colz"); pdata->SetAxisRange(ymin,ymax,"Y"); pdata->Draw("hist c"); pdata->Draw("E X0 same"); pdy->Draw("hist c same"); pdy->Draw("E X0 same"); // Stat box alignment DiMuPlottingSystem* dps = new DiMuPlottingSystem(); dps->arrangeStatBox(c); // Legend TLegend* l = new TLegend(0.15, 0.15, 0.7, 0.25, "", "brNDC"); l->AddEntry(pdata, dataname, "l"); l->AddEntry(pdy, dyname, "l"); l->Draw("same"); c->Print(savename); return pdata; }
void DrawRunQA(){ TFile *f = TFile::Open("merged_Anappmb.root"); TH2F* hrunbbcs = (TH2F*)f->Get("hrunbbcs"); TH2F* hrunbbcn = (TH2F*)f->Get("hrunbbcn"); TH2F* hrunntrack[4]; TH2F* hrunntracktot; TProfile* hQAntrack[4]; TProfile* hQAntracktot; hrunntrack[0] = (TH2F*)f->Get(Form("hrunntrack_arm0_pos")); hrunntrack[1] = (TH2F*)f->Get(Form("hrunntrack_arm0_neg")); hrunntrack[2] = (TH2F*)f->Get(Form("hrunntrack_arm1_pos")); hrunntrack[3] = (TH2F*)f->Get(Form("hrunntrack_arm1_neg")); hrunntracktot = (TH2F*)hrunntrack[0]->Clone("hrunntrack_tot"); for(int i=0;i<4;i++){ hQAntrack[i] = (TProfile*)hrunntrack[i]->ProfileX(Form("hQAntrack_%d",i)); if(i!=0) hrunntracktot->Add(hrunntrack[i]); } hQAntracktot = (TProfile*)hrunntracktot->ProfileX(Form("hQAntracktot")); TProfile* hQAbbcs = hrunbbcs->ProfileX("hQAbbcs"); TProfile* hQAbbcn = hrunbbcn->ProfileX("hQAbbcn"); TCanvas *c1 = new TCanvas(); SetTitle(*hQAbbcs,"run Number","bbc south charge average",""); SetYRange(*hQAbbcs,3,8); SetStyle(*hQAbbcs,0.8,1,20,0,0); hQAbbcs->Draw("P"); c1->Print("fig/RunQA/hrunbbcs.png"); TCanvas *c2 = new TCanvas(); SetTitle(*hQAbbcn,"run Number","bbc north charge average",""); SetYRange(*hQAbbcn,3,8); SetStyle(*hQAbbcn,0.8,1,20,0,0); hQAbbcn->Draw("P"); c2->Print("fig/RunQA/hrunbbcn.png"); TCanvas *c3 = new TCanvas(); TString title[4] = {"East arm positive","East arm negative","West arm positive","West arm negative"}; for(int i=0;i<4;i++){ SetTitle(*hQAntrack[i],"run Number","# of tracks average",title[i]); SetYRange(*hQAntrack[i],0.45,0.60); SetStyle(*hQAntrack[i],0.8,1,20,0,0); hQAntrack[i]->Draw("P"); c3->Print(Form("fig/RunQA/hrunntrack_%d.png",i)); } TCanvas *c4 = new TCanvas(); SetTitle(*hQAntracktot,"run Number","# of tracks average","track 0.2<p_{T}<5.0"); SetYRange(*hQAntracktot,0,5); SetStyle(*hQAntracktot,0.8,1,20,0,0); hQAntracktot->Draw("P"); c4->Print(Form("fig/RunQA/hrunntracktot.png")); }
void rotate2DN(const char* filename,int detNum){ TFile *f = new TFile(filename); TCanvas* cnew= new TCanvas("cnew","",800.,500.); cnew->cd(); stringstream sss; sss<<"Transposed-"<<filename; TFile f1(sss.str().c_str(),"RECREATE"); for (int i=0;i<detNum;i++){ stringstream orig ; orig<<"hNc"<<i ; TH2D* h1=(TH2D*)f->Get(orig.str().c_str()); string gname = h1->GetTitle(); stringstream hname ; hname<<"hN"<<i; TH2D* Hnew = new TH2D(hname.str().c_str(),gname.c_str(),1700.,0.,1700.,8000.,0.,8000.); for (int x=0;x<8000;x++){ for (int y=0;y<1600;y++){ int bin = h1->GetBinContent(x,y); Hnew->Fill(y,x,bin); } } cout<<"Histogram Number "<<i<<" transpose completed"<<endl; cnew->cd(); Hnew->SetMinimum(7); Hnew->GetYaxis()->SetRangeUser(1300,1600); Hnew->GetYaxis()->SetTitle("Energy (keV)"); Hnew->GetXaxis()->SetTitle("Cycle Number"); Hnew->Draw("COLZ"); TCutG *cutg = new TCutG("NaIcut1",5); cutg->SetVarX("y"); cutg->SetVarY("x"); cutg->SetPoint(0,0,1350); cutg->SetPoint(1,1500,1350); cutg->SetPoint(2,1500,1500); cutg->SetPoint(3,0,1500); cutg->SetPoint(4,0,1350); TProfile *profx = Hnew->ProfileX(Form("profx_%d",i),1,-1,"[NaIcut1]"); profx->SetLineColor(kRed); profx->Draw("same"); cnew->Update(); gname = gname + ".pdf"; cnew->SaveAs(gname.c_str()); } f1.Write(); }
void QAoccupancy(const Char_t *fdata, const Char_t *fmc) { style(); TFile *fdtin = TFile::Open(fdata); TList *ldtin = (TList *)fdtin->Get("clist"); TH2 *hdtin = (TH2 *)ldtin->FindObject("NClustersSPD2"); TProfile *pdtin = hdtin->ProfileY("pdtin_clusters"); pdtin->SetMarkerStyle(20); pdtin->SetMarkerSize(2); pdtin->SetMarkerColor(kAzure-3); TFile *fmcin = TFile::Open(fmc); TList *lmcin = (TList *)fmcin->Get("clist"); TH2 *hmcin = (TH2 *)lmcin->FindObject("NClustersSPD2"); TProfile *pmcin = hmcin->ProfileY("pmcin_clusters"); pmcin->SetMarkerStyle(25); pmcin->SetMarkerSize(2); pmcin->SetMarkerColor(kRed+1); TCanvas *c = new TCanvas("cOccupancy", "cOccupancy", 800, 800); c->SetLogy(); TH1 * hfr = c->DrawFrame(-0.5, 2., 10.5, 500.); DrawBinLabelsX(hfr, kTRUE); hfr->SetTitle(";;#LT#it{N}_{clusters,SPD-1}#GT"); pdtin->DrawCopy("same"); pmcin->DrawCopy("same"); TLegend *legend = new TLegend(0.20, 0.18, 0.50, 0.30); legend->SetFillColor(0); legend->SetBorderSize(0); legend->SetTextFont(42); legend->SetTextSize(0.04); legend->AddEntry(pdtin, "data", "pl"); legend->AddEntry(pmcin, "Monte Carlo", "pl"); legend->Draw("same"); c->SaveAs(canvasPrefix+"occupancy.pdf"); return; TCanvas *cr = new TCanvas("cOccupancyr", "cOccupancyr", 800, 800); // hfr = cr->DrawFrame(-0.5, 0.75, 10.5, 1.25); // DrawBinLabelsX(hfr, kTRUE); // hfr->SetTitle(";;#LT#it{N}_{clusters,SPD-1}#GT ratio"); pdtin->SetLineColor(kAzure-3); pdtin->SetLineWidth(3); pdtin->Divide(pmcin); pdtin->Draw("same,histo"); legend = new TLegend(0.505025, 0.760673, 0.805276, 0.930142); legend->SetFillColor(0); legend->SetBorderSize(0); legend->SetTextFont(42); legend->SetTextSize(0.04); legend->AddEntry(pdtin, "data / Monte Carlo", "l"); legend->Draw("same"); cr->SaveAs(canvasPrefix+"occupancyr.pdf"); }
void profile() { TCanvas* c1 = new TCanvas("canvas","nhitac",1200,600); c1->Divide(2,1); c1->cd(1); TFile *file1 = new TFile("test_nhitac_modified.root"); //TH1F *histo1 = new TH1F("nhitac1","nhitac1",60,0,300); TProfile *profile1 = new TProfile("profile","nhitac profile",100,0,100,0,300); TFile *file2 = new TFile("test_nhitac_unmodified.root"); //TH1F *histo2 = new TH1F("nhitac","nhitac",60,0,300); TProfile *profile2 = new TProfile("profile2","nhitac profile2",100,0,100,0,300); TProfile *ratio = new TProfile("ratio","nhitac ratio", 100,0,100,0,2); //histo2->SetMarkerStyle(31); TLegend *l1 = new TLegend(0.20, 0.60, 0.3, 0.7); l1->SetBorderSize(0); TTree* nhitac_modified = (TTree*)file1->Get("testnhitac"); TTree* nhitac_unmodified = (TTree*)file2->Get("testnhitac"); int testnhitac1, testnhitac2; nhitac_modified->SetBranchAddress("nhitac",&testnhitac1); nhitac_unmodified->SetBranchAddress("nhitac",&testnhitac2); for(int i= 0; i < nhitac_modified->GetEntries(); i++) { nhitac_modified->GetEntry(i); nhitac_unmodified->GetEntry(i); profile1->Fill(i,testnhitac1); profile2->Fill(i,testnhitac2); double temp = testnhitac2; ratio->Fill(i,testnhitac1/temp); //histo1->Fill(testnhitac1); //histo2->Fill(testnhitac2); } //histo1->SetMarkerColor(kRed); //histo1->SetLineColor(kRed); profile1->SetMarkerColor(kRed); profile1->SetMarkerStyle(5); profile2->SetMarkerColor(kBlue); l1->AddEntry(profile1,"modified od bad channel","P"); l1->AddEntry(profile2,"old od bad channel","l"); l1->SetTextSize(0.04); profile1->Draw("e1p"); profile1->GetXaxis()->SetTitle("event #"); profile1->GetYaxis()->SetTitle("nhitac"); profile2->Draw("same"); l1->Draw(); c1->cd(2); ratio->GetXaxis()->SetTitle("event #"); ratio->GetYaxis()->SetTitle("new/old"); //ratio->SetMarkerStyle(5); //ratio->SetMarkerColor(kRed); ratio->Draw(); }
void deviationBosonPtOld() { TFile *lFile = new TFile("ZTPMC.root"); TTree *lTree = (TTree*) lFile->FindObjectAny("WNtupleIdEffNT"); //lTree->Print(); //lTree->Draw("mt"); std::string lZPt = "sqrt((abs(pt)*cos(phi)+abs(jetpt)*cos(jetphi))*(abs(pt)*cos(phi)+abs(jetpt)*cos(jetphi)) + (abs(pt)*sin(phi)+abs(jetpt)*sin(jetphi))*(abs(pt)*sin(phi)+abs(jetpt)*sin(jetphi)))"; TProfile *lPProf = new TProfile("A","A",8,0,40); lPProf->SetMarkerColor(kBlue); lPProf->SetMarkerStyle(21); lPProf->SetLineColor(kBlue); TProfile *lMProf = new TProfile("B","B",8,0,40); lMProf->SetMarkerColor(kRed); lMProf->SetMarkerStyle(21); lMProf->SetLineColor(kRed); lTree->Draw(std::string("mt:"+lZPt+">>A").c_str(),std::string("mt > 80 && charge > 0 ").c_str()); lTree->Draw(std::string("mt:"+lZPt+">>B").c_str(),std::string("mt > 80 && charge < 0 ").c_str()); //lTree->Draw(std::string("mt>>A").c_str(),"mt > 80 && charge > 0"); //lTree->Draw(std::string("mt>>B").c_str(),"mt > 80 && charge < 0"); TLegend *lL = new TLegend(0.6,0.6,0.9,0.9); lL->SetFillColor(0); lL->AddEntry(lPProf,"Plus","lp"); lL->AddEntry(lMProf,"Minus","lp"); lPProf->Draw(); lMProf->Draw("same"); lL->Draw(); }
void ElectronSimulation::plotTProfile(TTree* treeData ) { TProfile* hprof = new TProfile("hprof", "hprof", 7, -0.5, 9.5); for (int i = 0; i < 7; ++i) { char chargeValueString[100]; snprintf(chargeValueString,100,"qChargeValues[%i]:%i",i,i); treeData->Project("+hprof",chargeValueString); } hprof->Draw(); }
void compareTPCTOF(Int_t icentr,Int_t spec,Int_t arm,Float_t pTh,Int_t addbin){ LoadLib(); Float_t ptMaxFit[8] = {20,0.7,0.55,1.2,2,2,2,2}; TProfile *pTPC = extractFlowVZEROsingle(icentr,spec,arm,0,pTh,addbin,"TPC",0,0,-1,-1+2*(spec!=3)); // TPC && !TOF (TPC PID) TProfile *pTPC2 = extractFlowVZEROsingle(icentr,spec,arm,0,pTh,addbin,"TPCextra",2,2,-1,-1+2*(spec!=3)); //TPC && TOF (TPC PID) TProfile *pTOF = extractFlowVZEROsingle(icentr,spec,arm,0,pTh,addbin,"TOF",1,1,-1,-1+2*(spec!=3)); //TPC && TOF (TPC&TOF PID) if(spec > 0) pTPC->Add(pTPC2); else pTPC->Add(pTOF); char name[100]; snprintf(name,100,"NUO_%i",spec); hNUO[spec] = pTPC->ProjectionX(name); hNUO[spec]->Add(pTOF,-1); if(spec && hNUO[0]) hNUO[spec]->Add(hNUO[0],-1); if(! kCleanMemory){ new TCanvas(); pTPC->Draw(); pTOF->Draw("SAME"); new TCanvas(); pTPC->SetLineColor(1); pTOF->SetLineColor(2); } hNUO[spec]->Draw(); if(kCleanMemory){ if(pTPC) delete pTPC; if(pTPC2) delete pTPC2; if(pTOF) delete pTOF; } }
void drawPtEta(char *inf){ TFile a(inf); a.cd("ana"); TProfile *h = new TProfile("h","",100,-3,3); TCanvas *c = new TCanvas("c","",400,400); hi->Draw("(pt):eta>>h","evtType!=92&&evtType!=93&&(abs(eta)<2.4&&chg!=0&&abs(pdg)!=11&&abs(pdg)!=13)","prof",10000); double nevt = hi->GetEntries("evtType!=92&&evtType!=93"); h->Sumw2(); //h->Scale(2./nevt); h->SetXTitle("#eta"); h->SetYTitle("Average P_{T}"); h->Draw(); c->SaveAs(Form("%s-PtEta-2.4.gif",inf)); c->SaveAs(Form("%s-PtEta-2.4.C",inf)); }
void plotAndProfileX (TH2* h2, float min, float max, bool profile) { setStyle(h2); gPad->SetGrid(1,1); gStyle->SetGridColor(15); h2->GetYaxis()->SetRangeUser(min,max); h2->Draw(); if (profile) { TProfile* prof = h2->ProfileX(); prof->SetMarkerColor(2); prof->SetLineColor(2); prof->Draw("same"); } TLine * l = new TLine(h2->GetXaxis()->GetXmin(),0,h2->GetXaxis()->GetXmax(),0); l->SetLineColor(3); l->Draw(); }
void show_mass_dist() { TFile *file_f = new TFile("particle_mass_dist.root"); TH2F *hm = (TH2F *) file_f->Get("mass_dist"); TProfile *pm = (TProfile *) file_f->Get("mass_dist_p"); TCanvas *cm = new TCanvas("cm", "Mass", 1000, 500); cm->Divide(2, 1); pm->SetLineColor(4); cm->cd(1); hm->Draw(); cm->cd(2)->SetBorderMode(0); pm->Draw(); }
TCanvas *Plot2D_profileX_my(TChain *data, TString branchname, TString binning,TString selection,TString opt,TString xLabel, TString yLabel){ //type == 0: data only //type == 1: MC only //type == 2: data/MC TCanvas *c = new TCanvas("c",""); data->Draw(branchname+">>data_hist"+binning,selection,opt); TH2F *d = (TH2F *) gROOT->FindObject("data_hist"); TCanvas *c1 = new TCanvas("c1",""); TProfile *prof = d->ProfileX("prof",1,-1,"s"); prof->SetMarkerStyle(20); prof->SetMarkerSize(1); prof->Draw(); prof->GetYaxis()->SetTitle(yLabel); prof->GetXaxis()->SetTitle(xLabel); return c1; }
void Fake100PeVShower(int opt) { // opt == 0 implies save to root file // opt == 1 implies plot and save to canvas TFile* file = NULL; TCanvas* c = NULL; if(opt == 0) file = new TFile("fake100PeVShower.root","recreate"); if(opt == 1) c = makeCanvas("c"); TString gaus = "1.5e7*TMath::Exp(-(pow(x-10,2)/9))"; TString bump = "5e6*TMath::Exp(-(pow(x-17,2)/20))"; TF1* f = new TF1("f",(gaus+"+"+bump).Data(),0,30); int nbins = 3000; float xmin = 0; float xmax = 30; TProfile* prof = new TProfile("prof","",nbins,xmin,xmax); prof->SetStats(0); prof->SetTitle(""); prof->GetYaxis()->SetTitle("Charge excess / 1e7"); prof->GetXaxis()->SetTitle("z [m]"); float step = xmax / nbins; for(int i =0; i<nbins; ++i){ float x = step * i; if(opt == 1 ) prof->Fill(x, f->Eval(x)/1e7); else prof->Fill(x, f->Eval(x)); } if(opt == 1){ prof->Draw(); c->SaveAs("JaimeCheck/FakeProfile100PeV.png"); } if(opt == 0){ file->Write(); file->Close(); } }
void plotQApid(Int_t ic,Float_t pt,Int_t addbin){ char name[100]; char stringa[200]; LoadLib(); snprintf(name,100,"AnalysisResults.root"); if(!fo) fo = new TFile(name); snprintf(name,100,"contVZEROv2"); TList *cont = (TList *) fo->Get(name); AliFlowVZEROResults *pidqa = cont->FindObject("qaPID"); Float_t xval[2] = {2.,pt+0.00001}; Float_t xval2[2] = {2.+addbin,pt+0.00001}; TProfile *proTPCpi = pidqa->GetV2(0,xval,xval2); TProfile *proTOFpi = pidqa->GetV2(1,xval,xval2); TProfile *proTPCka = pidqa->GetV2(2,xval,xval2); TProfile *proTOFka = pidqa->GetV2(3,xval,xval2); TProfile *proTPCpr = pidqa->GetV2(4,xval,xval2); TProfile *proTOFpr = pidqa->GetV2(5,xval,xval2); proTPCpi->SetName("hPiTPC"); proTOFpi->SetName("hPiTOF"); proTPCka->SetName("hKaTPC"); proTOFka->SetName("hKaTOF"); proTPCpr->SetName("hPrTPC"); proTOFpr->SetName("hPrTOF"); proTPCpi->GetXaxis()->SetTitle("dE/dx - dE/dx_{calc}^{#pi} (a.u)"); proTOFpi->GetXaxis()->SetTitle("t_{tof} - t_{calc}^{#pi} (ps)"); proTPCka->GetXaxis()->SetTitle("dE/dx - dE/dx_{calc}^{K} (a.u)"); proTOFka->GetXaxis()->SetTitle("t_{tof} - t_{calc}^{K} (ps)"); proTPCpr->GetXaxis()->SetTitle("dE/dx - dE/dx_{calc}^{p} (a.u)"); proTOFpr->GetXaxis()->SetTitle("t_{tof} - t_{calc}^{p} (ps)"); TCanvas *c = new TCanvas("cVproj","cVproj"); c->Divide(2,3); c->cd(1); proTPCpi->Draw(); c->cd(2); proTOFpi->Draw(); c->cd(3); proTPCka->Draw(); c->cd(4); proTOFka->Draw(); c->cd(5); proTPCpr->Draw(); c->cd(6); proTOFpr->Draw(); }
// ---------------------------------------------------------------------- void nmod(const int offset = 400) { c0.Clear(); c0.Divide(2,8); tl->SetTextSize(0.2); tl->SetNDC(kTRUE); tl->SetTextAngle(90); gStyle->SetOptTitle(0); gStyle->SetOptStat(0); gROOT->ForceStyle(); double min(-1), max(-1); if (offset == 600) { min = 120; max = 200; } TProfile *p; for (int i = 0; i < 16; ++i) { c0.cd(i+1); p = (TProfile*)gFile->Get(Form("p%i", offset+i)); if (min > -1) { p->SetMinimum(min); p->SetMaximum(max); } p->Draw(); tl->DrawLatex(0.2, 0.11, Form("Chip %i", i)); } if (offset == 400) c0.SaveAs("ped-nmod.ps"); if (offset == 500) c0.SaveAs("gain-nmod.ps"); if (offset == 600) c0.SaveAs("noise-nmod.ps"); if (offset == 700) c0.SaveAs("pedgain-nmod.ps"); }
void AnalysisBase::getTDC(){ TProfile *hb = new TProfile("hb","Cluster Charge vs TDC time",12,0,12,100,1000); Long64_t nentries = fChain->GetEntriesFast(); float lo = 0, hi = 0; int istrip; Long64_t nbytes = 0, nb = 0; std::cout << "============================================" << std::endl; std::cout << "getTDC(): Determining Optimal TDC time range" << std::endl; std::cout << "============================================" << std::endl; for (Long64_t jentry=0; jentry<max(50000,(int)nentries);jentry++) { Long64_t ientry = LoadTree(jentry); if (ientry < 0) break; nb = fChain->GetEntry(jentry); nbytes += nb; for(int j=0; j<min((int)clusterNumberPerEvent,10); j++){ //std::cout << "j: " << ", clustersTDC: " << clustersTDC << ", clustersCharge[j]: " << clustersCharge[j] << ", clustersPosition[j]: " << clustersPosition[j] << std::endl; istrip = clustersSeedPosition[j]; if(badStrips[istrip]==0) continue; // exclude bad strips if(clustersPosition[j] < 0.1) continue; if(polarity*clustersCharge[j] < kClusterChargeMin) continue; if(clustersPosition[j]>=iLo && clustersPosition[j]<=iHi && clustersTDC>1.0 && polarity*clustersCharge[j]>150 && polarity*clustersCharge[j]<500) hb->Fill(clustersTDC+0.1,polarity*clustersCharge[j]); } } getTDCBins(hb,lo,hi); tdcLo = lo; tdcHi = hi; std::cout << "====> TDC Range determined to be from " << tdcLo << " -- " << tdcHi << std::endl; hb->Draw(); //delete hb; return; }
void makePlots(char * file, char * suffix) { //Get rid of stat-box gROOT->GetStyle("Plain")->SetOptStat(0); // AXIS LABELS STYLE gROOT->GetStyle("Plain")->SetLabelColor(kBlack, "XYZ"); gROOT->GetStyle("Plain")->SetLabelFont(43, "XYZ"); gROOT->GetStyle("Plain")->SetLabelSize(20, "XYZ"); gROOT->SetStyle("Plain"); gROOT->ForceStyle(kTRUE); const char * folder = "demo"; const char * to_plot[] = {"TrackerClusterMap", "TrackerClusterOntrackMap", "TrackerSameClusterOntrackMap", "TrackerOccupancyOntrackMap", "TrackerOccupancySameClusterOntrackMap", 0}; TFile * f = new TFile(file); TCanvas * c = new TCanvas("C", "C", 1024, 1024); for (const char **profile = to_plot; *profile; ++profile) { TString obj_name(folder); obj_name.Append("/").Append(*profile); TProfile * p = (TProfile*)f->Get(obj_name.Data()); p->Draw("colz"); TString filename(*profile); filename.Append("_").Append(suffix).Append(".png"); c->SaveAs(filename.Data()); } }
void makePlots (string configFilePath){ if (( nHistList % inputRootFile.size() == 0 )) { for (int i=0; i<numHistos; i++) { TCanvas *c = new TCanvas(theHistNameStrings.at(i).c_str(), "", 81,58,500,602); TH1* h_mc; // histograms for MC TH1* h_mc_clone; // histograms for MC TH1* h_data; // histogram to store data points TH1* h_data_clone; TLegend *legend = new TLegend(0.2, 0.85-.035*inputLegend.size(), 0.5, 0.90,NULL,"brNDC"); int whichHisto = 0; for (int j=1;j<inputRootFile.size();j++) { whichHisto=j*numHistos; int a = 0; bool foundHisto = false; if (theHistNameStrings.at(i) == theHistNameStrings.at(i+whichHisto)) { foundHisto=true; a=i; } else { for (a = 0; a < numHistos; a++) { if (theHistNameStrings.at(i) == theHistNameStrings.at(a+whichHisto)) { foundHisto = true; break; } } } //----------------------------------------------------------- string hist2name = listHistos->At(a+whichHisto)->GetName(); if (foundHisto == true) { h_data = (TH1*)listHistos->At(i); h_data->SetMarkerStyle(inputMarkerStyle.at(0)); h_data = SetStyleh(h_data); h_data->Sumw2(); int thelineStyle = inputSetLineStyle.at(j); int thelineWidth = inputSetLineWidth.at(j); int setcolor = inputColor.at(j); int marker = inputMarkerStyle.at(j); h_data->SetMarkerColor(inputColor.at(0)); h_data->SetLineColor(inputColor.at(0)); if (j == 1) { if ( h_data->IsA()->InheritsFrom( "TH2" ) ) { //n.b. that ProfileX will do nothing if the //name you choose is alreayd taken! so each //profileX needs a unique name TString profileName = TString::Format("%s_data_pfx",h_data->GetName()); TProfile *dataProf = ((TH2*)h_data)->ProfileX(profileName.Data()); dataProf->SetMinimum(h_data->GetMinimum()); //min/max values were stored in the original hist dataProf->SetMaximum(h_data->GetMaximum()); dataProf->Draw(""); //profileX cretaes a clone, so no need to //clone again here. Need to set the hist //name so root doesn't complain TString cloneName = TString::Format("%s_data_pfx_clone",h_data->GetName()); TString cloneName2 = TString::Format("%s_data_pfx_clone_px",h_data->GetName()); h_data_clone = ((TH2*)h_data)->ProfileX(cloneName.Data())->ProjectionX(cloneName2.Data()); } else { //1d case Float_t ymaxc = gPad->GetUymax(); //h_data->SetMaximum(ymaxc+0.15*ymaxc); h_data->Draw("ep1"); h_data_clone = (TH1*)h_data->Clone(); } //h_data->SetLineColor(1); h_data->SetLineStyle(thelineStyle); h_data->SetLineWidth(thelineWidth); float rms_data = h_data->GetRMS(); float mean_data = h_data->GetMean(); std::stringstream legend_data; legend_data.str(""); legend_data << inputLegend.at(0).c_str() << ": mean=" << setprecision(3) <<mean_data <<", rms=" << setprecision(3) <<rms_data<< endl; legend->AddEntry(h_data,legend_data.str().c_str(), "lep"); } h_mc = (TH1*)listHistos->At(a+whichHisto); h_mc = SetStyleh(h_mc); h_mc->SetName(hist2name.c_str()); //cout<<"NAME "<<h_mc->GetName()<<endl; // Style string processlegend = (inputLegend.at(j)).c_str(); h_mc->SetLineStyle(thelineStyle); h_mc->SetLineWidth(thelineWidth); h_mc->SetLineColor(setcolor); h_mc->SetMarkerStyle(marker); h_mc->SetMarkerColor(setcolor); string processlegend = (inputLegend.at(j)).c_str(); if ( h_mc->IsA()->InheritsFrom( "TH2" ) ) { TString profileName = TString::Format("%s_mc_pfx", h_mc->GetName()); ((TH2*)h_mc)->ProfileX(profileName.Data())->Draw("SAME"); //profileX cretaes a clone, so no need to //clone again here. Need to set the hist //name so root doesn't complain TString cloneName = TString::Format("%s_mc_pfx_clone",h_mc->GetName()); TString cloneName2 = TString::Format("%s_mc_pfx_clone_px",h_mc->GetName()); h_mc_clone = ((TH2*)h_mc)->ProfileX(cloneName.Data())->ProjectionX(cloneName2.Data()); } else { //1d case Float_t ymaxc = gPad->GetUymax(); h_mc->SetMaximum(ymaxc+0.15*ymaxc); h_mc->Draw("epsame"); h_mc_clone = (TH1*)h_mc->Clone(); } h_mc_clone->SetMarkerStyle(marker); h_mc_clone->SetMarkerColor(setcolor); float rms_mc = h_mc->GetRMS(); float mean_mc = h_mc->GetMean(); std::stringstream legend_mc; legend_mc.str(""); legend_mc << processlegend.c_str() << " - "<< "mean: " << setprecision(3) <<mean_mc <<" , rms: " << setprecision(3) <<rms_mc<< endl; legend->AddEntry(h_mc, legend_mc.str().c_str(), "lep"); }// close if (foundHisto) legend->SetTextFont(42); legend->SetTextSize(.04); legend->SetMargin(0.15); legend->SetLineColor(1); legend->SetLineStyle(1); legend->SetLineWidth(1); legend->SetFillColor(0); legend->SetFillStyle(0); legend->SetBorderSize(0); legend->SetFillColor(kWhite); legend->Draw(); c->cd(); if (j == 1) { float startxbin = h_data_clone->GetXaxis()->GetBinWidth(h_data_clone->GetXaxis()->GetFirst()) * (h_data_clone->GetXaxis()->GetFirst() - 1); float lastxbin = h_data_clone->GetXaxis()->GetBinCenter(h_data_clone->GetXaxis()->GetNbins()); double x1 = 0; double x2 = lastxbin + h_data_clone->GetXaxis()->GetBinWidth(h_data_clone->GetXaxis()->GetNbins())/2.; if (h_data_clone->GetXaxis()->GetBinCenter(0) <= 0) x1 = h_data_clone->GetXaxis()->GetBinCenter(0) + h_data_clone->GetXaxis()->GetBinWidth(0)/2. + startxbin; else x1 = h_data_clone->GetXaxis()->GetBinCenter(0) - h_data_clone->GetXaxis()->GetBinWidth(0)/2. - startxbin; } } // close for loop inputRootFile TFile *hfile = (TFile*)gROOT->FindObject(HistosOutputRootFile.c_str()); if (hfile) {hfile->Close();} hfile = new TFile(HistosOutputRootFile.c_str(),"UPDATE"); for (int o = 0; o < inputHistoName.size(); o++) { if ( c->GetName() == inputHistoName.at(o) ) { string save = configFilePath+"/"+inputHistoName.at(o)+".pdf"; c->SaveAs(save.c_str()); c->Write(); break; } } hfile->Close(); c->Close(); } // close foor loop numHistos } // close if numHistos % inputRootFile.size() == 0 } // close makePlots function
void tauStudy(const TString inputfile = "/afs/cern.ch/work/k/klawhorn/HHToBBTT/Conf4_10GeV/HHToBBTT_10GeVJets_14TeV.root") { // set up input tree LorentzVector *genTau1=0, *genTau2=0, *genJetTau1=0, *genJetTau2=0, *jetTau1=0, *jetTau2=0; Float_t genTau1pt, genTau2pt, genJetTau1pt, genJetTau2pt, jetTau1pt, jetTau2pt, corrJetTau1pt, corrJetTau2pt; Float_t genTau1eta, genTau2eta, genJetTau1eta, genJetTau2eta, jetTau1eta, jetTau2eta; TFile *infile = new TFile(inputfile, "READ"); assert(infile); TTree *intree = (TTree*) infile->Get("Events"); assert(intree); intree->SetBranchAddress("genTau1", &genTau1); intree->SetBranchAddress("genTau2", &genTau2); intree->SetBranchAddress("genJetTau1", &genJetTau1); intree->SetBranchAddress("genJetTau2", &genJetTau2); intree->SetBranchAddress("jetTau1", &jetTau1); intree->SetBranchAddress("jetTau2", &jetTau2); const Float_t PT_MAX = 500; const Float_t PT_MIN = 0; const Int_t PT_BINS = 50; const Float_t ETA_MAX = 2.4; const Float_t ETA_MIN = -2.4; const Int_t ETA_BINS = 16; TProfile *tauTagEffWithPT = new TProfile("tauTagEffWithPT", "Tau Tagging Efficiency", PT_BINS, PT_MIN, PT_MAX); TProfile *tauTagEffWithEta = new TProfile("tauTagEffWithEta", "Tau Tagging Efficiency", ETA_BINS, ETA_MIN, ETA_MAX); //TProfile *ptScaleWithPT = new TProfile("ptScaleWithPT", "P_{T} Scale Factor between gen Tau and reco Jet", PT_BINS, PT_MIN, PT_MAX); //TProfile *ptJetScaleWithPT = new TProfile("ptJetScaleWithPT", "P_{T} Scale Factor between gen Jet and reco Jet", PT_BINS, PT_MIN, PT_MAX); //TProfile *ptScaleWithEta = new TProfile("ptScaleWithEta", "P_{T} Scale Factor between gen Tau and reco Jet", ETA_BINS, ETA_MIN, ETA_MAX); //TProfile *ptJetScaleWithEta = new TProfile("ptJetScaleWithEta", "P_{T} Scale Factor between gen Jet and reco Jet", ETA_BINS, ETA_MIN, ETA_MAX); //TProfile *ptResWithPT = new TProfile("ptResWithPT", "P_{T} Resolution between gen Tau and reco Jet", PT_BINS, PT_MIN, PT_MAX); TProfile *ptJetResWithPT = new TProfile("ptJetResWithPT", "P_{T} Resolution: (genJet-recoJet)/(genJet)", PT_BINS, PT_MIN, PT_MAX); TProfile *ptJetResCorrWithPT = new TProfile("ptJetResCorrWithPT", "P_{T} Resolution: (genJet-recoJet)/(genJet)", PT_BINS, PT_MIN, PT_MAX); //TProfile *ptResWithEta = new TProfile("ptResWithEta", "P_{T} Resolution between gen Tau and reco Jet", ETA_BINS, ETA_MIN, ETA_MAX); TProfile *ptJetResWithEta = new TProfile("ptJetResWithEta", "P_{T} Resolution: (genJet-recoJet)/(genJet)", ETA_BINS, ETA_MIN, ETA_MAX); TProfile *ptJetResCorrWithEta = new TProfile("ptJetResCorrWithEta", "P_{T} Resolution: (genJet-recoJet)/(genJet)", ETA_BINS, ETA_MIN, ETA_MAX); for (Int_t iEntry=0; iEntry<intree->GetEntries(); iEntry++) { intree->GetEntry(iEntry); genTau1pt = genTau1->Pt(); genTau1eta = genTau1->Eta(); genTau2pt = genTau2->Pt(); genTau2eta = genTau2->Eta(); genJetTau1pt = genJetTau1->Pt(); genJetTau1eta = genJetTau1->Eta(); genJetTau2pt = genJetTau2->Pt(); genJetTau2eta = genJetTau2->Eta(); jetTau1pt = jetTau1->Pt(); jetTau1eta = jetTau1->Eta(); jetTau2pt = jetTau2->Pt(); jetTau2eta = jetTau2->Eta(); // jet corrections //if ( (jetTau1pt != 999) ) cout << "eta " << jetTau1eta << " pt " << jetTau1pt << " scaleCorr " << getJetScaleFactor(jetTau1pt, jetTau1eta) << endl; corrJetTau1pt = jetTau1pt*getJetScaleFactor(jetTau1pt, jetTau1eta); corrJetTau2pt = jetTau2pt*getJetScaleFactor(jetTau2pt, jetTau2eta); if ( (genTau1pt != 999) && (jetTau1pt != 999) ) { tauTagEffWithPT->Fill(genTau1pt, 1); //ptScaleWithPT->Fill(genTau1pt, jetTau1pt/genTau1pt); //ptJetScaleWithPT->Fill(genJetTau1pt, jetTau1pt/genJetTau1pt); //ptResWithPT->Fill(genTau1pt, (genTau1pt-jetTau1pt)/genTau1pt); ptJetResWithPT->Fill(genJetTau1pt, (genJetTau1pt-jetTau1pt)/genJetTau1pt); ptJetResCorrWithPT->Fill(genJetTau1pt, (genJetTau1pt-corrJetTau1pt)/genJetTau1pt); tauTagEffWithEta->Fill(genTau1eta, 1); //ptScaleWithEta->Fill(genTau1eta, jetTau1pt/genTau1pt); //ptJetScaleWithEta->Fill(genJetTau1eta, jetTau1pt/genJetTau1pt); //ptResWithEta->Fill(genTau1eta, (genTau1pt-jetTau1pt)/genTau1pt); ptJetResWithEta->Fill(genJetTau1eta, (genJetTau1pt-jetTau1pt)/genJetTau1pt); ptJetResCorrWithEta->Fill(genJetTau1eta, (genJetTau1pt-corrJetTau1pt)/genJetTau1pt); } else if ( (genTau1pt != 999) && (jetTau1pt == 999) ) { tauTagEffWithPT->Fill(genTau1pt, 0); tauTagEffWithEta->Fill(genTau1eta, 0); } if ( (genTau2pt != 999) && (jetTau2pt != 999) ) { tauTagEffWithPT->Fill(genTau2pt, 1); //ptScaleWithPT->Fill(genTau2pt, jetTau2pt/genTau2pt); //ptJetScaleWithPT->Fill(genJetTau2pt, jetTau2pt/genJetTau2pt); //ptResWithPT->Fill(genTau2pt, (genTau2pt-jetTau2pt)/genTau2pt); ptJetResWithPT->Fill(genJetTau2pt, (genJetTau2pt-jetTau2pt)/genJetTau2pt); ptJetResCorrWithPT->Fill(genJetTau2pt, (genJetTau2pt-corrJetTau2pt)/genJetTau2pt); tauTagEffWithEta->Fill(genTau2eta, 1); //ptScaleWithEta->Fill(genTau2eta, jetTau2pt/genTau2pt); //ptJetScaleWithEta->Fill(genJetTau2eta, jetTau2pt/genJetTau2pt); //ptResWithEta->Fill(genTau2eta, (genTau2pt-jetTau2pt)/genTau2pt); ptJetResWithEta->Fill(genJetTau2eta, (genJetTau2pt-jetTau2pt)/genJetTau2pt); ptJetResCorrWithEta->Fill(genJetTau2eta, (genJetTau2pt-corrJetTau2pt)/genJetTau2pt); } else if ( (genTau2pt != 999) && (jetTau2pt == 999) ) { tauTagEffWithPT->Fill(genTau2pt, 0); tauTagEffWithEta->Fill(genTau2eta, 0); } } TCanvas *c1 = MakeCanvas("c1", "Tau Tagging Efficiency", 800, 600); tauTagEffWithPT->SetMarkerStyle(1); tauTagEffWithPT->GetXaxis()->SetTitle("P_{T} of Generator Tau"); tauTagEffWithPT->GetYaxis()->SetTitle("Efficiency"); tauTagEffWithPT->Draw(); c1->SaveAs("tauTagEffWithPT.png"); TCanvas *c2 = MakeCanvas("c2", "Tau Tagging Efficiency", 800, 600); tauTagEffWithEta->SetMarkerStyle(1); tauTagEffWithEta->GetXaxis()->SetTitle("Eta of Generator Tau"); tauTagEffWithEta->GetYaxis()->SetTitle("Efficiency"); tauTagEffWithEta->Draw(); c2->SaveAs("tauTagEffWithEta.png"); /* TCanvas *c3 = MakeCanvas("c3", "Tau P_{T} Scale (reco Tau Jet P_{T}/gen Tau P_{T})", 800, 600); ptScaleWithPT->SetMarkerStyle(1); ptScaleWithPT->GetXaxis()->SetTitle("P_{T} of Generator Tau"); ptScaleWithPT->GetYaxis()->SetTitle("P_{T} Scale"); ptScaleWithPT->Draw(); c3->SaveAs("ptScaleWithPT.png"); TCanvas *c4 = MakeCanvas("c4", "Tau P_{T} Scale (reco Tau Jet P_{T}/gen Tau P_{T})", 800, 600); ptScaleWithEta->SetMarkerStyle(1); ptScaleWithEta->GetXaxis()->SetTitle("Eta of Generator Tau"); ptScaleWithEta->GetYaxis()->SetTitle("P_{T} Scale"); ptScaleWithEta->Draw(); c4->SaveAs("ptScaleWithEta.png"); TCanvas *c5 = MakeCanvas("c5", "Tau P_{T} Scale (reco Tau Jet P_{T}/gen Tau Jet P_{T})", 800, 600); ptJetScaleWithPT->SetMarkerStyle(1); ptJetScaleWithPT->GetXaxis()->SetTitle("P_{T} of Generator Tau Jet"); ptJetScaleWithPT->GetYaxis()->SetTitle("P_{T} Scale"); ptJetScaleWithPT->Draw(); c5->SaveAs("ptJetScaleWithPT.png"); TCanvas *c6 = MakeCanvas("c6", "Tau P_{T} Scale (reco Tau Jet P_{T}/gen Tau Jet P_{T})", 800, 600); ptJetScaleWithEta->SetMarkerStyle(1); ptJetScaleWithEta->GetXaxis()->SetTitle("Eta of Generator Tau Jet"); ptJetScaleWithEta->GetYaxis()->SetTitle("P_{T} Scale"); ptJetScaleWithEta->Draw(); c6->SaveAs("ptJetScaleWithEta.png"); TCanvas *c7 = MakeCanvas("c7", "Tau P_{T} Resolution ((reco Tau Jet P_{T} - gen Tau P_{T})/gen Tau P_{T})", 800, 600); ptResWithPT->SetMarkerStyle(1); ptResWithPT->GetXaxis()->SetTitle("P_{T} of Generator Tau"); ptResWithPT->GetYaxis()->SetTitle("P_{T} Resolution"); ptResWithPT->Draw(); c7->SaveAs("ptResWithPT.png"); TCanvas *c8 = MakeCanvas("c8", "Tau P_{T} Resolution", 800, 600); ptResWithEta->SetMarkerStyle(1); ptResWithEta->GetXaxis()->SetTitle("Eta of Generator Tau"); ptResWithEta->GetYaxis()->SetTitle("P_{T} Resolution"); ptResWithEta->Draw(); c8->SaveAs("ptResWithEta.png"); TCanvas *c9 = MakeCanvas("c9", "Tau P_{T} Resolution", 800, 600); ptJetResWithPT->SetMarkerStyle(1); ptJetResWithPT->GetXaxis()->SetTitle("P_{T} of Generator Tau Jet"); ptJetResWithPT->GetYaxis()->SetTitle("P_{T} Resolution"); ptJetResWithPT->Draw(); ptJetResCorrWithPT->SetMarkerStyle(1); ptJetResCorrWithPT->SetLineColor(2); ptJetResCorrWithPT->Draw("same"); c9->SaveAs("ptJetResWithPT.png"); TCanvas *c10 = MakeCanvas("c10", "Tau P_{T} Resolution ((reco Tau Jet P_{T} - gen Tau Jet P_{T})/gen Tau Jet P_{T})", 800, 600); ptJetResWithEta->SetMarkerStyle(1); ptJetResWithEta->GetXaxis()->SetTitle("Eta of Generator Tau Jet"); ptJetResWithEta->GetYaxis()->SetTitle("P_{T} Resolution"); ptJetResWithEta->Draw(); ptJetResCorrWithEta->SetMarkerStyle(1); ptJetResCorrWithEta->SetLineColor(2); ptJetResCorrWithEta->Draw("same"); c10->SaveAs("ptJetResWithEta.png"); */ }
void plotAnaMult4(char *infname="ana.root") { TFile *inf = new TFile(infname); TTree *tData = (TTree*) inf->Get("Data_tree"); TTree *tMC = (TTree*) inf->Get("MC_tree"); TTree *tPP = (TTree*) inf->Get("PP_tree"); TCanvas *c1 = new TCanvas("c","",1200,700); // c->Divide(4,1); TCut recoCut = "leadingJetPt>120&&subleadingJetPt>50&&dphi>5*3.14159265358979/6.&&abs(leadingJetEta)<1.6&&abs(subleadingJetEta)<1.6"; TCut genCut = "genleadingJetPt>120&&gensubleadingJetPt>50&&genDphi>5*3.14159265358979/6.&&abs(genleadingJetEta)<1.6&&abs(gensubleadingJetEta)<1.6"; const int nPtBin=5; Float_t PtBins[nPtBin+1] = {0.001,0.5,1,1.5,2,3.2}; Int_t centBin[5] = {200,100,60,20,0}; makeMultiPanelCanvas(c1,4,2,0.0,0.0,0.2,0.2,0.02); for (int i=0;i<4;i++) { c1->cd(i+1); TH1D * empty=new TH1D("empty","",100,0,3.19); // empty->Fill(0.5,1000); empty->SetMaximum(39.99); empty->SetMinimum(0.001); empty->SetNdivisions(105,"X"); empty->GetXaxis()->SetTitleSize(28); empty->GetXaxis()->SetTitleFont(43); empty->GetXaxis()->SetTitleOffset(1.8); empty->GetXaxis()->SetLabelSize(22); empty->GetXaxis()->SetLabelFont(43); empty->GetYaxis()->SetTitleSize(28); empty->GetYaxis()->SetTitleFont(43); empty->GetYaxis()->SetTitleOffset(1.8); empty->GetYaxis()->SetLabelSize(22); empty->GetYaxis()->SetLabelFont(43); empty->GetXaxis()->CenterTitle(); empty->GetYaxis()->CenterTitle(); empty->SetXTitle("#Delta#eta_{1,2}"); empty->SetYTitle("Multiplicity Difference"); TProfile *pData = new TProfile(Form("pData%d",i),"",nPtBin,PtBins); TProfile *pMC = new TProfile(Form("pMC%d",i),"",nPtBin,PtBins); TProfile *pPP = new TProfile(Form("pPP%d",i),"",nPtBin,PtBins); TProfile *pGen = new TProfile(Form("pGen%d",i),"",nPtBin,PtBins); TCut centCut = Form("hiBin>=%d&&hiBin<%d",centBin[i+1],centBin[i]); tData->Draw(Form("-multDiff:abs(leadingJetEta-subleadingJetEta)>>pData%d",i),recoCut&¢Cut); tPP->Draw(Form("-multDiff:abs(leadingJetEta-subleadingJetEta)>>pPP%d",i),recoCut); tMC->Draw(Form("-multDiff:abs(leadingJetEta-subleadingJetEta)>>pMC%d",i),recoCut&¢Cut); tMC->Draw(Form("-genMultDiff:abs(genleadingJetEta-gensubleadingJetEta)>>pGen%d",i),genCut&¢Cut); pMC->SetLineColor(2); pMC->SetMarkerColor(2); pPP->SetLineColor(4); pPP->SetMarkerColor(4); // pData->SetAxisRange(0,50,"Y"); // pData->SetAxisRange(0,0.49,"X"); empty->Draw(); double diff=0; if (i==0) diff=0.1; drawText(Form("%d-%d %%",(int)(0.5*centBin[i+1]),(int)(0.5*centBin[i])),0.22+diff,0.65); if (i==0) drawText("PbPb #sqrt{s_{NN}}=2.76 TeV 150/#mub",0.22+diff,0.85); if (i==0) drawText("pp #sqrt{s_{NN}}=2.76 TeV 5.3/pb",0.22+diff,0.75); if (i==3) drawText("CMS Preliminary",0.3+diff,0.85); Float_t sys[4]={1,1,2.5,3}; for (int j=1;j<=pData->GetNbinsX();j++) { TBox *b = new TBox(pData->GetBinLowEdge(j),pData->GetBinContent(j)-sys[i],pData->GetBinLowEdge(j+1),pData->GetBinContent(j)+sys[i]); //b->SetFillColor(kGray); b->SetFillStyle(0); b->SetLineColor(1); b->Draw(); TBox *b2 = new TBox(pPP->GetBinLowEdge(j),pPP->GetBinContent(j)-1,pPP->GetBinLowEdge(j+1),pPP->GetBinContent(j)+1); //b2->SetFillColor(65); b2->SetFillStyle(0); b2->SetLineColor(4); b2->Draw(); } pData->Draw("same"); pMC->Draw("same"); pPP->Draw("same"); pGen->SetMarkerColor(4); pGen->SetMarkerStyle(24); pData->Draw("same"); // pGen->Draw(" same"); c1->cd(5+i); TH1D *empty2 = (TH1D*)empty->Clone("empty2"); empty2->SetYTitle("PbPb - pp"); empty2->SetMinimum(-5); empty2->SetMaximum(+29.99); empty2->Draw(); // TProfile *pDiff = (TProfile*)pData->Clone("pDiff"); TH1D *pDiff = new TH1D("pDiff","",nPtBin,PtBins); for (int j=1;j<=pData->GetNbinsX();j++) { pDiff->SetBinContent(j,pData->GetBinContent(j)-pPP->GetBinContent(j)); pDiff->SetBinError(j,sqrt(pData->GetBinError(j)*pData->GetBinError(j)+pPP->GetBinError(j)*pPP->GetBinError(j))); TBox *b = new TBox(pDiff->GetBinLowEdge(j),pDiff->GetBinContent(j)-sys[i],pDiff->GetBinLowEdge(j+1),pDiff->GetBinContent(j)+sys[i]); TBox *b2 = new TBox(pDiff->GetBinLowEdge(j),pDiff->GetBinContent(j)-sys[i],pDiff->GetBinLowEdge(j+1),pDiff->GetBinContent(j)+sys[i]); b->SetFillColor(TColor::GetColor("#FFEE00")); b2->SetLineColor(1); b2->SetFillStyle(0); b->Draw(); b2->Draw(); } pDiff->Draw("p same"); TLegend *leg = new TLegend(0.3,0.6,0.9,0.9); leg->SetFillStyle(0); leg->SetBorderSize(0); leg->AddEntry(pData,"PbPb","pl"); leg->AddEntry(pPP,"pp","pl"); leg->AddEntry(pMC,"PYTHIA+HYDJET","pl"); if (i==0) leg->Draw(); if (i==1) drawText("p_{T,1} > 120 GeV/c",0.22+diff,0.85); if (i==1) drawText("p_{T,2} > 50 GeV/c",0.22+diff,0.75); if (i==1) drawText("#Delta#phi_{1,2} > 5#pi/6",0.22+diff,0.65); } /* TCanvas *c1 = new TCanvas("c1","",(ncent+1)*300,700); makeMultiPanelCanvas(c1,ncent+1,2,0.0,0.0,0.2,0.2,0.02); TH1D * empty=new TH1D("empty",Form(";%s;<#slash{p}_{T}^{#parallel}> (GeV)",axistitle[index_var].Data()),nalpha/2+1,frac); TH1D * empty2=new TH1D("empty2",Form(";%s;<#slash{p}_{T}^{#parallel}> (GeV)",axistitle[index_var].Data()),nalpha/2+1,frac); empty->Fill(0.5,1000); empty2->Fill(0.5,1000); if(doIntegrate){ if(index_var==0){ empty->SetMaximum(30); empty->SetMinimum(-70); }else{ empty->SetMaximum(35); empty->SetMinimum(-45); } }else{ empty->SetMaximum(15); empty->SetMinimum(-10); empty2->SetMaximum(15); empty2->SetMinimum(-10); } empty->GetXaxis()->SetTitleSize(28); empty->GetXaxis()->SetTitleFont(43); empty->GetXaxis()->SetTitleOffset(2.2); empty->GetXaxis()->SetLabelSize(22); empty->GetXaxis()->SetLabelFont(43); empty->GetYaxis()->SetTitleSize(28); empty->GetYaxis()->SetTitleFont(43); empty->GetYaxis()->SetTitleOffset(2.2); empty->GetYaxis()->SetLabelSize(22); empty->GetYaxis()->SetLabelFont(43); empty2->GetXaxis()->SetTitleSize(28); empty2->GetXaxis()->SetTitleFont(43); empty2->GetXaxis()->SetTitleOffset(2.2); empty2->GetXaxis()->SetLabelSize(22); empty2->GetXaxis()->SetLabelFont(43); empty2->GetYaxis()->SetTitleSize(28); empty2->GetYaxis()->SetTitleFont(43); empty2->GetYaxis()->SetTitleOffset(2.2); empty2->GetYaxis()->SetLabelSize(22); empty2->GetYaxis()->SetLabelFont(43); c1->cd(ncent+2); */ c1->SaveAs("results/MultiplicityDifference-DeltaEta.C"); c1->SaveAs("results/MultiplicityDifference-DeltaEta.gif"); c1->SaveAs("results/MultiplicityDifference-DeltaEta.eps"); c1->SaveAs("results/MultiplicityDifference-DeltaEta.pdf"); }
void striptree(TString fileName="", Int_t nAPVs=4) { //=========================================================================== // Change the inputs //=========================================================================== //TString fileName = "Raw_Data_July1_Ped_300V"; //TString fileName = "Raw_Data_July1_Source_300V"; //TString fileName = "Raw_Data_July1_Ped_200V"; //TString fileName = "Raw_Data_Pedestal_300V"; // TString fileName = "Raw_Data_Source_300V"; // TString fileName = "Raw_Data_Sept_3_1"; // TString fileName = "Raw_Data_test_3_7"; // TString fileName = "Raw_Data_Albox_2011_03_31_1"; //-- TString fileName = "Raw_Data_04_01_AL_center_1"; // TString fileName = "Raw_Data_04_01_AL_7820_1"; //-- TString fileName = "Raw_Data_7817_04_01_1"; // TString fileName = "Raw_Data_7817_04_01_bkg_1"; //int nAPVs = 4; //TString fileName = "Raw_Data_July1_Source_200V"; //int nAPVs = 1; int nEvents = -1; // -1 means all TString dat = fileName; TString eps = fileName + "-events.eps"; TString root = fileName + "-events.root"; TFile* file = new TFile(root, "RECREATE"); //=========================================================================== // Read the data and make a 2D scatter plot //=========================================================================== ifstream in(dat); if (!in) { cout<< "File " << dat << " not found" <<endl; return; } TString comments = "vertical --> APV0, APV1, ... of event 1, ..."; TString s; while (1) { s.ReadLine(in); if (s.BeginsWith(comments)) break; } gStyle->SetOptStat(10); TString title = fileName+" ADC Counts vs Channel"; TString title32 = fileName+" ADC Counts vs Channel for 32 ch"; TH2D *h2d = new TH2D("h2d", title.Data(), nAPVs*128, 0, nAPVs*128, 200, 0, 200); TH2D *h2d32 = new TH2D("h2d32", title.Data(), 16, 0, 16, 200, 0, 200); TProfile *profile = new TProfile("profile", title32.Data(), nAPVs*128, 0, nAPVs*128); int event, apv, channel, adc; // TTree* tree = new TTree("tree", "tree"); // tree->Branch("event", &event, "event/I"); // tree->Branch("apv", &apv, "apv/I"); // tree->Branch("channel", &channel, "channel/I"); // tree->Branch("adc", &adc, "adc/I"); Int_t raw[512]; TTree* etree = new TTree("etree", "etree"); etree->Branch("raw", &raw, "raw[512]/I"); // etree->Draw("raw:Iteration$","Entry$==0") etree->SetMarkerStyle(6); etree->SetMarkerColor(2); int n = 0; while (1) { in >> s; if (!in.good()) break; if (s.BeginsWith("]DATA]")) // last line break; n++; if ((nEvents != -1) && (n > nEvents)) break; event = atoi(s.Data()); if (event%100 == 0) cout << "Processing event " << event << endl; for (int i=0; i<2; i++) in >> s; // time Int_t ichannel = 0; for (apv=1; apv<=nAPVs; apv++) { in >> s; // header + analog APV data + one tick mark int sequenceNumber = 0; TString subString = ""; int length = s.Length(); for (int j=0; j<length; j++) { char c = s[j]; if (c != ',') { subString += c; } else { if (sequenceNumber >= 12) { channel = sequenceNumber - 12; adc = atoi(subString.Data()); h2d->Fill((apv - 1) * 128 + channel + 0.5, adc); h2d32->Fill(((apv - 1) * 128 + channel)/32 + 0.5, adc); profile->Fill((apv - 1) * 128 + channel + 0.5, adc); //tree->Fill(); raw[ichannel] = adc; ++ichannel; } subString = ""; sequenceNumber++; } } } etree->Fill(); } in.close(); TCanvas *canvas = new TCanvas; canvas->Divide(1,2); canvas->cd(); canvas->cd(1); h2d->Draw(); canvas->cd(2); profile->Draw(); canvas->SaveAs(eps); // //-- TFile file(root, "RECREATE"); // h2d->Write(); // profile->Write(); // tree->Write(); // //file.Close(); cout<< "\nWrite " << etree->GetEntries() << " of tree " << etree->GetName() << " into file " << file->GetName() <<endl; cout<< "To plot strip content use e.g. etree->Draw(\"raw:Iteration$\",\"Entry$==0\")" <<endl; file->Write(); }
void RebinProfile(){ f = new TFile("../../../rootfiles/MC/EPOS_PbPb_Ntrk_0.root"); TH2D* h2; h2 = (TH2D*)f->Get("demo/scatterHist_effcorr"); TCanvas* C = new TCanvas("fitscatterplot","EPOS Hydjet Scatterplot",1800,1200); C->Divide(3,2); C->cd(1); double newbins[8] = {-0.3,-0.075,-0.045,-0.015,0.015,0.045,0.075,0.3}; //double newbins[6] = {-0.3,-0.045,-0.015,0.015,0.045,0.3}; TH2D* hnew = new TH2D("rebin","rebin",7,newbins,1000,-0.3,0.3); TAxis *xaxis = h2->GetXaxis(); TAxis *yaxis = h2->GetYaxis(); for (int k=1; k<=yaxis->GetNbins();k++) { for (int l=1; l<=xaxis->GetNbins();l++) { hnew->Fill(xaxis->GetBinCenter(l),yaxis->GetBinCenter(k),h2->GetBinContent(l,k)); } } TProfile *prof = hnew->ProfileX(); TF1* fit1 = new TF1("Linear fitting case 1", "[0]+x*[1]", -0.2, 0.2); fit1->SetLineColor(kBlue); fit1->SetLineStyle(1); fit1->SetLineWidth(3); prof->Fit(fit1,"RN0"); TLatex* text2 = makeLatex(Form("slope : %.3f #pm %.3f",fit1->GetParameter(1),fit1->GetParError(1)),0.55,0.25) ; prof->Draw(); text2->Draw("same"); fit1->Draw("same"); /* for (Int_t i=0;i<2;i++) { for (Int_t j=0;j<3;j++) { h = (TH2D*)f->Get("demo/scatterHist_noeffcorr"); h -> new TH2D(" "); corrTable[oc]->SetBinContent(eta+1, pt+1, c); double c1 = testload.getWeight(ptbins[pt], etabins[eta], ocbin[oc], "eff"); double c2 = testload.getWeight(ptbins[pt], etabins[eta], ocbin[oc], "fak"); double c = c1/(1-c2); if( oc == 0 && eta == 15 && pt == 20 ) cout << "1: " << c << endl; if( oc == 4 && eta == 15 && pt == 20 ) cout << "4: " << c << endl; //cout << "corr factor: " << c << endl; corrTable[oc]->SetBinContent(eta+1, pt+1, c); c = c1/(1-c2); c2 = c3/(1-c1); c4 = c2/(1-c3); c5 = c6/(1-c7); */ }
void calibrateEM() { // FIXME: There are two possibilities to execute the script: // i) root run_hadron_g4.C // root[] .L calibrateEM.C // root[] calibrateEM() // or ii) Include the basics from run_hadron_g4.C here and // execute simply: // root calibrateEM.C // Load basic libraries // Load basic libraries gROOT->LoadMacro("/opt/geant4_vmc.2.15a/examples/macro/basiclibs.C"); basiclibs(); // Load Geant4 libraries gROOT->LoadMacro("/opt/geant4_vmc.2.15a/examples/macro/g4libs.C"); g4libs(); // Load the tutorial application library gSystem->Load("libTutorialApplication"); // MC application TutorialApplication* app = new TutorialApplication("TutorialApplication", "Tutorial Application for HEP Lecture @EKP"); // configure Geant4 gROOT->LoadMacro("g4Config.C"); Config(); // instantiate graphical user interface for tutorial application new TutorialMainFrame(app); //FIXME: Load "CountChargedinScint.C" gROOT->ProcessLine(".L CountChargedinScint.C"); //FIXME: Initialize the geometry app->InitMC("geometry/calor(1,0.2)"); //FIXME: Set the primary particle to photon app->SetPrimaryPDG(22); // Profile histogram - will show us the mean numbers of counts in bins of the energy. // The given binning refers to the energy, the other binning will be inferred automatically. TProfile* hcounts = new TProfile("hcounts","Counts per particle energy", 10,0,10); hcounts->SetXTitle("energy [GeV]"); hcounts->SetYTitle("mean number of counts"); // FIXME loop over different particle momenta, and for each momentum simulate several events (e.g. 10) for(Int_t i = 0 ; i < 10 ; ++i) { for(Int_t k = 0 ; k < 10; k ++) { //FIXME: Set the momentum of the primary particle to p Double_t p = i; app->SetPrimaryMomentum(p); //FIXME: Run the simulation app->RunMC(); //FIXME: Fill both the momentum and the output from CountChargedinScint // into the profile histogram hcounts Double_t x = CountChargedinScint(); hcounts->Fill(p,x); } } TCanvas* c = new TCanvas(); c->cd(); hcounts->Draw(); TF1 *fitter = new TF1("fitf","[0]*x", 0,10); fitter->SetParameter(0,1.0); fitter->SetParNames("calibration factor"); //FIXME: Fit the histogram to get the calibration factor hcounts->Fit("fitf"); }
void fitBjetJES(int ppPbPb=1, int cbinlo=12, int cbinhi=40){ if(!ppPbPb){ cbinlo=0; cbinhi=40; } gStyle->SetOptTitle(0); gStyle->SetOptStat(0); TFile *fL; if(!ppPbPb)fL=new TFile("histos/ppMC_hiReco_jetTrig_highPurity_JEC.root"); else fL=new TFile("histos/PbPbQCDMC_pt30by3_ipHICalibCentWeight.root"); // these are dummy files for pp TFile *fB=new TFile("histos/PbPbBMC_pt30by3_ipHICalibCentWeight.root"); TFile *fC=new TFile("histos/PbPbCMC_pt30by3_ipHICalibCentWeight.root"); TNtuple *tL = (TNtuple*) fL->Get("nt"); TNtuple *tB = (TNtuple*) fB->Get("nt"); TNtuple *tC = (TNtuple*) fC->Get("nt"); float jtptL, refptL, jtetaL, weightL, refparton_flavorForBL, binL; tL->SetBranchAddress("jtpt",&jtptL); tL->SetBranchAddress("jteta",&jtetaL); tL->SetBranchAddress("refpt",&refptL); tL->SetBranchAddress("weight",&weightL); if(ppPbPb)tL->SetBranchAddress("bin",&binL); tL->SetBranchAddress("refparton_flavorForB",&refparton_flavorForBL); float jtptB, refptB, jtetaB, weightB, refparton_flavorForBB, binB; tB->SetBranchAddress("jtpt",&jtptB); tB->SetBranchAddress("jteta",&jtetaB); tB->SetBranchAddress("refpt",&refptB); tB->SetBranchAddress("weight",&weightB); if(ppPbPb)tB->SetBranchAddress("bin",&binB); tB->SetBranchAddress("refparton_flavorForB",&refparton_flavorForBB); float jtptC, refptC, jtetaC, weightC, refparton_flavorForBC, binC; tC->SetBranchAddress("jtpt",&jtptC); tC->SetBranchAddress("jteta",&jtetaC); tC->SetBranchAddress("refpt",&refptC); tC->SetBranchAddress("weight",&weightC); if(ppPbPb)tC->SetBranchAddress("bin",&binC); tC->SetBranchAddress("refparton_flavorForB",&refparton_flavorForBC); TProfile *hL = new TProfile("hL","hL",250,50,300,0,10); TProfile *hB = new TProfile("hB","hB",250,50,300,0,10); TProfile *hC = new TProfile("hC","hC",250,50,300,0,10); hL->Sumw2(),hB->Sumw2(),hC->Sumw2(); for(int i=0;i<tL->GetEntries();i++){ tL->GetEntry(i); if(!ppPbPb) binL=39; if(fabs(jtetaL)<2 && binL>=cbinlo && binL<cbinhi) hL->Fill(refptL,jtptL/refptL,weightL); if(!ppPbPb){ if(fabs(jtetaL)<2 && binL>=cbinlo && binL<cbinhi && abs(refparton_flavorForBL)==5) hB->Fill(refptL,jtptL/refptL,weightL); if(fabs(jtetaL)<2 && binL>=cbinlo && binL<cbinhi && abs(refparton_flavorForBL)==4) hC->Fill(refptL,jtptL/refptL,weightL); } } if(ppPbPb){ for(int i=0;i<tB->GetEntries();i++){ tB->GetEntry(i); if(fabs(jtetaB)<2 && binB>=cbinlo && binB<cbinhi && abs(refparton_flavorForBB)==5) hB->Fill(refptB,jtptB/refptB,weightB); } for(int i=0;i<tC->GetEntries();i++){ tC->GetEntry(i); if(fabs(jtetaC)<2 && binC>=cbinlo && binC<cbinhi && abs(refparton_flavorForBC)==4) hC->Fill(refptC,jtptC/refptC,weightC); } } hL->SetMinimum(0.); hL->SetLineColor(kBlue); hB->SetLineColor(kRed); hC->SetLineColor(kGreen); hL->SetMarkerColor(kBlue); hB->SetMarkerColor(kRed); hC->SetMarkerColor(kGreen); //hL->SetMarkerStyle(4); //hB->SetMarkerStyle(4); //hC->SetMarkerStyle(4); hL->SetXTitle("genJet p_{T} (GeV/c)"); hL->SetYTitle("<reco p_{T} / gen p_{T} >"); hL->GetXaxis()->SetRangeUser(50.,199.999); hL->GetYaxis()->SetRangeUser(0.5,1.05); TCanvas *c1=new TCanvas("c1","c1",800,600); c1->SetGridx(1); c1->SetGridy(1); hL->Draw("e1"); hB->Draw("e1,same"); hC->Draw("e1,same"); TLegend *leg=new TLegend(0.4,0.15,0.9,0.45); leg->SetBorderSize(0); leg->SetFillStyle(0); if(ppPbPb&&cbinlo==0&&cbinhi==40)leg->SetHeader("Pythia+Hydjet, 0-100%"); leg->AddEntry(hL,"Inclusive jets","pl"); leg->AddEntry(hC,"c-jets","pl"); leg->AddEntry(hB,"b-jets","pl"); leg->Draw(); TCanvas *c2=new TCanvas("c2","c2",1); /* TH1F *hL2 = (TH1F*)hL->Clone("hL2"); TH1F *hB2 = (TH1F*)hB->Clone("hB2"); hL2->Add(hB2,-1); hL2->Draw(); */ TH1F *hcorr = new TH1F("hcorr","hcorr",250,50,300); hcorr->Sumw2(); for(int i=0;i<hL->GetNbinsX();i++){ cout<<" b resp "<<hB->GetBinContent(i+1)<<endl; cout<<" l resp "<<hL->GetBinContent(i+1)<<endl; cout<<" l offset "<<1.-hL->GetBinContent(i+1)<<endl; cout<<" corrected b resp "<<hB->GetBinContent(i+1)+1.-hL->GetBinContent(i+1)<<endl; float jesOffset = 1.-hL->GetBinContent(i+1); hcorr->SetBinContent(i+1,hB->GetBinContent(i+1)+jesOffset); hcorr->SetBinError(i+1,sqrt(hB->GetBinError(i+1)*hB->GetBinError(i+1)+hL->GetBinError(i+1)*hL->GetBinError(i+1))); } hcorr->SetMinimum(0.5); hcorr->SetMaximum(1.1); hcorr->SetLineColor(kRed); hcorr->SetMarkerColor(kRed); hcorr->SetMarkerStyle(4); hcorr->Draw(); TF1 *fCorr = new TF1("fCorr","[0]+[1]*log(x)+[2]*log(x)*log(x)",50,300); fCorr->SetLineWidth(1); fCorr->SetLineColor(kBlue); hcorr->Fit(fCorr); TFile *fout; if(ppPbPb) fout =new TFile(Form("bJEShistos/bJetScale_PbPb_Cent_fineBin_%d_%d.root",cbinlo,cbinhi),"recreate"); else fout =new TFile("bJEShistos/bJetScale_PP_fineBin.root","recreate"); hcorr->Write(); fCorr->Write(); fout->Close(); }
void Dcurvature(const char *chargechoice = "plus", double ptmin=20){ TString sign=chargechoice; gStyle->SetPalette(1); gStyle->SetOptStat("e"); // double ptmin=20; double ptmax=200; double etamax=2.1; int ptbins=(ptmax-ptmin)/10; double ptbinwidth=(ptmax-ptmin)/ptbins; int etabins=21; int phibins=21; TProfile3D *khistptetaphi = new TProfile3D("DeltaCurv(pt,eta,phi)","DeltaCurv(pt,eta,phi) "+sign,ptbins,ptmin,ptmax,etabins,-etamax,etamax,phibins,-3.14,3.14); khistptetaphi->GetXaxis()->SetTitle("Pt"); khistptetaphi->GetYaxis()->SetTitle("Eta"); khistptetaphi->GetZaxis()->SetTitle("Phi"); TProfile2D *khistpteta = new TProfile2D("DeltaCurv(pt,eta)","DeltaCurv(pt,eta) "+sign,ptbins,ptmin,ptmax,etabins,-etamax,etamax); khistpteta->GetXaxis()->SetTitle("Pt"); khistpteta->GetYaxis()->SetTitle("Eta"); TProfile2D *khistptphi = new TProfile2D("DeltaCurv(pt,phi)","DeltaCurv(pt,phi) "+sign,ptbins,ptmin,ptmax,phibins,-3.14,3.14); khistptphi->GetXaxis()->SetTitle("Pt"); khistptphi->GetYaxis()->SetTitle("Phi"); TProfile *khistpt = new TProfile("DeltaCurv(pt)","DeltaCurv(pt) "+sign,ptbins,ptmin,ptmax); khistpt->GetXaxis()->SetTitle("Pt"); khistpt->SetAxisRange(-0.001,0.001,"Y"); TProfile *khisteta = new TProfile("DeltaCurv(eta)","DeltaCurv(eta) "+sign,etabins,-etamax,etamax); khistpt->GetXaxis()->SetTitle("Eta"); TProfile *khistphi = new TProfile("DeltaCurv(phi)","DeltaCurv(phi) "+sign,phibins,-3.14,3.14); khistpt->GetXaxis()->SetTitle("Phi"); TObjArray *khistptbins= new TObjArray(); for (int i=0; i<ptbins; i++) { TString name="DeltaCurv(eta,phi), pt bin "; name+=int(ptmin+i*(ptmax-ptmin)/ptbins); name+=TString(", charge ")+sign; TProfile2D *ist = new TProfile2D(name.Data(),name.Data(),phibins,-3.14,3.14,etabins,-etamax,etamax); ist->SetAxisRange(-0.002,0.002,"Z"); khistptbins->Add(ist); } TFile *f = new TFile("RecoRoutines_Z-selection_ZJets_TuneZ2_7TeV_alpgen_tauola.rew8.corr1.root","read"); TTree *tree; f->GetObject("SingleMuPtScale/"+sign+"muonstree",tree); Double_t MCPt; Double_t MCEta; Double_t MCPhi; Double_t RecoPt; Double_t RecoEta; Double_t RecoPhi; Double_t EvWeight; tree->SetBranchAddress("RecoPt",&RecoPt); tree->SetBranchAddress("RecoEta",&RecoEta); tree->SetBranchAddress("RecoPhi",&RecoPhi); tree->SetBranchAddress("MCPt",&MCPt); tree->SetBranchAddress("MCEta",&MCEta); tree->SetBranchAddress("MCPhi",&MCPhi); tree->SetBranchAddress("EvWeight",&EvWeight); long nentries = tree->GetEntriesFast(); for (int i=0; i<nentries; i++){ tree->GetEntry(i); if (RecoPt<ptmin || RecoPt>ptmax || RecoEta<-etamax || RecoEta>etamax) continue; double quantity=(MCPt-RecoPt)/MCPt/RecoPt; khistptetaphi->Fill(RecoPt,RecoEta,RecoPhi,quantity,EvWeight); khistpteta->Fill(RecoPt,RecoEta,quantity,EvWeight); khistptphi->Fill(RecoPt,RecoPhi,quantity,EvWeight); ((TProfile2D*)(khistptbins->At(int((RecoPt-ptmin)/ptbinwidth))))->Fill(RecoPhi,RecoEta,quantity,EvWeight); khistpt->Fill(RecoPt,quantity,EvWeight); khisteta->Fill(RecoEta,quantity,EvWeight); khistphi->Fill(RecoPhi,quantity,EvWeight); } TCanvas *c1 = new TCanvas(); khistptetaphi->Draw("BOX"); TCanvas *c2 = new TCanvas(); c2->Divide(2,1); c2->cd(1); khistpteta->Draw("BOX"); c2->cd(2); khistptphi->Draw("BOX"); TCanvas *c2b = new TCanvas(); c2b->Divide(3,1); c2b->cd(1); khistpt->Draw(); c2b->cd(2); khisteta->Draw(); c2b->cd(3); khistphi->Draw(); TCanvas *c3 = new TCanvas(); c3->Divide(int(sqrt(ptbins))+1,int(sqrt(ptbins))); for (int i=0;i<ptbins;i++) { c3->cd(i+1); ((TProfile2D*)(khistptbins->At(i)))->Draw("SURF1 PSR Z");} TProfile *khistcorrpt = new TProfile("DeltaCurv(pt)","DeltaCurv(pt) "+sign,ptbins,ptmin,ptmax); khistcorrpt->GetXaxis()->SetTitle("Pt"); khistcorrpt->SetAxisRange(-0.001,0.001,"Y"); TProfile *khistcorreta = new TProfile("DeltaCurv(eta)","DeltaCurv(eta) "+sign,etabins,-etamax,etamax); khistcorrpt->GetXaxis()->SetTitle("Eta"); TProfile *khistcorrphi = new TProfile("DeltaCurv(phi)","DeltaCurv(phi) "+sign,phibins,-3.14,3.14); khistcorrpt->GetXaxis()->SetTitle("Phi"); // correction for (int i=0; i<nentries; i++){ tree->GetEntry(i); if (RecoPt<ptmin || RecoPt>ptmax || RecoEta<-etamax || RecoEta>etamax) continue; double newpt=RecoPt+RecoPt*RecoPt*khistptetaphi->GetBinContent(khistptetaphi->FindBin(RecoPt,RecoEta,RecoPhi)); double quantity=(MCPt-newpt)/MCPt/newpt; khistcorrpt->Fill(RecoPt,quantity,EvWeight); khistcorreta->Fill(RecoEta,quantity,EvWeight); khistcorrphi->Fill(RecoPhi,quantity,EvWeight); } TCanvas *corrc2b = new TCanvas(); corrc2b->Divide(3,1); corrc2b->cd(1); khistcorrpt->Draw(); corrc2b->cd(2); khistcorreta->Draw(); corrc2b->cd(3); khistcorrphi->Draw(); khistptetaphi->SetName("ist"); khistptetaphi->SaveAs("mcptbinscorrectionfactors.C"); }
void drawOutputOfBensNumberZeroedChannel16BH(){ // gStyle->SetOptStat("mre"); auto cOld = new TChain("angResTree"); // cOld->Add("januaryTests/photogrammetryNumbers/generateAngularResolutionTreePlots_3*.root"); cOld->Add("januaryTests/photogrammetryNumbersZeroedChannel16BH_cosminV3Trees/generateAngularResolutionTreePlots_3*.root"); auto cNew = new TChain("angResTree"); cNew->Add("januaryTests/bensNumbersZeroedChannel16BH_cosminV3Trees/generateAngularResolutionTreePlots_3*.root"); const Int_t numVars = 2; TString drawVars[numVars] = {"deltaPhiDeg", "deltaThetaDeg"}; TString varNames[numVars] = {"#delta#phi", "#delta#theta"}; for(int varInd=0; varInd < numVars; varInd++){ auto c1 = new TCanvas(); const Int_t numPhiBins = 128; TProfile* hProfOld = new TProfile("hProfOld", "Photogrammetry", numPhiBins, 0, 360); TH1D* hOld = new TH1D("hOld", "Photogrammetry", numPhiBins/2, -5, 5); TString drawCommandOld = TString::Format("%s:phiExpected>>hProfOld", drawVars[varInd].Data()); cOld->Draw(drawCommandOld, "TMath::Abs(deltaPhiDeg) < 5", "goff"); TString drawCommandOld2 = TString::Format("%s>>hOld", drawVars[varInd].Data()); cOld->Draw(drawCommandOld2, "TMath::Abs(deltaPhiDeg) < 5", "goff"); hProfOld->SetLineColor(kBlue); hOld->SetLineColor(kBlue); TProfile* hProfNew = new TProfile("hProfNew", "Ben's numbers", numPhiBins, 0, 360); TH1D* hNew = new TH1D("hNew", "Ben's numbers", numPhiBins/2, -5, 5); TString drawCommandNew = TString::Format("%s:phiExpected>>hProfNew", drawVars[varInd].Data()); cNew->Draw(drawCommandNew, "TMath::Abs(deltaPhiDeg) < 5", "goff"); TString drawCommandNew2 = TString::Format("%s>>hNew", drawVars[varInd].Data()); cNew->Draw(drawCommandNew2, "TMath::Abs(deltaPhiDeg) < 5", "goff"); hProfNew->SetLineColor(kRed); hNew->SetLineColor(kRed); hProfNew->Draw(); hProfOld->Draw("same"); // hProfOld->Draw(); // hProfNew->Draw("same"); auto l = c1->BuildLegend(); l->Draw(); // TH1D* hs[2] = {hOld, hNew}; TH1D* hs[2] = {hNew, hOld}; TCanvas* c2 = RootTools::drawHistsWithStatsBoxes(2, hs, "", "mre"); auto l2 = c2->BuildLegend(); l2->Draw(); hProfNew->SetTitle("Comparison of WAIS divide photogrammetry vs. Ben's numbers "+varNames[varInd]+" ; Expected #phi (Degrees); " + varNames[varInd] + " (Degrees)"); hProfOld->SetTitle("Comparison of WAIS divide photogrammetry vs. Ben's numbers "+varNames[varInd]+" ; Expected #phi (Degrees); " + varNames[varInd] + " (Degrees)"); c1->Update(); hOld->SetTitle("Comparison of WAIS divide pulses "+varNames[varInd]+", photogrammetry vs. Ben's numbers;"+varNames[varInd]+" (Degrees); Events/bin"); hNew->SetTitle("Comparison of WAIS divide pulses "+varNames[varInd]+", photogrammetry vs. Ben's numbers;"+varNames[varInd]+" (Degrees); Events/bin"); c2->Update(); } }
int Profile(TString channel="el", TString date="130927", TString numberofjets="4jets_top", bool shouldsave=false) { TString folder; TString outname; if ( channel.Contains("el") || channel.Contains("El") ) { cout << "Plots in the electron channel" << endl; folder = "Plots_El_" + numberofjets + "_" + date + "/"; outname = folder + "ElectronChannel_" + numberofjets +"_" + date +".root"; } if ( channel.Contains("mu") || channel.Contains("Mu") ) { cout << "Plots in the muon channel" << endl; folder = "Plots_Mu_" + numberofjets + "_" + date + "/"; outname = folder + "MuonChannel_" + numberofjets +"_" + date +".root"; } TFile *fi = TFile::Open(outname); float inter = 0.; float num = 0.; TCanvas *cn1 = new TCanvas("JPSI_CHI2","JPSI_CHI2",700,500); cn1->cd(); cn1->SetLogy(1); TH1F *JPSI_CHI2 = (TH1F*)fi->Get("JPSI_CHI2"); JPSI_CHI2->Rebin(4); JPSI_CHI2->Draw(); inter = JPSI_CHI2->GetXaxis()->GetXmax() - JPSI_CHI2->GetXaxis()->GetXmin(); num = (inter/(Float_t)JPSI_CHI2->GetXaxis()->GetNbins()); h1_style(JPSI_CHI2,2,50,1,50,1001,-1111.,-1111.,510,510,20,50,1.2,0,"","#chi^{2}(J/#psi vertex)",TString::Format("Events / %0.1f", num)); cn1->Modified(); if (shouldsave) { cn1->SaveAs(folder + "Plots/Sum_JPSI_CHI2.jpg"); cn1->SaveAs(folder + "Plots/Sum_JPSI_CHI2.pdf"); cn1->SaveAs(folder + "Plots/Sum_JPSI_CHI2.eps"); cn1->SaveAs(folder + "Plots/Sum_JPSI_CHI2.C"); } TH2F *JPSI_MUDIST_CHI2 = (TH2F*)fi->Get("JPSI_MUDIST_CHI2"); JPSI_MUDIST_CHI2->SetContour(20); JPSI_MUDIST_CHI2->SetStats(0); JPSI_MUDIST_CHI2->GetXaxis()->SetTitle("3D distance (J/#psi's daughters) (#mu m)"); JPSI_MUDIST_CHI2->GetYaxis()->SetTitle("#chi^{2}(J/#psi vertex)"); JPSI_MUDIST_CHI2->SetTitle(""); TCanvas *cn11 = new TCanvas("cn11","cn11",700,500); cn11->cd(); JPSI_MUDIST_CHI2->SetLabelFont(62,"X"); JPSI_MUDIST_CHI2->SetLabelFont(62,"Y"); JPSI_MUDIST_CHI2->SetLabelOffset(0.01,"X"); JPSI_MUDIST_CHI2->SetLabelOffset(0.01,"Y"); JPSI_MUDIST_CHI2->SetLabelOffset(0.01,"Z"); JPSI_MUDIST_CHI2->SetTitleSize(0.045,"X"); JPSI_MUDIST_CHI2->SetTitleSize(0.045,"Y"); JPSI_MUDIST_CHI2->SetTitleSize(0.045,"Z"); JPSI_MUDIST_CHI2->SetTitleOffset(1.0,"X"); JPSI_MUDIST_CHI2->SetTitleOffset(1.0,"Y"); JPSI_MUDIST_CHI2->DrawCopy("cont1z"); if (shouldsave) { cn11->SaveAs(folder + "Plots/Sum_JPSI_MUDIST_CHI2.jpg"); cn11->SaveAs(folder + "Plots/Sum_JPSI_MUDIST_CHI2.pdf"); cn11->SaveAs(folder + "Plots/Sum_JPSI_MUDIST_CHI2.eps"); cn11->SaveAs(folder + "Plots/Sum_JPSI_MUDIST_CHI2.C"); } TCanvas *cn12 = new TCanvas("cn12","cn12",700,500); cn12->cd(); JPSI_MUDIST_CHI2->DrawCopy(); TProfile *prof = JPSI_MUDIST_CHI2->ProfileX(); prof->Draw("same"); if (shouldsave) { cn12->SaveAs(folder + "Plots/Prof_JPSI_MUDIST_CHI2.jpg"); cn12->SaveAs(folder + "Plots/Prof_JPSI_MUDIST_CHI2.pdf"); cn12->SaveAs(folder + "Plots/Prof_JPSI_MUDIST_CHI2.eps"); cn12->SaveAs(folder + "Plots/Prof_JPSI_MUDIST_CHI2.C"); } return 0; }
void RunPidGetterQAEff() { TString PidFrameworkDir = "/lustre/nyx/cbm/users/klochkov/soft/PidFramework/"; gSystem->Load( PidFrameworkDir + "build/libPid"); gStyle->SetOptStat(0000); TFile *f2 = new TFile("pid_0.root"); TTree *PidTree = (TTree*) f2->Get("PidTree"); TofPidGetter *getter = new TofPidGetter(); TBranch *PidGet = PidTree->GetBranch("TofPidGetter"); PidGet->SetAddress(&getter); PidGet->GetEntry(0); Float_t ret[3]; TProfile *hEffP = new TProfile ("hEffP", "", 100, 0, 10); TProfile *hEffPi = new TProfile ("hEffPi", "", 100, 0, 6); TProfile *hEffK = new TProfile ("hEffK", "", 100, 0, 5); TProfile *hEffPSigma = new TProfile ("hEffPSigma", "", 100, 0, 10); TProfile *hEffPiSigma = new TProfile ("hEffPiSigma", "", 100, 0, 6); TProfile *hEffKSigma = new TProfile ("hEffKSigma", "", 100, 0, 5); TProfile2D *hEffPtYP = new TProfile2D ("hEffPtYP", "", 100, -2.5, 2.5, 100, 0, 4); TProfile2D *hEffPtYK = new TProfile2D ("hEffPtYK", "", 100, -2.5, 2.5, 100, 0, 4); TProfile2D *hEffPtYPi = new TProfile2D ("hEffPtYPi", "", 100, -2.5, 2.5, 100, 0, 4); TString InTreeFileName = "/lustre/nyx/cbm/users/dblau/cbm/mc/UrQMD/AuAu/10AGeV/sis100_electron/SC_ON/2016_09_01/tree/11111.root"; TFile *InFile = new TFile(InTreeFileName); TTree *InTree = (TTree*) InFile->Get("fDataTree"); DataTreeEvent* DTEvent; InTree -> SetBranchAddress("DTEvent",&DTEvent); int nevents = 100000;//InTree->GetEntries(); int outputstep = 100; std::cout << "Entries = " << nevents << std::endl; for (int j=0;j<nevents;j++) { if ( (j+1) % outputstep == 0) std::cout << j+1 << "/" << nevents << "\r" << std::flush; InTree->GetEntry(j); Int_t Nmc[3] = {100,100,100}; Int_t Ntof[3] = {0,0,0}; Int_t PdgCode[3] = {2212, 212, 211}; Double_t sigmas [3] = {0,0,0}; for (int i=0;i<DTEvent->GetNTracks(); i++) { TLorentzVector v; DataTreeTrack* track = DTEvent -> GetTrack(i); DataTreeMCTrack* mctrack = DTEvent -> GetMCTrack(i); Double_t p = mctrack->GetPt() * TMath::CosH( mctrack->GetEta() ); if (track->GetTOFHitId() < 0) { if (mctrack->GetPdgId() == 2212 ) { v.SetPtEtaPhiM (track->GetPt(0), track->GetEta(0), track->GetPhi(0), 0.9386); hEffP->Fill ( p, 0 ); hEffPSigma->Fill ( p, 0 ); hEffPtYP -> Fill( v.Rapidity() - 1.52, v.Pt(), 0 ); } if (mctrack->GetPdgId() == 321 ) { v.SetPtEtaPhiM (track->GetPt(0), track->GetEta(0), track->GetPhi(0), 0.5); hEffK->Fill ( p, 0 ); hEffKSigma->Fill ( p, 0 ); hEffPtYK -> Fill( v.Rapidity() - 1.52, v.Pt(), 0 ); } if (mctrack->GetPdgId() == 211 ) { v.SetPtEtaPhiM (track->GetPt(0), track->GetEta(0), track->GetPhi(0), 0.14); hEffPi->Fill ( p, 0 ); hEffPiSigma->Fill ( p, 0); hEffPtYPi -> Fill( v.Rapidity() - 1.52, v.Pt(), 0 ); } continue; } // DataTreeTOFHit* toftrack = DTEvent -> GetTOFHit(track->GetTOFHitId()); p = toftrack->GetP(); Double_t m2 = toftrack->GetMass2 (); Bool_t cut = toftrack->GetBeta() > 0.1 && ( track->GetChiSq(0)/track->GetNDF(0) < 3 ) && p > 1.0 ; if ( !cut ) continue; getter->GetBayesProbability (m2, p, ret); sigmas[0] = getter->GetSigmaProton (m2, p); sigmas[1] = getter->GetSigmaKaon (m2, p); sigmas[2] = getter->GetSigmaPion (m2, p); // std::cout << "pdg = " << mctrack->GetPdgId() << " p = " << p << " Sp = " << sigmas[0] << " Sk = " << sigmas[1]<< " Spi = " << sigmas[2] << std::endl; if (mctrack->GetPdgId() == 2212 ) { v.SetPtEtaPhiM (track->GetPt(0), track->GetEta(0), track->GetPhi(0), 0.9386); hEffP->Fill ( p, ret[0] > 0.9 ); hEffPSigma->Fill ( p, sigmas[0] < 3&& sigmas[1] > 2 && sigmas[2] > 2 ); hEffPtYP -> Fill( v.Rapidity() - 1.52, v.Pt(), ret[0] > 0.9 ); } if (mctrack->GetPdgId() == 321 ) { v.SetPtEtaPhiM (track->GetPt(0), track->GetEta(0), track->GetPhi(0), 0.5); hEffK->Fill ( p, ret[1] > 0.9 ); hEffKSigma->Fill ( p, sigmas[1] < 3&& sigmas[2] > 2 && sigmas[0] > 2 ); hEffPtYK -> Fill( v.Rapidity() - 1.52, v.Pt(), ret[1] > 0.9 ); } if (mctrack->GetPdgId() == 211 ) { v.SetPtEtaPhiM (track->GetPt(0), track->GetEta(0), track->GetPhi(0), 0.14); hEffPi->Fill ( p, ret[2] > 0.9 ); hEffPiSigma->Fill ( p, sigmas[2] < 3&& sigmas[0] > 2 && sigmas[1] > 2 ); hEffPtYPi -> Fill( v.Rapidity() - 1.52, v.Pt(), ret[2] > 0.9 ); } } } hEffP -> SetMarkerStyle(21); hEffP -> SetMarkerColor(kRed); hEffP -> SetLineColor(kRed); hEffPi -> SetMarkerStyle(21); hEffPi -> SetMarkerColor(kRed); hEffPi -> SetLineColor(kRed); hEffK -> SetMarkerStyle(21); hEffK -> SetMarkerColor(kRed); hEffK -> SetLineColor(kRed); hEffPSigma -> SetMarkerStyle(22); hEffPSigma -> SetMarkerColor(kBlue); hEffPSigma -> SetLineColor(kBlue); hEffPiSigma -> SetMarkerStyle(22); hEffPiSigma -> SetMarkerColor(kBlue); hEffPiSigma -> SetLineColor(kBlue); hEffKSigma -> SetMarkerStyle(22); hEffKSigma -> SetMarkerColor(kBlue); hEffKSigma -> SetLineColor(kBlue); hEffP->GetXaxis()->SetTitle( "p, GeV/c" ); hEffP->GetYaxis()->SetTitle( "Efficiency" ); hEffP->GetYaxis()->SetRangeUser(0.0, 1.); hEffK->GetXaxis()->SetTitle( "p, GeV/c" ); hEffK->GetYaxis()->SetTitle( "Efficiency" ); hEffK->GetYaxis()->SetRangeUser(0.0, 1.); hEffPi->GetXaxis()->SetTitle( "p, GeV/c" ); hEffPi->GetYaxis()->SetTitle( "Efficiency" ); hEffPi->GetYaxis()->SetRangeUser(0.0, 1.); hEffPtYP->GetYaxis()->SetTitle( "p_{T}, GeV/c" ); hEffPtYP->GetXaxis()->SetTitle( "Rapidity" ); hEffPtYK->GetYaxis()->SetTitle( "p_{T}, GeV/c" ); hEffPtYK->GetXaxis()->SetTitle( "Rapidity" ); hEffPtYPi->GetYaxis()->SetTitle( "p_{T}, GeV/c" ); hEffPtYPi->GetXaxis()->SetTitle( "Rapidity" ); TCanvas *c1 = new TCanvas ("c1", "c1", 1400, 700); c1->Divide(3,1); c1->cd(1); hEffP->Draw(); hEffPSigma->Draw("same"); c1->cd(2); hEffK->Draw(); hEffKSigma->Draw("same"); c1->cd(3); hEffPi->Draw(); hEffPiSigma->Draw("same"); // c1->cd(4); // getter->GetProtonSigma()->Draw(); // getter->GetKaonSigma()->Draw("same"); // getter->GetPionSigma()->Draw("same"); // // c1->cd(5); // getter->GetProtonA()->Draw(); // getter->GetKaonA()->Draw("same"); // getter->GetPionA()->Draw("same"); // // c1->cd(6); // getter->GetProtonM2()->Draw(); // getter->GetKaonM2()->Draw("same"); // getter->GetPionM2()->Draw("same"); TCanvas *c2 = new TCanvas ("c2", "c2", 1400, 700); c2->Divide(3,1); c2->cd(1); hEffPtYP->Draw("colz"); c2->cd(2); hEffPtYK->Draw("colz"); c2->cd(3); hEffPtYPi->Draw("colz"); c1->SaveAs("Canvas_Eff_p_all.root"); c1->SaveAs("Canvas_Eff_p_all.C"); c1->SaveAs("Canvas_Eff_p_all.png"); c2->SaveAs("Canvas_Eff_pT_Y_all.root"); c2->SaveAs("Canvas_Eff_pT_Y_all.C"); c2->SaveAs("Canvas_Eff_pT_Y_all.png"); }