Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:26:41

0001 TCanvas* BremComparison;
0002 
0003 void DrawComparison(TH1F* fast, TH1F* full, int colfast=2, int colfull=2, int style=22, int same = 0) {
0004 
0005    // Draw Fast
0006    fast->SetStats(0);
0007    fast->SetTitle("");
0008    fast->SetLineWidth(colfast);
0009    fast->SetMarkerColor(colfast);
0010    fast->SetLineColor(colfast);
0011    fast->SetMarkerStyle(style);
0012    fast->GetYaxis()->SetTitleOffset(1.6);
0013    if ( fast->GetName() == "EGammaFast" )  
0014      fast->SetXTitle("Energy (GeV)");
0015    else if ( fast->GetName() == "FEGammaFast" ) 
0016      fast->SetXTitle("Energy Fraction");
0017    if ( fast->GetName() == "NGammaFast" || 
0018     fast->GetName() == "NGammaMinFast" )  
0019      fast->SetXTitle("Photons per electrons");
0020    else
0021      fast->SetXTitle("#eta");
0022    fast->SetYTitle("Nb. of photons");
0023    if ( same ) 
0024      fast->Draw("sameerro");
0025    else
0026      fast->Draw("erro");
0027 
0028    // Draw full
0029    full->SetStats(0);
0030    full->SetTitle("");
0031    full->SetLineColor(colfull);
0032    full->SetLineWidth(2);
0033    full->Draw("same");
0034 
0035 }
0036 
0037 void Comparison(TH1F* fast, TH1F* full) {
0038   //BremComparison->Delete();
0039   //  fast->SetMaximum(maximum);
0040   BremComparison = new TCanvas("Brem","BremComparison",150,150,800,600);
0041   BremComparison->cd();
0042   fast->Draw("erro");
0043   DrawComparison(fast,full,2,4);
0044   double nfast = fast->GetEntries();
0045   double nfull = full->GetEntries();
0046   cout << "Full/Fast/ratio = " << nfull << " " << nfast << " " << nfull/nfast << endl;
0047   //  BremComparison->SaveAs(Form("%s_Test.eps", fast->GetName()));
0048   //  BremComparison->SaveAs(Form("%s_Test.gif", fast->GetName()));
0049 }
0050 
0051 void Ratio(TH1F* fast, TH1F* full) {
0052   BremComparison->Delete();
0053   //  fast->SetMaximum(maximum);
0054   BremComparison = new TCanvas("Brem","BremComparison",150,150,800,600);
0055   BremComparison->SetGridx();
0056   BremComparison->SetGridy();
0057   TH1F* ratio = (TH1F*)full->Clone();
0058   ratio->Divide(fast);
0059   ratio->SetLineColor(4);
0060   ratio->SetLineWidth(2);
0061   ratio->SetTitle(Form("%s_Ratio",fast->GetName()));
0062   //  ratio->Fit("pol0");
0063   ratio->Draw();
0064   //  BremComparison->SaveAs(Form("%s_Ratio_Test.eps", fast->GetName()));
0065   //  BremComparison->SaveAs(Form("%s_Ratio_Test.gif", fast->GetName()));
0066 }
0067 
0068 void Brem() {
0069 
0070 
0071   TFile* f = new TFile("test.root");
0072   gDirectory->cd("DQMData");
0073   BremComparison = new TCanvas("Brem","BremComparison",150,150,800,600);
0074   BremComparison->cd();
0075   //  TrackerFast->SetMaximum(24000);
0076   TrackerFast->SetMaximum(9000);
0077   TrackerFast->SetMinimum(0);
0078   DrawComparison(TrackerFast,TrackerFull,2,2,22,0);
0079   DrawComparison(OuterFast,OuterFull,4,4,22,1);
0080   DrawComparison(InnerFast,InnerFull,3,3,22,1);
0081   DrawComparison(PixelFast,PixelFull,1,1,22,1);
0082   //  DrawComparison(BPFast,BPFull,5,5);
0083 
0084   TLegend* pixel = new TLegend(0.4,0.17,0.47,0.20);
0085   pixel->AddEntry("Pixels ","Pixels ","");
0086   TLegend* inner = new TLegend(0.28,0.37,0.42,0.40);
0087   inner->AddEntry("Inner Tracker  ","Inner Tracker  ","");
0088   TLegend* outer = new TLegend(0.30,0.57,0.44,0.60);
0089   outer->AddEntry("Outer Tracker  ","Outer Tracker  ","");
0090   pixel->Draw();
0091   inner->Draw();
0092   outer->Draw();
0093 
0094   BremComparison->SaveAs("Test.eps");
0095   BremComparison->SaveAs("Test.gif");
0096 
0097 }