File indexing completed on 2024-04-06 11:57:12
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.07);
0029 gStyle->SetTitleSize(0.046,"xy");
0030 gStyle->SetLabelSize(0.052,"xy");
0031
0032 gStyle->SetHistFillStyle(1001);
0033 gStyle->SetHistFillColor(0);
0034 gStyle->SetHistLineStyle(1);
0035 gStyle->SetHistLineWidth(2);
0036 gStyle->SetHistLineColor(2);
0037 gStyle->SetTitleXOffset(1.1);
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 f[0]= new TFile("../../singlemu_310607/Misalignment_scenarioIdeal_singlemu131.root");
0055 MyTree[0]=Tracks;
0056
0057 f[1]=new TFile("Misalignment_SurveyLASOnlyScenario_refitter_zmumu_singlemuSurveyLASCosmics.root");
0058 MyTree[1]=Tracks;
0059
0060 f[2]=new TFile("../../singlemu_310607/Misalignment100.root");
0061 MyTree[2]=Tracks;
0062
0063 f[3]=new TFile("../../singlemu_310607/Misalignment1000.root");
0064 MyTree[3]=Tracks;
0065
0066
0067
0068
0069
0070
0071 char histoname[128];
0072 char name[128];
0073 TH1F *Chi2[4];
0074
0075 for(int i=0; i<4; i++){
0076 sprintf(name,"Chi2[%d]",i);
0077 Chi2[i] = new TH1F(name,name,100,0,15);
0078 sprintf(histoname,"Chi2[%d]",i);
0079 MyTree[i]->Project(histoname,"CHISQ","eff==1 && TrackID==13");
0080
0081 cout << "Entries " << Chi2[i]->GetEntries() <<endl;
0082 Chi2[i]->Scale(1/Chi2[i]->GetEntries());
0083 Chi2[i]->SetTitle("Track Fit #chi^{2}/ndf");
0084 Chi2[i]->SetXTitle("#chi^{2}/ndf");
0085 Chi2[i]->SetYTitle("arb. units");
0086 Chi2[i]->SetLineColor(i+2);
0087 Chi2[i]->SetLineStyle(i+1);
0088 Chi2[i]->SetLineWidth(i+2);
0089
0090
0091 c1->Update();
0092 }
0093
0094 Chi2[0]->Draw("");
0095
0096 Chi2[1]->Draw("same");
0097 Chi2[2]->Draw("same");
0098 Chi2[3]->Draw("same");
0099
0100
0101 Legend("Chi2[0]","Chi2[1]","Chi2[2]","Chi2[3]",Chi2[0],Chi2[1],Chi2[2],Chi2[3]);
0102
0103 c1->SaveAs("Chi2_mu.eps");
0104 c1->SaveAs("Chi2_mu.gif");
0105 gROOT->Reset();
0106 gROOT->Clear();
0107
0108 delete c1;
0109
0110 }
0111
0112 void Plots::Legend(TString histoname1,TString histoname2,TString histoname3, TString histoname4, TH1F *histo1, TH1F *histo2, TH1F *histo3, TH1F *histo4)
0113 {
0114
0115 TLegend *leg = new TLegend(0.25,0.7,0.85,0.85.);
0116 leg->SetTextAlign(32);
0117 leg->SetTextColor(1);
0118 leg->SetTextSize(0.025);
0119
0120 char label[128];
0121 sprintf(label,"perfect alignment; mean = %1.3f, RMS = %1.3f",convert(histo1->GetMean()),convert(histo1->GetRMS()));
0122 leg->AddEntry(histoname1, label, "l");
0123 sprintf(label,"SuveyLASCosmics alignment; mean = %1.3f, RMS = %1.3f",convert(histo2->GetMean()),convert(histo2->GetRMS()));
0124 leg->AddEntry(histoname2, label, "l");
0125 sprintf(label,"100 pb-1 alignment; mean = %1.3f, RMS = %1.3f",convert(histo3->GetMean()),convert(histo3->GetRMS()));
0126 leg->AddEntry(histoname3, label, "l");
0127 sprintf(label,"1000 pb-1 alignment; mean = %1.3f, RMS = %1.3f",convert(histo4->GetMean()),convert(histo4->GetRMS()));
0128 leg->AddEntry(histoname4, label, "l");
0129 leg->Draw();
0130
0131 }
0132
0133 float Plots::convert(float num){
0134 int mean1 = num;
0135 float res = num - mean1;
0136 int res2 = res*1000;
0137 float res3 = res2*0.001;
0138 float mean2 = mean1 + res3;
0139
0140 float res4 = res - res3;
0141 int res5 = res4*10000;
0142
0143 if(res5>5)
0144 mean2 = mean2 + 0.001;
0145
0146 return mean2;
0147 }