Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 
0002 class Plots{
0003 
0004   public:
0005   Plots();
0006 
0007   void Legend(TString histoname1,TString histoname2,TString histoname3,TString histoname4,TString histoname5,TString histoname6, TH1F *histo1,TH1F *histo2,TH1F *histo3,TH1F *histo4,TH1F *histo5, TH1F *histo6);  
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.15);
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[6];
0052 TTree *MyTree[6];
0053 
0054 f[0]= new TFile("../../Z/MisalignmentIdeal.root");  
0055 MyTree[0]=Tracks;
0056 
0057 f[1]=new TFile("../../SurveyLAS/zmumu/Misalignment_SurveyLASOnlyScenario_refitter_zmumu.root");
0058 MyTree[1]=Tracks;
0059 
0060 f[2]=new TFile("Misalignment_SurveyLASOnlyScenario_refitter_zmumuSurveyLASCosmics.root");
0061 MyTree[2]=Tracks;
0062 
0063 f[3]=new TFile("../../Z/Misalignment10.root");
0064 MyTree[3]=Tracks;
0065 
0066 f[4]=new TFile("../../Z/Misalignment100.root");
0067 MyTree[4]=Tracks;
0068 
0069 f[5]=new TFile("../../Z/Misalignment_NOAPE_2.root");
0070 MyTree[5]=Tracks;
0071 
0072 
0073 ////&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
0074 
0075 //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
0076 /// EFFICIENCIES VS ETA ALIGNED
0077 //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
0078 hframe = new TH2F("hframe","#Delta (m_{Z})",100,-10.,10.,32,0.,0.125);
0079 hframe->SetXTitle("#Delta(m_{Z}) [GeV/c^{2}]");
0080 hframe->SetYTitle("N. ev. / 0.2");
0081 hframe->Draw();
0082 
0083 char histoname[128];
0084 char name[128];
0085 TH1F *mZmu[6];
0086 
0087 for(int i=0; i<6; i++){
0088   sprintf(name,"mZmu[%d]",i);
0089   mZmu[i] = new TH1F(name,name,100,-10.,10.);
0090   sprintf(histoname,"mZmu[%d]",i);
0091 
0092   MyTree[i]->Project(histoname,"recmzmu-mzmu","eff==1 && mzmu>0. && recmzmu>0.");
0093   
0094   cout << "Entries " << mZmu[i]->GetEntries() <<endl;
0095   mZmu[i]->Scale(1/mZmu[i]->GetEntries());
0096   mZmu[i]->SetTitle("Z->#mu#mu mass residual from Z->#mu#mu");    
0097   mZmu[i]->SetXTitle(" GeV/c2");
0098   mZmu[i]->SetYTitle("arb. units");
0099   
0100   mZmu[i]->SetLineColor(i+2);
0101   // mZmu[i]->SetLineStyle(i+1);
0102   // mZmu[i]->SetLineWidth(i+2);
0103   if (i==0) mZmu[i]->Draw("same");
0104   else mZmu[i]->Draw("same");
0105   //  c1->WaitPrimitive();
0106   c1->Update();
0107 }
0108 
0109 Legend("mZmu[0]","mZmu[1]","mZmu[2]","mZmu[3]","mZmu[4]","mZmu[5]",mZmu[0],mZmu[1],mZmu[2],mZmu[3],mZmu[4],mZmu[5]);
0110 
0111 c1->SaveAs("Residual_mZ_mu.gif");
0112 c1->SaveAs("Residual_mZ_mu.eps");
0113 gROOT->Reset();
0114 gROOT->Clear();
0115 
0116 delete c1;
0117 
0118 }
0119 
0120 void Plots::Legend(TString histoname1,TString histoname2,TString histoname3,TString histoname4, TString histoname5, TString histoname6, TH1F *histo1, TH1F *histo2, TH1F *histo3,TH1F *histo4,TH1F *histo5,TH1F *histo6)
0121 {
0122 
0123 TLegend *leg = new TLegend(0.3,0.74.,0.995,0.995);
0124 leg->SetTextAlign(32);
0125 leg->SetTextColor(1);
0126 leg->SetTextSize(0.033);
0127 leg->SetFillColor(0);
0128 
0129 char  label[128];
0130 
0131 sprintf(label,"perfect; mean=%1.4f, RMS=%1.4f",(histo1->GetMean()),histo1->GetRMS());
0132 leg->AddEntry(histoname1, label, "l");
0133 sprintf(label,"SurveyLAS; mean=%1.4f, RMS=%1.4f",(histo2->GetMean()),histo2->GetRMS());
0134 leg->AddEntry(histoname2, label, "l");
0135 sprintf(label,"SurveyLASCosmics; mean=%1.4f, RMS=%1.4f",(histo3->GetMean()),histo3->GetRMS());
0136 leg->AddEntry(histoname3, label, "l");
0137 sprintf(label,"10 pb^{-1};  mean=%1.4f, RMS=%1.4f",(histo4->GetMean()),histo4->GetRMS());
0138 leg->AddEntry(histoname4, label, "l");
0139 sprintf(label,"100 pb^{-1};  mean=%1.4f, RMS=%1.4f",(histo5->GetMean()),histo5->GetRMS());
0140 leg->AddEntry(histoname5, label, "l");
0141 sprintf(label,"10 pb^{-1}; APE not used; mean=%1.4f, RMS=%1.4f",(histo6->GetMean()),histo6->GetRMS());
0142 leg->AddEntry(histoname6, label, "l");
0143 
0144 leg->Draw();
0145 
0146 }
0147 
0148 float Plots::convert(float num){
0149   int mean1 = num;
0150   float res = num - mean1;
0151   int res2 = res*1000;
0152   float res3 = res2*0.001;
0153   float mean2 = mean1 + res3;
0154                                                                                                                   
0155   float res4 = res - res3;
0156   int res5 = res4*10000;
0157                                                                                                                   
0158   if(res5>5)
0159     mean2 = mean2 + 0.001;
0160                                                                                                                   
0161   return mean2;
0162 }