Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:21:36

0001 #include "Settings.h"
0002 void DrawResponseVsEta(int ptbin, char s1[1024])
0003 {
0004   char filename[2][1024];
0005   sprintf(filename[0],"%s",s1);
0006   MainProgram(ptbin,1,filename);
0007 }
0008 /////////////////////////////////////////////////////////////////////////////////
0009 void DrawResponseVsEta(int ptbin, char s1[1024],char s2[1024])
0010 {
0011   char filename[2][1024];
0012   sprintf(filename[0],"%s",s1);
0013   sprintf(filename[1],"%s",s2);
0014   MainProgram(ptbin,2,filename);
0015 }
0016 /////////////////////////////////////////////////////////////////////////////////
0017 void MainProgram(int ptbin, const int N, char filename[][1024])
0018 {
0019   gROOT->SetStyle("Plain");
0020   gStyle->SetOptStat(0000);
0021   gStyle->SetOptFit(111); 
0022   gStyle->SetPalette(1);
0023   TFile *f[N];
0024   TH1F *hResponse[N];
0025   int i;
0026   char name[100];
0027   sprintf(name,"Response_vs_Eta_RefPt%d",ptbin);
0028   for(i=0;i<N;i++)
0029     {
0030       f[i] = new TFile(filename[i],"r");
0031       if (f[i]->IsZombie()) break; 
0032       hResponse[i] = (TH1F*)f[i]->Get(name);
0033     }
0034   /////////////////////////////////////////////////////////////////////////////////
0035   TCanvas *can = new TCanvas("CanResponse","CanResponse",900,600);
0036   sprintf(name,"%d < RefPt < %d GeV",(int)Pt[ptbin],(int)Pt[ptbin+1]);
0037   hResponse[0]->SetTitle(name);
0038   hResponse[0]->GetXaxis()->SetTitle("#eta");
0039   hResponse[0]->GetYaxis()->SetTitle("Absolute Response");
0040   hResponse[0]->GetYaxis()->SetNdivisions(505);
0041   TLegend *leg = new TLegend(0.5,0.6,0.85,0.85);
0042   for(i=0;i<N;i++)
0043     {
0044       hResponse[i]->SetMarkerStyle(20+i);
0045       hResponse[i]->SetMarkerColor(i+1);
0046       hResponse[i]->SetLineColor(i+1); 
0047       hResponse[i]->Draw("same");
0048       leg->AddEntry(hResponse[i],filename[i],"LP");
0049     }
0050   leg->SetFillColor(0);
0051   leg->SetLineColor(0);
0052   leg->Draw();  
0053 }