Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:40:28

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