20 const unsigned int partNumber);
24 char* inFileName =
argv[1];
26 char* subDetName =
argv[3];
27 char* partName =
argv[4];
28 int partNumber = atoi(
argv[5]);
30 std::cout <<
"ready to make trend plots from " << inFileName <<
" to " <<
outFileName <<
" for " << subDetName
31 <<
" " << partName <<
" " << partNumber << std::endl;
50 const unsigned int partNumber) {
52 std::map<unsigned int, unsigned int> badModulesTK;
53 std::map<unsigned int, unsigned int> badFibersTK;
54 std::map<unsigned int, unsigned int> badAPVsTK;
55 std::map<unsigned int, unsigned int> badStripsTK;
56 std::map<unsigned int, unsigned int> badStripsFromAPVsTK;
57 std::map<unsigned int, unsigned int> allBadStripsTK;
59 std::ostringstream oss;
61 if (partName ==
"All")
306 std::ifstream resultsFile(inFileName);
310 resultsFile >> runIOV;
313 badModulesTK[runIOV] =
values[0];
314 badFibersTK[runIOV] =
values[1];
315 badAPVsTK[runIOV] =
values[2];
316 badStripsTK[runIOV] =
values[3];
317 badStripsFromAPVsTK[runIOV] =
values[4];
318 allBadStripsTK[runIOV] =
values[5];
319 }
while (!resultsFile.eof());
321 const unsigned int IOVSize = badStripsTK.size();
328 histoName =
"hBadModules" + subDetName + partName;
329 if (partNumber != 0) {
334 histoTitle =
"Bad modules in " + subDetName;
335 if (!partName.empty()) {
336 histoTitle +=
" " + partName;
338 if (partNumber != 0) {
340 histoTitle +=
" " + oss.str();
342 TH1F* hBadModulesTK =
new TH1F(
histoName.c_str(), histoTitle.c_str(), IOVSize, 0.5, IOVSize + 0.5);
345 histoName =
"hBadFibers" + subDetName + partName;
346 if (partNumber != 0) {
351 histoTitle =
"Bad fibers in " + subDetName;
352 if (!partName.empty()) {
353 histoTitle +=
" " + partName;
355 if (partNumber != 0) {
357 histoTitle +=
" " + oss.str();
359 TH1F* hBadFibersTK =
new TH1F(
histoName.c_str(), histoTitle.c_str(), IOVSize, 0.5, IOVSize + 0.5);
362 histoName =
"hBadAPVs" + subDetName + partName;
363 if (partNumber != 0) {
368 histoTitle =
"Bad APVs in " + subDetName;
369 if (!partName.empty()) {
370 histoTitle +=
" " + partName;
372 if (partNumber != 0) {
374 histoTitle +=
" " + oss.str();
376 TH1F* hBadAPVsTK =
new TH1F(
histoName.c_str(), histoTitle.c_str(), IOVSize, 0.5, IOVSize + 0.5);
379 histoName =
"hBadStrips" + subDetName + partName;
380 if (partNumber != 0) {
385 histoTitle =
"Bad strips in " + subDetName;
386 if (!partName.empty()) {
387 histoTitle +=
" " + partName;
389 if (partNumber != 0) {
391 histoTitle +=
" " + oss.str();
393 TH1F* hBadStripsTK =
new TH1F(
histoName.c_str(), histoTitle.c_str(), IOVSize, 0.5, IOVSize + 0.5);
396 histoName =
"hBadStripsFromAPVs" + subDetName + partName;
397 if (partNumber != 0) {
402 histoTitle =
"Bad strips from APVs in " + subDetName;
403 if (!partName.empty()) {
404 histoTitle +=
" " + partName;
406 if (partNumber != 0) {
408 histoTitle +=
" " + oss.str();
410 TH1F* hBadStripsFromAPVsTK =
new TH1F(
histoName.c_str(), histoTitle.c_str(), IOVSize, 0.5, IOVSize + 0.5);
413 histoName =
"hAllBadStrips" + subDetName + partName;
414 if (partNumber != 0) {
419 histoTitle =
"All bad strips in " + subDetName;
420 if (!partName.empty()) {
421 histoTitle +=
" " + partName;
423 if (partNumber != 0) {
425 histoTitle +=
" " + oss.str();
427 TH1F* hAllBadStripsTK =
new TH1F(
histoName.c_str(), histoTitle.c_str(), IOVSize, 0.5, IOVSize + 0.5);
430 for (std::map<unsigned int, unsigned int>::iterator iMap = badModulesTK.begin(); iMap != badModulesTK.end(); iMap++) {
431 hBadModulesTK->SetBinContent(++
j, iMap->second );
434 hBadModulesTK->GetXaxis()->SetBinLabel(
j, oss.str().c_str());
437 TCanvas* cBadModulesTK =
new TCanvas();
438 hBadModulesTK->Draw();
439 cBadModulesTK->Update();
442 for (std::map<unsigned int, unsigned int>::iterator iMap = badFibersTK.begin(); iMap != badFibersTK.end(); iMap++) {
443 hBadFibersTK->SetBinContent(++
j, iMap->second );
446 hBadFibersTK->GetXaxis()->SetBinLabel(
j, oss.str().c_str());
449 TCanvas* cBadFibersTK =
new TCanvas();
450 hBadFibersTK->Draw();
451 cBadFibersTK->Update();
454 for (std::map<unsigned int, unsigned int>::iterator iMap = badAPVsTK.begin(); iMap != badAPVsTK.end(); iMap++) {
455 hBadAPVsTK->SetBinContent(++
j, iMap->second );
458 hBadAPVsTK->GetXaxis()->SetBinLabel(
j, oss.str().c_str());
461 TCanvas* cBadAPVsTK =
new TCanvas();
463 cBadAPVsTK->Update();
466 for (std::map<unsigned int, unsigned int>::iterator iMap = badStripsTK.begin(); iMap != badStripsTK.end(); iMap++) {
467 hBadStripsTK->SetBinContent(++
j, iMap->second );
470 hBadStripsTK->GetXaxis()->SetBinLabel(
j, oss.str().c_str());
473 TCanvas* cBadStripsTK =
new TCanvas();
474 hBadStripsTK->Draw();
475 cBadStripsTK->Update();
478 for (std::map<unsigned int, unsigned int>::iterator iMap = badStripsFromAPVsTK.begin();
479 iMap != badStripsFromAPVsTK.end();
481 hBadStripsFromAPVsTK->SetBinContent(++
j, iMap->second );
484 hBadStripsFromAPVsTK->GetXaxis()->SetBinLabel(
j, oss.str().c_str());
487 TCanvas* cBadStripsFromAPVsTK =
new TCanvas();
488 hBadStripsFromAPVsTK->Draw();
489 cBadStripsFromAPVsTK->Update();
492 for (std::map<unsigned int, unsigned int>::iterator iMap = allBadStripsTK.begin(); iMap != allBadStripsTK.end();
494 hAllBadStripsTK->SetBinContent(++
j, iMap->second );
497 hAllBadStripsTK->GetXaxis()->SetBinLabel(
j, oss.str().c_str());
500 TCanvas* cAllBadStripsTK =
new TCanvas();
501 hAllBadStripsTK->Draw();
502 cAllBadStripsTK->Update();
513 hBadModulesTK->Write();
514 hBadFibersTK->Write();
516 hBadStripsTK->Write();
517 hBadStripsFromAPVsTK->Write();
518 hAllBadStripsTK->Write();
523 delete hBadModulesTK;
527 delete hBadStripsFromAPVsTK;
528 delete hAllBadStripsTK;
529 delete cBadModulesTK;
533 delete cBadStripsFromAPVsTK;
534 delete cAllBadStripsTK;
void makeTKTrend(const char *inFileName, const char *outFileName, std::string subDetName, std::string partName, const unsigned int partNumber)
int main(int argc, char *argv[])