File indexing completed on 2024-04-06 12:32:29
0001
0002 {
0003
0004 TCanvas *myc = new TCanvas("myc","",800,600);
0005
0006
0007 gPad->SetLeftMargin(0.15);
0008 gPad->SetRightMargin(0.05);
0009 gPad->SetTopMargin(0.1);
0010 gPad->SetBottomMargin(0.15);
0011
0012 gPad->SetBorderSize(1);
0013 gPad->SetFrameFillColor(55);
0014 gPad->SetFillColor(52);
0015
0016
0017
0018 TFile f1("HB_histo_pre5.root");
0019 TFile f2("HB_histo_pre6.root");
0020
0021
0022
0023 const int Nhist = 9;
0024 TH1F* f1_hist[Nhist];
0025 TH1F* f2_hist[Nhist];
0026
0027 char *label[Nhist];
0028
0029 label[0] = &"layer0.gif";
0030 label[1] = &"Lprofile.gif";
0031 label[2] = &"Nhits.gif";
0032 label[3] = &"Thits.gif";
0033 label[4] = &"ThitsEw.gif";
0034 label[5] = &"NxNfract.gif";
0035 label[6] = &"layer7.gif";
0036 label[7] = &"Erec_cone.gif";
0037 label[8] = &"Edep_tot.gif";
0038
0039 f1_hist[0] = (TH1F*)f1.Get("hl0") ;
0040 f2_hist[0] = (TH1F*)f2.Get("hl0") ;
0041
0042 f1_hist[1] = (TH1F*)f1.Get("h45") ;
0043 f2_hist[1] = (TH1F*)f2.Get("h45") ;
0044
0045 f1_hist[2] = (TH1F*)f1.Get("h43") ;
0046 f2_hist[2] = (TH1F*)f2.Get("h43") ;
0047
0048 f1_hist[3] = (TH1F*)f1.Get("h40") ;
0049 f2_hist[3] = (TH1F*)f2.Get("h40") ;
0050
0051 f1_hist[4] = (TH1F*)f1.Get("h41") ;
0052 f2_hist[4] = (TH1F*)f2.Get("h41") ;
0053
0054 f1_hist[5] = (TH1F*)f1.Get("h39") ;
0055 f2_hist[5] = (TH1F*)f2.Get("h39") ;
0056
0057 f1_hist[6] = (TH1F*)f1.Get("hl6") ;
0058 f2_hist[6] = (TH1F*)f2.Get("hl6") ;
0059
0060 f1_hist[7] = (TH1F*)f1.Get("h6") ;
0061 f2_hist[7] = (TH1F*)f2.Get("h6") ;
0062
0063 f1_hist[8] = (TH1F*)f1.Get("h46") ;
0064 f2_hist[8] = (TH1F*)f2.Get("h46") ;
0065
0066 f1_hist[0]->GetXaxis()->SetTitle("L0 Deposited energy (GeV)");
0067 f1_hist[0]->GetYaxis()->SetTitle("N_{ev}/bin");
0068
0069 f1_hist[1]->GetXaxis()->SetTitle("N_{layer}");
0070 f1_hist[1]->GetYaxis()->SetTitle("Deposited energy (GeV)");
0071
0072 f1_hist[2]->GetXaxis()->SetTitle("N_{hits}");
0073 f1_hist[2]->GetYaxis()->SetTitle("N_{ev}");
0074
0075 f1_hist[3]->GetXaxis()->SetTitle("t_{hits} (ns)");
0076 f1_hist[3]->GetYaxis()->SetTitle("N_{ev}/bin");
0077
0078 f1_hist[4]->GetXaxis()->SetTitle("t_{hist} (ns)");
0079 f1_hist[4]->GetYaxis()->SetTitle("Energy/bin (MeV)");
0080
0081 f1_hist[5]->GetXaxis()->SetTitle("NxN square number");
0082 f1_hist[5]->GetYaxis()->SetTitle("Fraction of energy");
0083
0084 f1_hist[6]->GetXaxis()->SetTitle("L7 Deposited energy (GeV)");
0085 f1_hist[6]->GetYaxis()->SetTitle("N_{ev}/bin");
0086
0087 f1_hist[7]->GetXaxis()->SetTitle("Pseudo-reconstructed energy (GeV)");
0088 f1_hist[7]->GetYaxis()->SetTitle("N_{ev}/bin");
0089
0090 f1_hist[8]->GetXaxis()->SetTitle("Deposited energy (GeV)");
0091 f1_hist[8]->GetYaxis()->SetTitle("N_{ev}/bin");
0092
0093
0094 f1_hist[5]->SetMaximum(1.02.);
0095
0096
0097 f1_hist[2]->GetXaxis()->SetRangeUser(0.,2000.);
0098 f1_hist[7]->GetXaxis()->SetRangeUser(0.,100.);
0099 f1_hist[8]->GetXaxis()->SetRangeUser(0.,1.);
0100
0101
0102
0103 for (int i = 0; i < Nhist; i++){
0104
0105 if(i == 5 ) {
0106 f1_hist[i]->SetStats(kFALSE);
0107 f2_hist[i]->SetStats(kFALSE);
0108 }
0109 else {
0110 f1_hist[i]->SetStats(kTRUE);
0111 f2_hist[i]->SetStats(kTRUE);
0112 }
0113
0114 f1_hist[i]->SetTitle("");
0115 f2_hist[i]->SetTitle("");
0116
0117 f1_hist[i]->SetLineWidth(2);
0118 f2_hist[i]->SetLineWidth(3);
0119
0120
0121 f1_hist[i]->SetLineColor(41);
0122 f1_hist[i]->SetLineStyle(1);
0123
0124 f2_hist[i]->SetLineColor(43);
0125 f2_hist[i]->SetLineStyle(2);
0126
0127
0128 f1_hist[i]->GetXaxis()->SetTickLength(-0.01);
0129 f1_hist[i]->GetYaxis()->SetTickLength(-0.01);
0130 f1_hist[i]->GetXaxis()->SetTitleOffset(1.5);
0131 f1_hist[i]->GetYaxis()->SetTitleOffset(1.5);
0132 f1_hist[i]->GetXaxis()->SetLabelOffset(0.02);
0133 f1_hist[i]->GetYaxis()->SetLabelOffset(0.02);
0134 f1_hist[i]->GetXaxis()->SetLabelSize(0.04);
0135 f1_hist[i]->GetYaxis()->SetLabelSize(0.04);
0136 f1_hist[i]->GetXaxis()->SetTitleSize(0.045);
0137 f1_hist[i]->GetYaxis()->SetTitleSize(0.045);
0138
0139
0140
0141
0142 TLegend *leg = new TLegend(0.55, 0.91, 0.84, 0.99, "" , "brNDC");
0143
0144 leg->SetBorderSize(2);
0145
0146 leg->SetFillStyle(1001);
0147 leg->AddEntry(f1_hist[i],"CMSSW_300pre5","l");
0148 leg->AddEntry(f2_hist[i],"CMSSW_300pre6","l");
0149
0150 if (i != 5 ) {
0151 TPaveStats *ptstats = new TPaveStats(0.85,0.86,0.98,0.98,"brNDC");
0152 ptstats->SetTextColor(41);
0153 f1_hist[i]->GetListOfFunctions()->Add(ptstats);
0154 ptstats->SetParent(f1_hist[i]->GetListOfFunctions());
0155 TPaveStats *ptstats = new TPaveStats(0.85,0.74,0.98,0.86,"brNDC");
0156 ptstats->SetTextColor(43);
0157 f2_hist[i]->GetListOfFunctions()->Add(ptstats);
0158 ptstats->SetParent(f2_hist[i]->GetListOfFunctions());
0159
0160 f1_hist[i]->Draw("");
0161 f2_hist[i]->Draw("hist sames");
0162 }
0163 else {
0164 f1_hist[i]->Draw("hist");
0165 f2_hist[i]->Draw("hist same");
0166 }
0167
0168 leg->Draw();
0169
0170
0171 if(i == 2 || i == 3 || i == 7 || i ==8 ) {
0172 const float NCHI2MIN = 0.01;
0173
0174 float pval;
0175 stringstream mystream;
0176 char tempbuff[30];
0177
0178 pval = f1_hist[i]->Chi2Test(f2_hist[i]);
0179
0180
0181 sprintf(tempbuff,"Chi2 p-value: %6.3E%c",pval,'\0');
0182 mystream<<tempbuff;
0183
0184 TPaveText* ptchi2 = new TPaveText(0.25, 0.91, 0.5, 0.99, "NDC");
0185
0186 if (pval > NCHI2MIN) ptchi2->SetFillColor(kGreen);
0187 else ptchi2->SetFillColor(kRed);
0188
0189 ptchi2->SetTextSize(0.03);
0190 ptchi2->AddText(mystream.str().c_str());
0191 ptchi2->Draw();
0192
0193 }
0194
0195
0196 myc->SaveAs(label[i]);
0197 }
0198
0199
0200
0201
0202 f1.Close() ;
0203 f2.Close() ;
0204
0205
0206
0207
0208 return ;
0209
0210 }