Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:57:14

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 //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
0071 /// EFFICIENCIES VS ETA ALIGNED
0072 //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
0073 char histoname[128];
0074 char name[128];
0075 TH1F *pullphi[4];
0076 
0077 for(int i=0; i<4; i++){
0078   sprintf(name,"pullphi[%d]",i);
0079   pullphi[i] = new TH1F(name,name,150,-10,10);
0080   sprintf(histoname,"pullphi[%d]",i);
0081   MyTree[i]->Project(histoname,"pullphi","eff==1 && TrackID==13");
0082 
0083   cout << "Entries " << pullphi[i]->GetEntries() <<endl;
0084   pullphi[i]->Scale(1/pullphi[i]->GetEntries());
0085   pullphi[i]->SetTitle("pull (#phi)");    
0086   pullphi[i]->SetXTitle("pull (#phi)");
0087   pullphi[i]->SetYTitle("arb. units");
0088   
0089   pullphi[i]->SetLineColor(i+2);
0090   pullphi[i]->SetLineStyle(i+1);
0091   pullphi[i]->SetLineWidth(i+2);
0092   if (i==0) pullphi[i]->Draw();
0093   else pullphi[i]->Draw("same");
0094   //  c1->WaitPrimitive();
0095   c1->Update();
0096 }
0097 
0098 Legend("pullphi[0]","pullphi[1]","pullphi[2]","pullphi[3]",pullphi[0],pullphi[1],pullphi[2],pullphi[3]);
0099 
0100 c1->SaveAs("pullphi_mu.eps");
0101 c1->SaveAs("pullphi_mu.gif");
0102 gROOT->Reset();
0103 gROOT->Clear();
0104 
0105 delete c1;
0106 
0107 }
0108 
0109 void Plots::Legend(TString histoname1,TString histoname2,TString histoname3, TString histoname4, TH1F *histo1, TH1F *histo2, TH1F *histo3, TH1F *histo4)
0110 {
0111 
0112 TLegend *leg = new TLegend(0.45,0.89,1.,1.); 
0113 leg->SetTextAlign(32);
0114 leg->SetTextColor(1);
0115 leg->SetTextSize(0.020);
0116 
0117 char  label[128];
0118 sprintf(label,"perfect alignment;      mean = %1.3f, RMS = %1.3f",convert(histo1->GetMean()),convert(histo1->GetRMS()));
0119 leg->AddEntry(histoname1, label, "l");
0120 sprintf(label,"SurveyLASCosmics alignment; mean = %1.3f, RMS = %1.3f",convert(histo2->GetMean()),convert(histo2->GetRMS()));
0121 leg->AddEntry(histoname2, label, "l");
0122 sprintf(label,"10 pb-1 alignment;  mean = %1.3f, RMS = %1.3f",convert(histo3->GetMean()),convert(histo3->GetRMS()));
0123 leg->AddEntry(histoname3, label, "l");
0124 sprintf(label,"100 pb-1 alignment;  mean = %1.3f, RMS = %1.3f",convert(histo4->GetMean()),convert(histo4->GetRMS()));
0125 leg->AddEntry(histoname4, label, "l");
0126 leg->Draw();
0127 
0128 }
0129 
0130 float Plots::convert(float num){
0131   int mean1 = num;
0132   float res = num - mean1;
0133   int res2 = res*1000;
0134   float res3 = res2*0.001;
0135   float mean2 = mean1 + res3;
0136                                                                                                                   
0137   float res4 = res - res3;
0138   int res5 = res4*10000;
0139                                                                                                                   
0140   if(res5>5)
0141     mean2 = mean2 + 0.001;
0142                                                                                                                   
0143   return mean2;
0144 }