Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:46:05

0001 
0002 class Plots{
0003 
0004   public:
0005   Plots();
0006 
0007   void Legend(TString histoname1,TString histoname2,TString histoname3, TString histoname4, TString histoname5, TH1F *histo1, TH1F *histo2, TH1F *histo3,  TH1F *histo4, TH1F *histo5 );  
0008   void Save();
0009   
0010   float convert(float num);
0011 
0012 };
0013 
0014 void Plots::Plots()
0015 {
0016 
0017 gROOT->Reset();
0018 gROOT->Clear();
0019 
0020 gStyle->SetNdivisions(10);
0021 gStyle->SetCanvasBorderMode(0); 
0022 gStyle->SetPadBorderMode(1);
0023 gStyle->SetOptTitle(1);
0024 gStyle->SetStatFont(42);
0025 gStyle->SetCanvasColor(10);
0026 gStyle->SetPadColor(0);
0027 gStyle->SetTitleFont(62,"xy");
0028 gStyle->SetLabelFont(62,"xy");
0029 gStyle->SetTitleFontSize(0.05);
0030 gStyle->SetTitleSize(0.039,"xy");
0031 gStyle->SetLabelSize(0.046,"xy");
0032 // gStyle->SetTitleFillColor(0);
0033 gStyle->SetHistFillStyle(1001);
0034 gStyle->SetHistFillColor(0);
0035 gStyle->SetHistLineStyle(1);
0036 gStyle->SetHistLineWidth(2);
0037 gStyle->SetHistLineColor(2);
0038 gStyle->SetTitleXOffset(1.25);
0039 gStyle->SetTitleYOffset(1.3);
0040 gStyle->SetOptStat(1110);
0041 gStyle->SetOptStat(kFALSE);
0042 gStyle->SetOptFit(0111);
0043 gStyle->SetStatH(0.1); 
0044 
0045 TCanvas *c1 = new TCanvas("c1","c1",129,17,926,703);
0046 c1->SetBorderSize(2);
0047 c1->SetFrameFillColor(0);
0048 c1->SetLogy(0);
0049 c1->cd(); 
0050 
0051 TFile *f[5];
0052 TTree *MyTree[5];
0053 
0054 
0055 f[0]= new TFile("ValidationMisalignedTracker_singlemu100_merged.root");
0056 MyTree[0]=EffTracks;
0057 
0058 f[1]=new TFile("../../SurveyLAS/singlemu/Misalignment_SurveyLASOnlyScenario_refitter_singlemu.root");
0059 MyTree[1]=Tracks;
0060  
0061 f[2]=new TFile("Misalignment_SurveyLASOnlyScenario_refitter_zmumu_singlemuSurveyLASCosmics.root");
0062 MyTree[2]=Tracks;
0063  
0064 f[3]=new TFile("../../singlemu_310607/Misalignment10.root");
0065 MyTree[3]=Tracks;
0066  
0067 f[4]=new TFile("../../singlemu_310607/Misalignment100.root");
0068 MyTree[4]=Tracks;
0069 
0070 
0071 ////&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
0072 
0073 //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
0074 /// EFFICIENCIES VS ETA ALIGNED
0075 //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
0076 hframe = new TH2F("hframe","#Delta(d_{0})",100,-0.03,0.03,32,0.,0.32);
0077 hframe->SetXTitle("#Delta(d_{0}) [#mum]");
0078 hframe->SetYTitle("N. ev. /0.0006");
0079 hframe->Draw();
0080 
0081 
0082 char histoname[128];
0083 char name[128];
0084 TH1F *Resd0[5];
0085 
0086 for(int i=0; i<5; i++){
0087   sprintf(name,"Resd0[%d]",i);
0088   Resd0[i] = new TH1F(name,name,100,-0.03,0.03);
0089   sprintf(histoname,"Resd0[%d]",i);
0090   MyTree[i]->Project(histoname,"resd0","eff==1 && TrackID==13");
0091 
0092   cout << "Entries " << Resd0[i]->GetEntries() <<endl;
0093   Resd0[i]->Scale(1/Resd0[i]->GetEntries());
0094   Resd0[i]->SetTitle("#Delta(d_{0})");    
0095   Resd0[i]->SetXTitle("#Delta(d_{0}) ");
0096   Resd0[i]->SetYTitle("arb. units");
0097   
0098   Resd0[i]->SetLineColor(i+2);
0099   Resd0[i]->SetLineStyle(i+1);
0100   Resd0[i]->SetLineWidth(i+2);
0101   if (i==0) Resd0[i]->Draw("same");
0102   else Resd0[i]->Draw("same");
0103   //  c1->WaitPrimitive();
0104   c1->Update();
0105 }
0106 
0107 Legend("Resd0[0]","Resd0[1]","Resd0[2]","Resd0[3]","Resd0[4]",Resd0[0],Resd0[1],Resd0[2],Resd0[3],Resd0[4]);
0108 
0109 c1->SaveAs("Residuald0_mu.eps");
0110 c1->SaveAs("Residuald0_mu.gif");
0111 gROOT->Reset();
0112 gROOT->Clear();
0113 
0114 delete c1;
0115 
0116 }
0117 
0118 void Plots::Legend(TString histoname1,TString histoname2,TString histoname3, TString histoname4, TString histoname5, TH1F *histo1, TH1F *histo2, TH1F *histo3, TH1F *histo4,  TH1F *histo5)
0119 {
0120 
0121 TLegend *leg = new TLegend(0.31,0.74.,0.995,0.995);
0122 leg->SetTextAlign(32);
0123 leg->SetTextColor(1);
0124 leg->SetTextSize(0.033);
0125 leg->SetFillColor(0);
0126 
0127 char  label[128];
0128 // sprintf(label,"perfect alignment;      mean = %1.3f, RMS = %1.3f",convert(histo1->GetMean()),convert(histo1->GetRMS()));
0129 // leg->AddEntry(histoname1, label, "l");
0130 // sprintf(label,"SurveyLAS alignment; mean = %1.3f, RMS = %1.3f",convert(histo2->GetMean()),convert(histo2->GetRMS()));
0131 // leg->AddEntry(histoname2, label, "l");
0132 // sprintf(label,"SurveyLASCosmics alignment; mean = %1.3f, RMS = %1.3f",convert(histo3->GetMean()),convert(histo3->GetRMS()));
0133 // leg->AddEntry(histoname3, label, "l");
0134 // sprintf(label,"10 pb-1 alignment;  mean = %1.3f, RMS = %1.3f",convert(histo4->GetMean()),convert(histo4->GetRMS()));
0135 // leg->AddEntry(histoname4, label, "l");
0136 // sprintf(label,"100 pb-1 alignment;  mean = %1.3f, RMS = %1.3f",convert(histo5->GetMean()),convert(histo5->GetRMS()));
0137 // leg->AddEntry(histoname5, label, "l");
0138 
0139 
0140 sprintf(label,"perfect; mean=%1.4f, RMS=%1.4f",(histo1->GetMean()),histo1->GetRMS());
0141 leg->AddEntry(histoname1, label, "l");
0142 sprintf(label,"SurveyLAS; mean=%1.4f, RMS=%1.4f",(histo2->GetMean()),histo2->GetRMS());
0143 leg->AddEntry(histoname2, label, "l");
0144 sprintf(label,"SurveyLASCosmics; mean=%1.4f, RMS=%1.4f",(histo3->GetMean()),histo3->GetRMS());
0145 leg->AddEntry(histoname3, label, "l");
0146 sprintf(label,"10 pb^{-1};  mean=%1.4f, RMS=%1.4f",(histo4->GetMean()),histo4->GetRMS());
0147 leg->AddEntry(histoname4, label, "l");
0148 sprintf(label,"100 pb^{-1};  mean=%1.4f, RMS=%1.4f",(histo5->GetMean()),histo5->GetRMS());
0149 leg->AddEntry(histoname5, label, "l");
0150 
0151 leg->Draw();
0152 
0153 }
0154 
0155 float Plots::convert(float num){
0156   int mean1 = num;
0157   float res = num - mean1;
0158   int res2 = res*1000;
0159   float res3 = res2*0.001;
0160   float mean2 = mean1 + res3;
0161                                                                                                                   
0162   float res4 = res - res3;
0163   int res5 = res4*10000;
0164                                                                                                                   
0165   if(res5>5)
0166     mean2 = mean2 + 0.001;
0167                                                                                                                   
0168   return mean2;
0169 }