Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:20:58

0001 void plot_validation(){
0002 
0003   bool dojet = true;
0004   bool compare_releases = false; // if false, assume that we compare full/fast
0005   bool dofull = true; // only relevant if compare_releases = true
0006 
0007   TString setup = "ideal";
0008   TString sample = "qcd80";
0009 
0010   TString release1 = "2_2_3";
0011   TString release2 = "2_2_3";
0012 
0013   if (dojet)  TString trigname = "SingleJet50";
0014   if (!dojet) TString trigname = "SingleMET35";
0015 
0016   // ---------------------------------------------------------------------------
0017 
0018 
0019   TString ff1 = "";
0020   TString ff2 = "";
0021   if (!compare_releases) ff2 = "_fastsim";
0022   if (compare_releases && !dofull){
0023     ff1 = "_fastsim";
0024     ff2 = "_fastsim";
0025   };
0026 
0027   TString shortrelease1 = release1.ReplaceAll("_","");
0028   TString shortrelease2 = release2.ReplaceAll("_","");
0029   TString file1 = Form("/uscms_data/d1/cammin/CMSSW/TriggerPerformance/CMSSW_2_2_3/src/run/relval%s_%s/%s%s_output.root",shortrelease1.Data(),setup.Data(),sample.Data(),ff1.Data());
0030   TString file2 = Form("/uscms_data/d1/cammin/CMSSW/TriggerPerformance/CMSSW_2_2_3/src/run/relval%s_%s/%s%s_output.root",shortrelease2.Data(),setup.Data(),sample.Data(),ff2.Data());
0031 
0032 
0033   TString fastfull;
0034 
0035   printf("\nInput file 1: %s\n",file1.Data());
0036   printf(  "Input file 2: %s\n\n",file2.Data());
0037 
0038   double xmin = 0;
0039   double xmax = 200;
0040   if (!dojet) xmax = 250; // for MET
0041 
0042   TCanvas *c = new TCanvas("c", Form("%s",trigname.Data()), 0,0,700,500);
0043   c->SetTopMargin(0.05);
0044   c->SetRightMargin(0.05);
0045   c->SetLeftMargin(0.12);
0046   c->SetBottomMargin(0.15);
0047   TH1F *hframe = (TH1F*)c->DrawFrame(xmin,0,xmax,1.1);
0048   if (dojet)  hframe->GetXaxis()->SetTitle("Leading GenJet p_{T} (GeV)");
0049   if (!dojet) hframe->GetXaxis()->SetTitle("GenMET (GeV)");
0050   hframe->GetYaxis()->SetTitle("HLT efficiency");
0051   hframe->GetXaxis()->SetTitleSize(0.07);
0052   hframe->GetYaxis()->SetTitleSize(0.07);
0053   hframe->GetXaxis()->SetTitleOffset(0.9);
0054   hframe->GetYaxis()->SetTitleOffset(0.7);
0055 
0056 
0057   TFile *f1 = new TFile(file1);
0058   f1->cd(Form("DQMData/HLT/HLTJETMET/%s",trigname.Data()));
0059   if (dojet){
0060     TH1F *h1 = (TH1F*)gROOT->FindObject("_meGenJetPtTrg");
0061     TH1F *h2 = (TH1F*)gROOT->FindObject("_meGenJetPt");
0062   } else{
0063     TH1F *h1 = (TH1F*)gROOT->FindObject("_meGenMETTrg");
0064     TH1F *h2 = (TH1F*)gROOT->FindObject("_meGenMET");
0065   }
0066 
0067   h1->Sumw2();
0068   h2->Sumw2();
0069 
0070   h1->Divide(h1,h2,1,1,"B");
0071 
0072   h1->SetFillColor(kYellow);
0073   h1->Draw("hsame");
0074   h1->Draw("samee");
0075 
0076 
0077 
0078   TFile *f2 = new TFile(file2);
0079   f2->cd(Form("DQMData/HLT/HLTJETMET/%s",trigname.Data()));
0080 
0081   if (dojet){
0082     TH1F *h3 = (TH1F*)gROOT->FindObject("_meGenJetPtTrg");
0083     TH1F *h4 = (TH1F*)gROOT->FindObject("_meGenJetPt");
0084   } else {
0085     TH1F *h3 = (TH1F*)gROOT->FindObject("_meGenMETTrg");
0086     TH1F *h4 = (TH1F*)gROOT->FindObject("_meGenMET");
0087   }
0088 //   h3->Draw();
0089 //   h4->Draw();
0090   h3->Sumw2();
0091   h4->Sumw2();
0092 
0093   h3->Divide(h3,h4,1,1,"B");
0094 
0095   //  h3->Draw("histesame");
0096   h3->SetMarkerStyle(20);
0097   h3->SetMarkerColor(kRed);
0098   h3->SetLineColor(kRed);
0099   h3->Draw("samee");
0100 
0101   TLegend *leg = new TLegend(0.623, 0.2, 0.92, 0.44);
0102   leg->SetFillColor(kYellow-9);
0103   leg->SetBorderSize(1);
0104   if (!compare_releases){
0105     leg->AddEntry(h1,Form("%s ideal full",release1.Data()),"lfe");
0106     leg->AddEntry(h3,Form("%s ideal fast",release2.Data()),"ple");
0107   } else {
0108     if (dofull)  fastfull = "full";
0109     if (!dofull) fastfull = "fast";
0110     leg->AddEntry(h1,Form("%s ideal %s",release1.Data(),fastfull.Data()),"lfe");
0111     leg->AddEntry(h3,Form("%s ideal %s",release2.Data(),fastfull.Data()),"ple");
0112   }
0113   leg->Draw();
0114 
0115   //  TLatex *tex = new TLatex(0.15, 0.9, Form("RelVal TTbar - %s",(trigname.Remove(0,4)).Data()));
0116   TLatex *tex = new TLatex(0.15, 0.9, Form("RelVal %s - %s",sample.Data(),(trigname).Data()));
0117   tex->SetNDC();
0118   tex->Draw();
0119 
0120   c->SetGridx();
0121   c->RedrawAxis();
0122 
0123   if (!compare_releases){
0124     c->Print(Form("plots/RelVal_%s_FullFast_%s_%s.eps",sample.Data(),release1.Data(),trigname.Data()));
0125     c->Print(Form("plots/RelVal_%s_FullFast_%s_%s.png",sample.Data(),release1.Data(),trigname.Data()));
0126   }
0127   if (compare_releases){
0128     c->Print(Form("plots/RelVal_%s_%s_%s--%s_%s.eps",sample.Data(),fastfull.Data(),release1.Data(),release2.Data(),trigname.Data()));
0129     c->Print(Form("plots/RelVal_%s_%s_%s--%s_%s.png",sample.Data(),fastfull.Data(),release1.Data(),release2.Data(),trigname.Data()));
0130   }
0131 }