File indexing completed on 2024-04-06 12:06:33
0001 #include "SeedMultiplicityPlots.h"
0002 #include <vector>
0003 #include <algorithm>
0004 #include <string>
0005 #include <map>
0006 #include <iostream>
0007 #include "TPad.h"
0008 #include "TFile.h"
0009 #include "TH2F.h"
0010 #include "TH1F.h"
0011 #include "TProfile.h"
0012 #include "TLegend.h"
0013 #include "DPGAnalysis/SiStripTools/interface/CommonAnalyzer.h"
0014 #include "TCanvas.h"
0015 #include "TSystem.h"
0016 #include "TStyle.h"
0017 #include "TCanvas.h"
0018
0019 void SeedMultiplicityComparisonPlot() {
0020
0021 TFile f1("/afs/cern.ch/cms/tracking/output/rootfiles/seedmultiplicity_Run2011A_express_ge1711_v3_v2.root");
0022 TFile f2(
0023 "/afs/cern.ch/cms/tracking/output/rootfiles/"
0024 "seedmultiplicity_highmult_default_Run2011A_express_ge1711_v3_v2.root");
0025 TFile f3("/afs/cern.ch/cms/tracking/output/rootfiles/seedmultiplicity_highmult_Run2011A_express_ge1711_v3_v2.root");
0026
0027 CommonAnalyzer castat1(&f1, "", "seedmultiplicitymonitor");
0028 CommonAnalyzer castat2(&f2, "", "seedmultiplicitymonitor");
0029 CommonAnalyzer castat3(&f3, "", "seedmultiplicitymonitor");
0030
0031 TH2F* iter3Pixel1 = (TH2F*)castat1.getObject("thTripletsPixel");
0032 TH2F* iter3Pixel2 = (TH2F*)castat2.getObject("thTripletsPixel");
0033 TH2F* iter3Pixel3 = (TH2F*)castat3.getObject("thTripletsPixel");
0034
0035 if (iter3Pixel1 && iter3Pixel2 && iter3Pixel3) {
0036 TProfile* iter3Pixel1_prof = iter3Pixel1->ProfileX("prof1");
0037 TProfile* iter3Pixel2_prof = iter3Pixel2->ProfileX("prof2");
0038 TProfile* iter3Pixel3_prof = iter3Pixel3->ProfileX("prof3");
0039
0040 iter3Pixel1_prof->SetMarkerColor(kBlack);
0041 iter3Pixel1_prof->SetLineColor(kBlack);
0042 iter3Pixel2_prof->SetMarkerColor(kBlue);
0043 iter3Pixel2_prof->SetLineColor(kBlue);
0044 iter3Pixel3_prof->SetMarkerColor(kRed);
0045 iter3Pixel3_prof->SetLineColor(kRed);
0046
0047 new TCanvas("profile", "profile");
0048
0049 iter3Pixel1_prof->GetXaxis()->SetRangeUser(0, 10000);
0050 iter3Pixel1_prof->GetXaxis()->SetTitle("clusters");
0051 iter3Pixel1_prof->GetYaxis()->SetTitle("seeds");
0052
0053 TLegend* leg = new TLegend(.2, .6, .5, .85, "Seeds vs clusters");
0054 leg->AddEntry(iter3Pixel1_prof->DrawCopy(), "standard RECO", "l");
0055 leg->AddEntry(iter3Pixel2_prof->DrawCopy("same"), "standard RECO (high stat)", "l");
0056 leg->AddEntry(iter3Pixel3_prof->DrawCopy("same"), "iter2 thr = 2M", "l");
0057 leg->Draw();
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067 }
0068
0069 TH1F* iter3_2 = (TH1F*)castat2.getObject("thTriplets");
0070 TH1F* iter3_3 = (TH1F*)castat3.getObject("thTriplets");
0071
0072 if (iter3_2 && iter3_3) {
0073 iter3_2->SetLineColor(kBlue);
0074 iter3_3->SetLineColor(kRed);
0075
0076 new TCanvas("iter3", "iter3");
0077
0078 gPad->SetLogy(1);
0079 TLegend* legiter3 = new TLegend(.5, .6, .85, .85, "iter3 seeds");
0080 legiter3->AddEntry(iter3_2->DrawCopy(), "standard RECO", "l");
0081 legiter3->AddEntry(iter3_3->DrawCopy("same"), "iter2 thr = 2M", "l");
0082 legiter3->Draw();
0083 }
0084
0085 TH1F* iter2_2 = (TH1F*)castat2.getObject("secTriplets");
0086 TH1F* iter2_3 = (TH1F*)castat3.getObject("secTriplets");
0087
0088 if (iter2_2 && iter2_3) {
0089 iter2_2->SetLineColor(kBlue);
0090 iter2_3->SetLineColor(kRed);
0091
0092 new TCanvas("iter2", "iter2");
0093
0094 gPad->SetLogy(1);
0095 TLegend* legiter2 = new TLegend(.5, .6, .85, .85, "iter2 seeds");
0096 legiter2->AddEntry(iter2_2->DrawCopy(), "standard RECO", "l");
0097 legiter2->AddEntry(iter2_3->DrawCopy("same"), "iter2 thr = 2M", "l");
0098 legiter2->Draw();
0099 }
0100
0101 }
0102
0103 void SeedMultiplicityPlots(
0104 const char* fullname, const char* module, const char* postfix, const char* shortname, const char* outtrunk) {
0105 std::cout << shortname << module << postfix << std::endl;
0106
0107 char modfull[300];
0108 sprintf(modfull, "%s%s", module, postfix);
0109
0110 char dirname[400];
0111
0112 sprintf(dirname, "%s%s", "seedmultiplicity_", shortname);
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124 TFile ff(fullname);
0125
0126
0127
0128 gStyle->SetOptStat(111111);
0129
0130 CommonAnalyzer castat(&ff, "", modfull);
0131
0132 std::cout << "ready" << std::endl;
0133
0134 TH1F* iter0 = (TH1F*)castat.getObject("newSeedFromTriplets");
0135 if (iter0) {
0136 iter0->Draw();
0137 gPad->SetLogy(1);
0138 std::string plotfilename;
0139 plotfilename += outtrunk;
0140 plotfilename += dirname;
0141 plotfilename += "/iter0_";
0142 plotfilename += dirname;
0143 plotfilename += ".gif";
0144 gPad->Print(plotfilename.c_str());
0145 delete iter0;
0146 gPad->SetLogy(0);
0147 }
0148
0149 TH1F* iter1 = (TH1F*)castat.getObject("newSeedFromPairs");
0150 if (iter1) {
0151 iter1->Draw();
0152 gPad->SetLogy(1);
0153 std::string plotfilename;
0154 plotfilename += outtrunk;
0155 plotfilename += dirname;
0156 plotfilename += "/iter1_";
0157 plotfilename += dirname;
0158 plotfilename += ".gif";
0159 gPad->Print(plotfilename.c_str());
0160 delete iter1;
0161 gPad->SetLogy(0);
0162 }
0163
0164 TH1F* iter2 = (TH1F*)castat.getObject("secTriplets");
0165 if (iter2) {
0166 iter2->Draw();
0167 gPad->SetLogy(1);
0168 std::string plotfilename;
0169 plotfilename += outtrunk;
0170 plotfilename += dirname;
0171 plotfilename += "/iter2_";
0172 plotfilename += dirname;
0173 plotfilename += ".gif";
0174 gPad->Print(plotfilename.c_str());
0175 delete iter2;
0176 gPad->SetLogy(0);
0177 }
0178
0179 TH1F* iter3 = (TH1F*)castat.getObject("thTriplets");
0180 if (iter3) {
0181 iter3->Draw();
0182 gPad->SetLogy(1);
0183 std::string plotfilename;
0184 plotfilename += outtrunk;
0185 plotfilename += dirname;
0186 plotfilename += "/iter3_";
0187 plotfilename += dirname;
0188 plotfilename += ".gif";
0189 gPad->Print(plotfilename.c_str());
0190 delete iter3;
0191 gPad->SetLogy(0);
0192 }
0193
0194 TH1F* iter3A = (TH1F*)castat.getObject("thTripletsA");
0195 if (iter3A) {
0196 iter3A->Draw();
0197 gPad->SetLogy(1);
0198 std::string plotfilename;
0199 plotfilename += outtrunk;
0200 plotfilename += dirname;
0201 plotfilename += "/iter3A_";
0202 plotfilename += dirname;
0203 plotfilename += ".gif";
0204 gPad->Print(plotfilename.c_str());
0205 delete iter3A;
0206 gPad->SetLogy(0);
0207 }
0208
0209 TH1F* iter3B = (TH1F*)castat.getObject("thTripletsB");
0210 if (iter3B) {
0211 iter3B->Draw();
0212 gPad->SetLogy(1);
0213 std::string plotfilename;
0214 plotfilename += outtrunk;
0215 plotfilename += dirname;
0216 plotfilename += "/iter3B_";
0217 plotfilename += dirname;
0218 plotfilename += ".gif";
0219 gPad->Print(plotfilename.c_str());
0220 delete iter3B;
0221 gPad->SetLogy(0);
0222 }
0223
0224 TH1F* iter4 = (TH1F*)castat.getObject("fourthPLSeeds");
0225 if (iter4) {
0226 iter4->Draw();
0227 gPad->SetLogy(1);
0228 std::string plotfilename;
0229 plotfilename += outtrunk;
0230 plotfilename += dirname;
0231 plotfilename += "/iter4_";
0232 plotfilename += dirname;
0233 plotfilename += ".gif";
0234 gPad->Print(plotfilename.c_str());
0235 delete iter4;
0236 gPad->SetLogy(0);
0237 }
0238
0239 TH1F* iter5 = (TH1F*)castat.getObject("fifthSeeds");
0240 if (iter5) {
0241 iter5->Draw();
0242 gPad->SetLogy(1);
0243 std::string plotfilename;
0244 plotfilename += outtrunk;
0245 plotfilename += dirname;
0246 plotfilename += "/iter5_";
0247 plotfilename += dirname;
0248 plotfilename += ".gif";
0249 gPad->Print(plotfilename.c_str());
0250 delete iter5;
0251 gPad->SetLogy(0);
0252 }
0253
0254 TH2F* iter0TK = (TH2F*)castat.getObject("newSeedFromTripletsTK");
0255 if (iter0TK) {
0256 iter0TK->Draw("colz");
0257 iter0TK->GetYaxis()->SetRangeUser(0, 1000);
0258 iter0TK->GetYaxis()->SetTitle("seeds");
0259 iter0TK->GetXaxis()->SetRangeUser(0, 50000);
0260 iter0TK->GetXaxis()->SetTitle("clusters");
0261 gPad->SetLogz(1);
0262 std::string plotfilename;
0263 plotfilename += outtrunk;
0264 plotfilename += dirname;
0265 plotfilename += "/iter0TK_";
0266 plotfilename += dirname;
0267 plotfilename += ".gif";
0268 gPad->Print(plotfilename.c_str());
0269 delete iter0TK;
0270 gPad->SetLogz(0);
0271 }
0272
0273 TH2F* iter1TK = (TH2F*)castat.getObject("newSeedFromPairsTK");
0274 if (iter1TK) {
0275 iter1TK->Draw("colz");
0276 iter1TK->GetYaxis()->SetTitle("seeds");
0277 iter1TK->GetXaxis()->SetRangeUser(0, 50000);
0278 iter1TK->GetXaxis()->SetTitle("clusters");
0279 gPad->SetLogz(1);
0280 std::string plotfilename;
0281 plotfilename += outtrunk;
0282 plotfilename += dirname;
0283 plotfilename += "/iter1TK_";
0284 plotfilename += dirname;
0285 plotfilename += ".gif";
0286 gPad->Print(plotfilename.c_str());
0287 delete iter1TK;
0288 gPad->SetLogz(0);
0289 }
0290
0291 TH2F* iter2TK = (TH2F*)castat.getObject("secTripletsTK");
0292 if (iter2TK) {
0293 iter2TK->Draw("colz");
0294 iter2TK->GetYaxis()->SetRangeUser(0, 50000);
0295 iter2TK->GetYaxis()->SetTitle("seeds");
0296 iter2TK->GetXaxis()->SetRangeUser(0, 50000);
0297 iter2TK->GetXaxis()->SetTitle("clusters");
0298 gPad->SetLogz(1);
0299 std::string plotfilename;
0300 plotfilename += outtrunk;
0301 plotfilename += dirname;
0302 plotfilename += "/iter2TK_";
0303 plotfilename += dirname;
0304 plotfilename += ".gif";
0305 gPad->Print(plotfilename.c_str());
0306 delete iter2TK;
0307 gPad->SetLogz(0);
0308 }
0309
0310 TH2F* iter3TK = (TH2F*)castat.getObject("thTripletsTK");
0311 if (iter3TK) {
0312 iter3TK->Draw("colz");
0313
0314 iter3TK->GetYaxis()->SetTitle("seeds");
0315 iter3TK->GetXaxis()->SetRangeUser(0, 50000);
0316 iter3TK->GetXaxis()->SetTitle("clusters");
0317 gPad->SetLogz(1);
0318 std::string plotfilename;
0319 plotfilename += outtrunk;
0320 plotfilename += dirname;
0321 plotfilename += "/iter3TK_";
0322 plotfilename += dirname;
0323 plotfilename += ".gif";
0324 gPad->Print(plotfilename.c_str());
0325 delete iter3TK;
0326 gPad->SetLogz(0);
0327 }
0328
0329 TH2F* iter3ATK = (TH2F*)castat.getObject("thTripletsATK");
0330 if (iter3ATK) {
0331 iter3ATK->Draw("colz");
0332
0333 iter3ATK->GetYaxis()->SetTitle("seeds");
0334 iter3ATK->GetXaxis()->SetRangeUser(0, 50000);
0335 iter3ATK->GetXaxis()->SetTitle("clusters");
0336 gPad->SetLogz(1);
0337 std::string plotfilename;
0338 plotfilename += outtrunk;
0339 plotfilename += dirname;
0340 plotfilename += "/iter3ATK_";
0341 plotfilename += dirname;
0342 plotfilename += ".gif";
0343 gPad->Print(plotfilename.c_str());
0344 delete iter3ATK;
0345 gPad->SetLogz(0);
0346 }
0347
0348 TH2F* iter3BTK = (TH2F*)castat.getObject("thTripletsBTK");
0349 if (iter3BTK) {
0350 iter3BTK->Draw("colz");
0351
0352 iter3BTK->GetYaxis()->SetTitle("seeds");
0353 iter3BTK->GetXaxis()->SetRangeUser(0, 50000);
0354 iter3BTK->GetXaxis()->SetTitle("clusters");
0355 gPad->SetLogz(1);
0356 std::string plotfilename;
0357 plotfilename += outtrunk;
0358 plotfilename += dirname;
0359 plotfilename += "/iter3BTK_";
0360 plotfilename += dirname;
0361 plotfilename += ".gif";
0362 gPad->Print(plotfilename.c_str());
0363 delete iter3BTK;
0364 gPad->SetLogz(0);
0365 }
0366
0367 TH2F* iter4TK = (TH2F*)castat.getObject("fourthPLSeedsTK");
0368 if (iter4TK) {
0369 iter4TK->Draw("colz");
0370 iter4TK->GetYaxis()->SetTitle("seeds");
0371 iter4TK->GetXaxis()->SetRangeUser(0, 50000);
0372 iter4TK->GetXaxis()->SetTitle("clusters");
0373 gPad->SetLogz(1);
0374 std::string plotfilename;
0375 plotfilename += outtrunk;
0376 plotfilename += dirname;
0377 plotfilename += "/iter4TK_";
0378 plotfilename += dirname;
0379 plotfilename += ".gif";
0380 gPad->Print(plotfilename.c_str());
0381 delete iter4TK;
0382 gPad->SetLogz(0);
0383 }
0384
0385 TH2F* iter5TK = (TH2F*)castat.getObject("fifthSeedsTK");
0386 if (iter5TK) {
0387 iter5TK->Draw("colz");
0388 iter5TK->GetYaxis()->SetRangeUser(0, 30000);
0389 iter5TK->GetYaxis()->SetTitle("seeds");
0390 iter5TK->GetXaxis()->SetRangeUser(0, 50000);
0391 iter5TK->GetXaxis()->SetTitle("clusters");
0392 gPad->SetLogz(1);
0393 std::string plotfilename;
0394 plotfilename += outtrunk;
0395 plotfilename += dirname;
0396 plotfilename += "/iter5TK_";
0397 plotfilename += dirname;
0398 plotfilename += ".gif";
0399 gPad->Print(plotfilename.c_str());
0400 delete iter5TK;
0401 gPad->SetLogz(0);
0402 }
0403
0404 TH2F* iter0Pixel = (TH2F*)castat.getObject("newSeedFromTripletsPixel");
0405 if (iter0Pixel) {
0406 iter0Pixel->Draw("colz");
0407 iter0Pixel->GetYaxis()->SetRangeUser(0, 1000);
0408 iter0Pixel->GetYaxis()->SetTitle("seeds");
0409 iter0Pixel->GetXaxis()->SetRangeUser(0, 10000);
0410 iter0Pixel->GetXaxis()->SetTitle("clusters");
0411 gPad->SetLogz(1);
0412 std::string plotfilename;
0413 plotfilename += outtrunk;
0414 plotfilename += dirname;
0415 plotfilename += "/iter0Pixel_";
0416 plotfilename += dirname;
0417 plotfilename += ".gif";
0418 gPad->Print(plotfilename.c_str());
0419 delete iter0Pixel;
0420 gPad->SetLogz(0);
0421 }
0422
0423 TH2F* iter1Pixel = (TH2F*)castat.getObject("newSeedFromPairsPixel");
0424 if (iter1Pixel) {
0425 iter1Pixel->Draw("colz");
0426 iter1Pixel->GetYaxis()->SetTitle("seeds");
0427 iter1Pixel->GetXaxis()->SetRangeUser(0, 10000);
0428 iter1Pixel->GetXaxis()->SetTitle("clusters");
0429 gPad->SetLogz(1);
0430 std::string plotfilename;
0431 plotfilename += outtrunk;
0432 plotfilename += dirname;
0433 plotfilename += "/iter1Pixel_";
0434 plotfilename += dirname;
0435 plotfilename += ".gif";
0436 gPad->Print(plotfilename.c_str());
0437 delete iter1Pixel;
0438 gPad->SetLogz(0);
0439 }
0440
0441 TH2F* iter2Pixel = (TH2F*)castat.getObject("secTripletsPixel");
0442 if (iter2Pixel) {
0443 iter2Pixel->Draw("colz");
0444 iter2Pixel->GetYaxis()->SetRangeUser(0, 50000);
0445 iter2Pixel->GetYaxis()->SetTitle("seeds");
0446 iter2Pixel->GetXaxis()->SetRangeUser(0, 10000);
0447 iter2Pixel->GetXaxis()->SetTitle("clusters");
0448 gPad->SetLogz(1);
0449 std::string plotfilename;
0450 plotfilename += outtrunk;
0451 plotfilename += dirname;
0452 plotfilename += "/iter2Pixel_";
0453 plotfilename += dirname;
0454 plotfilename += ".gif";
0455 gPad->Print(plotfilename.c_str());
0456 delete iter2Pixel;
0457 gPad->SetLogz(0);
0458 }
0459
0460 TH2F* iter3Pixel = (TH2F*)castat.getObject("thTripletsPixel");
0461 if (iter3Pixel) {
0462 iter3Pixel->Draw("colz");
0463
0464 iter3Pixel->GetYaxis()->SetTitle("seeds");
0465 iter3Pixel->GetXaxis()->SetRangeUser(0, 10000);
0466 iter3Pixel->GetXaxis()->SetTitle("clusters");
0467 gPad->SetLogz(1);
0468 std::string plotfilename;
0469 plotfilename += outtrunk;
0470 plotfilename += dirname;
0471 plotfilename += "/iter3Pixel_";
0472 plotfilename += dirname;
0473 plotfilename += ".gif";
0474 gPad->Print(plotfilename.c_str());
0475 delete iter3Pixel;
0476 gPad->SetLogz(0);
0477 }
0478
0479 TH2F* iter3APixel = (TH2F*)castat.getObject("thTripletsAPixel");
0480 if (iter3APixel) {
0481 iter3APixel->Draw("colz");
0482
0483 iter3APixel->GetYaxis()->SetTitle("seeds");
0484 iter3APixel->GetXaxis()->SetRangeUser(0, 10000);
0485 iter3APixel->GetXaxis()->SetTitle("clusters");
0486 gPad->SetLogz(1);
0487 std::string plotfilename;
0488 plotfilename += outtrunk;
0489 plotfilename += dirname;
0490 plotfilename += "/iter3APixel_";
0491 plotfilename += dirname;
0492 plotfilename += ".gif";
0493 gPad->Print(plotfilename.c_str());
0494 delete iter3APixel;
0495 gPad->SetLogz(0);
0496 }
0497
0498 TH2F* iter3BPixel = (TH2F*)castat.getObject("thTripletsBPixel");
0499 if (iter3BPixel) {
0500 iter3BPixel->Draw("colz");
0501
0502 iter3BPixel->GetYaxis()->SetTitle("seeds");
0503 iter3BPixel->GetXaxis()->SetRangeUser(0, 10000);
0504 iter3BPixel->GetXaxis()->SetTitle("clusters");
0505 gPad->SetLogz(1);
0506 std::string plotfilename;
0507 plotfilename += outtrunk;
0508 plotfilename += dirname;
0509 plotfilename += "/iter3BPixel_";
0510 plotfilename += dirname;
0511 plotfilename += ".gif";
0512 gPad->Print(plotfilename.c_str());
0513 delete iter3BPixel;
0514 gPad->SetLogz(0);
0515 }
0516
0517 TH2F* iter4Pixel = (TH2F*)castat.getObject("fourthPLSeedsPixel");
0518 if (iter4Pixel) {
0519 iter4Pixel->Draw("colz");
0520 iter4Pixel->GetYaxis()->SetTitle("seeds");
0521 iter4Pixel->GetXaxis()->SetRangeUser(0, 10000);
0522 iter4Pixel->GetXaxis()->SetTitle("clusters");
0523 gPad->SetLogz(1);
0524 std::string plotfilename;
0525 plotfilename += outtrunk;
0526 plotfilename += dirname;
0527 plotfilename += "/iter4Pixel_";
0528 plotfilename += dirname;
0529 plotfilename += ".gif";
0530 gPad->Print(plotfilename.c_str());
0531 delete iter4Pixel;
0532 gPad->SetLogz(0);
0533 }
0534
0535 TH2F* iter5Pixel = (TH2F*)castat.getObject("fifthSeedsPixel");
0536 if (iter5Pixel) {
0537 iter5Pixel->Draw("colz");
0538 iter5Pixel->GetYaxis()->SetRangeUser(0, 30000);
0539 iter5Pixel->GetYaxis()->SetTitle("seeds");
0540 iter5Pixel->GetXaxis()->SetRangeUser(0, 10000);
0541 iter5Pixel->GetXaxis()->SetTitle("clusters");
0542 gPad->SetLogz(1);
0543 std::string plotfilename;
0544 plotfilename += outtrunk;
0545 plotfilename += dirname;
0546 plotfilename += "/iter5Pixel_";
0547 plotfilename += dirname;
0548 plotfilename += ".gif";
0549 gPad->Print(plotfilename.c_str());
0550 delete iter5Pixel;
0551 gPad->SetLogz(0);
0552 }
0553 gStyle->SetOptStat(1111);
0554 }