void noise_plots(char* newFile="DQM_fastsim.root",char* refFile="DQM_fullsim.root") { gROOT ->Reset(); gROOT ->SetBatch(); //========= settings ==================== gROOT->SetStyle("Plain"); gStyle->SetPadGridX(kTRUE); gStyle->SetPadGridY(kTRUE); gStyle->SetPadRightMargin(0.07); gStyle->SetPadLeftMargin(0.13); char* refLabel("reference histogram"); char* newLabel("new histogram"); delete gROOT->GetListOfFiles()->FindObject(refFile); delete gROOT->GetListOfFiles()->FindObject(newFile); TText* te = new TText(); TFile * sfile = new TFile(newFile); TDirectory * sdir=gDirectory; TFile * rfile = new TFile(refFile); TDirectory * rdir=gDirectory; if(sfile->GetDirectory("DQMData/Run 1/HcalRecHitsV")) sfile->cd("DQMData/Run 1/HcalRecHitsV/Run summary/HcalRecHitTask"); else if(sfile->GetDirectory("DQMData/HcalRecHitsV/HcalRecHitTask"))sfile->cd("DQMData/HcalRecHitsV/HcalRecHitTask"); sdir=gDirectory; TList *sl= sdir->GetListOfKeys(); if(rfile->GetDirectory("DQMData/Run 1/HcalRecHitsV")) rfile->cd("DQMData/Run 1/HcalRecHitsV/Run summary/HcalRecHitTask"); else if(rfile->GetDirectory("DQMData/HcalRecHitsV/HcalRecHitTask"))rfile->cd("DQMData/HcalRecHitsV/HcalRecHitTask"); rdir=gDirectory; TList *rl= rdir->GetListOfKeys(); TCanvas *canvas; TH1F *sh1,*rh1; TH1F *sh2,*rh2; TH1F *sh3,*rh3; TH1F *sh4,*rh4; TH1F *sh5,*rh5; rdir->GetObject("e_hb",rh1); sdir->GetObject("e_hb",sh1); rdir->GetObject("e_he",rh2); sdir->GetObject("e_he",sh2); rdir->GetObject("e_hfl",rh3); sdir->GetObject("e_hfl",sh3); rdir->GetObject("e_hfs",rh4); sdir->GetObject("e_hfs",sh4); rdir->GetObject("e_ho",rh5); sdir->GetObject("e_ho",sh5); rh1->GetXaxis()->SetTitle("E"); rh1->GetYaxis()->SetTitleSize(0.05); rh1->GetYaxis()->SetTitleOffset(1.2); // rh1->GetYaxis()->SetRangeUser(0.4,1.); // sh1->GetYaxis()->SetRangeUser(0.4,1.); // rh1->Rebin(5); // sh1->Rebin(5); NormalizeHistograms(rh1,sh1); double maxH = max(rh1,sh1)*1.1; rh1->GetYaxis()->SetRangeUser(0.,maxH); sh1->GetYaxis()->SetRangeUser(0.,maxH); rh2->GetXaxis()->SetTitle("E"); rh2->GetYaxis()->SetTitleSize(0.05); rh2->GetYaxis()->SetTitleOffset(1.2); // rh2->GetYaxis()->SetRangeUser(0.4,1.); // sh2->GetYaxis()->SetRangeUser(0.4,1.); // rh2->Rebin(5); // sh2->Rebin(5); NormalizeHistograms(rh2,sh2); double maxH = max(rh2,sh2)*1.1; rh2->GetYaxis()->SetRangeUser(0.,maxH); sh2->GetYaxis()->SetRangeUser(0.,maxH); rh3->GetXaxis()->SetTitle("E"); rh3->GetYaxis()->SetTitleSize(0.05); rh3->GetYaxis()->SetTitleOffset(1.2); NormalizeHistograms(rh3,sh3); double maxH = max(rh3,sh3)*1.1; rh3->GetYaxis()->SetRangeUser(0.,maxH); sh3->GetYaxis()->SetRangeUser(0.,maxH); rh4->GetXaxis()->SetTitle("E"); rh4->GetYaxis()->SetTitleSize(0.05); rh4->GetYaxis()->SetTitleOffset(1.2); NormalizeHistograms(rh4,sh4); double maxH = max(rh4,sh4)*1.1; rh4->GetYaxis()->SetRangeUser(0.,maxH); sh4->GetYaxis()->SetRangeUser(0.,maxH); rh5->GetXaxis()->SetTitle("E"); rh5->GetYaxis()->SetTitleSize(0.05); rh5->GetYaxis()->SetTitleOffset(1.2); NormalizeHistograms(rh5,sh5); double maxH = max(rh5,sh5)*1.1; rh5->GetYaxis()->SetRangeUser(0.,maxH); sh5->GetYaxis()->SetRangeUser(0.,maxH); canvas = new TCanvas("Noise","Noise",1000,1400); TH1F * r[5]={rh1,rh2,rh3,rh4,rh5}; TH1F * s[5]={sh1,sh2,sh3,sh4,sh5}; plotBuilding(canvas,s, r,5, te,"UU",-1);//, 1, true, 0); canvas->cd(); l = new TLegend(0.50,0.14,0.90,0.19); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(rh1,refLabel,"LPF"); l->AddEntry(sh1,newLabel,"LPF"); l->Draw(); TString namepdf = "hcal_noise.pdf"; canvas->Print(namepdf); delete l; delete canvas; }
void RecoMuonValHistoPublisher(char* newFile="NEW_FILE",char* refFile="REF_FILE") { //gROOT->ProcessLine(".x HistoCompare_Tracks.C"); gROOT ->Reset(); gROOT ->SetBatch(); //========= settings ==================== char* dataType = "DATATYPE"; gROOT->SetStyle("Plain"); gStyle->SetPadGridX(kTRUE); gStyle->SetPadGridY(kTRUE); gStyle->SetPadRightMargin(0.07); gStyle->SetPadLeftMargin(0.13); //gStyle->SetTitleXSize(0.07); //gStyle->SetTitleXOffset(0.6); //tyle->SetTitleYSize(0.3); //gStyle->SetLabelSize(0.6) //gStyle->SetTextSize(0.5); char* refLabel("REF_LABEL, REF_RELEASE REFSELECTION"); char* newLabel("NEW_LABEL, NEW_RELEASE NEWSELECTION"); Float_t maxPT=1500.; char* fastSim = "IS_FSIM"; //============================================= delete gROOT->GetListOfFiles()->FindObject(refFile); delete gROOT->GetListOfFiles()->FindObject(newFile); //INPUT FILE IS DEFINED HERE, passed from python wrapper TText* te = new TText(); TFile * sfile = new TFile(newFile); TDirectory * sdir=gDirectory; TFile * rfile = new TFile(refFile); TDirectory * rdir=gDirectory; //check datatype if (dataType == "RECO") { if(sfile->cd("DQMData/Run 1/Muons/Run summary")) {;} else { cout << " Muon Histos for " << dataType << " not found" << endl; return; } } else { cout << " Data type " << dataType << " not allowed: only RECO is considered" << endl; return; } sdir=gDirectory; TIter nextkey( sdir->GetListOfKeys() ); TList *sl = new TList(); TKey *key, *oldkey=0; cout << "- New DQM muon reco collections: " << endl; while ( key = (TKey*)nextkey() ) { TObject *obj = key->ReadObj(); if ( obj->IsA()->InheritsFrom( "TDirectory" ) ) { TString theName = obj->GetName(); if (theName.Contains("RecoMuonV")) { cout << " -> " << theName << endl; sl->Add(obj); } } } if (sl->GetSize()>0) { TString collname2 =sl->At(0)->GetName(); } else { cout << " No DQM muon reco histos found in NEW file " << endl; return; } if (dataType == "RECO") { if(rfile->cd("DQMData/Run 1/Muons/Run summary")) {;} else { cout << " Muon Histos for " << dataType << " not found" << endl; return; } } rdir=gDirectory; TIter nextkeyr( rdir->GetListOfKeys() ); TList *rl = new TList(); TKey *keyr, *oldkeyr=0; cout << "- Ref DQM muon reco collections: " << endl; while ( keyr = (TKey*)nextkeyr() ) { TObject *obj = keyr->ReadObj(); if ( obj->IsA()->InheritsFrom( "TDirectory" ) ) { TString theName = obj->GetName(); if (theName.Contains("RecoMuonV")) { cout << " -> " << theName << endl; rl->Add(obj); } } } if (rl->GetSize()>0) { TString collname1=rl->At(0)->GetName(); } else { cout << " No DQM muon reco histos found in REF file " << endl; return; } TCanvas *canvas; TH1F *sh1,*rh1; TH1F *sh2,*rh2; TH1F *sh3,*rh3; TH1F *sh4,*rh4; TH1F *sh5,*rh5; TH1F *sh6,*rh6; TIter iter_r( rl ); TIter iter_s( sl ); TKey * myKey1, *myKey2; while ( (myKey1 = (TKey*)iter_r()) ) { TString myName = myKey1->GetName(); collname1 = myName; myKey2 = (TKey*)iter_s(); if (!myKey2) continue; collname2 = myKey2->GetName(); if ( (collname1 != collname2) && (collname1+"FS" != collname2) && (collname1 != collname2+"FS") ) { cout << " Different collection names, please check: " << collname1 << " : " << collname2 << endl; continue; } TString newDir("NEW_RELEASE/NEWSELECTION/NEW_LABEL/"); newDir+=myName; gSystem->mkdir(newDir,kTRUE); //rh1 = 0; //sh1 = 0; //===== For each monitored type as defined in muonValidation_cff.py //===== reco muon distributions: GLB rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Glb"+fastSim+"/ErrPt",rh1); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Glb"+fastSim+"/ErrPt",sh1); rh1->GetYaxis()->SetTitle("GlobalMuon(GLB) #Delta p_{T}/p_{T}"); rh1->GetYaxis()->SetTitleSize(0.05); rh1->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Glb"+fastSim+"/ErrP",rh2); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Glb"+fastSim+"/ErrP",sh2); rh2->GetYaxis()->SetTitle("GlobalMuon(GLB) #Delta p/p"); rh2->GetYaxis()->SetTitleSize(0.05); rh2->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Glb"+fastSim+"/ErrPt_vs_Eta_Sigma",rh3); if (!rh3) rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Glb"+fastSim+"/ErrPt_vs_Eta_Sigma",(TProfile*)rh3); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Glb"+fastSim+"/ErrPt_vs_Eta_Sigma",sh3); if (!sh3) sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Glb"+fastSim+"/ErrPt_vs_Eta_Sigma",(TProfile*)sh3); rh3->GetYaxis()->SetTitle("GlobalMuon(GLB) #Delta p_{T}/p_{T} vs #sigma(#eta)"); rh3->GetYaxis()->SetTitleSize(0.05); rh3->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Glb"+fastSim+"/ErrPt_vs_Pt_Sigma",rh4); if (!rh4) rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Glb"+fastSim+"/ErrPt_vs_Pt_Sigma",(TProfile*)rh4); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Glb"+fastSim+"/ErrPt_vs_Pt_Sigma",sh4); if (!sh4) sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Glb"+fastSim+"/ErrPt_vs_Pt_Sigma",(TProfile*)sh4); rh4->GetYaxis()->SetTitle("GlobalMuon(GLB) #Delta p_{T}/p_{T} vs #sigma(p_{T})"); rh4->GetYaxis()->SetTitleSize(0.05); rh4->GetYaxis()->SetTitleOffset(1.2); canvas = new TCanvas("RecHistosGlb","Distributions for GlobalMuons (GLB)",1000,1050); // Normalize to the same number of "new" events: NormalizeHistograms(rh1,sh1); NormalizeHistograms(rh2,sh2); plot4histos(canvas, sh1,rh1,sh2,rh2, sh3,rh3,sh4,rh4, te,"UU",-1); canvas->cd(); l = new TLegend(0.20,0.48,0.90,0.53); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(rh1,refLabel,"LPF"); l->AddEntry(sh1,newLabel,"LPF"); l->Draw(); canvas->Print(newDir+"/muonRecoGlb.pdf"); delete l; delete canvas; //==== efficiencies and fractions GLB rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Glb"+fastSim+"/EffP",rh1); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Glb"+fastSim+"/EffP",sh1); //if(! rh1 && sh1) continue; rh1->GetYaxis()->SetTitle("GlobalMuon(GLB) #epsilon vs. p"); rh1->GetYaxis()->SetTitleSize(0.05); rh1->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Glb"+fastSim+"/EffEta",rh2); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Glb"+fastSim+"/EffEta",sh2); rh2->GetYaxis()->SetTitle("GlobalMuon(GLB) #epsilon vs. #eta"); rh2->GetYaxis()->SetTitleSize(0.05); rh2->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Glb"+fastSim+"/FractP",rh3); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Glb"+fastSim+"/FractP",sh3); rh3->GetYaxis()->SetTitle("GlobalMuon(GLB) fraction vs. p"); rh3->GetYaxis()->SetTitleSize(0.05); rh3->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Glb"+fastSim+"/FractEta",rh4); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Glb"+fastSim+"/FractEta",sh4); rh4->GetYaxis()->SetTitle("GlobalMuon(GLB) fraction vs. #eta"); rh4->GetYaxis()->SetTitleSize(0.05); rh4->GetYaxis()->SetTitleOffset(1.2); canvas = new TCanvas("RecEffHistosGlb","Distributions for GlobalMuons (GLB), efficiencies and fractions",1000,1050); plot4histos(canvas, sh1,rh1,sh2,rh2, sh3,rh3,sh4,rh4, te,"UU",-1); canvas->cd(); l = new TLegend(0.20,0.48,0.90,0.53); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(rh1,refLabel,"LPF"); l->AddEntry(sh1,newLabel,"LPF"); l->Draw(); canvas->Print(newDir+"/muonRecoGlbEff.pdf"); delete l; delete canvas; //===== reco muon distributions: GLBPF rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_GlbPF"+fastSim+"/ErrPt",rh1); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_GlbPF"+fastSim+"/ErrPt",sh1); // if(! rh1 && sh1) continue; rh1->GetYaxis()->SetTitle("PFGlobalMuon(GLBPF) #Delta p_{T}/p_{T}"); rh1->GetYaxis()->SetTitleSize(0.05); rh1->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_GlbPF"+fastSim+"/ErrP",rh2); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_GlbPF"+fastSim+"/ErrP",sh2); rh2->GetYaxis()->SetTitle("PFGlobalMuon(GLBPF) #Delta p/p"); rh2->GetYaxis()->SetTitleSize(0.05); rh2->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_GlbPF"+fastSim+"/ErrPt_vs_Eta_Sigma",rh3); if (!rh3) rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_GlbPF"+fastSim+"/ErrPt_vs_Eta_Sigma",(TProfile*)rh3); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_GlbPF"+fastSim+"/ErrPt_vs_Eta_Sigma",sh3); if (!sh3) sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_GlbPF"+fastSim+"/ErrPt_vs_Eta_Sigma",(TProfile*)sh3); rh3->GetYaxis()->SetTitle("PFGlobalMuon(GLBPF) #Delta p_{T}/p_{T} vs #sigma(#eta)"); rh3->GetYaxis()->SetTitleSize(0.05); rh3->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_GlbPF"+fastSim+"/ErrPt_vs_Pt_Sigma",rh4); if (!rh4) rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_GlbPF"+fastSim+"/ErrPt_vs_Pt_Sigma",(TProfile*)rh4); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_GlbPF"+fastSim+"/ErrPt_vs_Pt_Sigma",sh4); if (!sh4) sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_GlbPF"+fastSim+"/ErrPt_vs_Pt_Sigma",(TProfile*)sh4); rh4->GetYaxis()->SetTitle("PFGlobalMuon(GLBPF) #Delta p_{T}/p_{T} vs #sigma(p_{T})"); rh4->GetYaxis()->SetTitleSize(0.05); rh4->GetYaxis()->SetTitleOffset(1.2); canvas = new TCanvas("RecHistosGlbPF","Distributions for PFGlobalMuons (GLBPF)",1000,1050); // Normalize to the same number of "new" events: NormalizeHistograms(rh1,sh1); NormalizeHistograms(rh2,sh2); plot4histos(canvas, sh1,rh1,sh2,rh2, sh3,rh3,sh4,rh4, te,"UU",-1); canvas->cd(); l = new TLegend(0.20,0.48,0.90,0.53); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(rh1,refLabel,"LPF"); l->AddEntry(sh1,newLabel,"LPF"); l->Draw(); canvas->Print(newDir+"/muonRecoGlbPF.pdf"); delete l; delete canvas; //==== efficiencies and fractions GLBPF rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_GlbPF"+fastSim+"/EffP",rh1); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_GlbPF"+fastSim+"/EffP",sh1); //if(! rh1 && sh1) continue; rh1->GetYaxis()->SetTitle("PFGlobalMuon(GLBPF) #epsilon vs. p"); rh1->GetYaxis()->SetTitleSize(0.05); rh1->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_GlbPF"+fastSim+"/EffEta",rh2); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_GlbPF"+fastSim+"/EffEta",sh2); rh2->GetYaxis()->SetTitle("PFGlobalMuon(GLBPF) #epsilon vs. #eta"); rh2->GetYaxis()->SetTitleSize(0.05); rh2->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_GlbPF"+fastSim+"/FractP",rh3); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_GlbPF"+fastSim+"/FractP",sh3); rh3->GetYaxis()->SetTitle("PFGlobalMuon(GLBPF) fraction vs. p"); rh3->GetYaxis()->SetTitleSize(0.05); rh3->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_GlbPF"+fastSim+"/FractEta",rh4); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_GlbPF"+fastSim+"/FractEta",sh4); rh4->GetYaxis()->SetTitle("PFGlobalMuon(GLBPF) fraction vs. #eta"); rh4->GetYaxis()->SetTitleSize(0.05); rh4->GetYaxis()->SetTitleOffset(1.2); canvas = new TCanvas("RecEffHistosGlbPF","Distributions for PFGlobalMuons (GLBPF), efficiencies and fractions",1000,1050); plot4histos(canvas, sh1,rh1,sh2,rh2, sh3,rh3,sh4,rh4, te,"UU",-1); canvas->cd(); l = new TLegend(0.20,0.48,0.90,0.53); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(rh1,refLabel,"LPF"); l->AddEntry(sh1,newLabel,"LPF"); l->Draw(); canvas->Print(newDir+"/muonRecoGlbPFEff.pdf"); delete l; delete canvas; //===== reco muon distributions: STA rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Sta"+fastSim+"/ErrPt",rh1); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Sta"+fastSim+"/ErrPt",sh1); // if(! rh1 && sh1) continue; rh1->GetYaxis()->SetTitle("StandAloneMuon(STA) #Delta p_{T}/p_{T}"); rh1->GetYaxis()->SetTitleSize(0.05); rh1->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Sta"+fastSim+"/ErrP",rh2); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Sta"+fastSim+"/ErrP",sh2); rh2->GetYaxis()->SetTitle("StandAloneMuon(STA) #Delta p/p"); rh2->GetYaxis()->SetTitleSize(0.05); rh2->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Sta"+fastSim+"/ErrPt_vs_Eta_Sigma",rh3); if (!rh3) rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Sta"+fastSim+"/ErrPt_vs_Eta_Sigma",(TProfile*)rh3); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Sta"+fastSim+"/ErrPt_vs_Eta_Sigma",sh3); if (!sh3) sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Sta"+fastSim+"/ErrPt_vs_Eta_Sigma",(TProfile*)sh3); rh3->GetYaxis()->SetTitle("StandAloneMuon(STA) #Delta p_{T}/p_{T} vs #sigma(#eta)"); rh3->GetYaxis()->SetTitleSize(0.05); rh3->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Sta"+fastSim+"/ErrPt_vs_Pt_Sigma",rh4); if (!rh4) rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Sta"+fastSim+"/ErrPt_vs_Pt_Sigma",(TProfile*)rh4); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Sta"+fastSim+"/ErrPt_vs_Pt_Sigma",sh4); if (!sh4) sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Sta"+fastSim+"/ErrPt_vs_Pt_Sigma",(TProfile*)sh4); rh4->GetYaxis()->SetTitle("StandAloneMuon(STA) #Delta p_{T}/p_{T} vs #sigma(p_{T})"); rh4->GetYaxis()->SetTitleSize(0.05); rh4->GetYaxis()->SetTitleOffset(1.2); canvas = new TCanvas("RecHistosSta","Distributions for StandAloneMuons (STA)",1000,1050); // Normalize to the same number of "new" events: NormalizeHistograms(rh1,sh1); NormalizeHistograms(rh2,sh2); plot4histos(canvas, sh1,rh1,sh2,rh2, sh3,rh3,sh4,rh4, te,"UU",-1); canvas->cd(); l = new TLegend(0.20,0.48,0.90,0.53); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(rh1,refLabel,"LPF"); l->AddEntry(sh1,newLabel,"LPF"); l->Draw(); canvas->Print(newDir+"/muonRecoSta.pdf"); delete l; delete canvas; //==== efficiencies and fractions STA rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Sta"+fastSim+"/EffP",rh1); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Sta"+fastSim+"/EffP",sh1); // if(! rh1 && sh1) continue; rh1->GetYaxis()->SetTitle("StandAloneMuon(STA) #epsilon vs. p"); rh1->GetYaxis()->SetTitleSize(0.05); rh1->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Sta"+fastSim+"/EffEta",rh2); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Sta"+fastSim+"/EffEta",sh2); rh2->GetYaxis()->SetTitle("StandAloneMuon(STA) #epsilon vs. #eta"); rh2->GetYaxis()->SetTitleSize(0.05); rh2->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Sta"+fastSim+"/FractP",rh3); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Sta"+fastSim+"/FractP",sh3); rh3->GetYaxis()->SetTitle("StandAloneMuon(STA) fraction vs. p"); rh3->GetYaxis()->SetTitleSize(0.05); rh3->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Sta"+fastSim+"/FractEta",rh4); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Sta"+fastSim+"/FractEta",sh4); rh4->GetYaxis()->SetTitle("StandAloneMuon(STA) fraction vs. #eta"); rh4->GetYaxis()->SetTitleSize(0.05); rh4->GetYaxis()->SetTitleOffset(1.2); canvas = new TCanvas("RecEffHistosSta","Distributions for StandAloneMuons (STA), efficiencies and fractions",1000,1050); plot4histos(canvas, sh1,rh1,sh2,rh2, sh3,rh3,sh4,rh4, te,"UU",-1); canvas->cd(); l = new TLegend(0.20,0.48,0.90,0.53); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(rh1,refLabel,"LPF"); l->AddEntry(sh1,newLabel,"LPF"); l->Draw(); canvas->Print(newDir+"/muonRecoStaEff.pdf"); delete l; delete canvas; //===== reco muon distributions: TRK rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Trk"+fastSim+"/ErrPt",rh1); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Trk"+fastSim+"/ErrPt",sh1); // if(! rh1 && sh1) continue; rh1->GetYaxis()->SetTitle("TrackerMuon(TRK) #Delta p_{T}/p_{T}"); rh1->GetYaxis()->SetTitleSize(0.05); rh1->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Trk"+fastSim+"/ErrP",rh2); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Trk"+fastSim+"/ErrP",sh2); rh2->GetYaxis()->SetTitle("TrackerMuon(TRK) #Delta p/p"); rh2->GetYaxis()->SetTitleSize(0.05); rh2->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Trk"+fastSim+"/ErrPt_vs_Eta_Sigma",rh3); if (!rh3) rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Trk"+fastSim+"/ErrPt_vs_Eta_Sigma",(TProfile*)rh3); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Trk"+fastSim+"/ErrPt_vs_Eta_Sigma",sh3); if (!sh3) sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Trk"+fastSim+"/ErrPt_vs_Eta_Sigma",(TProfile*)sh3); rh3->GetYaxis()->SetTitle("TrackerMuon(TRK) #Delta p_{T}/p_{T} vs #sigma(#eta)"); rh3->GetYaxis()->SetTitleSize(0.05); rh3->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Trk"+fastSim+"/ErrPt_vs_Pt_Sigma",rh4); if (!rh4) rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Trk"+fastSim+"/ErrPt_vs_Pt_Sigma",(TProfile*)rh4); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Trk"+fastSim+"/ErrPt_vs_Pt_Sigma",sh4); if (!sh4) sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Trk"+fastSim+"/ErrPt_vs_Pt_Sigma",(TProfile*)sh4); rh4->GetYaxis()->SetTitle("TrackerMuon(TRK) #Delta p_{T}/p_{T} vs #sigma(p_{T})"); rh4->GetYaxis()->SetTitleSize(0.05); rh4->GetYaxis()->SetTitleOffset(1.2); canvas = new TCanvas("RecHistosTrk","Distributions for TrackerMuons (TRK)",1000,1050); // Normalize to the same number of "new" events: NormalizeHistograms(rh1,sh1); NormalizeHistograms(rh2,sh2); plot4histos(canvas, sh1,rh1,sh2,rh2, sh3,rh3,sh4,rh4, te,"UU",-1); canvas->cd(); l = new TLegend(0.20,0.48,0.90,0.53); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(rh1,refLabel,"LPF"); l->AddEntry(sh1,newLabel,"LPF"); l->Draw(); canvas->Print(newDir+"/muonRecoTrk.pdf"); delete l; delete canvas; //==== efficiencies and fractions TRK rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Trk"+fastSim+"/EffP",rh1); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Trk"+fastSim+"/EffP",sh1); // if(! rh1 && sh1) continue; rh1->GetYaxis()->SetTitle("TrackerMuon(TRK) #epsilon vs. p"); rh1->GetYaxis()->SetTitleSize(0.05); rh1->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Trk"+fastSim+"/EffEta",rh2); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Trk"+fastSim+"/EffEta",sh2); rh2->GetYaxis()->SetTitle("TrackerMuon(TRK) #epsilon vs. #eta"); rh2->GetYaxis()->SetTitleSize(0.05); rh2->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Trk"+fastSim+"/FractP",rh3); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Trk"+fastSim+"/FractP",sh3); rh3->GetYaxis()->SetTitle("TrackerMuon(TRK) fraction vs. p"); rh3->GetYaxis()->SetTitleSize(0.05); rh3->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Trk"+fastSim+"/FractEta",rh4); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Trk"+fastSim+"/FractEta",sh4); rh4->GetYaxis()->SetTitle("TrackerMuon(TRK) fraction vs. #eta"); rh4->GetYaxis()->SetTitleSize(0.05); rh4->GetYaxis()->SetTitleOffset(1.2); canvas = new TCanvas("RecEffHistosTrk","Distributions for TrackerMuons (TRK), efficiencies and fractions",1000,1050); plot4histos(canvas, sh1,rh1,sh2,rh2, sh3,rh3,sh4,rh4, te,"UU",-1); canvas->cd(); l = new TLegend(0.20,0.48,0.90,0.53); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(rh1,refLabel,"LPF"); l->AddEntry(sh1,newLabel,"LPF"); l->Draw(); canvas->Print(newDir+"/muonRecoTrkEff.pdf"); delete l; delete canvas; // //===== reco muon distributions: Tight Muons // rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Tgt"+fastSim+"/ErrPt",rh1); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Tgt"+fastSim+"/ErrPt",sh1); // if(! rh1 && sh1) continue; rh1->GetYaxis()->SetTitle("Tight Muon #Delta p_{T}/p_{T}"); rh1->GetYaxis()->SetTitleSize(0.05); rh1->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Tgt"+fastSim+"/ErrP",rh2); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Tgt"+fastSim+"/ErrP",sh2); rh2->GetYaxis()->SetTitle("Tight Muon #Delta p/p"); rh2->GetYaxis()->SetTitleSize(0.05); rh2->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Tgt"+fastSim+"/ErrPt_vs_Eta_Sigma",rh3); if (!rh3) rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Tgt"+fastSim+"/ErrPt_vs_Eta_Sigma",(TProfile*)rh3); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Tgt"+fastSim+"/ErrPt_vs_Eta_Sigma",sh3); if (!sh3) sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Tgt"+fastSim+"/ErrPt_vs_Eta_Sigma",(TProfile*)sh3); rh3->GetYaxis()->SetTitle("Tight Muon #Delta p_{T}/p_{T} vs #sigma(#eta)"); rh3->GetYaxis()->SetTitleSize(0.05); rh3->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Tgt"+fastSim+"/ErrPt_vs_Pt_Sigma",rh4); if (!rh4) rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Tgt"+fastSim+"/ErrPt_vs_Pt_Sigma",(TProfile*)rh4); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Tgt"+fastSim+"/ErrPt_vs_Pt_Sigma",sh4); if (!sh4) sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Tgt"+fastSim+"/ErrPt_vs_Pt_Sigma",(TProfile*)sh4); rh4->GetYaxis()->SetTitle("Tigh Muon) #Delta p_{T}/p_{T} vs #sigma(p_{T})"); rh4->GetYaxis()->SetTitleSize(0.05); rh4->GetYaxis()->SetTitleOffset(1.2); canvas = new TCanvas("RecHistosTgt","Distributions for Tight Muons",1000,1050); // Normalize to the same number of "new" events: NormalizeHistograms(rh1,sh1); NormalizeHistograms(rh2,sh2); plot4histos(canvas, sh1,rh1,sh2,rh2, sh3,rh3,sh4,rh4, te,"UU",-1); canvas->cd(); l = new TLegend(0.20,0.48,0.90,0.53); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(rh1,refLabel,"LPF"); l->AddEntry(sh1,newLabel,"LPF"); l->Draw(); canvas->Print(newDir+"/muonRecoTgt.pdf"); delete l; delete canvas; //==== efficiencies and fractions Tight Muons rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Tgt"+fastSim+"/EffP",rh1); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Tgt"+fastSim+"/EffP",sh1); // if(! rh1 && sh1) continue; rh1->GetYaxis()->SetTitle("Tight Muon #epsilon vs. p"); rh1->GetYaxis()->SetTitleSize(0.05); rh1->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Tgt"+fastSim+"/EffEta",rh2); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Tgt"+fastSim+"/EffEta",sh2); rh2->GetYaxis()->SetTitle("Tight Muon #epsilon vs. #eta"); rh2->GetYaxis()->SetTitleSize(0.05); rh2->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Tgt"+fastSim+"/FractP",rh3); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Tgt"+fastSim+"/FractP",sh3); rh3->GetYaxis()->SetTitle("Tight Muon fraction vs. p"); rh3->GetYaxis()->SetTitleSize(0.05); rh3->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/RecoMuon_MuonAssoc_Tgt"+fastSim+"/FractEta",rh4); sdir->GetObject(collname2+"/RecoMuon_MuonAssoc_Tgt"+fastSim+"/FractEta",sh4); rh4->GetYaxis()->SetTitle("Tight Muon fraction vs. #eta"); rh4->GetYaxis()->SetTitleSize(0.05); rh4->GetYaxis()->SetTitleOffset(1.2); canvas = new TCanvas("RecEffHistosTgt","Distributions for Tight Muons, efficiencies and fractions",1000,1050); plot4histos(canvas, sh1,rh1,sh2,rh2, sh3,rh3,sh4,rh4, te,"UU",-1); canvas->cd(); l = new TLegend(0.20,0.48,0.90,0.53); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(rh1,refLabel,"LPF"); l->AddEntry(sh1,newLabel,"LPF"); l->Draw(); canvas->Print(newDir+"/muonRecoTgtEff.pdf"); delete l; delete canvas; // // Merge pdf histograms together into larger files, and name them based on the collection names // gSystem->Exec("gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=merged.pdf " +newDir+"/muonRecoGlb.pdf " +newDir+"/muonRecoGlbEff.pdf " +newDir+"/muonRecoGlbPF.pdf " +newDir+"/muonRecoGlbPFEff.pdf " +newDir+"/muonRecoSta.pdf " +newDir+"/muonRecoStaEff.pdf " +newDir+"/muonRecoTrk.pdf " +newDir+"/muonRecoTrkEff.pdf " +newDir+"/muonRecoTgt.pdf " +newDir+"/muonRecoTgtEff.pdf "); gSystem->Exec("mv merged.pdf "+newDir+"/../"+myName+".pdf"); gSystem->Exec("rm -r "+newDir); } // end of "while loop" }
void IterTrackValHistoPublisher(char* newFile="NEW_FILE",char* refFile="REF_FILE") { //gROOT->ProcessLine(".x HistoCompare_Tracks.C"); gROOT ->Reset(); gROOT ->SetBatch(); //========= settings ==================== gROOT->SetStyle("Plain"); gStyle->SetPadGridX(kTRUE); gStyle->SetPadGridY(kTRUE); gStyle->SetPadRightMargin(0.07); gStyle->SetPadLeftMargin(0.13); //gStyle->SetTitleXSize(0.07); //gStyle->SetTitleXOffset(0.6); //tyle->SetTitleYSize(0.3); //gStyle->SetLabelSize(0.6) //gStyle->SetTextSize(0.5); char* refLabel("REF_LABEL, REF_RELEASE REFSELECTION"); char* newLabel("NEW_LABEL, NEW_RELEASE NEWSELECTION"); //============================================= delete gROOT->GetListOfFiles()->FindObject(refFile); delete gROOT->GetListOfFiles()->FindObject(newFile); TText* te = new TText(); TFile * sfile = new TFile(newFile); TDirectory * sdir=gDirectory; TFile * rfile = new TFile(refFile); TDirectory * rdir=gDirectory; if(sfile->GetDirectory("DQMData/Run 1/RecoTrackV")) sfile->cd("DQMData/Run 1/RecoTrackV/Run summary/Track"); else if(sfile->GetDirectory("DQMData/RecoTrackV/Track"))sfile->cd("DQMData/RecoTrackV/Track"); else if(sfile->GetDirectory("DQMData/Run 1/Tracking")) sfile->cd("DQMData/Run 1/Tracking/Run summary/Track"); else if(sfile->GetDirectory("DQMData/Tracking/Track"))sfile->cd("DQMData/Tracking/Track"); sdir=gDirectory; TList *sl= sdir->GetListOfKeys(); TString collname2 =sl->At(0)->GetName(); // select generalTracks to make the usual validation plots for int num_col = sl->GetSize(); for(int i=0; i<num_col;i++){ collname2 =sl->At(i)->GetName(); if(collname2.Contains("general")) break; } //cout << "collname2 = " << collname2 << endl; if(rfile->GetDirectory("DQMData/Run 1/RecoTrackV")) rfile->cd("DQMData/Run 1/RecoTrackV/Run summary/Track"); else if(rfile->GetDirectory("DQMData/RecoTrackV/Track"))rfile->cd("DQMData/RecoTrackV/Track"); else if(rfile->GetDirectory("DQMData/Run 1/Tracking")) rfile->cd("DQMData/Run 1/Tracking/Run summary/Track"); else if(rfile->GetDirectory("DQMData/Tracking/Track"))rfile->cd("DQMData/Tracking/Track"); rdir=gDirectory; TList *rl= rdir->GetListOfKeys(); TString collname1=rl->At(0)->GetName(); num_col = rl->GetSize(); for(int i=0; i<num_col;i++){ collname1 =rl->At(i)->GetName(); if(collname1.Contains("general")) break; } //cout << "collname1 = " << collname1 << endl; //int num_col = rl->GetSize(); //for(int i=0; i<num_col;i++){ // cout << " >>>>>>>>>dir " << i << " name = " << rl->At(i)->GetName() << endl; //} //HistoCompare_Tracks * myPV = new HistoCompare_Tracks(); TCanvas *canvas; TH1F *sh1,*rh1; TH1F *sh2,*rh2; TH1F *sh3,*rh3; TH1F *sh4,*rh4; TH1F *sh5,*rh5; TH1F *sh6,*rh6; TH1F *sc1,*rc1; TH1F *sc2,*rc2; TH1F *sc3,*rc3; bool hit=1; bool chi2=1; bool ctf=1; bool rs=0; ////////////////////////////////////// /////////// CTF ////////////////////// ////////////////////////////////////// if (ctf){ //===== building rdir->GetObject(collname1+"/effic",rh1); sdir->GetObject(collname2+"/effic",sh1); rh1->GetYaxis()->SetRangeUser(MINEFF,MAXEFF); sh1->GetYaxis()->SetRangeUser(MINEFF,MAXEFF); rh1->GetXaxis()->SetTitle("#eta"); rh1->GetYaxis()->SetTitle("efficiency vs #eta"); rh1->GetYaxis()->SetTitleSize(0.05); rh1->GetYaxis()->SetTitleOffset(1.2); // rh1->GetYaxis()->SetRangeUser(0.5,1.025); // sh1->GetYaxis()->SetRangeUser(0.5,1.025); rdir->GetObject(collname1+"/fakerate",rh2); sdir->GetObject(collname2+"/fakerate",sh2); rh2->GetYaxis()->SetRangeUser(0.,MAXFAKE); sh2->GetYaxis()->SetRangeUser(0.,MAXFAKE); rh2->GetXaxis()->SetTitle("#eta"); rh2->GetYaxis()->SetTitle("fakerate vs #eta"); rh2->GetYaxis()->SetTitleSize(0.05); rh2->GetYaxis()->SetTitleOffset(1.2); // rh2->GetYaxis()->SetRangeUser(0.,.70); // sh2->GetYaxis()->SetRangeUser(0.,.70); rdir->GetObject(collname1+"/efficPt",rh3); sdir->GetObject(collname2+"/efficPt",sh3); rh3->GetXaxis()->SetRangeUser(0,300); sh3->GetXaxis()->SetRangeUser(0,300); rh3->GetXaxis()->SetTitle("p_{t}"); rh3->GetYaxis()->SetTitle("efficiency vs p_{t}"); rh3->GetYaxis()->SetTitleSize(0.05); rh3->GetYaxis()->SetTitleOffset(1.2); rh3->SetTitle(""); rdir->GetObject(collname1+"/fakeratePt",rh4); sdir->GetObject(collname2+"/fakeratePt",sh4); rh4->SetTitle(""); rh4->GetXaxis()->SetTitle("p_{t}"); rh4->GetYaxis()->SetTitle("fakrate vs p_{t}"); rh4->GetYaxis()->SetTitleSize(0.05); rh4->GetYaxis()->SetTitleOffset(1.2); rh4->GetYaxis()->SetRangeUser(0.,.80); sh4->GetYaxis()->SetRangeUser(0.,.80); rh4->GetXaxis()->SetRangeUser(0.2,300); sh4->GetXaxis()->SetRangeUser(0.2,300); rdir->GetObject(collname1+"/effic_vs_hit",rh5); sdir->GetObject(collname2+"/effic_vs_hit",sh5); rh5->GetXaxis()->SetTitle("hits"); rh5->GetYaxis()->SetTitle("efficiency vs hits"); rh5->GetYaxis()->SetTitleSize(0.05); rh5->GetYaxis()->SetTitleOffset(1.2); //rh3->GetXaxis()->SetRangeUser(0,30); //sh3->GetXaxis()->SetRangeUser(0,30); rdir->GetObject(collname1+"/fakerate_vs_hit",rh6); sdir->GetObject(collname2+"/fakerate_vs_hit",sh6); rh6->GetYaxis()->SetRangeUser(0.,1.0); rh6->GetYaxis()->SetRangeUser(0.,1.0); rh6->GetXaxis()->SetTitle("hits"); rh6->GetYaxis()->SetTitle("fakerate vs hits"); rh6->GetYaxis()->SetTitleSize(0.05); rh6->GetYaxis()->SetTitleOffset(1.2); //rdir->GetObject(collname1+"/num_reco_pT",rh6); //sdir->GetObject(collname2+"/num_reco_pT",sh6); canvas = new TCanvas("Tracks","Tracks: efficiency & fakerate",1000,1400); //NormalizeHistograms(rh2,sh2); //NormalizeHistograms(rh6,sh6); //rh1->GetYaxis()->SetRangeUser(8,24); //sh1->GetYaxis()->SetRangeUser(8,24); //rh6->GetXaxis()->SetRangeUser(0,10); //sh6->GetXaxis()->SetRangeUser(0,10); TH1F * r[6]={rh1,rh2,rh3,rh4,rh5,rh6}; TH1F * s[6]={sh1,sh2,sh3,sh4,sh5,sh6}; plotBuilding(canvas,s, r,6, te,"UU",-1, 1, false, 0xC); canvas->cd(); //TPaveText* text = new TPaveText(0.25,0.72,0.75,0.77,"prova"); //text->SetFillColor(0); //text->SetTextColor(1); //text->Draw(); l = new TLegend(0.10,0.64,0.90,0.69); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(rh1,refLabel,"LPF"); l->AddEntry(sh1,newLabel,"LPF"); l->Draw(); canvas->Print("building.pdf"); delete l; // ====== hits and pt rdir->GetObject(collname1+"/nhits_vs_eta_pfx",(TProfile*)rh1); sdir->GetObject(collname2+"/nhits_vs_eta_pfx",(TProfile*)sh1); rdir->GetObject(collname1+"/hits",rh2); sdir->GetObject(collname2+"/hits",sh2); rdir->GetObject(collname1+"/num_simul_pT",rh3); sdir->GetObject(collname2+"/num_simul_pT",sh3); rdir->GetObject(collname1+"/num_reco_pT",rh4); sdir->GetObject(collname2+"/num_reco_pT",sh4); canvas = new TCanvas("Tracks1","Tracks: hits and Pt",1000,1050); rh1->GetYaxis()->SetRangeUser(8,24); sh1->GetYaxis()->SetRangeUser(8,24); rh1->GetXaxis()->SetTitle("#eta"); rh1->GetYaxis()->SetTitle("<hits> vs #eta"); rh2->GetXaxis()->SetRangeUser(0,30); sh2->GetXaxis()->SetRangeUser(0,30); rh2->GetXaxis()->SetTitle("hits"); rh3->GetXaxis()->SetRangeUser(0,10); sh3->GetXaxis()->SetRangeUser(0,10); rh3->GetXaxis()->SetTitle("p_{t}"); rh4->GetXaxis()->SetRangeUser(0,10); sh4->GetXaxis()->SetRangeUser(0,10); rh4->GetXaxis()->SetTitle("p_{t}"); NormalizeHistograms(rh3,sh3); NormalizeHistograms(rh4,sh4); plot4histos(canvas, sh1,rh1,sh2,rh2, sh3,rh3,sh4,rh4, te,"UU",-1); canvas->cd(); l = new TLegend(0.20,0.49,0.90,0.54); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(rh1,refLabel,"LPF"); l->AddEntry(sh1,newLabel,"LPF"); l->Draw(); canvas->Print("hitsAndPt.pdf"); delete l; //===== tuning rdir->GetObject(collname1+"/chi2",rh1); sdir->GetObject(collname2+"/chi2",sh1); rdir->GetObject(collname1+"/chi2_prob",rh2); sdir->GetObject(collname2+"/chi2_prob",sh2); rdir->GetObject(collname1+"/chi2_vs_eta_pfx",(TProfile*)rh3); sdir->GetObject(collname2+"/chi2_vs_eta_pfx",(TProfile*)sh3); rdir->GetObject(collname1+"/ptres_vs_eta_Mean",rh4); sdir->GetObject(collname2+"/ptres_vs_eta_Mean",sh4); canvas = new TCanvas("Tracks2","Tracks: chi2 & chi2 probability",1000,1050); NormalizeHistograms(rh1,sh1); NormalizeHistograms(rh2,sh2); fixRangeY(rh1,sh1); fixRangeY(rh2,sh2); rh1->GetXaxis()->SetTitle("#chi^{2}"); rh2->GetXaxis()->SetTitle("Prob(#chi^{2})"); rh3->GetYaxis()->SetRangeUser(0,2.5); sh3->GetYaxis()->SetRangeUser(0,2.5); rh3->SetTitle(""); rh3->GetYaxis()->SetTitleSize(0.05); rh3->GetYaxis()->SetTitleOffset(1.2); rh3->GetYaxis()->SetTitle("< #chi^{2} / ndf >"); rh3->GetXaxis()->SetTitleSize(0.07); rh3->GetXaxis()->SetTitleOffset(0.6); rh3->GetXaxis()->SetTitle("#eta"); rh4->Scale(100.); sh4->Scale(100.); rh4->GetYaxis()->SetRangeUser(-1.5,1.5); sh4->GetYaxis()->SetRangeUser(-1.5,1.5); rh4->SetTitle(""); rh4->GetYaxis()->SetTitleSize(0.05); rh4->GetYaxis()->SetTitleOffset(1.2); rh4->GetYaxis()->SetTitle("< #delta p_{t} / p_{t} > [%]"); rh4->GetXaxis()->SetTitleSize(0.07); rh4->GetXaxis()->SetTitleOffset(0.6); rh4->GetXaxis()->SetTitle("#eta"); plot4histos(canvas, sh1,rh1,sh2,rh2, sh3,rh3,sh4,rh4, te,"UU",-1); canvas->cd(); l = new TLegend(0.20,0.48,0.90,0.53); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(rh1,refLabel,"LPF"); l->AddEntry(sh1,newLabel,"LPF"); l->Draw(); canvas->Print("tuning.pdf"); delete l; //===== pulls rdir->GetObject(collname1+"/pullPt",rh1); sdir->GetObject(collname2+"/pullPt",sh1); rdir->GetObject(collname1+"/pullQoverp",rh2); sdir->GetObject(collname2+"/pullQoverp",sh2); rdir->GetObject(collname1+"/pullPhi",rh3); sdir->GetObject(collname2+"/pullPhi",sh3); rdir->GetObject(collname1+"/pullTheta",rh4); sdir->GetObject(collname2+"/pullTheta",sh4); rdir->GetObject(collname1+"/pullDxy",rh5); sdir->GetObject(collname2+"/pullDxy",sh5); rdir->GetObject(collname1+"/pullDz",rh6); sdir->GetObject(collname2+"/pullDz",sh6); canvas = new TCanvas("Tracks4","Tracks: pull of Pt, Qoverp and Phi",1000,1400); NormalizeHistograms(rh1,sh1); NormalizeHistograms(rh2,sh2); NormalizeHistograms(rh3,sh3); NormalizeHistograms(rh4,sh4); NormalizeHistograms(rh5,sh5); NormalizeHistograms(rh6,sh6); rh1->GetXaxis()->SetRangeUser(-10,10); sh1->GetXaxis()->SetRangeUser(-10,10); rh2->GetXaxis()->SetRangeUser(-10,10); sh2->GetXaxis()->SetRangeUser(-10,10); rh3->GetXaxis()->SetRangeUser(-10,10); sh3->GetXaxis()->SetRangeUser(-10,10); rh4->GetXaxis()->SetRangeUser(-10,10); sh4->GetXaxis()->SetRangeUser(-10,10); rh5->GetXaxis()->SetRangeUser(-10,10); sh5->GetXaxis()->SetRangeUser(-10,10); rh6->GetXaxis()->SetRangeUser(-10,10); sh6->GetXaxis()->SetRangeUser(-10,10); plotPulls(canvas, sh1,rh1,sh2,rh2, sh3,rh3,sh4,rh4, sh5,rh5,sh6,rh6, te,"UU",-1); canvas->cd(); l = new TLegend(0.20,0.655,0.80,0.69); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(rh1,refLabel,"LPF"); l->AddEntry(sh1,newLabel,"LPF"); l->Draw(); canvas->Print("pulls.pdf"); delete l; //===== resolutions vs eta rdir->GetObject(collname1+"/phires_vs_eta_Sigma",rh1); sdir->GetObject(collname2+"/phires_vs_eta_Sigma",sh1); rdir->GetObject(collname1+"/cotThetares_vs_eta_Sigma",rh2); sdir->GetObject(collname2+"/cotThetares_vs_eta_Sigma",sh2); rdir->GetObject(collname1+"/dxyres_vs_eta_Sigma",rh3); sdir->GetObject(collname2+"/dxyres_vs_eta_Sigma",sh3); rdir->GetObject(collname1+"/dzres_vs_eta_Sigma",rh4); sdir->GetObject(collname2+"/dzres_vs_eta_Sigma",sh4); rdir->GetObject(collname1+"/ptres_vs_eta_Sigma",rh5); sdir->GetObject(collname2+"/ptres_vs_eta_Sigma",sh5); canvas = new TCanvas("Tracks7","Tracks: Dxy, Dz, Theta resolution",1000,1400); plotResolutions(canvas, sh1,rh1,sh2,rh2, sh3,rh3,sh4,rh4, sh5,rh5,sh6,rh6, te,"UU",-1); // new general range rh1->GetYaxis()->SetRangeUser(0.000009,0.01); sh1->GetYaxis()->SetRangeUser(0.000009,0.01); rh1->SetTitle(""); rh1->GetYaxis()->SetTitleSize(0.05); rh1->GetYaxis()->SetTitleOffset(1.2); // rh1->GetYaxis()->SetTitleColor(2); rh1->GetYaxis()->SetTitle("#sigma(#delta #phi) [rad]"); rh1->GetXaxis()->SetTitleSize(0.07); rh1->GetXaxis()->SetTitleOffset(0.6); rh1->GetXaxis()->SetTitle("#eta"); // new general range rh2->GetYaxis()->SetRangeUser(0.00009,0.03); sh2->GetYaxis()->SetRangeUser(0.00009,0.03); // for multi-track samples //rh2->GetYaxis()->SetRangeUser(0.0009,0.01); //sh2->GetYaxis()->SetRangeUser(0.0009,0.01); // for single particle pt 10 //rh2->GetYaxis()->SetRangeUser(0.00009,0.01); //sh2->GetYaxis()->SetRangeUser(0.00009,0.01); // for single particle pt 1 //rh2->GetYaxis()->SetRangeUser(0.0009,0.01); //sh2->GetYaxis()->SetRangeUser(0.0009,0.01); rh2->SetTitle(""); rh2->GetYaxis()->SetTitleSize(0.05); rh2->GetYaxis()->SetTitleOffset(1.2); rh2->GetYaxis()->SetTitle("#sigma(#delta cot(#theta)) "); rh2->GetXaxis()->SetTitleSize(0.07); rh2->GetXaxis()->SetTitleOffset(0.6); rh2->GetXaxis()->SetTitle("#eta"); // new general range rh3->GetYaxis()->SetRangeUser(0.00009,0.05); sh3->GetYaxis()->SetRangeUser(0.00009,0.05); // for multi-track samples //rh3->GetYaxis()->SetRangeUser(0.0009,0.02); //sh3->GetYaxis()->SetRangeUser(0.0009,0.02); //rh3->GetYaxis()->SetRangeUser(0.0009,0.02); //sh3->GetYaxis()->SetRangeUser(0.0009,0.02); // for single particle pt 100 //rh3->GetYaxis()->SetRangeUser(0.00009,0.002); //sh3->GetYaxis()->SetRangeUser(0.00009,0.002); rh3->SetTitle(""); rh3->GetYaxis()->SetTitleSize(0.05); rh3->GetYaxis()->SetTitleOffset(1.2); rh3->GetYaxis()->SetTitle("#sigma(#delta d_{0}) [cm]"); rh3->GetXaxis()->SetTitleSize(0.07); rh3->GetXaxis()->SetTitleOffset(0.6); rh3->GetXaxis()->SetTitle("#eta"); // new general range rh4->GetYaxis()->SetRangeUser(0.0009,0.1); sh4->GetYaxis()->SetRangeUser(0.0009,0.1); // for multi-track samples //rh4->GetYaxis()->SetRangeUser(0.0009,0.08); //sh4->GetYaxis()->SetRangeUser(0.0009,0.08); rh4->SetTitle(""); rh4->GetYaxis()->SetTitleSize(0.05); rh4->GetYaxis()->SetTitleOffset(1.2); rh4->GetYaxis()->SetTitle("#sigma(#delta z_{0}) [cm]"); rh4->GetXaxis()->SetTitleSize(0.07); rh4->GetXaxis()->SetTitleOffset(0.6); rh4->GetXaxis()->SetTitle("#eta"); rh5->SetTitle(""); rh5->GetYaxis()->SetTitleSize(0.05); rh5->GetYaxis()->SetTitleOffset(1.2); rh5->GetYaxis()->SetTitle("#sigma(#delta p_{t}/p_{t}) "); rh5->GetXaxis()->SetTitleSize(0.07); rh5->GetXaxis()->SetTitleOffset(0.6); rh5->GetXaxis()->SetTitle("#eta"); /* plotResolutions(canvas, sh1,rh1,sh2,rh2, sh3,rh3,sh4,rh4, sh5,rh5,sh6,rh6, te,"UU",-1); */ canvas->cd(); l = new TLegend(0.10,0.63,0.90,0.67); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(rh1,refLabel,"LPF"); l->AddEntry(sh1,newLabel,"LPF"); l->Draw(); canvas->Print("resolutionsEta.pdf"); delete l; //===== resolutions vs pt rdir->GetObject(collname1+"/phires_vs_pt_Sigma",rh1); sdir->GetObject(collname2+"/phires_vs_pt_Sigma",sh1); rdir->GetObject(collname1+"/cotThetares_vs_pt_Sigma",rh2); sdir->GetObject(collname2+"/cotThetares_vs_pt_Sigma",sh2); rdir->GetObject(collname1+"/dxyres_vs_pt_Sigma",rh3); sdir->GetObject(collname2+"/dxyres_vs_pt_Sigma",sh3); rdir->GetObject(collname1+"/dzres_vs_pt_Sigma",rh4); sdir->GetObject(collname2+"/dzres_vs_pt_Sigma",sh4); rdir->GetObject(collname1+"/ptres_vs_pt_Sigma",rh5); sdir->GetObject(collname2+"/ptres_vs_pt_Sigma",sh5); rh1->SetTitle(""); rh1->GetYaxis()->SetTitleSize(0.05); rh1->GetYaxis()->SetTitleOffset(1.2); rh1->GetYaxis()->SetTitle("#sigma(#delta #phi) [rad]"); rh1->GetXaxis()->SetTitleSize(0.055); rh1->GetXaxis()->SetTitleOffset(0.8); rh1->GetXaxis()->SetTitle("p_{t}"); rh1->GetXaxis()->SetRangeUser(0,1000.); sh1->GetXaxis()->SetRangeUser(0,1000.); rh2->SetTitle(""); rh2->GetYaxis()->SetTitleSize(0.05); rh2->GetYaxis()->SetTitleOffset(1.2); rh2->GetYaxis()->SetTitle("#sigma(#delta cot(#theta)) "); rh2->GetXaxis()->SetTitleSize(0.055); rh2->GetXaxis()->SetTitleOffset(0.8); rh2->GetXaxis()->SetTitle("p_{t}"); rh2->GetXaxis()->SetRangeUser(0,1000.); sh2->GetXaxis()->SetRangeUser(0,1000.); rh3->SetTitle(""); rh3->GetYaxis()->SetTitleSize(0.05); rh3->GetYaxis()->SetTitleOffset(1.2); rh3->GetYaxis()->SetTitle("#sigma(#delta d_{0}) [cm]"); rh3->GetXaxis()->SetTitleSize(0.055); rh3->GetXaxis()->SetTitleOffset(0.8); rh3->GetXaxis()->SetTitle("p_{t}"); rh3->GetXaxis()->SetRangeUser(0,1000.); sh3->GetXaxis()->SetRangeUser(0,1000.); rh4->SetTitle(""); rh4->GetYaxis()->SetTitleSize(0.05); rh4->GetYaxis()->SetTitleOffset(1.2); rh4->GetYaxis()->SetTitle("#sigma(#delta z_{0}) [cm]"); rh4->GetXaxis()->SetTitleSize(0.055); rh4->GetXaxis()->SetTitleOffset(0.8); rh4->GetXaxis()->SetTitle("p_{t}"); rh4->GetXaxis()->SetRangeUser(0,1000.); sh4->GetXaxis()->SetRangeUser(0,1000.); rh5->SetTitle(""); rh5->GetYaxis()->SetTitleSize(0.05); rh5->GetYaxis()->SetTitleOffset(1.2); rh5->GetYaxis()->SetTitle("#sigma(#delta p_{t}/p_{t}) "); rh5->GetXaxis()->SetTitleSize(0.055); rh5->GetXaxis()->SetTitleOffset(0.8); rh5->GetXaxis()->SetTitle("p_{t}"); rh5->GetXaxis()->SetRangeUser(0,1000.); sh5->GetXaxis()->SetRangeUser(0,1000.); rh6->GetXaxis()->SetRangeUser(0,1000.); sh6->GetXaxis()->SetRangeUser(0,1000.); canvas = new TCanvas("Tracks7b","Tracks: Dxy, Dz, Theta resolution",1000,1400); plotResolutions(canvas, sh1,rh1,sh2,rh2, sh3,rh3,sh4,rh4, sh5,rh5,sh6,rh6, te,"UU",-1, true); canvas->cd(); l = new TLegend(0.10,0.63,0.90,0.67); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(rh1,refLabel,"LPF"); l->AddEntry(sh1,newLabel,"LPF"); l->Draw(); canvas->Print("resolutionsPt.pdf"); delete l; //===== building 2 rdir->GetObject(collname1+"/effic_vs_phi",rh1); sdir->GetObject(collname2+"/effic_vs_phi",sh1); rh1->GetYaxis()->SetRangeUser(MINEFF,MAXEFF); sh1->GetYaxis()->SetRangeUser(MINEFF,MAXEFF); rh1->GetXaxis()->SetTitle("#phi"); rh1->GetYaxis()->SetTitle("efficiency vs #phi"); rh1->GetYaxis()->SetTitleSize(0.05); rh1->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/fakerate_vs_phi",rh2); sdir->GetObject(collname2+"/fakerate_vs_phi",sh2); rh2->GetXaxis()->SetTitle("#phi"); rh2->GetYaxis()->SetTitle("fakerate vs #phi"); rh2->GetYaxis()->SetRangeUser(0.,MAXFAKE); sh2->GetYaxis()->SetRangeUser(0.,MAXFAKE); rh2->GetYaxis()->SetTitleSize(0.05); rh2->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/effic_vs_dxy",rh3); sdir->GetObject(collname2+"/effic_vs_dxy",sh3); rh3->GetXaxis()->SetTitle("dxy"); rh3->GetYaxis()->SetTitle("efficiency vs dxy"); rh3->GetYaxis()->SetRangeUser(MINEFF,MAXEFF); sh3->GetYaxis()->SetRangeUser(MINEFF,MAXEFF); rh3->GetYaxis()->SetTitleSize(0.05); rh3->GetYaxis()->SetTitleOffset(1.2); rh3->SetTitle(""); rdir->GetObject(collname1+"/fakerate_vs_dxy",rh4); sdir->GetObject(collname2+"/fakerate_vs_dxy",sh4); rh4->SetTitle(""); rh4->GetXaxis()->SetTitle("dxy"); rh4->GetYaxis()->SetTitle("fakerate vs dxy"); rh4->GetYaxis()->SetTitleSize(0.05); rh4->GetYaxis()->SetTitleOffset(1.2); rh4->GetYaxis()->SetRangeUser(0.,MAXFAKE); sh4->GetYaxis()->SetRangeUser(0.,MAXFAKE); rdir->GetObject(collname1+"/effic_vs_dz",rh5); sdir->GetObject(collname2+"/effic_vs_dz",sh5); rh5->GetXaxis()->SetTitle("dz"); rh5->GetYaxis()->SetTitle("efficiency vs dz"); rh5->GetYaxis()->SetTitleSize(0.05); rh5->GetYaxis()->SetTitleOffset(1.2); rh5->GetYaxis()->SetRangeUser(MINEFF,MAXEFF); sh5->GetYaxis()->SetRangeUser(MINEFF,MAXEFF); rdir->GetObject(collname1+"/fakerate_vs_dz",rh6); sdir->GetObject(collname2+"/fakerate_vs_dz",sh6); rh6->GetYaxis()->SetRangeUser(0.,1.0); rh6->GetYaxis()->SetRangeUser(0.,1.0); rh6->GetXaxis()->SetTitle("dz"); rh6->GetYaxis()->SetTitle("fakerate vs dz"); rh6->GetYaxis()->SetTitleSize(0.05); rh6->GetYaxis()->SetTitleOffset(1.2); canvas = new TCanvas("Tracks8","Tracks: efficiency & fakerate",1000,1400); TH1F * r[6]={rh1,rh2,rh3,rh4,rh5,rh6}; TH1F * s[6]={sh1,sh2,sh3,sh4,sh5,sh6}; plotBuilding(canvas,s, r,6, te,"UU",-1); canvas->cd(); l = new TLegend(0.10,0.64,0.90,0.69); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(rh1,refLabel,"LPF"); l->AddEntry(sh1,newLabel,"LPF"); l->Draw(); canvas->Print("building2.pdf"); delete l; //===== building 3 rdir->GetObject(collname1+"/effic_vs_vertpos",rh1); sdir->GetObject(collname2+"/effic_vs_vertpos",sh1); rh1->GetYaxis()->SetRangeUser(MINEFF,MAXEFF); sh1->GetYaxis()->SetRangeUser(MINEFF,MAXEFF); rh1->GetXaxis()->SetTitle("TP vert xy pos"); rh1->GetYaxis()->SetTitle("efficiency vs vert xy pos"); rh1->GetYaxis()->SetTitleSize(0.05); rh1->GetYaxis()->SetTitleOffset(1.2); rdir->GetObject(collname1+"/effic_vs_zpos",rh2); sdir->GetObject(collname2+"/effic_vs_zpos",sh2); rh2->GetXaxis()->SetTitle("TP vert z pos"); rh2->GetYaxis()->SetTitle("efficiency vs vert z pos"); rh2->GetYaxis()->SetRangeUser(MINEFF,MAXEFF); sh2->GetYaxis()->SetRangeUser(MINEFF,MAXEFF); rh2->GetYaxis()->SetTitleSize(0.05); rh2->GetYaxis()->SetTitleOffset(1.2); rh2->SetTitle(""); canvas = new TCanvas("Tracks9","Tracks: efficiency & fakerate",1000,1400); TH1F * r[2]={rh1,rh2}; TH1F * s[2]={sh1,sh2}; plotBuilding(canvas,s, r,2, te,"UU",-1); canvas->cd(); l = new TLegend(0.10,0.14,0.90,0.19); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(rh1,refLabel,"LPF"); l->AddEntry(sh1,newLabel,"LPF"); l->Draw(); canvas->Print("building3.pdf"); delete l; //======== plots of eff, fake rates for various iterative tracking steps //== we assume that the ref and new have the same histogram list! (and there are 6!) // HERE // TString refcollname=rl->At(0)->GetName(); // TString newcollname=sl->At(0)->GetName(); // num_col = rl->GetSize(); TH1F * r[6]; TH1F * s[6]; // // eff vs eta // for(int i=0; i<num_col;i++){ // refcollname =rl->At(i)->GetName(); // newcollname =sl->At(i)->GetName(); // rdir->GetObject(refcollname+"/effic",r[i]); // sdir->GetObject(newcollname+"/effic",s[i]); // //r[i]->GetYaxis()->SetRangeUser(MINEFF,MAXEFF); // //s[i]->GetYaxis()->SetRangeUser(MINEFF,MAXEFF); // r[i]->GetYaxis()->SetRangeUser(0.,MAXEFF); // s[i]->GetYaxis()->SetRangeUser(0.,MAXEFF); // r[i]->GetXaxis()->SetTitle("#eta"); // r[i]->GetYaxis()->SetTitle("efficiency vs #eta"); // r[i]->GetYaxis()->SetTitleSize(0.05); // r[i]->GetYaxis()->SetTitleOffset(1.2); // r[i]->SetTitle(refcollname); // if(i==2 || i==3) { // //r[i]->SetTitleY(0.); // //r[i]->SetTitle(""); // r[i]->SetTitleOffset(-1.,"HIST"); // } // } // fill with the histos we want for eff fillStepHisto(rdir, sdir, rl, sl, r, s, "/effic", "#eta", "efficiency vs #eta", 0., MAXEFF); // rearrange to a more natural order for plotting TH1F * rr[6]={r[5],r[2],r[0],r[3],r[4],r[1]}; TH1F * ss[6]={s[5],s[2],s[0],s[3],s[4],s[1]}; canvas = new TCanvas("Tracks10","Tracks: efficiency for each step",1000,1400); plotBuilding(canvas,ss, rr,6, te,"UU",-69); canvas->cd(); l = new TLegend(0.10,0.64,0.90,0.69); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(r[0],refLabel,"LPF"); l->AddEntry(s[0],newLabel,"LPF"); l->Draw(); canvas->Print("steps_eff.pdf"); delete l; // fill with the histos we want for fake rate fillStepHisto(rdir, sdir, rl, sl, r, s, "/fakerate", "#eta", "fakerate vs #eta", 0., MAXFAKE); // rearrange to a more natural order for plotting TH1F * rr[6]={r[5],r[2],r[0],r[3],r[4],r[1]}; TH1F * ss[6]={s[5],s[2],s[0],s[3],s[4],s[1]}; canvas = new TCanvas("Tracks11","Tracks: fakerate for each step",1000,1400); plotBuilding(canvas,ss, rr,6, te,"UU",-69); canvas->cd(); l = new TLegend(0.10,0.64,0.90,0.69); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(r[0],refLabel,"LPF"); l->AddEntry(s[0],newLabel,"LPF"); l->Draw(); canvas->Print("steps_fakerate.pdf"); delete l; // fill with the histos we want for eff vs pT fillStepHisto(rdir, sdir, rl, sl, r, s, "/efficPt", "p_{t}", "efficiency vs p_{t}", 0., MAXEFF); // rearrange to a more natural order for plotting TH1F * rr[6]={r[5],r[2],r[0],r[3],r[4],r[1]}; TH1F * ss[6]={s[5],s[2],s[0],s[3],s[4],s[1]}; canvas = new TCanvas("Tracks12","Tracks: efficiency for each step",1000,1400); plotBuilding(canvas,ss, rr,6, te,"UU",-69, 1, false, 127); canvas->cd(); l = new TLegend(0.10,0.64,0.90,0.69); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(r[0],refLabel,"LPF"); l->AddEntry(s[0],newLabel,"LPF"); l->Draw(); canvas->Print("steps_effpt.pdf"); delete l; fillStepHisto(rdir, sdir, rl, sl, r, s, "/fakeratePt", "p_{t}", "fakerate vs p_{t}", 0., MAXFAKE); // rearrange to a more natural order for plotting TH1F * rr[6]={r[5],r[2],r[0],r[3],r[4],r[1]}; TH1F * ss[6]={s[5],s[2],s[0],s[3],s[4],s[1]}; canvas = new TCanvas("Tracks13","Tracks: fakerate for each step",1000,1400); plotBuilding(canvas,ss, rr,6, te,"UU",-69, 1, false, 127); canvas->cd(); l = new TLegend(0.10,0.64,0.90,0.69); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(r[0],refLabel,"LPF"); l->AddEntry(s[0],newLabel,"LPF"); l->Draw(); canvas->Print("steps_fakeratePt.pdf"); delete l; // fill with the histos we want for eff fillStepHisto(rdir, sdir, rl, sl, r, s, "/effic_vs_hit", "hits", "efficiency vs hits", 0., MAXEFF); // rearrange to a more natural order for plotting TH1F * rr[6]={r[5],r[2],r[0],r[3],r[4],r[1]}; TH1F * ss[6]={s[5],s[2],s[0],s[3],s[4],s[1]}; canvas = new TCanvas("Tracks14","Tracks: efficiency for each step",1000,1400); plotBuilding(canvas,ss, rr,6, te,"UU",-69); canvas->cd(); l = new TLegend(0.10,0.64,0.90,0.69); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(r[0],refLabel,"LPF"); l->AddEntry(s[0],newLabel,"LPF"); l->Draw(); canvas->Print("steps_effhits.pdf"); delete l; // fill with the histos we want for fake rate fillStepHisto(rdir, sdir, rl, sl, r, s, "/fakerate_vs_hit", "hits", "fakerate vs hits", 0., MAXFAKE); // rearrange to a more natural order for plotting TH1F * rr[6]={r[5],r[2],r[0],r[3],r[4],r[1]}; TH1F * ss[6]={s[5],s[2],s[0],s[3],s[4],s[1]}; canvas = new TCanvas("Tracks15","Tracks: fakerate for each step",1000,1400); plotBuilding(canvas,ss, rr,6, te,"UU",-69); canvas->cd(); l = new TLegend(0.10,0.64,0.90,0.69); l->SetTextSize(0.016); l->SetLineColor(1); l->SetLineWidth(1); l->SetLineStyle(1); l->SetFillColor(0); l->SetBorderSize(3); l->AddEntry(r[0],refLabel,"LPF"); l->AddEntry(s[0],newLabel,"LPF"); l->Draw(); canvas->Print("steps_fakeratehits.pdf"); delete l; } }
void createPlot(TCanvas *canvas, TFile *file, TString type, TString name, int nbins, double xMin, double xMax, bool runSecTrackColl, TText* te, char * option, double startingY, double startingX = .1, bool fit = false, bool logx=false, bool logy=false, int normScale){ TTree *tree; tree = file->GetObject("tree",tree); TH1F *h1; // for ctf trk h1 = new TH1F("h1", "h1", nbins, xMin, xMax); TH1F *h2; // for sectrk h2 = new TH1F("h2","h2",nbins,xMin,xMax); TString x_title = ""; TString y_title = "Number of Tracks"; // If the histogram is filled per track, cut on the event and track. // Otherwise, cut only on the event level TString basecut="isTechBit40&&!isBeamHalo&&hasGoodPvtx==1"; TString evtcutstring=basecut; evtcutstring.Append("&&EVTSELECTION"); TString trkcutstring=basecut; trkcutstring.Append("&&EVTSELECTION&&TRKSELECTION"); TString ctf_name = "ctf_"; if( name.Contains("cluster_charge",TString::kExact) ) { ctf_name = "ctf"; ctf_name.Append(name); tree->Project("h1",ctf_name, evtcutstring); } else if (name == "recz_pxlpvtx") { tree->Project("h1",name, evtcutstring); y_title="Number of pixelVertices"; } else if( name.Contains("pvtx")) { if(name.Contains("rec")) { y_title="Number of Real PrimaryVertices"; TString vtxcutstring=evtcutstring; tree->Project("h1",name, vtxcutstring.Append("&&isFake_pvtx==0")); } else { y_title="Number of Valid PrimaryVertices"; tree->Project("h1",name, evtcutstring); } } else if ( name.Contains("nVertices",TString::kExact) || name.Contains("hasGoodPvtx",TString::kExact) || name.Contains("nPixelVertices",TString::kExact) || name.Contains("isTechBit40",TString::kExact) || name.Contains("isBSC",TString::kExact) || name.Contains("bsX0",TString::kExact) || name.Contains("bsY0",TString::kExact) || name.Contains("bsZ0",TString::kExact) || name.Contains("glob_ls",TString::kExact) || name.Contains("glob_bx",TString::kExact) ) { tree->Project("h1",name, evtcutstring); y_title = "Number of Events"; } else { ctf_name.Append(name); tree->Project("h1",ctf_name, trkcutstring); } if(runSecTrackColl && ctf_name.Contains("ctf")) { TString sectrk_name = ctf_name.ReplaceAll("ctf","sectrk"); tree->Project("h2",sectrk_name,evtcutstring); } // Set the x_tile if( name == "n" ) { x_title = "Tracks per Event" ; y_title = "Number of Events"; } // All Clusters if( name.Contains("clusterCharge_all",TString::kExact) ) x_title = "All Cluster Charge (ADC Counts)"; if( name.Contains("clusterCharge_TIB",TString::kExact) ) x_title = "All TIB Cluster Charge (ADC Counts)"; if( name.Contains("clusterCharge_TID",TString::kExact) ) x_title = "All TID Cluster Charge (ADC Counts)"; if( name.Contains("clusterCharge_TOB",TString::kExact) ) x_title = "All TOB Cluster Charge (ADC Counts)"; if( name.Contains("clusterCharge_TEC",TString::kExact) ) x_title = "All TEC Cluster Charge (ADC Counts)"; if( name.Contains("cluster_charge",TString::kExact) ) { x_title = " Strip Cluster Charge (ADC Counts)"; y_title = "Number of Clusters"; } // Histograms filled per Track if( name.Contains("nHit",TString::kExact) ) x_title = "Number of Valid Hits per Track" ; if( name.Contains("nLostHit",TString::kExact) ) x_title = "Number of Lost Hits per Track" ; if( name.Contains("nPXBhit",TString::kExact) ) x_title = "Number of PixelBarrel Hits per Track" ; if( name.Contains("nPXFhit",TString::kExact) ) x_title = "Number of PixEndcap Hits per Track" ; if( name.Contains("nTIBhit",TString::kExact) ) x_title = "Number of TIB Hits per Track" ; if( name.Contains("nTOBhit",TString::kExact) ) x_title = "Number of TOB Hits per Track" ; if( name.Contains("nTIDhit",TString::kExact) ) x_title = "Number of TID Hits per Track" ; if( name.Contains("nTEChit",TString::kExact) ) x_title = "Number of TEC Hits per Track" ; if( name.Contains("nPixelHit",TString::kExact) ) x_title = "Number of Pixel Hits per Track" ; if( name.Contains("nLayers",TString::kExact) ) x_title = "Number of Layers per Track" ; if( name.Contains("nLayers3D",TString::kExact) ) x_title = "Number of 3D Layers per Track" ; if( name.Contains("nPXBLayers",TString::kExact) ) x_title = "Number of PixelBarrel Layers per Track" ; if( name.Contains("nPXFLayers",TString::kExact) ) x_title = "Number of PixEndcap Layers per Track" ; if( name.Contains("eta",TString::kExact) ) x_title = "Track Pseudorapidity" ; if( name.Contains("pt",TString::kExact) ) x_title = "p_{T} (GeV)" ; if( name.Contains("phi",TString::kExact) ) x_title = "Track Azimuthal Angle" ; if( name.Contains("dxy",TString::kExact) ) x_title = "Track dxy wrt (0,0,0) (cm)" ; if( name.Contains("dz",TString::kExact) ) x_title = "Track dz wrt (0,0,0) (cm)" ; if( name.Contains("dxyCorr",TString::kExact) ) x_title = "Track dxy wrt BS (cm)" ; if( name.Contains("dzCorr",TString::kExact) ) x_title = "Track dz wrt BS (cm)" ; if( name.Contains("xPCA",TString::kExact) ) x_title = "x PCA (cm)" ; if( name.Contains("yPCA",TString::kExact) ) x_title = "y PCA (cm)" ; if( name.Contains("zPCA",TString::kExact) ) x_title = "z PCA (cm)" ; if( name.Contains("chi2ndof",TString::kExact) ) x_title = "#chi^{2}/ndf" ; if( name.Contains("algo",TString::kExact) ) x_title = "Track Algorithm" ; if( name.Contains("isHighPurity",TString::kExact) ) x_title = "isHighPurity" ; // pvtx stuff if( name.Contains("recx_pvtx",TString::kExact) ) x_title = "PrimaryVertex Position X (cm)" ; if( name.Contains("recy_pvtx",TString::kExact) ) x_title = "PrimaryVertex Position Y (cm)" ; if( name.Contains("recz_pvtx",TString::kExact) ) x_title = "PrimaryVertex Position Z (cm)" ; if( name.Contains("isFake_pvtx",TString::kExact) ) x_title = "PrimaryVertex isFake()"; if( name.Contains("recz_pxlpvtx",TString::kExact) ) x_title = "pixelVertices Position Z (cm)" ; //beamspot if( name.Contains("bsX0",TString::kExact) ) x_title = "BeamSpot X (cm)" ; if( name.Contains("bsY0",TString::kExact) ) x_title = "BeamSpot Y (cm)" ; if( name.Contains("bsZ0",TString::kExact) ) x_title = "BeamSpot Z (cm)" ; if( name.Contains("nVertices",TString::kExact) ) x_title = "Number of PrimaryVertices"; if( name.Contains("nPixelVertices",TString::kExact) ) x_title = "Number of pixelVertices"; if( name.Contains("hasGoodPvtx",TString::kExact) ) x_title = "hasRealPrimaryVertex"; if( name.Contains("isTechBit40",TString::kExact) ) x_title = "isTechBit40"; if( name.Contains("isBSC",TString::kExact) ) x_title = "isBSC"; if( name.Contains("glob_bx",TString::kExact) ) x_title = "bunchCrossing"; if(logx) gPad->SetLogx(); else gPad->SetLogx(0); if(logy) gPad->SetLogy(); else gPad->SetLogy(0); h1->SetLineColor(4); h1->SetMarkerColor(4); h1->SetMarkerStyle(21); h1->SetMarkerSize(0.7); //h1->StatOverflows(kTRUE); h1->SetLineWidth(3); h1->GetXaxis()->SetTitle(x_title); h1->GetYaxis()->SetTitle(y_title); if(runSecTrackColl) { h2->SetLineColor(2); h2->SetMarkerColor(2); h2->SetMarkerStyle(21); h2->SetMarkerSize(0.7); //h2->StatOverflows(kTRUE); h2->SetLineWidth(3); h2->GetXaxis()->SetTitle(x_title); h2->GetYaxis()->SetTitle(y_title); } if(runSecTrackColl) { setStats(h1, h2, startingY, startingX, fit); NormalizeHistograms(h1, h2, normScale); if(!logy && !logx) fixRangeY(h1,h2); //I don't know why, with logy or logx, this line creates trouble in overlaying two plots if there is an Y=0 bin } else { setStats(h1, startingY, startingX, fit); } gPad->Update(); h1->Draw(); if(runSecTrackColl) h2->Draw("sames"); canvas->Update(); TLegend *leg = new TLegend(0.16,0.93,0.60,0.995); leg->SetTextSize(0.04); leg->SetTextFont(42); leg->SetFillColor(0); leg->SetBorderSize(1); leg->AddEntry(h1, "TRACKCOLLECTION" , "L" ); if(runSecTrackColl) leg->AddEntry(h2, "SECTRKCOLLECTION" , "L" ); if(type == "perTrk" || name == "n" || name == "cluster_charge") leg->Draw("SAME"); TString pngdirname ="PNGDIR/SAMPLE/CUTSTRING/"; TString pngfilename = pngdirname; pngfilename.Append(name); pngfilename.Append(".png"); canvas->Print(pngfilename); TString epsdirname ="EPSDIR/SAMPLE/CUTSTRING/"; TString epsfilename = epsdirname; epsfilename.Append(name); epsfilename.Append(".eps"); canvas->Print(epsfilename); delete h1; delete h2; }
void createPlot(TCanvas *canvas, TFile *file, TFile *reffile, TString type, TString name, int nbins, double xMin, double xMax, TText* te, char * option, double startingY, double startingX = .1, bool fit = false, bool logx=false, bool logy=false, int algo, int normScale){ TTree *tree; tree = file->GetObject("tree",tree); TTree *reftree; reftree = reffile->GetObject("tree",reftree); TH1F *h1 = new TH1F("h1", "h1", nbins, xMin, xMax); TH1F *h2 = new TH1F("h2", "h2", nbins, xMin, xMax); TString x_title = ""; TString y_title = ""; if(normScale == 3) y_title = "Number of Tracks Per Event"; else y_title = "Number of Tracks"; // If the histogram is filled per track, cut on the event and track. // Otherwise, cut only on the event level TString basecut="hasGoodPvtx==1&&ctf_fHighPurity>0.25"; TString evtcutstring=basecut; evtcutstring.Append("&&EVTSELECTION"); TString trkcutstring=basecut; trkcutstring.Append("&&EVTSELECTION&&TRKSELECTION"); // Get the nEvents TH1F *hn1 = new TH1F("hn1", "hn1", 300, 0, 300); TH1F *hn2 = new TH1F("hn2", "hn2", 300, 0, 300); int nEvents1, nEvents2; tree->Project("hn1","ctf_nHighPurity", evtcutstring); reftree->Project("hn2","ctf_nHighPurity", evtcutstring); int nEvents1 = hn1->GetEntries(); int nEvents2 = hn2->GetEntries(); TString hist_name; if( name.Contains("cluster_charge",TString::kExact) ) { if(algo == 1) hist_name = "ctf"; if(algo == 2) hist_name = "sectrk_"; hist_name.Append(name); tree->Project("h1",hist_name, evtcutstring); reftree->Project("h2",hist_name, evtcutstring); x_title = " Strip Cluster Charge (ADC Counts)"; y_title = "Number of Clusters"; } else if (name.Contains("pxlpvtx")) { tree->Project("h1",name, evtcutstring); reftree->Project("h2",name, evtcutstring); y_title="Number of Real PixelVertices"; } else if( name.Contains("pvtx") && (!name.Contains("dxy",TString::kExact)) && (!name.Contains("dz"))) { y_title="Number of Real PrimaryVertices"; tree->Project("h1",name, evtcutstring); reftree->Project("h2",name, evtcutstring); } else if ( name.Contains("nVertices",TString::kExact) || name.Contains("hasGoodPvtx",TString::kExact) || name.Contains("nPixelVertices",TString::kExact) || name.Contains("hasGoodPxlPvtx",TString::kExact) || name.Contains("bsX0",TString::kExact) || name.Contains("bsY0",TString::kExact) || name.Contains("bsZ0",TString::kExact) || name.Contains("bsWidthX",TString::kExact) || name.Contains("bsWidthY",TString::kExact) || name.Contains("bsSigmaZ",TString::kExact) || name.Contains("glob_ls",TString::kExact) || name.Contains("glob_bx",TString::kExact) || name.Contains("ctf_nHighPurity",TString::kExact) || name.Contains("ctf_fHighPurity",TString::kExact) || name.Contains("nTracks_pvtx",TString::kExact) || name == "n" ) { hist_name = name; if(name=="n" && algo == 1) hist_name.Prepend("ctf_"); tree->Project("h1",hist_name, evtcutstring); reftree->Project("h2",hist_name, evtcutstring); y_title = "Number of Events"; } else { if(algo == 1) hist_name = "ctf_"; if(algo == 2) hist_name = "sectrk_"; hist_name.Append(name); tree->Project("h1",hist_name, trkcutstring); reftree->Project("h2",hist_name, trkcutstring); } if( name.Contains("nHighPurity",TString::kExact) ) x_title = "Number of HighPurity Tracks" ; if( name.Contains("nHit",TString::kExact) ) x_title = "Number of Valid Hits per Track" ; if( name.Contains("nLostHit",TString::kExact) ) x_title = "Number of Lost Hits per Track" ; if( name.Contains("nPXBhit",TString::kExact) ) x_title = "Number of PixelBarrel Hits per Track" ; if( name.Contains("nPXFhit",TString::kExact) ) x_title = "Number of PixEndcap Hits per Track" ; if( name.Contains("nTIBhit",TString::kExact) ) x_title = "Number of TIB Hits per Track" ; if( name.Contains("nTOBhit",TString::kExact) ) x_title = "Number of TOB Hits per Track" ; if( name.Contains("nTIDhit",TString::kExact) ) x_title = "Number of TID Hits per Track" ; if( name.Contains("nTEChit",TString::kExact) ) x_title = "Number of TEC Hits per Track" ; if( name.Contains("nPixelHit",TString::kExact) ) x_title = "Number of Pixel Hits per Track" ; if( name.Contains("nLayers",TString::kExact) ) x_title = "Number of Layers per Track" ; if( name.Contains("nPXBLayers",TString::kExact) ) x_title = "Number of PixelBarrel Layers per Track" ; if( name.Contains("nPXFLayers",TString::kExact) ) x_title = "Number of PixEndcap Layers per Track" ; if( name.Contains("nLayers3D",TString::kExact) ) x_title = "Number of 3D Layers per Track" ; if( name.Contains("nPixelLayers",TString::kExact) ) x_title = "Number of Pixel Layers per Track" ; if( name.Contains("eta",TString::kExact) ) x_title = "Track Pseudorapidity" ; if( name.Contains("pt",TString::kExact) ) x_title = "p_{T} (GeV)" ; if( name.Contains("phi",TString::kExact) ) x_title = "Track Azimuthal Angle" ; if( name.Contains("dxy",TString::kExact) ) x_title = "Track dxy (0,0,0) (cm)" ; if( name.Contains("dxyCorr",TString::kExact) ) x_title = "Track dxy (BS) (cm)" ; if( name.Contains("dxyCorr_pvtx",TString::kExact) ) x_title = "Track dxy (PV) (cm)" ; if( name.Contains("dz",TString::kExact) ) x_title = "Track dz (0,0,0) (cm)" ; if( name.Contains("dzCorr",TString::kExact) ) x_title = "Track dz (BS) (cm)" ; if( name.Contains("dzCorr_pvtx",TString::kExact) ) x_title = "Track dz (PV) (cm)" ; if( name.Contains("xPCA",TString::kExact) ) x_title = "x PCA (cm)" ; if( name.Contains("yPCA",TString::kExact) ) x_title = "y PCA (cm)" ; if( name.Contains("zPCA",TString::kExact) ) x_title = "z PCA (cm)" ; if( name.Contains("chi2ndof",TString::kExact) ) x_title = "#chi^{2}/ndf" ; if( name.Contains("algo",TString::kExact) ) x_title = "Track Algorithm" ; if( name.Contains("isHighPurity",TString::kExact) ) x_title = "isHighPurity"; if( name.Contains("ctf_fHighPurity",TString::kExact) ) x_title = "Fraction of HighPurity Tracks"; // all cluster charge if( name.Contains("clusterCharge_all",TString::kExact) ) x_title = "Cluster Charge (ADC Counts)"; if( name.Contains("clusterCharge_TIB",TString::kExact) ) x_title = "TIB Cluster Charge (ADC Counts)"; if( name.Contains("clusterCharge_TID",TString::kExact) ) x_title = "TID Cluster Charge (ADC Counts)"; if( name.Contains("clusterCharge_TOB",TString::kExact) ) x_title = "TOB Cluster Charge (ADC Counts)"; if( name.Contains("clusterCharge_TEC",TString::kExact) ) x_title = "TEC Cluster Charge (ADC Counts)"; // pvtx stuff if( name.Contains("recx_pvtx",TString::kExact) ) x_title = "PrimaryVertex Position X (cm)" ; if( name.Contains("recy_pvtx",TString::kExact) ) x_title = "PrimaryVertex Position Y (cm)" ; if( name.Contains("recz_pvtx",TString::kExact) ) x_title = "PrimaryVertex Position Z (cm)" ; if( name.Contains("nTracks_pvtx",TString::kExact) ) x_title = "Number of Tracks in PVTX"; if( name.Contains("nVertices",TString::kExact) ) x_title = "Number of PrimaryVertices"; if( name.Contains("nPixelVertices",TString::kExact) ) x_title = "Number of pixelVertices"; if( name.Contains("recx_pxlpvtx",TString::kExact) ) x_title = "PixelVertex Position X (cm)" ; if( name.Contains("recy_pxlpvtx",TString::kExact) ) x_title = "PixelVertex Position Y (cm)" ; if( name.Contains("recz_pxlpvtx",TString::kExact) ) x_title = "PixelVertex Position Z (cm)" ; if( name.Contains("hasGoodPvtx",TString::kExact) ) x_title = "hasRealPrimaryVertex"; if( name.Contains("hasGoodPxlPvtx",TString::kExact) ) x_title = "hasRealPixelVertex"; //beamspot if( name.Contains("bsX0",TString::kExact) ) x_title = "BeamSpot X (cm)" ; if( name.Contains("bsY0",TString::kExact) ) x_title = "BeamSpot Y (cm)" ; if( name.Contains("bsZ0",TString::kExact) ) x_title = "BeamSpot Z (cm)" ; if( name.Contains("bsWidthX",TString::kExact) ) x_title = "BeamSpot WidthX (cm)" ; if( name.Contains("bsWidthY",TString::kExact) ) x_title = "BeamSpot WidthY (cm)" ; if( name.Contains("bsSigmaZ",TString::kExact) ) x_title = "BeamSpot SigmaZ (cm)" ; // TriggerBits if( name == "n" ) x_title = "Number of Tracks"; if(logx) gPad->SetLogx(); else gPad->SetLogx(0); if(logy) gPad->SetLogy(); else gPad->SetLogy(0); h1->SetLineColor(4); h1->SetMarkerColor(4); h1->SetMarkerStyle(21); h1->SetMarkerSize(0.7); //h1->SetFillColor(63); //h1->StatOverflows(kTRUE); h1->SetLineWidth(3); h1->GetXaxis()->SetTitle(x_title); h1->GetYaxis()->SetTitle(y_title); setOverFlowBin(h1); h2->SetLineColor(2); h2->SetMarkerColor(2); h2->SetMarkerStyle(21); h2->SetMarkerSize(0.7); //h2->StatOverflows(kTRUE); h2->SetLineWidth(3); h2->GetXaxis()->SetTitle(x_title); h2->GetYaxis()->SetTitle(y_title); setOverFlowBin(h2); setStats(h1, h2, startingY, startingX, fit); if(normScale!=3) NormalizeHistograms(h1, h2, normScale); else NormalizeHistogramsByEvent(h1, h2, nEvents1, nEvents2); if(!logy&&!logx) fixRangeY(h1,h2); gPad->Update(); h1->Draw(); h2->Draw("sames"); canvas->Update(); TLegend *leg = new TLegend(0.16,0.93,0.60,0.995); leg->SetTextSize(0.03); leg->SetTextFont(42); leg->SetFillColor(0); leg->SetBorderSize(1); leg->AddEntry(h1, "NEWLABEL" , "L" ); leg->AddEntry(h2, "REFLABEL" , "L" ); leg->Draw("SAME"); TString pngdirname ="PNGDIR"; TString pngfilename = pngdirname; pngfilename.Append(name); if(logy) pngfilename.Append("_log"); pngfilename.Append(".png"); canvas->Print(pngfilename); TString epsdirname ="EPSDIR"; TString epsfilename = epsdirname; epsfilename.Append(name); if(logy) epsfilename.Append("_log"); epsfilename.Append(".eps"); canvas->Print(epsfilename); delete h1; delete h2; delete hn1; delete hn2; }