File indexing completed on 2024-04-06 12:06:32
0001 #include "ClusMultPlots.h"
0002 #include <iostream>
0003 #include <algorithm>
0004 #include <vector>
0005 #include <string>
0006 #include <map>
0007 #include "TPad.h"
0008 #include "TFile.h"
0009 #include "TH2F.h"
0010 #include "TH1F.h"
0011 #include "TProfile.h"
0012 #include "TGraph.h"
0013 #include "DPGAnalysis/SiStripTools/interface/CommonAnalyzer.h"
0014 #include "TCanvas.h"
0015 #include "TStyle.h"
0016
0017 void ClusMultPlots(const char* fullname,
0018 const char* pxmod,
0019 const char* strpmod,
0020 const char* corrmod,
0021 const char* pxlabel,
0022 const char* strplabel,
0023 const char* corrlabel,
0024 const char* postfix,
0025 const char* shortname,
0026 const char* outtrunk) {
0027 char pxmodfull[300];
0028 sprintf(pxmodfull, "%s%s", pxmod, postfix);
0029 char pxlabfull[300];
0030 sprintf(pxlabfull, "%s%s", pxlabel, postfix);
0031
0032 char strpmodfull[300];
0033 sprintf(strpmodfull, "%s%s", strpmod, postfix);
0034 char strplabfull[300];
0035 sprintf(strplabfull, "%s%s", strplabel, postfix);
0036
0037 char corrmodfull[300];
0038 sprintf(corrmodfull, "%s%s", corrmod, postfix);
0039 char corrlabfull[300];
0040 sprintf(corrlabfull, "%s%s", corrlabel, postfix);
0041
0042
0043
0044
0045 TFile ff(fullname);
0046
0047 gStyle->SetOptStat(111111);
0048
0049 CommonAnalyzer capixel(&ff, "", pxmodfull, "EventProcs/Pixel");
0050
0051 TH1F* pixel = (TH1F*)capixel.getObject("nPixeldigi");
0052 if (pixel) {
0053 pixel->Draw();
0054 gPad->SetLogy(1);
0055 std::string plotfilename;
0056 plotfilename += outtrunk;
0057 plotfilename += shortname;
0058 plotfilename += "/pixel";
0059 plotfilename += pxlabfull;
0060 plotfilename += "_";
0061 plotfilename += shortname;
0062 plotfilename += ".gif";
0063 gPad->Print(plotfilename.c_str());
0064 delete pixel;
0065 gPad->SetLogy(0);
0066 }
0067
0068 capixel.setPath("VtxCorr/Pixel");
0069
0070 TH2F* pixelvtx = (TH2F*)capixel.getObject("nPixeldigivsnvtx");
0071 if (pixelvtx) {
0072 pixelvtx->Draw("colz");
0073
0074 TProfile* pixelvtxprof = pixelvtx->ProfileX("prof", 1, -1, "");
0075 pixelvtxprof->SetMarkerStyle(20);
0076 pixelvtxprof->SetMarkerSize(.4);
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086 pixelvtxprof->Draw("esame");
0087 gPad->SetLogz(1);
0088 std::string plotfilename;
0089 plotfilename += outtrunk;
0090 plotfilename += shortname;
0091 plotfilename += "/pixelvtx";
0092 plotfilename += pxlabfull;
0093 plotfilename += "_";
0094 plotfilename += shortname;
0095 plotfilename += ".gif";
0096 gPad->Print(plotfilename.c_str());
0097 delete pixelvtx;
0098 gPad->SetLogz(0);
0099 }
0100
0101 CommonAnalyzer castrip(&ff, "", strpmodfull, "EventProcs/TK");
0102
0103 TH1F* tk = (TH1F*)castrip.getObject("nTKdigi");
0104 if (tk) {
0105 tk->Draw();
0106 gPad->SetLogy(1);
0107 std::string plotfilename;
0108 plotfilename += outtrunk;
0109 plotfilename += shortname;
0110 plotfilename += "/tk";
0111 plotfilename += strplabfull;
0112 plotfilename += "_";
0113 plotfilename += shortname;
0114 plotfilename += ".gif";
0115 gPad->Print(plotfilename.c_str());
0116 delete tk;
0117 gPad->SetLogy(0);
0118 }
0119
0120 castrip.setPath("VtxCorr/TK");
0121
0122 TH2F* tkvtx = (TH2F*)castrip.getObject("nTKdigivsnvtx");
0123 if (tkvtx) {
0124 tkvtx->Draw("colz");
0125
0126 TProfile* tkvtxprof = tkvtx->ProfileX("prof2", 1, -1, "");
0127 tkvtxprof->SetMarkerStyle(20);
0128 tkvtxprof->SetMarkerSize(.4);
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138 tkvtxprof->Draw("esame");
0139 gPad->SetLogz(1);
0140 std::string plotfilename;
0141 plotfilename += outtrunk;
0142 plotfilename += shortname;
0143 plotfilename += "/tkvtx";
0144 plotfilename += strplabfull;
0145 plotfilename += "_";
0146 plotfilename += shortname;
0147 plotfilename += ".gif";
0148 gPad->Print(plotfilename.c_str());
0149 delete tkvtx;
0150 gPad->SetLogz(0);
0151 }
0152
0153 CommonAnalyzer cacorr(&ff, "", corrmodfull, "");
0154
0155 TH1F* rat = (TH1F*)cacorr.getObject("PixelOverTK");
0156 if (rat) {
0157 rat->Draw();
0158 gPad->SetLogy(1);
0159 std::string plotfilename;
0160 plotfilename += outtrunk;
0161 plotfilename += shortname;
0162 plotfilename += "/pixelovertk";
0163 plotfilename += corrlabfull;
0164 plotfilename += "_";
0165 plotfilename += shortname;
0166 plotfilename += ".gif";
0167 gPad->Print(plotfilename.c_str());
0168 delete rat;
0169 gPad->SetLogy(0);
0170 }
0171
0172 TH2F* mult2d = (TH2F*)cacorr.getObject("PixelVsTK");
0173 if (mult2d) {
0174 mult2d->Draw("colz");
0175 gPad->SetLogz(1);
0176
0177
0178 std::string plotfilename;
0179 plotfilename += outtrunk;
0180 plotfilename += shortname;
0181 plotfilename += "/pixelvstk";
0182 plotfilename += corrlabfull;
0183 plotfilename += "_";
0184 plotfilename += shortname;
0185 plotfilename += ".gif";
0186 gPad->Print(plotfilename.c_str());
0187 delete mult2d;
0188 gPad->SetLogz(0);
0189 }
0190
0191 gStyle->SetOptStat(1111);
0192
0193 ff.Close();
0194 }
0195
0196 void ClusMultInvestPlots(const char* fullname,
0197 const char* mod,
0198 const char* label,
0199 const char* postfix,
0200 const char* subdet,
0201 const char* shortname,
0202 const char* outtrunk) {
0203 char modfull[300];
0204 sprintf(modfull, "%s%s", mod, postfix);
0205 char labfull[300];
0206 sprintf(labfull, "%s%s", label, postfix);
0207
0208
0209
0210
0211 TFile ff(fullname);
0212
0213 gStyle->SetOptStat(111111);
0214
0215 char subdirname[300];
0216 sprintf(subdirname, "EventProcs/%s", subdet);
0217 char histname[300];
0218 sprintf(histname, "n%sdigi", subdet);
0219
0220 CommonAnalyzer ca(&ff, "", modfull, subdirname);
0221
0222 TH1F* hist = (TH1F*)ca.getObject(histname);
0223 if (hist) {
0224 hist->Draw();
0225 gPad->SetLogy(1);
0226 std::string plotfilename;
0227 plotfilename += outtrunk;
0228 plotfilename += shortname;
0229 plotfilename += "/";
0230 plotfilename += subdet;
0231 plotfilename += labfull;
0232 plotfilename += "_";
0233 plotfilename += shortname;
0234 plotfilename += ".gif";
0235 gPad->Print(plotfilename.c_str());
0236 delete hist;
0237 gPad->SetLogy(0);
0238 }
0239 gStyle->SetOptStat(1111);
0240
0241 ff.Close();
0242 }
0243
0244 void ClusMultCorrPlots(const char* fullname,
0245 const char* mod,
0246 const char* label,
0247 const char* postfix,
0248 const char* shortname,
0249 const char* outtrunk) {
0250 char modfull[300];
0251 sprintf(modfull, "%s%s", mod, postfix);
0252 char labfull[300];
0253 sprintf(labfull, "%s%s", label, postfix);
0254
0255
0256
0257
0258 TFile ff(fullname);
0259
0260 gStyle->SetOptStat(111111);
0261
0262 CommonAnalyzer ca(&ff, "", modfull, "");
0263
0264 TH1F* rat = (TH1F*)ca.getObject("PixelOverTK");
0265 if (rat) {
0266 rat->Draw();
0267 gPad->SetLogy(1);
0268 std::string plotfilename;
0269 plotfilename += outtrunk;
0270 plotfilename += shortname;
0271 plotfilename += "/pixelovertk";
0272 plotfilename += labfull;
0273 plotfilename += "_";
0274 plotfilename += shortname;
0275 plotfilename += ".gif";
0276 gPad->Print(plotfilename.c_str());
0277 delete rat;
0278 gPad->SetLogy(0);
0279 }
0280
0281 TH2F* mult2d = (TH2F*)ca.getObject("PixelVsTK");
0282 if (mult2d) {
0283 mult2d->Draw("colz");
0284 gPad->SetLogz(1);
0285
0286
0287 std::string plotfilename;
0288 plotfilename += outtrunk;
0289 plotfilename += shortname;
0290 plotfilename += "/pixelvstk";
0291 plotfilename += labfull;
0292 plotfilename += "_";
0293 plotfilename += shortname;
0294 plotfilename += ".gif";
0295 gPad->Print(plotfilename.c_str());
0296 delete mult2d;
0297 gPad->SetLogz(0);
0298 }
0299
0300 gStyle->SetOptStat(1111);
0301
0302 ff.Close();
0303 }
0304
0305 void ClusMultVtxCorrPlots(const char* fullname,
0306 const char* mod,
0307 const char* label,
0308 const char* postfix,
0309 const char* subdet,
0310 const char* shortname,
0311 const char* outtrunk) {
0312 char modfull[300];
0313 sprintf(modfull, "%s%s", mod, postfix);
0314 char labfull[300];
0315 sprintf(labfull, "%s%s", label, postfix);
0316
0317
0318
0319
0320 TFile ff(fullname);
0321
0322 gStyle->SetOptStat(111111);
0323
0324 char subdirname[300];
0325 sprintf(subdirname, "VtxCorr/%s", subdet);
0326 char histname[300];
0327 sprintf(histname, "n%sdigivsnvtx", subdet);
0328 char profname[300];
0329 sprintf(profname, "n%sdigivsnvtxprof", subdet);
0330
0331 CommonAnalyzer ca(&ff, "", modfull, subdirname);
0332
0333 TH2F* histvtx = (TH2F*)ca.getObject(histname);
0334 if (histvtx) {
0335 histvtx->Draw("colz");
0336
0337 TProfile* histvtxprof = nullptr;
0338 histvtxprof = (TProfile*)ca.getObject(profname);
0339 if (histvtxprof == nullptr) {
0340 std::cout << "TProfile " << profname << " missing!" << std::endl;
0341 histvtxprof = histvtx->ProfileX("prof", 1, -1, "");
0342 }
0343 histvtxprof->SetMarkerStyle(20);
0344 histvtxprof->SetMarkerSize(.4);
0345
0346
0347
0348
0349
0350
0351
0352
0353
0354 histvtxprof->Draw("esame");
0355 gPad->SetLogz(1);
0356 std::string plotfilename;
0357 plotfilename += outtrunk;
0358 plotfilename += shortname;
0359 plotfilename += "/";
0360 plotfilename += subdet;
0361 plotfilename += "vtx";
0362 plotfilename += labfull;
0363 plotfilename += "_";
0364 plotfilename += shortname;
0365 plotfilename += ".gif";
0366 gPad->Print(plotfilename.c_str());
0367 delete histvtx;
0368 gPad->SetLogz(0);
0369 }
0370
0371 gStyle->SetOptStat(1111);
0372
0373 ff.Close();
0374 }
0375
0376 void ClusMultLumiCorrPlots(const char* fullname,
0377 const char* mod,
0378 const char* label,
0379 const char* postfix,
0380 const char* subdet,
0381 const char* shortname,
0382 const char* outtrunk) {
0383 char modfull[300];
0384 sprintf(modfull, "%s%s", mod, postfix);
0385 char labfull[300];
0386 sprintf(labfull, "%s%s", label, postfix);
0387
0388
0389
0390
0391 TFile ff(fullname);
0392
0393 gStyle->SetOptStat(111111);
0394
0395 char subdirname[300];
0396 sprintf(subdirname, "LumiCorr/%s", subdet);
0397 char histname[300];
0398 sprintf(histname, "n%sdigivslumi", subdet);
0399 char profname[300];
0400 sprintf(profname, "n%sdigivslumiprof", subdet);
0401
0402 CommonAnalyzer ca(&ff, "", modfull, subdirname);
0403
0404 TH2F* histlumi = (TH2F*)ca.getObject(histname);
0405 if (histlumi) {
0406 histlumi->Draw("colz");
0407
0408 TProfile* histlumiprof = nullptr;
0409 histlumiprof = (TProfile*)ca.getObject(profname);
0410 if (histlumiprof == nullptr) {
0411 std::cout << "TProfile " << profname << " missing!" << std::endl;
0412 histlumiprof = histlumi->ProfileX("prof", 1, -1, "");
0413 }
0414 histlumiprof->SetMarkerStyle(20);
0415 histlumiprof->SetMarkerSize(.4);
0416
0417
0418
0419
0420
0421
0422
0423
0424
0425 histlumiprof->Draw("esame");
0426 gPad->SetLogz(1);
0427 std::string plotfilename;
0428 plotfilename += outtrunk;
0429 plotfilename += shortname;
0430 plotfilename += "/";
0431 plotfilename += subdet;
0432 plotfilename += "lumi";
0433 plotfilename += labfull;
0434 plotfilename += "_";
0435 plotfilename += shortname;
0436 plotfilename += ".gif";
0437 gPad->Print(plotfilename.c_str());
0438 delete histlumi;
0439 gPad->SetLogz(0);
0440 }
0441
0442 gStyle->SetOptStat(1111);
0443
0444 ff.Close();
0445 }