File indexing completed on 2024-04-06 12:30:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include "TCanvas.h"
0013 #include "TChain.h"
0014 #include "TDirectory.h"
0015 #include "TF1.h"
0016 #include "TFile.h"
0017 #include "TFitResult.h"
0018 #include "TFitResultPtr.h"
0019 #include "TGraphErrors.h"
0020 #include "TGraphAsymmErrors.h"
0021 #include "TH1D.h"
0022 #include "TH2.h"
0023 #include "THStack.h"
0024 #include "TLegend.h"
0025 #include "TMinuit.h"
0026 #include "TMath.h"
0027 #include "TPaveStats.h"
0028 #include "TPaveText.h"
0029 #include "TProfile.h"
0030 #include "TROOT.h"
0031 #include "TStyle.h"
0032
0033 #include <cstdlib>
0034 #include <fstream>
0035 #include <iomanip>
0036 #include <iostream>
0037 #include <string>
0038 #include <vector>
0039
0040
0041 const int nn = 4;
0042 std::string rdir[nn] = {"CMSSW_9_4_0_pre2/FTFP_BERT_EMM_","CMSSW_9_4_DEVEL_X_2017-10-08-2300/FTFP_BERT_EMM_","CMSSW_9_3_ROOT6_X_2017-08-16-2300/FTFP_BERT_EMM_","CMSSW_10_0_ROOT6_X_2017-11-07-2300/FTFP_BERT_EMM_"};
0043 std::string res[nn] = {"Geant4 10.2p02 FTFP_BERT_EMM","Geant4 10.3p02 FTFP_BERT_EMM","Geant4 10.4beta FTFP_BERT_EMM","Geant4 10.3ref11 FTFP_BERT_EMM"};
0044 int col[nn] = {2, 3, 4, 6};
0045 int mar[nn] = {21, 22, 23, 20};
0046
0047 std::string partsF[6] = {"pi-","p","pi+","kaon+","kaon-","pbar"};
0048 std::string partsN[6] = {"#pi^{-}","p","#pi^{+}","K^{+}","K^{-}","pbar"};
0049
0050 std::string tpin[15] = {"2","3","4","5","6","7","8","9","20","30","50","100","150","200","300"};
0051 std::string tpip[9] = {"2","3","4","5","6","7","8","9","20"};
0052 std::string tp[11] = {"2","3","4","5","6","7","8","9","20","30","350"};
0053 std::string tpbar[9] = {"2","2.5","3","4","5","6","7","8","9"};
0054 std::string tkp[8] = {"2","3","4","5","6","7","8","9"};
0055 std::string tkn[8] = {"2.5","3","4","5","6","7","8","9"};
0056
0057 double ppin[15] = {2,3,4,5,6,7,8,9,20,30,50,100,150,200,300};
0058 double ppip[9] = {2,3,4,5,6,7,8,9,20};
0059 double pp[11] = {2,3,4,5,6,7,8,9,20,30,350};
0060 double ppbar[9] = {2,2.5,3,4,5,6,7,8,9};
0061 double pkp[8] = {2,3,4,5,6,7,8,9};
0062 double pkn[8] = {2.5,3,4,5,6,7,8,9};
0063
0064 double spin[15] = {0.53,0.57,0.574,0.615,0.644,0.647,0.642,0.666,0.733,0.761,0.775,0.798,0.802,0.808,0.827};
0065 double spip[9] = {0.58,0.6,0.62,0.62,0.64,0.65,0.66,0.67,0.74};
0066 double sp[11] = {0.35,0.413,0.444,0.468,0.504,0.517,0.534,0.578,0.64,0.687,0.814};
0067 double spbar[9] = {0.738,0.738,0.73,0.7,0.695,0.69,0.685,0.68,0.675};
0068 double skp[8] = {0.36,0.475,0.58,0.59,0.63,0.65,0.62,0.635};
0069 double skn[8] = {0.63,0.44,0.59,0.58,0.61,0.63,0.63,0.66};
0070
0071 double ww[15] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
0072 double wss[15] = {0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02};
0073 double wpbar[9] = {0.07,0.03,0.025,0.02,0.02,0.015,0.015,0.015,0.015};
0074 double wpip[9] = {0.01,0.01,0.01,0.01,0.01,0.01,0.01,0.01,0.01};
0075 double wkp[8] = {0.2,0.13,0.02,0.02,0.02,0.02,0.02,0.02};
0076 double wkn[8] = {0.1,0.06,0.02,0.02,0.02,0.02,0.02,0.02};
0077
0078 double rpin[15] = {0.987,0.756,0.63,0.546,0.491,0.447,0.421,0.393,0.274,0.236,0.195,0.164,0.151,0.146,0.132};
0079 double rp[11] = {1.354,0.908,0.776,0.642,0.528,0.483,0.466,0.45,0.304,0.235,0.123};
0080
0081 double hpin[15] = {0.46,0.585,0.618,0.7,0.747,0.746,0.733,0.773,0.819,0.835,0.825,0.832,0.82,0.827,0.846};
0082 double hp[11] = {0.298,0.37,0.44,0.489,0.569,0.579,0.607,0.682,0.748,0.784,0.834};
0083
0084 double whpin[15]= {1.186,0.931,0.701,0.569,0.492,0.449,0.424,0.383,0.251,0.221,0.202,0.188,0.184,0.184,0.166};
0085 double whp[11] = {1.551,1.038,0.88,0.722,0.569,0.504,0.457,0.444,0.267,0.226,0.17};
0086
0087 double mpin[15] = {.68, .5, .42, .375, .36, .34, .345, .33, .328, .326, .323, .33, .32, .29, .26};
0088 double mp[11] = {.835, .635, .49, 0.438, .39, 0.387,0.375,0.37, 0.3, 0.3, 0.285};
0089
0090 double xmin[6] = {1, 1, 1, 1, 1, 1};
0091 double xmax[6] = {350, 400, 30, 15, 15, 15};
0092 double ymin[6] = {0.4, 0.3, 0.4, 0.2, 0.2, 0.6};
0093 double ymax[6] = {1, 0.9, 1, 0.8, 0.8, 0.9};
0094 double rmin[6] = {0.8, 0.8, 0.8, 0.5, 0.5, 0.7};
0095 double rmax[6] = {1.2, 1.2, 1.2, 1.5, 1.5, 1.3};
0096
0097 TFile* ff[1000];
0098 TH1F* hh[1000];
0099 TLegend* leg[1000];
0100 TGraphErrors* gr[1000];
0101
0102 double vx[15];
0103 double vmean[15];
0104 double vrms[15];
0105 double verr[15];
0106 double rmean[15];
0107 double rrms[15];
0108 double rerr[15];
0109 double rerrr[15];
0110
0111 double hmean[15];
0112 double herr[15];
0113 double hrmean[15];
0114 double hverr[15];
0115 double hrms[15];
0116 double hrrms[15];
0117 double hvrms[15];
0118 double hrerr[15];
0119
0120 double mip[15];
0121 double mipr[15];
0122 double rmip[15];
0123 double rmipr[15];
0124
0125 double sn = std::sqrt(5000);
0126 double sq2= std::sqrt(2);
0127
0128 void PlotMeanTotal(int ip, int np, double* mom, double* sig, double* err, std::string* ttt, double* x1, double* x2, double* x3, double* x4)
0129 {
0130 TPad* pad = new TCanvas("c1","c1", 700, 900);
0131
0132 gStyle->SetPadBottomMargin(0.15);
0133 gStyle->SetPadTopMargin(0.10);
0134 gStyle->SetLabelSize(0.035, "x");
0135 gStyle->SetLabelSize(0.035, "y");
0136 gStyle->SetTitleOffset(1.4, "x");
0137 gStyle->SetTitleOffset(1.6, "y");
0138 gStyle->SetTitleSize(0.03, "x");
0139 gStyle->SetTitleSize(0.03, "y");
0140
0141 TPad* pad1 = new TPad(partsF[ip].c_str(),"pad1",0,0.3,1,1);
0142 pad1->SetBottomMargin(0.15);
0143 pad1->SetTopMargin(0.1);
0144 pad1->Update();
0145 pad1->Modified();
0146 pad1->Draw();
0147 pad1->cd();
0148
0149 std::string tleg = "2006 Test Beam Data (" + partsN[ip] + ")";
0150 std::string title = "";
0151 gPad->SetLogx();
0152 hh[ip] = pad1->DrawFrame(xmin[ip],ymin[ip],xmax[ip],ymax[ip],title.c_str());
0153 hh[ip]->GetXaxis()->SetTitle("p_{Beam} (GeV/c)");
0154 hh[ip]->GetYaxis()->SetTitle("Mean of E_{Measured}/p_{Beam}");
0155
0156 leg[999] = new TLegend(0.68, 0.78, 0.88, 0.88, "CMS Pleriminary");
0157 leg[999]->SetBorderSize(0);
0158 leg[999]->SetMargin(0.1);
0159
0160 leg[998] = new TLegend(0.18, 0.78, 0.68, 0.88, tleg.c_str());
0161 leg[998]->SetBorderSize(0);
0162 leg[998]->SetMargin(0.1);
0163
0164 leg[ip] = new TLegend(0.18, 0.74, 0.72, 0.88);
0165 leg[ip]->SetBorderSize(0);
0166 leg[ip]->SetMargin(0.15);
0167
0168 gr[ip+800] = new TGraphErrors(np, mom, sig, ww, err);
0169 gr[ip+800]->SetMarkerColor(1);
0170 gr[ip+800]->SetMarkerStyle(20);
0171 gr[ip+800]->Draw("P SAME");
0172 leg[ip]->AddEntry(gr[ip+800],tleg.c_str(),"p");
0173
0174 double fact = 1.0;
0175 for(int i=0; i<nn; ++i) {
0176 int idx = i*100;
0177 for(int j=0; j<np; ++j) {
0178 std::string fname = rdir[i] + partsF[ip] + "_RR_" + ttt[j] + "gev.root";
0179 ff[idx+j] = new TFile(fname.c_str());
0180 if(!ff[idx+j]) continue;
0181 TH1F* h1 = (TH1F*)ff[idx+j]->Get("testbeam/edepN");
0182 if(!h1) {
0183 cout << "Error open testbeam/edepN for i= " << i << " j= " << j << endl;
0184 continue;
0185 }
0186 vx[j] = mom[j]*fact;
0187 vmean[j]= h1->GetMean();
0188 vrms[j] = h1->GetRMS();
0189 verr[j] = vrms[j]/sn;
0190 rmean[j]= vmean[j]/sig[j];
0191 double w1 = verr[j]/vmean[j];
0192 double w2 = err[j]/sig[j];
0193 rerr[j] = rmean[j]*std::sqrt(w1*w1 + w2*w2);
0194 if(ip <= 1) {
0195 vrms[j] /= vmean[j];
0196 verr[j] /= vmean[j];
0197 rrms[j]= vrms[j]/x1[j];
0198 w1 = verr[j]/vrms[j];
0199 w2 = err[j]/x1[j];
0200 rerrr[j] = rrms[j]*std::sqrt(2*w1*w1 + w2*w2);
0201
0202 if(3 <= i) {
0203 TH1F* h2 = (TH1F*)ff[idx+j]->Get("testbeam/emhcN");
0204 if(!h2) {
0205 cout << "Error open testbeam/emhcN for i= " << i << " j= " << j << endl;
0206 continue;
0207 }
0208 hmean[j]= h2->GetMean();
0209 hrms[j] = h2->GetRMS();
0210 double stat = sqrt(1/h2->GetEntries());
0211 herr[j] = hrms[j]*stat;
0212 hrmean[j]= hmean[j]/x2[j];
0213 w1 = herr[j]/hmean[j];
0214 w2 = err[j]/x2[j];
0215 herr[j] *= sq2;
0216 hverr[j] = hrmean[j]*std::sqrt(w1*w1 + w2*w2);
0217
0218 w1 = herr[j]/hrms[j];
0219 w2 = err[j]/x4[j];
0220 hrms[j] /= hmean[j];
0221 hvrms[j] = hrms[j]/x4[j];
0222 hrrms[j] = hrms[j]*w1*sq2;
0223 hrerr[j] = hvrms[j]*std::sqrt(2*w1*w1 + w2*w2);
0224 }
0225
0226 TH1F* h3 = (TH1F*)ff[idx+j]->Get("testbeam/edecS");
0227 if(!h3) {
0228 cout << "Error open testbeam/edecS for i= " << i << " j= " << j << endl;
0229 continue;
0230 }
0231 double tot = h3->GetEntries();
0232 double ecal = 0.0;
0233 for(int k=1; k<=28; ++k) {
0234 ecal += h3->GetBinContent(k);
0235
0236 }
0237
0238 mip[j] = ecal/tot;
0239 mipr[j] = sqrt(ecal)/tot;
0240 rmip[j] = mip[j]/x3[j];
0241 w1 = mipr[j]/mip[j];
0242 w2 = err[j]/x3[j];
0243 rmipr[j] = rmip[j]*std::sqrt(w1*w1 + w2*w2);
0244 }
0245 }
0246 gr[idx] = new TGraphErrors(np, vx, vmean, ww, verr);
0247 gr[idx+1] = new TGraphErrors(np, vx, rmean, ww, rerr);
0248 if(ip <= 1) {
0249 gr[idx+2] = new TGraphErrors(np, vx, vrms, ww, verr);
0250 gr[idx+3] = new TGraphErrors(np, vx, rrms, ww, rerrr);
0251 gr[idx+2]->SetMarkerColor(col[i]);
0252 gr[idx+2]->SetMarkerStyle(mar[i]);
0253 gr[idx+3]->SetMarkerColor(col[i]);
0254 gr[idx+3]->SetMarkerStyle(mar[i]);
0255 gr[idx+6] = new TGraphErrors(np, vx, mip, ww, mipr);
0256 gr[idx+7] = new TGraphErrors(np, vx, rmip, ww, rmipr);
0257 gr[idx+6]->SetMarkerColor(col[i]);
0258 gr[idx+6]->SetMarkerStyle(mar[i]);
0259 gr[idx+7]->SetMarkerColor(col[i]);
0260 gr[idx+7]->SetMarkerStyle(mar[i]);
0261
0262 if(3 <= i) {
0263 gr[idx+14] = new TGraphErrors(np, vx, hmean, ww, herr);
0264 gr[idx+15] = new TGraphErrors(np, vx, hrmean, ww, hverr);
0265 gr[idx+16] = new TGraphErrors(np, vx, hrms, ww, hrrms);
0266 gr[idx+17] = new TGraphErrors(np, vx, hvrms, ww, hrerr);
0267 gr[idx+14]->SetMarkerColor(col[i]);
0268 gr[idx+14]->SetMarkerStyle(mar[i]);
0269 gr[idx+15]->SetMarkerColor(col[i]);
0270 gr[idx+15]->SetMarkerStyle(mar[i]);
0271 gr[idx+16]->SetMarkerColor(col[i]);
0272 gr[idx+16]->SetMarkerStyle(mar[i]);
0273 gr[idx+17]->SetMarkerColor(col[i]);
0274 gr[idx+17]->SetMarkerStyle(mar[i]);
0275 }
0276 }
0277 gr[idx]->SetMarkerColor(col[i]);
0278 gr[idx]->SetMarkerStyle(mar[i]);
0279 gr[idx]->Draw("P L SAME");
0280 leg[ip]->AddEntry(gr[idx],res[i].c_str(),"p");
0281 gr[idx+1]->SetMarkerColor(col[i]);
0282 gr[idx+1]->SetMarkerStyle(mar[i]);
0283 fact *= 1.02;
0284 }
0285 leg[ip]->Draw("SAME");
0286 leg[999]->Draw("SAME");
0287 pad1->Update();
0288 pad1->Modified();
0289
0290 pad->cd();
0291 pad->Update();
0292 pad->Modified();
0293
0294 gStyle->SetPadBottomMargin(0.3);
0295 gStyle->SetPadTopMargin(0.10);
0296 gStyle->SetLabelSize(0.07, "x");
0297 gStyle->SetLabelSize(0.07, "y");
0298 gStyle->SetTitleOffset(1.2, "x");
0299 gStyle->SetTitleOffset(0.7, "y");
0300 gStyle->SetTitleSize(0.07, "x");
0301 gStyle->SetTitleSize(0.07, "y");
0302
0303 TPad* pad2 = new TPad(partsF[ip].c_str(),"pad2",0,0,1,0.3);
0304 pad2->SetBottomMargin(0.2);
0305 pad2->SetTopMargin(0.1);
0306 pad2->Draw();
0307 pad2->cd();
0308
0309 gPad->SetLogx();
0310 hh[ip+10] = pad2->DrawFrame(xmin[ip],rmin[ip],xmax[ip],rmax[ip],title.c_str());
0311 hh[ip+10]->GetXaxis()->SetTitle("p_{Beam} (GeV/c)");
0312 hh[ip+10]->GetYaxis()->SetTitle("MC/Data");
0313
0314 TLine *line = new TLine(xmin[ip],1.0,xmax[ip],1.0);
0315 line->SetLineStyle(2);
0316
0317 line->SetLineColor(kBlack);
0318 line->Draw("SAME");
0319
0320 for(int i=0; i<nn; ++i) {
0321 int idx = i*100;
0322 gr[idx+1]->Draw("P L SAME");
0323 }
0324 leg[998]->Draw("SAME");
0325 leg[999]->Draw("SAME");
0326 pad2->Update();
0327 pad2->Modified();
0328 pad->cd();
0329 pad->Update();
0330 pad->Modified();
0331 std::string pl = "Amean_" + partsF[ip] + ".png";
0332 pad->Print(pl.c_str());
0333 delete pad;
0334 }
0335
0336 void PlotRmsTotal(int ip, int np, double* mom, double* sig, double* err)
0337 {
0338 TPad* pad = new TCanvas("c2","c2", 700, 900);
0339
0340 gStyle->SetPadBottomMargin(0.15);
0341 gStyle->SetPadTopMargin(0.10);
0342 gStyle->SetLabelSize(0.035, "x");
0343 gStyle->SetLabelSize(0.035, "y");
0344 gStyle->SetTitleOffset(1.4, "x");
0345 gStyle->SetTitleOffset(1.6, "y");
0346 gStyle->SetTitleSize(0.03, "x");
0347 gStyle->SetTitleSize(0.03, "y");
0348
0349 TPad* pad1 = new TPad(partsF[ip].c_str(),"pad1",0,0.3,1,1);
0350 pad1->SetBottomMargin(0.15);
0351 pad1->SetTopMargin(0.1);
0352 pad1->Update();
0353 pad1->Modified();
0354 pad1->Draw();
0355 pad1->cd();
0356
0357 std::string tleg = "2006 Test Beam Data (" + partsN[ip] + ")";
0358 std::string title = "";
0359 gPad->SetLogx();
0360 hh[ip+20] = pad1->DrawFrame(xmin[ip],0.0,xmax[ip],1.5,title.c_str());
0361 hh[ip+20]->GetXaxis()->SetTitle("p_{Beam} (GeV/c)");
0362 hh[ip+20]->GetYaxis()->SetTitle("Resolution RMS/E_{Mean}");
0363
0364 gr[ip+810] = new TGraphErrors(np, mom, sig, ww, err);
0365 gr[ip+810]->SetMarkerColor(1);
0366 gr[ip+810]->SetMarkerStyle(20);
0367 gr[ip+810]->Draw("P SAME");
0368
0369 for(int i=0; i<nn; ++i) {
0370 int idx = i*100;
0371 gr[idx+2]->Draw("P L SAME");
0372 }
0373
0374 leg[ip]->Draw("SAME");
0375 leg[999]->Draw("SAME");
0376 pad1->Update();
0377 pad1->Modified();
0378
0379 pad->cd();
0380 pad->Update();
0381 pad->Modified();
0382
0383 gStyle->SetPadBottomMargin(0.3);
0384 gStyle->SetPadTopMargin(0.10);
0385 gStyle->SetLabelSize(0.07, "x");
0386 gStyle->SetLabelSize(0.07, "y");
0387 gStyle->SetTitleOffset(1.2, "x");
0388 gStyle->SetTitleOffset(0.7, "y");
0389 gStyle->SetTitleSize(0.07, "x");
0390 gStyle->SetTitleSize(0.07, "y");
0391
0392 TPad* pad2 = new TPad(partsF[ip].c_str(),"pad2",0,0,1,0.3);
0393 pad2->SetBottomMargin(0.2);
0394 pad2->SetTopMargin(0.1);
0395 pad2->Draw();
0396 pad2->cd();
0397
0398 gPad->SetLogx();
0399 hh[ip+30] = pad2->DrawFrame(xmin[ip],0.7,xmax[ip],1.3,title.c_str());
0400 hh[ip+30]->GetXaxis()->SetTitle("p_{Beam} (GeV/c)");
0401 hh[ip+30]->GetYaxis()->SetTitle("MC/Data");
0402
0403 TLine *line = new TLine(xmin[ip],1.0,xmax[ip],1.0);
0404 line->SetLineStyle(2);
0405
0406 line->SetLineColor(kBlack);
0407 line->Draw("SAME");
0408
0409 for(int i=0; i<nn; ++i) {
0410 int idx = i*100;
0411 gr[idx+3]->Draw("P L SAME");
0412 }
0413 leg[998]->Draw("SAME");
0414 leg[999]->Draw("SAME");
0415 pad2->Update();
0416 pad2->Modified();
0417 pad->cd();
0418 pad->Update();
0419 pad->Modified();
0420 std::string pl = "Arms_" + partsF[ip] + ".png";
0421 pad->Print(pl.c_str());
0422 delete pad;
0423 }
0424
0425 void PlotMeanHcal(int ip, int np, double* mom, double* sig, double* err)
0426 {
0427 TPad* pad = new TCanvas("c3","c3", 700, 900);
0428
0429 gStyle->SetPadBottomMargin(0.15);
0430 gStyle->SetPadTopMargin(0.10);
0431 gStyle->SetLabelSize(0.035, "x");
0432 gStyle->SetLabelSize(0.035, "y");
0433 gStyle->SetTitleOffset(1.4, "x");
0434 gStyle->SetTitleOffset(1.6, "y");
0435 gStyle->SetTitleSize(0.03, "x");
0436 gStyle->SetTitleSize(0.03, "y");
0437
0438 TPad* pad1 = new TPad(partsF[ip].c_str(),"pad1",0,0.3,1,1);
0439 pad1->SetBottomMargin(0.15);
0440 pad1->SetTopMargin(0.1);
0441 pad1->Update();
0442 pad1->Modified();
0443 pad1->Draw();
0444 pad1->cd();
0445
0446 std::string tleg = "2006 Test Beam Data (" + partsN[ip] + ")";
0447 std::string title = "";
0448 gPad->SetLogx();
0449 hh[ip+40] = pad1->DrawFrame(xmin[ip],0.0,xmax[ip],1.2,title.c_str());
0450 hh[ip+40]->GetXaxis()->SetTitle("p_{Beam} (GeV/c)");
0451 hh[ip+40]->GetYaxis()->SetTitle("Mean of E_{Measured}/p_{Beam} (MIP Ecal)");
0452
0453 gr[ip+820] = new TGraphErrors(np, mom, sig, ww, err);
0454 gr[ip+820]->SetMarkerColor(1);
0455 gr[ip+820]->SetMarkerStyle(20);
0456 gr[ip+820]->Draw("P SAME");
0457
0458 for(int i=0; i<nn; ++i) {
0459 if(i < 3) continue;
0460 int idx = i*100 + 14;
0461 gr[idx]->Draw("P L SAME");
0462 }
0463
0464 leg[ip]->Draw("SAME");
0465 leg[999]->Draw("SAME");
0466 pad1->Update();
0467 pad1->Modified();
0468
0469 pad->cd();
0470 pad->Update();
0471 pad->Modified();
0472
0473 gStyle->SetPadBottomMargin(0.3);
0474 gStyle->SetPadTopMargin(0.10);
0475 gStyle->SetLabelSize(0.07, "x");
0476 gStyle->SetLabelSize(0.07, "y");
0477 gStyle->SetTitleOffset(1.2, "x");
0478 gStyle->SetTitleOffset(0.7, "y");
0479 gStyle->SetTitleSize(0.07, "x");
0480 gStyle->SetTitleSize(0.07, "y");
0481
0482 TPad* pad2 = new TPad(partsF[ip].c_str(),"pad2",0,0,1,0.3);
0483 pad2->SetBottomMargin(0.2);
0484 pad2->SetTopMargin(0.1);
0485 pad2->Draw();
0486 pad2->cd();
0487
0488 gPad->SetLogx();
0489 hh[ip+50] = pad2->DrawFrame(xmin[ip],0.7,xmax[ip],1.4,title.c_str());
0490 hh[ip+50]->GetXaxis()->SetTitle("p_{Beam} (GeV/c)");
0491 hh[ip+50]->GetYaxis()->SetTitle("MC/Data");
0492
0493 TLine *line = new TLine(xmin[ip],1.0,xmax[ip],1.0);
0494 line->SetLineStyle(2);
0495
0496 line->SetLineColor(kBlack);
0497 line->Draw("SAME");
0498
0499 for(int i=0; i<nn; ++i) {
0500 if(i < 3) continue;
0501 int idx = i*100+15;
0502 gr[idx]->Draw("P L SAME");
0503 }
0504 leg[998]->Draw("SAME");
0505 leg[999]->Draw("SAME");
0506 pad2->Update();
0507 pad2->Modified();
0508 pad->cd();
0509 pad->Update();
0510 pad->Modified();
0511 std::string pl = "Ahcal_" + partsF[ip] + ".png";
0512 pad->Print(pl.c_str());
0513 delete pad;
0514 }
0515
0516 void PlotRmsHcal(int ip, int np, double* mom, double* sig, double* err)
0517 {
0518 TPad* pad = new TCanvas("c5","c5", 700, 900);
0519
0520 gStyle->SetPadBottomMargin(0.15);
0521 gStyle->SetPadTopMargin(0.10);
0522 gStyle->SetLabelSize(0.035, "x");
0523 gStyle->SetLabelSize(0.035, "y");
0524 gStyle->SetTitleOffset(1.4, "x");
0525 gStyle->SetTitleOffset(1.6, "y");
0526 gStyle->SetTitleSize(0.03, "x");
0527 gStyle->SetTitleSize(0.03, "y");
0528
0529 TPad* pad1 = new TPad(partsF[ip].c_str(),"pad1",0,0.3,1,1);
0530 pad1->SetBottomMargin(0.15);
0531 pad1->SetTopMargin(0.1);
0532 pad1->Update();
0533 pad1->Modified();
0534 pad1->Draw();
0535 pad1->cd();
0536
0537 std::string tleg = "2006 Test Beam Data (" + partsN[ip] + ")";
0538 std::string title = "";
0539 gPad->SetLogx();
0540 hh[ip+40] = pad1->DrawFrame(xmin[ip],0.0,xmax[ip],2.0,title.c_str());
0541 hh[ip+40]->GetXaxis()->SetTitle("p_{Beam} (GeV/c)");
0542 hh[ip+40]->GetYaxis()->SetTitle("Resolution RMS/E_{Mean} (MIP Ecal)");
0543
0544 gr[ip+830] = new TGraphErrors(np, mom, sig, ww, err);
0545 gr[ip+830]->SetMarkerColor(1);
0546 gr[ip+830]->SetMarkerStyle(20);
0547 gr[ip+830]->Draw("P SAME");
0548
0549 for(int i=0; i<nn; ++i) {
0550 if(i < 3) continue;
0551 int idx = i*100 + 16;
0552 gr[idx]->Draw("P L SAME");
0553 }
0554
0555 leg[ip]->Draw("SAME");
0556 leg[999]->Draw("SAME");
0557 pad1->Update();
0558 pad1->Modified();
0559
0560 pad->cd();
0561 pad->Update();
0562 pad->Modified();
0563
0564 gStyle->SetPadBottomMargin(0.3);
0565 gStyle->SetPadTopMargin(0.10);
0566 gStyle->SetLabelSize(0.07, "x");
0567 gStyle->SetLabelSize(0.07, "y");
0568 gStyle->SetTitleOffset(1.2, "x");
0569 gStyle->SetTitleOffset(0.7, "y");
0570 gStyle->SetTitleSize(0.07, "x");
0571 gStyle->SetTitleSize(0.07, "y");
0572
0573 TPad* pad2 = new TPad(partsF[ip].c_str(),"pad2",0,0,1,0.3);
0574 pad2->SetBottomMargin(0.2);
0575 pad2->SetTopMargin(0.1);
0576 pad2->Draw();
0577 pad2->cd();
0578
0579 gPad->SetLogx();
0580 hh[ip+50] = pad2->DrawFrame(xmin[ip],0.7,xmax[ip],1.4,title.c_str());
0581 hh[ip+50]->GetXaxis()->SetTitle("p_{Beam} (GeV/c)");
0582 hh[ip+50]->GetYaxis()->SetTitle("MC/Data");
0583
0584 TLine *line = new TLine(xmin[ip],1.0,xmax[ip],1.0);
0585 line->SetLineStyle(2);
0586
0587 line->SetLineColor(kBlack);
0588 line->Draw("SAME");
0589
0590 for(int i=0; i<nn; ++i) {
0591 if(i < 3) continue;
0592 int idx = i*100+17;
0593 gr[idx]->Draw("P L SAME");
0594 }
0595 leg[998]->Draw("SAME");
0596 leg[999]->Draw("SAME");
0597 pad2->Update();
0598 pad2->Modified();
0599 pad->cd();
0600 pad->Update();
0601 pad->Modified();
0602 std::string pl = "Ahrms_" + partsF[ip] + ".png";
0603 pad->Print(pl.c_str());
0604 delete pad;
0605 }
0606
0607 void PlotMIP(int ip, int np, double* mom, double* sig, double* err)
0608 {
0609 TPad* pad = new TCanvas("c4","c4", 700, 900);
0610
0611 gStyle->SetPadBottomMargin(0.15);
0612 gStyle->SetPadTopMargin(0.10);
0613 gStyle->SetLabelSize(0.035, "x");
0614 gStyle->SetLabelSize(0.035, "y");
0615 gStyle->SetTitleOffset(1.4, "x");
0616 gStyle->SetTitleOffset(1.6, "y");
0617 gStyle->SetTitleSize(0.03, "x");
0618 gStyle->SetTitleSize(0.03, "y");
0619
0620 TPad* pad1 = new TPad(partsF[ip].c_str(),"pad1",0,0.3,1,1);
0621 pad1->SetBottomMargin(0.15);
0622 pad1->SetTopMargin(0.1);
0623 pad1->Update();
0624 pad1->Modified();
0625 pad1->Draw();
0626 pad1->cd();
0627
0628 std::string tleg = "2006 Test Beam Data (" + partsN[ip] + ")";
0629 std::string title = "";
0630 gPad->SetLogx();
0631 hh[ip+60] = pad1->DrawFrame(xmin[ip],0.0,xmax[ip],1.0,title.c_str());
0632 hh[ip+60]->GetXaxis()->SetTitle("p_{Beam} (GeV/c)");
0633 hh[ip+60]->GetYaxis()->SetTitle("MIP Fraction");
0634
0635 gr[ip+840] = new TGraphErrors(np, mom, sig, ww, err);
0636 gr[ip+840]->SetMarkerColor(1);
0637 gr[ip+840]->SetMarkerStyle(20);
0638 gr[ip+840]->Draw("P SAME");
0639
0640 for(int i=0; i<nn; ++i) {
0641 int idx = i*100;
0642 gr[idx+6]->Draw("P L SAME");
0643 }
0644
0645 leg[ip]->Draw("SAME");
0646 leg[999]->Draw("SAME");
0647 pad1->Update();
0648 pad1->Modified();
0649
0650 pad->cd();
0651 pad->Update();
0652 pad->Modified();
0653
0654 gStyle->SetPadBottomMargin(0.3);
0655 gStyle->SetPadTopMargin(0.10);
0656 gStyle->SetLabelSize(0.07, "x");
0657 gStyle->SetLabelSize(0.07, "y");
0658 gStyle->SetTitleOffset(1.2, "x");
0659 gStyle->SetTitleOffset(0.7, "y");
0660 gStyle->SetTitleSize(0.07, "x");
0661 gStyle->SetTitleSize(0.07, "y");
0662
0663 TPad* pad2 = new TPad(partsF[ip].c_str(),"pad2",0,0,1,0.3);
0664 pad2->SetBottomMargin(0.2);
0665 pad2->SetTopMargin(0.1);
0666 pad2->Draw();
0667 pad2->cd();
0668
0669 gPad->SetLogx();
0670 hh[ip+70] = pad2->DrawFrame(xmin[ip],0.7,xmax[ip],1.4,title.c_str());
0671 hh[ip+70]->GetXaxis()->SetTitle("p_{Beam} (GeV/c)");
0672 hh[ip+70]->GetYaxis()->SetTitle("MC/Data");
0673
0674 TLine *line = new TLine(xmin[ip],1.0,xmax[ip],1.0);
0675 line->SetLineStyle(2);
0676
0677 line->SetLineColor(kBlack);
0678 line->Draw("SAME");
0679
0680 for(int i=0; i<nn; ++i) {
0681 int idx = i*100;
0682 gr[idx+7]->Draw("P L SAME");
0683 }
0684 leg[998]->Draw("SAME");
0685 leg[999]->Draw("SAME");
0686 pad2->Update();
0687 pad2->Modified();
0688 pad->cd();
0689 pad->Update();
0690 pad->Modified();
0691 std::string pl = "Amip_" + partsF[ip] + ".png";
0692 pad->Print(pl.c_str());
0693 delete pad;
0694 }
0695
0696 void TB06Plots()
0697 {
0698 gROOT->SetStyle("Plain");
0699 gStyle->SetPadBottomMargin(0.15);
0700 gStyle->SetPadTopMargin(0.10);
0701 gStyle->SetPadLeftMargin(0.15);
0702 gStyle->SetPadRightMargin(0.05);
0703 gStyle->SetPadBorderMode(0);
0704
0705 PlotMeanTotal(0, 15, ppin, spin, wss, tpin, rpin, hpin, mpin, whpin);
0706 PlotRmsTotal(0, 15, ppin, rpin, wss);
0707 PlotMeanHcal(0, 15, ppin, hpin, wss);
0708 PlotRmsHcal(0, 15, ppin, whpin, wss);
0709 PlotMIP(0, 15, ppin, mpin, wss);
0710
0711 PlotMeanTotal(1, 11, pp, sp, wss, tp, rp, hp, mp, whp);
0712 PlotRmsTotal(1, 11, pp, rp, wss);
0713 PlotMeanHcal(1, 11, pp, hp, wss);
0714 PlotRmsHcal(1, 11, pp, whp, wss);
0715 PlotMIP(1, 11, pp, mp, wss);
0716
0717 PlotMeanTotal(2, 9, ppip, spip, wpip, tpip, ww, ww, ww, ww);
0718 PlotMeanTotal(3, 8, pkp, skp, wkp, tkp, ww, ww, ww, ww);
0719 PlotMeanTotal(4, 8, pkn, skn, wkn, tkn, ww, ww, ww, ww);
0720 PlotMeanTotal(5, 9, ppbar, spbar, wpbar, tpbar, ww, ww, ww, ww);
0721 }