00001 #include <iostream>
00002 #include <vector>
00003 #include <string>
00004 #include <map>
00005 #include <sstream>
00006
00007 #include "TFile.h"
00008 #include "TH1F.h"
00009 #include "THStack.h"
00010 #include "TCanvas.h"
00011 #include "TLegend.h"
00012 #include "TPaveText.h"
00013 #include "TSystem.h"
00014
00015 void setCanvasStyle(TCanvas* c, const bool logScale);
00016 void setHistoStyle(TH1* h);
00017 void setHistoStackStyle(TH1* h, const unsigned int lineColor);
00018 void setLegendStyle(TLegend* l, const unsigned int nColumns);
00019 void setPaveTextStyle(TPaveText* t, const bool isHorizontal=true);
00020 void fillNormFactorMaps();
00021 double findNormFactor(const std::string currentPlotType, const std::string currentPart, const bool stackOption);
00022 void makePlots(std::string inputFileName, std::string outputFileName);
00023
00024
00025
00026 static std::map<std::string, unsigned int> modulesStackNormFactors;
00027 static std::map<std::string, unsigned int> modulesNoStackNormFactors;
00028 static std::map<std::string, unsigned int> fibersStackNormFactors;
00029 static std::map<std::string, unsigned int> fibersNoStackNormFactors;
00030 static std::map<std::string, unsigned int> APVsStackNormFactors;
00031 static std::map<std::string, unsigned int> APVsNoStackNormFactors;
00032 static std::map<std::string, unsigned int> stripsStackNormFactors;
00033 static std::map<std::string, unsigned int> stripsNoStackNormFactors;
00034
00035 int main(int argc , char *argv[]) {
00036
00037 if(argc==3) {
00038 char* inputFileName = argv[1];
00039 char* outputFileName = argv[2];
00040
00041 std::cout << "ready to make plots from " << inputFileName << " to " << outputFileName << std::endl;
00042
00043
00044 int returncode = 0;
00045 makePlots(inputFileName,outputFileName);
00046
00047 return returncode;
00048
00049 }
00050 else {std::cout << "Too few arguments: " << argc << std::endl; return -1; }
00051
00052 return -9;
00053
00054 }
00055
00056
00057 void makePlots(std::string inputFileName, std::string outputFileName)
00058 {
00059
00060
00061
00062
00063 TFile* inputFile = new TFile(inputFileName.c_str(),"READ");
00064 TFile* outputFile = new TFile(outputFileName.c_str(), "RECREATE");
00065
00066 std::ostringstream oss;
00067 std::string histoName;
00068 std::vector< std::string > plotType;
00069 plotType.push_back("BadModules"); plotType.push_back("BadFibers"); plotType.push_back("BadAPVs"); plotType.push_back("BadStrips"); plotType.push_back("BadStripsFromAPVs"); plotType.push_back("AllBadStrips");
00070 std::vector< std::string > subDetName;
00071 subDetName.push_back("TIB"); subDetName.push_back("TID+"); subDetName.push_back("TID-"); subDetName.push_back("TOB"); subDetName.push_back("TEC+"); subDetName.push_back("TEC-");
00072
00073
00074 const bool stackHistograms = true;
00075
00076 std::string plotStackOptions;
00077 if(stackHistograms)
00078 plotStackOptions = "";
00079 else
00080 plotStackOptions = "nostack p";
00081 const std::string plotHistoOptions("p");
00082
00083
00084
00085 fillNormFactorMaps();
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105 TH1F* hTracker;
00106 TH1F* hTIB;
00107 TH1F* hTID;
00108 TH1F* hTOB;
00109 TH1F* hTEC;
00110 TH1F* histo;
00111 TH1F* histo2;
00112 THStack* histoStack;
00113 TCanvas* c1;
00114 TCanvas* c2;
00115 TLegend* legend;
00116 TLegend* legend2;
00117 TPaveText* textX;
00118 TPaveText* textY;
00119 std::string entryLabel;
00120 std::vector<TH1F*> hLayers;
00121
00122
00123 for(std::vector< std::string >::iterator itPlot=plotType.begin(); itPlot!=plotType.end(); itPlot++)
00124 {
00125
00126
00127 histoName = "h" + *itPlot + "Tracker";
00128 hTracker = (TH1F*)inputFile->Get(histoName.c_str());
00129 if(hTracker) {
00130 hTracker->Scale(1/findNormFactor(*itPlot,"Tracker",stackHistograms));
00131 }
00132 else {std::cout << histoName << " not found" << std::endl;}
00133
00134 histoStack = new THStack(histoName.c_str(), histoName.c_str());
00135
00136 histoName = "h" + *itPlot + "TIB";
00137 hTIB = (TH1F*)inputFile->Get(histoName.c_str());
00138 if(hTIB) {
00139 hTIB->Scale(1/findNormFactor(*itPlot,"TIB",stackHistograms));
00140 }
00141 else {std::cout << histoName << " not found" << std::endl;}
00142
00143 histoName = "h" + *itPlot + "TID";
00144 hTID = (TH1F*)inputFile->Get(histoName.c_str());
00145 if(hTID) {
00146 hTID->Scale(1/findNormFactor(*itPlot,"TID",stackHistograms));
00147 }
00148 else {std::cout << histoName << " not found" << std::endl;}
00149
00150 histoName = "h" + *itPlot + "TOB";
00151 hTOB = (TH1F*)inputFile->Get(histoName.c_str());
00152 if(hTOB) {
00153 hTOB->Scale(1/findNormFactor(*itPlot,"TOB",stackHistograms));
00154 }
00155 else {std::cout << histoName << " not found" << std::endl;}
00156
00157 histoName = "h" + *itPlot + "TEC";
00158 hTEC = (TH1F*)inputFile->Get(histoName.c_str());
00159 if(hTEC) {
00160 hTEC->Scale(1/findNormFactor(*itPlot,"TEC",stackHistograms));
00161 }
00162 else {std::cout << histoName << " not found" << std::endl;}
00163
00164 c1 = new TCanvas(("c"+*itPlot+"Tracker").c_str(), "", 1200, 600);
00165 setCanvasStyle(c1, false);
00166
00167 if(hTracker) setHistoStackStyle(hTracker,1);
00168
00169 if(hTIB) {
00170 setHistoStackStyle(hTIB,2);
00171 histoStack->Add(hTIB);
00172 }
00173
00174 if(hTID) {
00175 setHistoStackStyle(hTID,3);
00176 histoStack->Add(hTID);
00177 }
00178
00179 if(hTOB) {
00180 setHistoStackStyle(hTOB,4);
00181 histoStack->Add(hTOB);
00182 }
00183
00184 if(hTEC) {
00185 setHistoStackStyle(hTEC,6);
00186 histoStack->Add(hTEC);
00187 }
00188
00189
00190
00191
00192
00193 double histoStackMaximum = histoStack->GetMaximum();
00194 if(histoStackMaximum==0)
00195 {
00196 c1->SetLogy(0);
00197 }
00198 histoStack->Draw(plotStackOptions.c_str());
00199 if(histoStack->GetYaxis()->GetXmax() > 0.9)
00200 histoStack->GetYaxis()->SetRangeUser(0.,0.1);
00201 legend = new TLegend(0.4,0.9,0.9,1);
00202 legend->AddEntry(hTIB, "TIB");
00203 legend->AddEntry(hTID, "TID");
00204 legend->AddEntry(hTOB, "TOB");
00205 legend->AddEntry(hTEC, "TEC");
00206 setLegendStyle(legend, 2);
00207 legend->Draw();
00208 textX = new TPaveText();
00209 textY = new TPaveText();
00210 setPaveTextStyle(textX);
00211 setPaveTextStyle(textY, false);
00212 textX->Draw();
00213 textY->Draw();
00214 gSystem->ProcessEvents();
00215 c1->Update();
00216 outputFile->cd();
00217 c1->Write();
00218 c1->SaveAs((*itPlot+"Tracker.png").c_str());
00219
00220 delete histoStack;
00221 delete textX;
00222 delete textY;
00223 delete legend;
00224 delete c1;
00225
00226
00227
00228
00229 for(std::vector< std::string >::iterator itSub=subDetName.begin(); itSub!=subDetName.end(); itSub++)
00230 {
00231 unsigned int nLayers = 0;
00232 std::string layerName;
00233
00234 if((*itSub).compare("TIB")==0)
00235 {
00236 nLayers=4;
00237 layerName="Layer";
00238 legend = new TLegend(0.4,0.9,0.9,1);
00239 setLegendStyle(legend,2);
00240 }
00241 else if((*itSub).compare("TID+")==0 || (*itSub).compare("TID-")==0)
00242 {
00243 nLayers=3;
00244 layerName="Disk";
00245 legend = new TLegend(0.35,0.9,0.9,1);
00246 setLegendStyle(legend,3);
00247 }
00248 else if((*itSub).compare("TOB")==0)
00249 {
00250 nLayers=6;
00251 layerName="Layer";
00252 legend = new TLegend(0.35,0.9,0.9,1);
00253 setLegendStyle(legend,3);
00254 }
00255 else if((*itSub).compare("TEC+")==0 || (*itSub).compare("TEC-")==0)
00256 {
00257 nLayers=9;
00258 layerName="Disk";
00259 legend = new TLegend(0.35,0.9,1,1);
00260 setLegendStyle(legend,5);
00261 }
00262
00263 c1 = new TCanvas(("c" + *itPlot + *itSub).c_str(),"", 1200, 600);
00264 setCanvasStyle(c1, false);
00265
00266
00267
00268
00269
00270
00271 histoName = "h" + *itPlot + *itSub;
00272
00273
00274
00275
00276 histoStack = new THStack(histoName.c_str(), histoName.c_str());
00277
00278 for(unsigned int iLayer = 1; iLayer<=nLayers; iLayer++)
00279 {
00280 oss.str("");
00281 oss << iLayer;
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347 histoName = "h" + *itPlot + *itSub + layerName + oss.str();
00348
00349 histo = (TH1F*)inputFile->Get(histoName.c_str());
00350 if(histo) {
00351 histo2 = new TH1F(*histo);
00352 histo->Scale(1/findNormFactor(*itPlot, *itSub + " " + layerName + " " + oss.str(), false));
00353 histo2->Scale(1/findNormFactor(*itPlot, *itSub + " " + layerName + " " + oss.str(), stackHistograms));
00354
00355 setHistoStyle(histo);
00356 c2 = new TCanvas(("c" + *itPlot + *itSub + layerName + oss.str()).c_str(), "", 1200, 600);
00357 setCanvasStyle(c2, true);
00358 histo->Draw(plotHistoOptions.c_str());
00359 double histoMaximum = histo->GetMaximum();
00360
00361 if(histoMaximum==0)
00362 {
00363 c2->SetLogy(0);
00364 }
00365 legend2 = new TLegend(0.6,0.92,0.9,0.97);
00366 legend2->AddEntry(histo,(*itSub + layerName + oss.str()).c_str());
00367 setLegendStyle(legend2, 1);
00368 legend2->Draw();
00369 textX = new TPaveText();
00370 textY = new TPaveText();
00371 setPaveTextStyle(textX);
00372 setPaveTextStyle(textY,false);
00373 textX->Draw();
00374 textY->Draw();
00375 gSystem->ProcessEvents();
00376 c2->Update();
00377 outputFile->cd();
00378 c2->Write();
00379 c2->SaveAs((*itPlot + *itSub + layerName + oss.str() + ".png").c_str());
00380 delete textX;
00381 delete textY;
00382 delete legend2;
00383 delete c2;
00384
00385
00386 setHistoStyle(histo2);
00387 hLayers.push_back(histo2);
00388 setHistoStackStyle(hLayers.back(), iLayer);
00389 histoStack->Add(hLayers.back());
00390 entryLabel = *itSub + " " + layerName + " " + oss.str();
00391 legend->AddEntry(hLayers.back(), entryLabel.c_str());
00392
00393
00394
00395 }
00396 else {std::cout << histoName << " not found" << std::endl;}
00397 }
00398 histoStack->Draw(plotStackOptions.c_str());
00399
00400
00401
00402
00403
00404
00405 double histoStackMaximum = histoStack->GetMaximum();
00406 if(histoStackMaximum==0)
00407 {
00408 c1->SetLogy(0);
00409 }
00410 if(histoStackMaximum > 0.01)
00411 histoStack->SetMaximum(0.01);
00412 textX = new TPaveText();
00413 textY = new TPaveText();
00414 setPaveTextStyle(textX);
00415 setPaveTextStyle(textY,false);
00416 textX->Draw();
00417 textY->Draw();
00418 legend->Draw();
00419 gSystem->ProcessEvents();
00420 c1->Update();
00421 outputFile->cd();
00422 c1->Write();
00423 c1->SaveAs((*itPlot + *itSub + ".png").c_str());
00424 delete histoStack;
00425 delete textX;
00426 delete textY;
00427 delete legend;
00428 delete c1;
00429 }
00430 }
00431
00432 inputFile->Close();
00433 outputFile->Close();
00434
00435 }
00436
00437
00438
00439 void setCanvasStyle(TCanvas* c, const bool logScale)
00440 {
00441 c->SetFillColor(0);
00442 c->SetFrameBorderMode(0);
00443 if(logScale)
00444 c->SetLogy(1);
00445 else
00446 c->SetLogy(0);
00447 c->SetCanvasSize(1200,600);
00448 c->SetWindowSize(1200,600);
00449 }
00450
00451
00452
00453 void setHistoStyle(TH1* h)
00454 {
00455 h->SetLineStyle(0);
00456 h->SetMarkerStyle(3);
00457 h->SetMarkerSize(1);
00458 h->SetMarkerColor(1);
00459 h->SetStats(kFALSE);
00460
00461
00462
00463
00464 if(h->GetNbinsX() > 25)
00465 for(int i = 1; i < h->GetNbinsX()-1; i++)
00466 if((i%(h->GetNbinsX()/25+1)))
00467 h->GetXaxis()->SetBinLabel(i+1,"");
00468 }
00469
00470
00471
00472 void setHistoStackStyle(TH1* h, const unsigned int lineColor)
00473 {
00474 h->SetLineStyle(0);
00475
00476
00477 h->SetMarkerStyle(lineColor%4+20);
00478 h->SetMarkerSize(1);
00479 h->SetMarkerColor(lineColor);
00480 h->SetLineColor(lineColor);
00481 h->SetFillColor(lineColor);
00482 h->SetLineWidth(2);
00483 h->SetStats(kFALSE);
00484 h->GetYaxis()->SetTitle("Fraction of total");
00485
00486
00487
00488 if(h->GetNbinsX() > 25)
00489 for(int i = 1; i < h->GetNbinsX()-1; i++)
00490 if(i%(h->GetNbinsX()/25+1))
00491 h->GetXaxis()->SetBinLabel(i+1,"");
00492 }
00493
00494
00495
00496 void setLegendStyle(TLegend* l, const unsigned int nColumns)
00497 {
00498 l->SetNColumns(nColumns);
00499 l->SetFillColor(0);
00500 }
00501
00502
00503
00504 void setPaveTextStyle(TPaveText* t, const bool isHorizontal)
00505 {
00506 t->SetLineStyle(0);
00507 t->SetFillColor(0);
00508 t->SetFillStyle(0);
00509 t->SetBorderSize(0);
00510 if(isHorizontal)
00511 {
00512 t->SetX1NDC(0.905);
00513 t->SetX2NDC(0.975);
00514 t->SetY1NDC(0.062);
00515 t->SetY2NDC(0.095);
00516 t->AddText("IOV");
00517 }
00518 else
00519 {
00520 t->SetX1NDC(0.03);
00521 t->SetX2NDC(0.05);
00522 t->SetY1NDC(0.33);
00523 t->SetY2NDC(0.68);
00524 TText* t1 = t->AddText("Fraction of total");
00525 t1->SetTextAngle(90.);
00526 }
00527 }
00528
00529
00530
00531 void fillNormFactorMaps()
00532 {
00533
00534 std::vector< std::string > tkParts;
00535 tkParts.push_back("Tracker");
00536 tkParts.push_back("TIB");
00537 tkParts.push_back("TID");
00538 tkParts.push_back("TOB");
00539 tkParts.push_back("TEC");
00540 tkParts.push_back("TIB Layer 1");
00541 tkParts.push_back("TIB Layer 2");
00542 tkParts.push_back("TIB Layer 3");
00543 tkParts.push_back("TIB Layer 4");
00544 tkParts.push_back("TID+ Disk 1");
00545 tkParts.push_back("TID+ Disk 2");
00546 tkParts.push_back("TID+ Disk 3");
00547 tkParts.push_back("TID- Disk 1");
00548 tkParts.push_back("TID- Disk 2");
00549 tkParts.push_back("TID- Disk 3");
00550 tkParts.push_back("TOB Layer 1");
00551 tkParts.push_back("TOB Layer 2");
00552 tkParts.push_back("TOB Layer 3");
00553 tkParts.push_back("TOB Layer 4");
00554 tkParts.push_back("TOB Layer 5");
00555 tkParts.push_back("TOB Layer 6");
00556 tkParts.push_back("TEC+ Disk 1");
00557 tkParts.push_back("TEC+ Disk 2");
00558 tkParts.push_back("TEC+ Disk 3");
00559 tkParts.push_back("TEC+ Disk 4");
00560 tkParts.push_back("TEC+ Disk 5");
00561 tkParts.push_back("TEC+ Disk 6");
00562 tkParts.push_back("TEC+ Disk 7");
00563 tkParts.push_back("TEC+ Disk 8");
00564 tkParts.push_back("TEC+ Disk 9");
00565 tkParts.push_back("TEC- Disk 1");
00566 tkParts.push_back("TEC- Disk 2");
00567 tkParts.push_back("TEC- Disk 3");
00568 tkParts.push_back("TEC- Disk 4");
00569 tkParts.push_back("TEC- Disk 5");
00570 tkParts.push_back("TEC- Disk 6");
00571 tkParts.push_back("TEC- Disk 7");
00572 tkParts.push_back("TEC- Disk 8");
00573 tkParts.push_back("TEC- Disk 9");
00574
00575 std::vector<unsigned int> nModulesStack;
00576 nModulesStack.push_back(15148);
00577 nModulesStack.push_back(15148);
00578 nModulesStack.push_back(15148);
00579 nModulesStack.push_back(15148);
00580 nModulesStack.push_back(15148);
00581 nModulesStack.push_back(2724);
00582 nModulesStack.push_back(2724);
00583 nModulesStack.push_back(2724);
00584 nModulesStack.push_back(2724);
00585 nModulesStack.push_back(408);
00586 nModulesStack.push_back(408);
00587 nModulesStack.push_back(408);
00588 nModulesStack.push_back(408);
00589 nModulesStack.push_back(408);
00590 nModulesStack.push_back(408);
00591 nModulesStack.push_back(5208);
00592 nModulesStack.push_back(5208);
00593 nModulesStack.push_back(5208);
00594 nModulesStack.push_back(5208);
00595 nModulesStack.push_back(5208);
00596 nModulesStack.push_back(5208);
00597 nModulesStack.push_back(3200);
00598 nModulesStack.push_back(3200);
00599 nModulesStack.push_back(3200);
00600 nModulesStack.push_back(3200);
00601 nModulesStack.push_back(3200);
00602 nModulesStack.push_back(3200);
00603 nModulesStack.push_back(3200);
00604 nModulesStack.push_back(3200);
00605 nModulesStack.push_back(3200);
00606 nModulesStack.push_back(3200);
00607 nModulesStack.push_back(3200);
00608 nModulesStack.push_back(3200);
00609 nModulesStack.push_back(3200);
00610 nModulesStack.push_back(3200);
00611 nModulesStack.push_back(3200);
00612 nModulesStack.push_back(3200);
00613 nModulesStack.push_back(3200);
00614 nModulesStack.push_back(3200);
00615
00616 std::vector<unsigned int> nModulesNoStack;
00617 nModulesNoStack.push_back(15148);
00618 nModulesNoStack.push_back(2724);
00619 nModulesNoStack.push_back(816);
00620 nModulesNoStack.push_back(5208);
00621 nModulesNoStack.push_back(6400);
00622 nModulesNoStack.push_back(672);
00623 nModulesNoStack.push_back(864);
00624 nModulesNoStack.push_back(540);
00625 nModulesNoStack.push_back(648);
00626 nModulesNoStack.push_back(136);
00627 nModulesNoStack.push_back(136);
00628 nModulesNoStack.push_back(136);
00629 nModulesNoStack.push_back(136);
00630 nModulesNoStack.push_back(136);
00631 nModulesNoStack.push_back(136);
00632 nModulesNoStack.push_back(1008);
00633 nModulesNoStack.push_back(1152);
00634 nModulesNoStack.push_back(648);
00635 nModulesNoStack.push_back(720);
00636 nModulesNoStack.push_back(792);
00637 nModulesNoStack.push_back(888);
00638 nModulesNoStack.push_back(408);
00639 nModulesNoStack.push_back(408);
00640 nModulesNoStack.push_back(408);
00641 nModulesNoStack.push_back(360);
00642 nModulesNoStack.push_back(360);
00643 nModulesNoStack.push_back(360);
00644 nModulesNoStack.push_back(312);
00645 nModulesNoStack.push_back(312);
00646 nModulesNoStack.push_back(272);
00647 nModulesNoStack.push_back(408);
00648 nModulesNoStack.push_back(408);
00649 nModulesNoStack.push_back(408);
00650 nModulesNoStack.push_back(360);
00651 nModulesNoStack.push_back(360);
00652 nModulesNoStack.push_back(360);
00653 nModulesNoStack.push_back(312);
00654 nModulesNoStack.push_back(312);
00655 nModulesNoStack.push_back(272);
00656
00657
00658 std::vector<unsigned int> nFibersStack;
00659 nFibersStack.push_back(36392);
00660 nFibersStack.push_back(36392);
00661 nFibersStack.push_back(36392);
00662 nFibersStack.push_back(36392);
00663 nFibersStack.push_back(36392);
00664 nFibersStack.push_back(6984);
00665 nFibersStack.push_back(6984);
00666 nFibersStack.push_back(6984);
00667 nFibersStack.push_back(6984);
00668 nFibersStack.push_back(1104);
00669 nFibersStack.push_back(1104);
00670 nFibersStack.push_back(1104);
00671 nFibersStack.push_back(1104);
00672 nFibersStack.push_back(1104);
00673 nFibersStack.push_back(1104);
00674 nFibersStack.push_back(12096);
00675 nFibersStack.push_back(12096);
00676 nFibersStack.push_back(12096);
00677 nFibersStack.push_back(12096);
00678 nFibersStack.push_back(12096);
00679 nFibersStack.push_back(12096);
00680 nFibersStack.push_back(7552);
00681 nFibersStack.push_back(7552);
00682 nFibersStack.push_back(7552);
00683 nFibersStack.push_back(7552);
00684 nFibersStack.push_back(7552);
00685 nFibersStack.push_back(7552);
00686 nFibersStack.push_back(7552);
00687 nFibersStack.push_back(7552);
00688 nFibersStack.push_back(7552);
00689 nFibersStack.push_back(7552);
00690 nFibersStack.push_back(7552);
00691 nFibersStack.push_back(7552);
00692 nFibersStack.push_back(7552);
00693 nFibersStack.push_back(7552);
00694 nFibersStack.push_back(7552);
00695 nFibersStack.push_back(7552);
00696 nFibersStack.push_back(7552);
00697 nFibersStack.push_back(7552);
00698
00699 std::vector<unsigned int> nFibersNoStack;
00700 nFibersNoStack.push_back(36392);
00701 nFibersNoStack.push_back(6984);
00702 nFibersNoStack.push_back(2208);
00703 nFibersNoStack.push_back(12096);
00704 nFibersNoStack.push_back(15104);
00705 nFibersNoStack.push_back(2016);
00706 nFibersNoStack.push_back(2592);
00707 nFibersNoStack.push_back(1080);
00708 nFibersNoStack.push_back(1296);
00709 nFibersNoStack.push_back(368);
00710 nFibersNoStack.push_back(368);
00711 nFibersNoStack.push_back(368);
00712 nFibersNoStack.push_back(368);
00713 nFibersNoStack.push_back(368);
00714 nFibersNoStack.push_back(368);
00715 nFibersNoStack.push_back(2016);
00716 nFibersNoStack.push_back(2304);
00717 nFibersNoStack.push_back(1296);
00718 nFibersNoStack.push_back(1440);
00719 nFibersNoStack.push_back(2376);
00720 nFibersNoStack.push_back(2664);
00721 nFibersNoStack.push_back(992);
00722 nFibersNoStack.push_back(992);
00723 nFibersNoStack.push_back(992);
00724 nFibersNoStack.push_back(848);
00725 nFibersNoStack.push_back(848);
00726 nFibersNoStack.push_back(848);
00727 nFibersNoStack.push_back(704);
00728 nFibersNoStack.push_back(704);
00729 nFibersNoStack.push_back(624);
00730 nFibersNoStack.push_back(992);
00731 nFibersNoStack.push_back(992);
00732 nFibersNoStack.push_back(992);
00733 nFibersNoStack.push_back(848);
00734 nFibersNoStack.push_back(848);
00735 nFibersNoStack.push_back(848);
00736 nFibersNoStack.push_back(704);
00737 nFibersNoStack.push_back(704);
00738 nFibersNoStack.push_back(624);
00739
00740
00741 std::vector<unsigned int> nAPVsStack;
00742 nAPVsStack.push_back(72784);
00743 nAPVsStack.push_back(72784);
00744 nAPVsStack.push_back(72784);
00745 nAPVsStack.push_back(72784);
00746 nAPVsStack.push_back(72784);
00747 nAPVsStack.push_back(13968);
00748 nAPVsStack.push_back(13968);
00749 nAPVsStack.push_back(13968);
00750 nAPVsStack.push_back(13968);
00751 nAPVsStack.push_back(2208);
00752 nAPVsStack.push_back(2208);
00753 nAPVsStack.push_back(2208);
00754 nAPVsStack.push_back(2208);
00755 nAPVsStack.push_back(2208);
00756 nAPVsStack.push_back(2208);
00757 nAPVsStack.push_back(24192);
00758 nAPVsStack.push_back(24192);
00759 nAPVsStack.push_back(24192);
00760 nAPVsStack.push_back(24192);
00761 nAPVsStack.push_back(24192);
00762 nAPVsStack.push_back(24192);
00763 nAPVsStack.push_back(15104);
00764 nAPVsStack.push_back(15104);
00765 nAPVsStack.push_back(15104);
00766 nAPVsStack.push_back(15104);
00767 nAPVsStack.push_back(15104);
00768 nAPVsStack.push_back(15104);
00769 nAPVsStack.push_back(15104);
00770 nAPVsStack.push_back(15104);
00771 nAPVsStack.push_back(15104);
00772 nAPVsStack.push_back(15104);
00773 nAPVsStack.push_back(15104);
00774 nAPVsStack.push_back(15104);
00775 nAPVsStack.push_back(15104);
00776 nAPVsStack.push_back(15104);
00777 nAPVsStack.push_back(15104);
00778 nAPVsStack.push_back(15104);
00779 nAPVsStack.push_back(15104);
00780 nAPVsStack.push_back(15104);
00781
00782 std::vector<unsigned int> nAPVsNoStack;
00783 nAPVsNoStack.push_back(72784);
00784 nAPVsNoStack.push_back(13968);
00785 nAPVsNoStack.push_back(4416);
00786 nAPVsNoStack.push_back(24192);
00787 nAPVsNoStack.push_back(30208);
00788 nAPVsNoStack.push_back(4032);
00789 nAPVsNoStack.push_back(5184);
00790 nAPVsNoStack.push_back(2160);
00791 nAPVsNoStack.push_back(2592);
00792 nAPVsNoStack.push_back(736);
00793 nAPVsNoStack.push_back(736);
00794 nAPVsNoStack.push_back(736);
00795 nAPVsNoStack.push_back(736);
00796 nAPVsNoStack.push_back(736);
00797 nAPVsNoStack.push_back(736);
00798 nAPVsNoStack.push_back(4032);
00799 nAPVsNoStack.push_back(4608);
00800 nAPVsNoStack.push_back(2592);
00801 nAPVsNoStack.push_back(2880);
00802 nAPVsNoStack.push_back(4752);
00803 nAPVsNoStack.push_back(5328);
00804 nAPVsNoStack.push_back(1984);
00805 nAPVsNoStack.push_back(1984);
00806 nAPVsNoStack.push_back(1984);
00807 nAPVsNoStack.push_back(1696);
00808 nAPVsNoStack.push_back(1696);
00809 nAPVsNoStack.push_back(1696);
00810 nAPVsNoStack.push_back(1408);
00811 nAPVsNoStack.push_back(1408);
00812 nAPVsNoStack.push_back(1248);
00813 nAPVsNoStack.push_back(1984);
00814 nAPVsNoStack.push_back(1984);
00815 nAPVsNoStack.push_back(1984);
00816 nAPVsNoStack.push_back(1696);
00817 nAPVsNoStack.push_back(1696);
00818 nAPVsNoStack.push_back(1696);
00819 nAPVsNoStack.push_back(1408);
00820 nAPVsNoStack.push_back(1408);
00821 nAPVsNoStack.push_back(1248);
00822
00823
00824 std::vector<unsigned int> nStripsStack;
00825 nStripsStack.push_back(9316352);
00826 nStripsStack.push_back(9316352);
00827 nStripsStack.push_back(9316352);
00828 nStripsStack.push_back(9316352);
00829 nStripsStack.push_back(9316352);
00830 nStripsStack.push_back(1787904);
00831 nStripsStack.push_back(1787904);
00832 nStripsStack.push_back(1787904);
00833 nStripsStack.push_back(1787904);
00834 nStripsStack.push_back(282624);
00835 nStripsStack.push_back(282624);
00836 nStripsStack.push_back(282624);
00837 nStripsStack.push_back(282624);
00838 nStripsStack.push_back(282624);
00839 nStripsStack.push_back(282624);
00840 nStripsStack.push_back(3096576);
00841 nStripsStack.push_back(3096576);
00842 nStripsStack.push_back(3096576);
00843 nStripsStack.push_back(3096576);
00844 nStripsStack.push_back(3096576);
00845 nStripsStack.push_back(3096576);
00846 nStripsStack.push_back(1933312);
00847 nStripsStack.push_back(1933312);
00848 nStripsStack.push_back(1933312);
00849 nStripsStack.push_back(1933312);
00850 nStripsStack.push_back(1933312);
00851 nStripsStack.push_back(1933312);
00852 nStripsStack.push_back(1933312);
00853 nStripsStack.push_back(1933312);
00854 nStripsStack.push_back(1933312);
00855 nStripsStack.push_back(1933312);
00856 nStripsStack.push_back(1933312);
00857 nStripsStack.push_back(1933312);
00858 nStripsStack.push_back(1933312);
00859 nStripsStack.push_back(1933312);
00860 nStripsStack.push_back(1933312);
00861 nStripsStack.push_back(1933312);
00862 nStripsStack.push_back(1933312);
00863 nStripsStack.push_back(1933312);
00864
00865 std::vector<unsigned int> nStripsNoStack;
00866 nStripsNoStack.push_back(9316352);
00867 nStripsNoStack.push_back(1787904);
00868 nStripsNoStack.push_back(565248);
00869 nStripsNoStack.push_back(3096576);
00870 nStripsNoStack.push_back(3866624);
00871 nStripsNoStack.push_back(516096);
00872 nStripsNoStack.push_back(663552);
00873 nStripsNoStack.push_back(276480);
00874 nStripsNoStack.push_back(331776);
00875 nStripsNoStack.push_back(94208);
00876 nStripsNoStack.push_back(94208);
00877 nStripsNoStack.push_back(94208);
00878 nStripsNoStack.push_back(94208);
00879 nStripsNoStack.push_back(94208);
00880 nStripsNoStack.push_back(94208);
00881 nStripsNoStack.push_back(516096);
00882 nStripsNoStack.push_back(589824);
00883 nStripsNoStack.push_back(331776);
00884 nStripsNoStack.push_back(368640);
00885 nStripsNoStack.push_back(608256);
00886 nStripsNoStack.push_back(681984);
00887 nStripsNoStack.push_back(253952);
00888 nStripsNoStack.push_back(253952);
00889 nStripsNoStack.push_back(253952);
00890 nStripsNoStack.push_back(217088);
00891 nStripsNoStack.push_back(217088);
00892 nStripsNoStack.push_back(217088);
00893 nStripsNoStack.push_back(180224);
00894 nStripsNoStack.push_back(180224);
00895 nStripsNoStack.push_back(159744);
00896 nStripsNoStack.push_back(253952);
00897 nStripsNoStack.push_back(253952);
00898 nStripsNoStack.push_back(253952);
00899 nStripsNoStack.push_back(217088);
00900 nStripsNoStack.push_back(217088);
00901 nStripsNoStack.push_back(217088);
00902 nStripsNoStack.push_back(180224);
00903 nStripsNoStack.push_back(180224);
00904 nStripsNoStack.push_back(159744);
00905
00906 for(unsigned int i = 0; i < tkParts.size(); i++)
00907 {
00908 modulesStackNormFactors[tkParts[i].c_str()] = nModulesStack[i];
00909 modulesNoStackNormFactors[tkParts[i].c_str()] = nModulesNoStack[i];
00910 fibersStackNormFactors[tkParts[i].c_str()] = nFibersStack[i];
00911 fibersNoStackNormFactors[tkParts[i].c_str()] = nFibersNoStack[i];
00912 APVsStackNormFactors[tkParts[i].c_str()] = nAPVsStack[i];
00913 APVsNoStackNormFactors[tkParts[i].c_str()] = nAPVsNoStack[i];
00914 stripsStackNormFactors[tkParts[i].c_str()] = nStripsStack[i];
00915 stripsNoStackNormFactors[tkParts[i].c_str()] = nStripsNoStack[i];
00916 }
00917
00918
00919
00920
00921
00922
00923
00924 }
00925
00926
00927
00928 double findNormFactor(const std::string currentPlotType, const std::string currentPart, const bool stackOption)
00929 {
00930
00931
00932
00933
00934 if(stackOption)
00935 {
00936 if(currentPlotType.compare("BadModules") == 0)
00937 {
00938 return modulesStackNormFactors[currentPart.c_str()];
00939 }
00940 else if(currentPlotType.compare("BadFibers") == 0)
00941 {
00942 return fibersStackNormFactors[currentPart];
00943 }
00944 else if(currentPlotType.compare("BadAPVs") == 0)
00945 {
00946 return APVsStackNormFactors[currentPart];
00947 }
00948 else if(currentPlotType.compare("AllBadStrips") == 0 ||
00949 currentPlotType.compare("BadStripsFromAPVs") == 0 ||
00950 currentPlotType.compare("BadStrips") == 0)
00951 {
00952 return stripsStackNormFactors[currentPart];
00953 }
00954 else
00955 {
00956 std::cout << "findNormFactor(): ERROR! Requested a non supported plot type: " << currentPlotType.c_str() << std::endl;
00957 std::cout << " Add this to the function body or correct the error\n";
00958 return 0;
00959 }
00960 }
00961 else
00962 {
00963 if(currentPlotType.compare("BadModules") == 0)
00964 {
00965 return modulesNoStackNormFactors[currentPart.c_str()];
00966 }
00967 else if(currentPlotType.compare("BadFibers") == 0)
00968 {
00969 return fibersNoStackNormFactors[currentPart];
00970 }
00971 else if(currentPlotType.compare("BadAPVs") == 0)
00972 {
00973 return APVsNoStackNormFactors[currentPart];
00974 }
00975 else if(currentPlotType.compare("BadStrips") == 0 ||
00976 currentPlotType.compare("BadStripsFromAPVs") == 0 ||
00977 currentPlotType.compare("AllBadStrips") == 0)
00978 {
00979 return stripsNoStackNormFactors[currentPart];
00980 }
00981 else
00982 {
00983 std::cout << "findNormFactor(): ERROR! Requested a non supported plot type: \"" << currentPlotType.c_str() << "\"\n";
00984 std::cout << " Add this to the function body or correct the error otherwise.\n";
00985 return 0;
00986 }
00987 }
00988 }