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, 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
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
0075
0076 hframe = new TH2F("hframe","#Delta(#phi)",100,-0.0015,0.0015,32,0.,0.17);
0077 hframe->SetXTitle("#Delta(#phi) [rad]");
0078 hframe->SetYTitle("N. ev. / 0.00003");
0079 hframe->Draw();
0080
0081 char histoname[128];
0082 char name[128];
0083 TH1F *Resphi[5];
0084
0085 for(int i=0; i<5; i++){
0086 sprintf(name,"Resphi[%d]",i);
0087 Resphi[i] = new TH1F(name,name,100,-0.0015,0.0015);
0088 sprintf(histoname,"Resphi[%d]",i);
0089 MyTree[i]->Project(histoname,"resphi","eff==1 && TrackID==13");
0090
0091 cout << "Entries " << Resphi[i]->GetEntries() <<endl;
0092 Resphi[i]->Scale(1/Resphi[i]->GetEntries());
0093 Resphi[i]->SetTitle("#Delta(#phi)");
0094 Resphi[i]->SetXTitle("#Delta(#phi) ");
0095 Resphi[i]->SetYTitle("arb. units");
0096
0097 Resphi[i]->SetLineColor(i+2);
0098 Resphi[i]->SetLineStyle(i+1);
0099 Resphi[i]->SetLineWidth(i+2);
0100 if (i==0) Resphi[i]->Draw("same");
0101 else Resphi[i]->Draw("same");
0102
0103 c1->Update();
0104 }
0105
0106 Legend("Resphi[0]","Resphi[1]","Resphi[2]","Resphi[3]","Resphi[4]", Resphi[0],Resphi[1],Resphi[2],Resphi[3],Resphi[4]);
0107
0108 c1->SaveAs("Residualphi_mu.eps");
0109 c1->SaveAs("Residualphi_mu.gif");
0110 gROOT->Reset();
0111 gROOT->Clear();
0112
0113 delete c1;
0114
0115 }
0116
0117 void Plots::Legend(TString histoname1,TString histoname2,TString histoname3, TString histoname4, TString histoname5, TH1F *histo1, TH1F *histo2, TH1F *histo3, TH1F *histo4, TH1F *histo5)
0118 {
0119
0120 TLegend *leg = new TLegend(0.31,0.74.,0.995,0.995);
0121 leg->SetTextAlign(32);
0122 leg->SetTextColor(1);
0123 leg->SetTextSize(0.033);
0124 leg->SetFillColor(0);
0125
0126
0127 char label[128];
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139 sprintf(label,"perfect; mean=%1.4f, RMS=%1.4f",(histo1->GetMean()),histo1->GetRMS());
0140 leg->AddEntry(histoname1, label, "l");
0141 sprintf(label,"SurveyLAS; mean=%1.4f, RMS=%1.4f",(histo2->GetMean()),histo2->GetRMS());
0142 leg->AddEntry(histoname2, label, "l");
0143 sprintf(label,"SurveyLASCosmics; mean=%1.4f, RMS=%1.4f",(histo3->GetMean()),histo3->GetRMS());
0144 leg->AddEntry(histoname3, label, "l");
0145 sprintf(label,"10 pb^{-1}; mean=%1.4f, RMS=%1.4f",(histo4->GetMean()),histo4->GetRMS());
0146 leg->AddEntry(histoname4, label, "l");
0147 sprintf(label,"100 pb^{-1}; mean=%1.4f, RMS=%1.4f",(histo5->GetMean()),histo5->GetRMS());
0148 leg->AddEntry(histoname5, label, "l");
0149
0150 leg->Draw();
0151
0152 }
0153
0154 float Plots::convert(float num){
0155 int mean1 = num;
0156 float res = num - mean1;
0157 int res2 = res*1000;
0158 float res3 = res2*0.001;
0159 float mean2 = mean1 + res3;
0160
0161 float res4 = res - res3;
0162 int res5 = res4*10000;
0163
0164 if(res5>5)
0165 mean2 = mean2 + 0.001;
0166
0167 return mean2;
0168 }