16 void makeTKTrend(
const char* inFileName,
const char* outFileName, std::string subDetName, std::string
partName,
const unsigned int partNumber);
21 char* inFileName = argv[1];
22 char* outFileName = argv[2];
23 char* subDetName = argv[3];
25 int partNumber = atoi(argv[5]);
27 std::cout <<
"ready to make trend plots from "
28 << inFileName <<
" to " << outFileName <<
" for "
29 << subDetName <<
" " << partName <<
" " << partNumber << std::endl;
33 makeTKTrend(inFileName,outFileName,subDetName,partName,partNumber);
38 else {
std::cout <<
"Too few arguments: " << argc << std::endl;
return -1; }
44 void makeTKTrend(
const char* inFileName,
const char* outFileName, std::string subDetName, std::string
partName,
const unsigned int partNumber)
47 std::map<unsigned int, unsigned int> badModulesTK;
48 std::map<unsigned int, unsigned int> badFibersTK;
49 std::map<unsigned int, unsigned int> badAPVsTK;
50 std::map<unsigned int, unsigned int> badStripsTK;
51 std::map<unsigned int, unsigned int> badStripsFromAPVsTK;
52 std::map<unsigned int, unsigned int> allBadStripsTK;
54 std::ostringstream oss;
56 if(partName==
"All") partName=
"";
300 std::ifstream resultsFile(inFileName);
305 resultsFile >> runIOV;
306 resultsFile >> values[0] >> values[1] >> values[2] >> values[3] >> values[4] >> values[5];
308 badModulesTK[runIOV]=values[0];
309 badFibersTK[runIOV]=values[1];
310 badAPVsTK[runIOV]=values[2];
311 badStripsTK[runIOV]=values[3];
312 badStripsFromAPVsTK[runIOV]=values[4];
313 allBadStripsTK[runIOV]=values[5];
315 while(!resultsFile.eof());
317 const unsigned int IOVSize = badStripsTK.size();
320 std::string histoName;
321 std::string histoTitle;
324 histoName =
"hBadModules" + subDetName +
partName;
328 histoName += oss.str();
331 histoTitle =
"Bad modules in " + subDetName;
339 histoTitle +=
" " + oss.str();
341 TH1F* hBadModulesTK =
new TH1F(histoName.c_str(), histoTitle.c_str(), IOVSize, 0.5, IOVSize+0.5);
344 histoName =
"hBadFibers" + subDetName +
partName;
348 histoName += oss.str();
351 histoTitle =
"Bad fibers in " + subDetName;
359 histoTitle +=
" " + oss.str();
361 TH1F* hBadFibersTK =
new TH1F(histoName.c_str(), histoTitle.c_str(), IOVSize, 0.5, IOVSize+0.5);
364 histoName =
"hBadAPVs" + subDetName +
partName;
368 histoName += oss.str();
371 histoTitle =
"Bad APVs in " + subDetName;
379 histoTitle +=
" " + oss.str();
381 TH1F* hBadAPVsTK =
new TH1F(histoName.c_str(), histoTitle.c_str(), IOVSize, 0.5, IOVSize+0.5);
384 histoName =
"hBadStrips" + subDetName +
partName;
388 histoName += oss.str();
391 histoTitle =
"Bad strips in " + subDetName;
399 histoTitle +=
" " + oss.str();
401 TH1F* hBadStripsTK =
new TH1F(histoName.c_str(), histoTitle.c_str(), IOVSize, 0.5, IOVSize+0.5);
404 histoName =
"hBadStripsFromAPVs" + subDetName +
partName;
408 histoName += oss.str();
411 histoTitle =
"Bad strips from APVs in " + subDetName;
419 histoTitle +=
" " + oss.str();
421 TH1F* hBadStripsFromAPVsTK =
new TH1F(histoName.c_str(), histoTitle.c_str(), IOVSize, 0.5, IOVSize+0.5);
424 histoName =
"hAllBadStrips" + subDetName +
partName;
428 histoName += oss.str();
431 histoTitle =
"All bad strips in " + subDetName;
439 histoTitle +=
" " + oss.str();
441 TH1F* hAllBadStripsTK =
new TH1F(histoName.c_str(), histoTitle.c_str(), IOVSize, 0.5, IOVSize+0.5);
444 for(std::map<unsigned int, unsigned int>::iterator iMap=badModulesTK.begin(); iMap!=badModulesTK.end(); iMap++ )
446 hBadModulesTK->SetBinContent(++j,iMap->second);
449 hBadModulesTK->GetXaxis()->SetBinLabel(j,oss.str().c_str());
452 TCanvas* cBadModulesTK =
new TCanvas();
453 hBadModulesTK->Draw();
454 cBadModulesTK->Update();
457 for(std::map<unsigned int, unsigned int>::iterator iMap=badFibersTK.begin(); iMap!=badFibersTK.end(); iMap++ )
459 hBadFibersTK->SetBinContent(++j,iMap->second);
462 hBadFibersTK->GetXaxis()->SetBinLabel(j,oss.str().c_str());
465 TCanvas* cBadFibersTK =
new TCanvas();
466 hBadFibersTK->Draw();
467 cBadFibersTK->Update();
470 for(std::map<unsigned int, unsigned int>::iterator iMap=badAPVsTK.begin(); iMap!=badAPVsTK.end(); iMap++ )
472 hBadAPVsTK->SetBinContent(++j,iMap->second);
475 hBadAPVsTK->GetXaxis()->SetBinLabel(j,oss.str().c_str());
478 TCanvas* cBadAPVsTK =
new TCanvas();
480 cBadAPVsTK->Update();
483 for(std::map<unsigned int, unsigned int>::iterator iMap=badStripsTK.begin(); iMap!=badStripsTK.end(); iMap++ )
485 hBadStripsTK->SetBinContent(++j,iMap->second);
488 hBadStripsTK->GetXaxis()->SetBinLabel(j,oss.str().c_str());
491 TCanvas* cBadStripsTK =
new TCanvas();
492 hBadStripsTK->Draw();
493 cBadStripsTK->Update();
496 for(std::map<unsigned int, unsigned int>::iterator iMap=badStripsFromAPVsTK.begin(); iMap!=badStripsFromAPVsTK.end(); iMap++ )
498 hBadStripsFromAPVsTK->SetBinContent(++j,iMap->second);
501 hBadStripsFromAPVsTK->GetXaxis()->SetBinLabel(j,oss.str().c_str());
504 TCanvas* cBadStripsFromAPVsTK =
new TCanvas();
505 hBadStripsFromAPVsTK->Draw();
506 cBadStripsFromAPVsTK->Update();
509 for(std::map<unsigned int, unsigned int>::iterator iMap=allBadStripsTK.begin(); iMap!=allBadStripsTK.end(); iMap++ )
511 hAllBadStripsTK->SetBinContent(++j,iMap->second);
514 hAllBadStripsTK->GetXaxis()->SetBinLabel(j,oss.str().c_str());
517 TCanvas* cAllBadStripsTK =
new TCanvas();
518 hAllBadStripsTK->Draw();
519 cAllBadStripsTK->Update();
523 TFile*
outFile =
new TFile(outFileName,
"UPDATE");
525 hBadModulesTK->Write();
526 hBadFibersTK->Write();
528 hBadStripsTK->Write();
529 hBadStripsFromAPVsTK->Write();
530 hAllBadStripsTK->Write();
void makeTKTrend(const char *inFileName, const char *outFileName, std::string subDetName, std::string partName, const unsigned int partNumber)
int main(int argc, char **argv)
const char * partName[nParticles]