Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:20:14

0001 void gctAnalyzerBasicPlotter()
0002 {
0003 
0004   setStyle();
0005 
0006   // Open the file
0007   TFile *data = new TFile("raw_gctAnalyzer.root");
0008   
0009   // Canvas
0010   TCanvas *c1 = new TCanvas("c1","c1",800,800);
0011 
0012   PlotErrors(data,"analyzer/ErrorHistograms_Flags/isoEg_errorFlag"); c1->Print("isoEg_errorFlag.png");
0013   PlotErrors(data,"analyzer/ErrorHistograms_Flags/nonIsoEg_errorFlag"); c1->Print("nonIsoEg_errorFlag.png");
0014   PlotErrors(data,"analyzer/ErrorHistograms_Flags/cenJet_errorFlag"); c1->Print("cenJet_errorFlag.png");
0015   PlotErrors(data,"analyzer/ErrorHistograms_Flags/tauJet_errorFlag"); c1->Print("tauJet_errorFlag.png");
0016   PlotErrors(data,"analyzer/ErrorHistograms_Flags/forJet_errorFlag"); c1->Print("forJet_errorFlag.png");
0017   PlotErrors(data,"analyzer/ErrorHistograms_Flags/hfRingSum_errorFlag"); c1->Print("hfRingSum_errorFlag.png");
0018   PlotErrors(data,"analyzer/ErrorHistograms_Flags/hfBitCount_errorFlag"); c1->Print("hfBitCount_errorFlag.png");
0019   PlotErrors(data,"analyzer/ErrorHistograms_Flags/totalEt_errorFlag"); c1->Print("totalEt_errorFlag.png");  
0020   PlotErrors(data,"analyzer/ErrorHistograms_Flags/totalHt_errorFlag"); c1->Print("totalHt_errorFlag.png");  
0021   PlotErrors(data,"analyzer/ErrorHistograms_Flags/missingEt_errorFlag"); c1->Print("missingEt_errorFlag.png");  
0022   PlotErrors(data,"analyzer/ErrorHistograms_Flags/missingHt_errorFlag"); c1->Print("missingHt_errorFlag.png");  
0023   
0024   data->Close();
0025 
0026 }
0027 
0028 void PlotErrors(TFile* data, TString Hist, TString Opt="")
0029 {
0030 
0031   // Get the histograms from the files
0032   TH1D *Data = (TH1D*)data->Get(Hist);
0033 
0034   //check to make sure there are some events for log scale
0035   if(Data->Integral() == 0 ) c1->SetLogy(0);
0036   else  c1->SetLogy(1);
0037 
0038   // Fill for histogram
0039   Data->SetFillColor(kBlue);
0040 
0041   // plot them
0042   Data->DrawCopy("hist");
0043 
0044   gPad->RedrawAxis();
0045 
0046 }
0047 
0048 void setStyle() {
0049 
0050   TStyle *setStyle = new TStyle("setStyle","Style for GCTAnalyzer");
0051 
0052   // Stuff from plain style
0053   setStyle->SetFrameBorderMode(0);
0054   setStyle->SetCanvasBorderMode(0);
0055   setStyle->SetCanvasColor(kWhite);
0056   setStyle->SetPadBorderMode(0);
0057   setStyle->SetPadColor(kWhite); 
0058 
0059   setStyle->SetOptStat(0);
0060   setStyle->SetOptTitle(1);
0061   setStyle->SetOptFit(0);
0062   setStyle->SetOptDate(0);
0063 
0064   setStyle->cd();
0065 }