Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:33:36

0001 #include "TFile.h"
0002 #include "TProfile.h"
0003 #include "TDirectory.h"
0004 #include "TLegend.h"
0005 #include "TLine.h"
0006 
0007 void recovsmcdraw(TFile* _file0, const char* dir, const char* label, const int color, TLegend* leg, const bool isFirst) {
0008 
0009   TProfile* prof=0;
0010   if(_file0->cd(dir)) {
0011     prof = (TProfile*)gDirectory->Get("recovsmcnvtxprof");
0012     if(prof) {
0013       prof->SetMarkerStyle(20);
0014       prof->SetMarkerColor(color);
0015       prof->SetLineColor(color);
0016       if(isFirst) {prof->Draw();} else {prof->Draw("same");}
0017       prof->GetXaxis()->SetRangeUser(-0.5,30.5);
0018       if(leg) {
0019     leg->AddEntry(prof,label,"p");
0020       }
0021     }
0022   }
0023   
0024 }
0025 
0026 void recovsmcalgoplot(TFile* _file0, const char* dir, const char* name, const double offset)
0027 {
0028 
0029   char dir1[300]; 
0030   char dir2[300]; 
0031   char dir3[300]; 
0032 
0033   sprintf(dir1,"%sanalyzer",dir);
0034   sprintf(dir2,"%sD0s51mm",dir);
0035   sprintf(dir3,"%sDA100um",dir);
0036 
0037   TLegend leg(.4,.2,.6,.4,name);
0038 
0039   recovsmcdraw(_file0,dir3,"DA 100um",kRed,&leg,true);
0040   recovsmcdraw(_file0,dir1,"2010 reco",kBlack,&leg,false);
0041   recovsmcdraw(_file0,dir2,"gap=1mm, d0 sig=5",kBlue,&leg,false);
0042 
0043   TLine ll(0,offset,30,offset+30*0.7); 
0044   ll.DrawClone();
0045   leg.AddEntry(&ll,"70% efficiency","l");
0046   leg.DrawClone();
0047 }
0048 
0049 void recovsmcplot(TFile* _file0, const char* dir, const char* name, const double offset)
0050 {
0051 
0052   char dir1[300]; 
0053   char dir2[300]; 
0054   char dir3[300]; 
0055 
0056   sprintf(dir1,"%s",dir);
0057   sprintf(dir2,"weighted%s",dir);
0058   sprintf(dir3,"weighted45mm%s",dir);
0059 
0060   TLegend leg(.4,.2,.6,.4,name);
0061 
0062   recovsmcdraw(_file0,dir1,"sigmaZ=6.26cm",kBlack,&leg,true);
0063   recovsmcdraw(_file0,dir2,"sigmaZ=5.20cm",kBlue,&leg,false);
0064   recovsmcdraw(_file0,dir3,"sigmaZ=4.50cm",kRed,&leg,false);
0065 
0066   TLine ll(0,offset,30,offset+30*0.7); 
0067   ll.DrawClone();
0068   leg.AddEntry(&ll,"70% efficiency","l");
0069   leg.DrawClone();
0070 }