26 #include <boost/type_index.hpp> 27 #include <fmt/printf.h> 33 #include "TEfficiency.h" 34 #include "TGraphAsymmErrors.h" 40 #define LOGPRINT edm::LogPrint("SiStripHitEfficiencyHarvester") 70 std::unique_ptr<TrackerTopology>
tTopo_;
89 const std::array<long, bounds::k_END_OF_LAYERS>& layerTotal)
const;
92 unsigned int countTotalHits(
const std::vector<MonitorElement*>& maps);
97 bool doProfiles =
true)
const;
103 : inputFolder_(conf.getParameter<
std::
string>(
"inputFolder")),
104 isAtPCL_(conf.getParameter<
bool>(
"isAtPCL")),
105 autoIneffModTagging_(conf.getUntrackedParameter<
bool>(
"AutoIneffModTagging",
false)),
106 doStoreOnDB_(conf.getParameter<
bool>(
"doStoreOnDB")),
107 doStoreOnTree_(conf.getUntrackedParameter<
bool>(
"doStoreOnTree")),
108 showRings_(conf.getUntrackedParameter<
bool>(
"ShowRings",
false)),
109 showEndcapSides_(conf.getUntrackedParameter<
bool>(
"ShowEndcapSides",
true)),
110 showTOB6TEC9_(conf.getUntrackedParameter<
bool>(
"ShowTOB6TEC9",
false)),
111 showOnlyGoodModules_(conf.getUntrackedParameter<
bool>(
"ShowOnlyGoodModules",
false)),
112 nTEClayers_(showRings_ ? 7 : 9),
113 threshold_(conf.getParameter<double>(
"Threshold")),
114 nModsMin_(conf.getParameter<
int>(
"nModsMin")),
115 effPlotMin_(conf.getUntrackedParameter<double>(
"EffPlotMin", 0.9)),
116 tkMapMin_(conf.getUntrackedParameter<double>(
"TkMapMin", 0.9)),
117 title_(conf.getParameter<
std::
string>(
"Title")),
118 record_(conf.getParameter<
std::
string>(
"Record")),
124 for (
int l = 0;
l < bounds::k_END_OF_LAYS_AND_RINGS;
l++) {
144 for (
const auto& det : tkGeom.detUnits()) {
145 if (dynamic_cast<const StripGeomDetUnit*>(det)) {
154 std::vector<bool> isThere;
155 isThere.reserve(maps.size());
156 std::transform(maps.begin() + 1, maps.end(), std::back_inserter(isThere), [](
auto&
x) {
return !(
x ==
nullptr); });
159 for (
const auto&
it : isThere) {
161 LogDebug(
"SiStripHitEfficiencyHarvester") <<
" layer: " <<
count <<
" " <<
it << std::endl;
163 LogDebug(
"SiStripHitEfficiencyHarvester") <<
"resolving to " << maps[
count]->getName() << std::endl;
167 bool areMapsAvailable{
true};
169 for (
const auto&
it : isThere) {
173 <<
type <<
" TkHistoMap for layer " << layerCount <<
" was not found.\n -> Aborting!";
174 areMapsAvailable =
false;
178 return areMapsAvailable;
190 if (!
fs.isAvailable()) {
192 <<
"please add it to config file";
197 tree =
fs->make<TTree>(
"ModEff",
"ModEff");
200 tree->Branch(
"FoundHits", &
t_found,
"FoundHits/i");
210 LOGPRINT <<
"A module is bad if the upper limit on the efficiency is < to the avg in the layer - " <<
threshold_ 211 <<
" and has at least " <<
nModsMin_ <<
" nModsMin.";
213 auto h_module_total = std::make_unique<TkHistoMap>(
tkDetMap_.get());
215 auto h_module_found = std::make_unique<TkHistoMap>(
tkDetMap_.get());
219 const auto& totalMaps = h_module_total->getAllMaps();
220 const auto& foundMaps = h_module_found->getAllMaps();
222 LogDebug(
"SiStripHitEfficiencyHarvester")
223 <<
"totalMaps.size(): " << totalMaps.size() <<
" foundMaps.size() " << foundMaps.size() << std::endl;
229 LogDebug(
"SiStripHitEfficiencyHarvester")
230 <<
"isTotalMapAvailable: " << isTotalMapAvailable <<
" isFoundMapAvailable " << isFoundMapAvailable << std::endl;
233 if (!isTotalMapAvailable
or !isFoundMapAvailable)
236 LogDebug(
"SiStripHitEfficiencyHarvester")
237 <<
"Entries in total TkHistoMap for layer 3: " << h_module_total->getMap(3)->getEntries() <<
", found " 238 << h_module_found->getMap(3)->getEntries();
244 for (
size_t i = 1;
i < totalMaps.size();
i++) {
245 h_module_total->getMap(
i)->setOption(
"colz");
246 h_module_found->getMap(
i)->setOption(
"colz");
252 std::vector<MonitorElement*> hEffInLayer(std::size_t(1),
nullptr);
253 hEffInLayer.reserve(bounds::k_END_OF_LAYERS);
254 for (std::size_t
i = 1;
i != bounds::k_END_OF_LAYERS; ++
i) {
256 hEffInLayer.push_back(booker.
book1D(
257 Form(
"eff_layer%i",
int(
i)), Form(
"Module efficiency in layer %s", lyrName.c_str()), 201, 0, 1.005));
259 std::array<long, bounds::k_END_OF_LAYERS> layerTotal{};
260 std::array<long, bounds::k_END_OF_LAYERS> layerFound{};
272 TrackerMap tkMapDen{
" Detector denominator "};
273 std::map<unsigned int, double> badModules;
280 "perModule_FEDErrors");
286 LogDebug(
"SiStripHitEfficiencyHarvester")
287 << __PRETTY_FUNCTION__ <<
" bad module from FEDError " << badId <<
"," <<
fraction << std::endl;
292 const auto num = h_module_found->getValue(det);
293 const auto denom = h_module_total->getValue(det);
298 hEffInLayer[
layer]->Fill(eff);
302 badModules[det] = eff;
303 tkMapBad.fillc(det, 255, 0, 0);
305 << det.rawId() <<
" efficiency: " << eff <<
" , " <<
num <<
"/" <<
denom;
308 tkMapBad.fillc(det, 255, 255, 255);
312 << det.rawId() <<
" efficiency: " << eff <<
" , " <<
num <<
"/" <<
denom;
316 << det.rawId() <<
" is under occupancy at " <<
denom;
334 for (
unsigned int i = 1;
i <= k_LayersAtTECEnd;
i++) {
336 hEffInLayer[
i]->getTH1()->GetXaxis()->SetRange(
337 3, hEffInLayer[
i]->getNbinsX() + 1);
338 const double layer_min_eff = hEffInLayer[
i]->getMean() -
std::max(2.5 * hEffInLayer[
i]->getRMS(),
threshold_);
339 LOGPRINT <<
"Layer " <<
i <<
" threshold for bad modules: <" << layer_min_eff
340 <<
" (layer mean: " << hEffInLayer[
i]->getMean() <<
" rms: " << hEffInLayer[
i]->getRMS() <<
")";
342 hEffInLayer[
i]->getTH1()->GetXaxis()->SetRange(1, hEffInLayer[
i]->getNbinsX() + 1);
345 const auto layer = ::checkLayer(det,
tTopo_.get());
347 const auto num = h_module_found->getValue(det);
348 const auto denom = h_module_total->getValue(det);
354 const auto eff_up = TEfficiency::Bayesian(
denom,
num, .99, 1, 1,
true);
358 badModules[det] = eff;
359 tkMapBad.fillc(det, 255, 0, 0);
365 tkMapBad.fillc(det, 255, 255, 255);
370 if (eff_up < layer_min_eff + 0.08) {
373 << det.rawId() <<
" efficiency: " << eff <<
" , " <<
num <<
"/" <<
denom 374 <<
" , upper limit: " << eff_up;
378 << det.rawId() <<
" layer " <<
layer <<
" is under occupancy at " <<
denom;
391 tkMap.fill(det, 1. - eff);
392 tkMapEff.fill(det, eff);
393 tkMapNum.fill(det,
num);
394 tkMapDen.fill(det,
denom);
401 if (
layer <= bounds::k_LayersAtTOBEnd) {
404 }
else if (
layer <= bounds::k_LayersAtTIDEnd) {
405 if (
tTopo_->tidSide(det) == 1) {
408 }
else if (
tTopo_->tidSide(det) == 2) {
412 }
else if (
layer <= bounds::k_LayersAtTECEnd) {
413 if (
tTopo_->tecSide(det) == 1) {
416 }
else if (
tTopo_->tecSide(det) == 2) {
424 if (
layer <= bounds::k_LayersAtTOBEnd) {
427 }
else if (
layer <= bounds::k_LayersAtTIDEnd) {
428 if (
tTopo_->tidSide(det) == 1) {
431 }
else if (
tTopo_->tidSide(det) == 2) {
435 }
else if (
layer <= bounds::k_LayersAtTECEnd) {
436 if (
tTopo_->tecSide(det) == 1) {
439 }
else if (
tTopo_->tecSide(det) == 2) {
450 tkMap.save(
true, 0, 0,
"SiStripHitEffTKMap_NEW.png");
451 tkMapBad.save(
true, 0, 0,
"SiStripHitEffTKMapBad_NEW.png");
452 tkMapEff.save(
true,
tkMapMin_, 1.,
"SiStripHitEffTKMapEff_NEW.png");
453 tkMapNum.save(
true, 0, 0,
"SiStripHitEffTKMapNum_NEW.png");
454 tkMapDen.save(
true, 0, 0,
"SiStripHitEffTKMapDen_NEW.png");
462 for (
const auto it : badModules) {
463 const auto det =
it.first;
464 std::vector<unsigned int> badStripList;
469 badStripList.push_back(pQuality.encode(0,
nStrips, 0));
471 LOGPRINT <<
"ID1 should match list of modules above " << det;
472 pQuality.compact(det, badStripList);
475 pQuality.fillBadComponents();
477 if (totalHits > 0u) {
481 << __PRETTY_FUNCTION__ <<
" There are no SiStrip hits for a valid measurement, skipping!";
484 edm::LogInfo(
"SiStripHitEfficiencyHarvester") <<
"Will not produce payload!";
500 const std::array<long, bounds::k_END_OF_LAYERS>& layerFound,
501 const std::array<long, bounds::k_END_OF_LAYERS>& layerTotal)
const {
506 int subdetfound[5] = {0, 0, 0, 0, 0};
507 int subdettotal[5] = {0, 0, 0, 0, 0};
509 for (
unsigned int i = 1;
i <= bounds::k_LayersAtTECEnd;
i++) {
510 layereff = double(layerFound[
i]) / double(layerTotal[
i]);
512 << layereff <<
" " << layerFound[
i] <<
"/" << layerTotal[
i];
513 totalfound += layerFound[
i];
514 totaltotal += layerTotal[
i];
515 if (
i <= bounds::k_LayersAtTIBEnd) {
516 subdetfound[1] += layerFound[
i];
517 subdettotal[1] += layerTotal[
i];
519 if (
i > bounds::k_LayersAtTIBEnd &&
i <= bounds::k_LayersAtTOBEnd) {
520 subdetfound[2] += layerFound[
i];
521 subdettotal[2] += layerTotal[
i];
523 if (
i > bounds::k_LayersAtTOBEnd &&
i <= bounds::k_LayersAtTIDEnd) {
524 subdetfound[3] += layerFound[
i];
525 subdettotal[3] += layerTotal[
i];
527 if (
i > bounds::k_LayersAtTIDEnd) {
528 subdetfound[4] += layerFound[
i];
529 subdettotal[4] += layerTotal[
i];
533 LOGPRINT <<
"The total efficiency is " << double(totalfound) / double(totaltotal);
534 LOGPRINT <<
" TIB: " << double(subdetfound[1]) / subdettotal[1] <<
" " << subdetfound[1] <<
"/" 536 LOGPRINT <<
" TOB: " << double(subdetfound[2]) / subdettotal[2] <<
" " << subdetfound[2] <<
"/" 538 LOGPRINT <<
" TID: " << double(subdetfound[3]) / subdettotal[3] <<
" " << subdetfound[3] <<
"/" 540 LOGPRINT <<
" TEC: " << double(subdetfound[4]) / subdettotal[4] <<
" " << subdetfound[4] <<
"/" 546 const auto pQdvBegin =
quality.getDataVectorBegin();
547 for (
auto rIt =
quality.getRegistryVectorBegin(); rIt !=
quality.getRegistryVectorEnd(); ++rIt) {
549 if (!pBadStrip.put(rIt->detid,
range))
550 edm::LogError(
"SiStripHitEfficiencyHarvester") <<
"detid already exists in SiStripBadStrip";
562 bool doProfiles)
const {
577 booker.
book1D(
"found_good",
"found hits per layer (good modules only)",
nLayers + 1, 0,
nLayers + 1);
579 booker.
book1D(
"all_good",
"all hits per layer (good modules only)",
nLayers + 1, 0,
nLayers + 1);
589 for (
unsigned int i = 1;
i <
nLayers + 2; ++
i) {
596 TCanvas* c7 =
new TCanvas(
"c7",
" test ", 10, 10, 800, 600);
600 unsigned int nLayers_max =
nLayers + 1;
603 for (
unsigned int i = 1;
i < nLayers_max; ++
i) {
620 for (
unsigned int i = 11;
i < 14; ++
i) {
635 LOGPRINT <<
"Fill only good modules layer " <<
i - 3
642 LOGPRINT <<
"Filling all modules layer " <<
i - 3
652 found_good->
getTH1F()->Sumw2();
661 booker.
book1D(
"eff_good",
"Strip hit efficiency for good modules",
nLayers + 1, 0,
nLayers + 1);
665 TProfile* profile_all = ::computeEff(found_all->
getTH1F(), all_all->
getTH1F(),
"all");
667 profile_all->SetTitle(
"Strip hit efficiency for all modules");
668 booker.
bookProfile(profile_all->GetName(), profile_all);
670 TProfile* profile_good = ::computeEff(found_good->
getTH1F(), all_good->
getTH1F(),
"good");
672 profile_good->SetTitle(
"Strip hit efficiency for good modules");
673 booker.
bookProfile(profile_good->GetName(), profile_good);
693 const auto& effPair_all = ::computeCPEfficiency(num_all, den_all);
705 const auto& effPair_good = ::computeCPEfficiency(num_good, den_good);
720 if (!
fs.isAvailable()) {
722 <<
"please add it to config file";
725 TGraphAsymmErrors* gr = (*fs).make<TGraphAsymmErrors>(
nLayers + 1);
726 gr->SetName(
"eff_good");
729 TGraphAsymmErrors* gr2 = (*fs).make<TGraphAsymmErrors>(
nLayers + 1);
730 gr2->SetName(
"eff_all");
733 for (
unsigned int j = 0;
j <
nLayers + 1;
j++) {
734 gr->SetPointError(
j, 0., 0., gr->GetErrorYlow(
j), gr->GetErrorYhigh(
j));
735 gr2->SetPointError(
j, 0., 0., gr2->GetErrorYlow(
j), gr2->GetErrorYhigh(
j));
740 gr->GetXaxis()->SetLimits(0,
nLayers);
741 gr->SetMarkerColor(2);
742 gr->SetMarkerSize(1.2);
745 gr->SetMarkerStyle(20);
747 gr->SetMaximum(1.001);
748 gr->GetYaxis()->SetTitle(
"Efficiency");
749 gStyle->SetTitleFillColor(0);
750 gStyle->SetTitleBorderSize(0);
751 gr->SetTitle(
"SiStripHitEfficiency by Layer");
753 gr2->GetXaxis()->SetLimits(0,
nLayers);
754 gr2->SetMarkerColor(1);
755 gr2->SetMarkerSize(1.2);
756 gr2->SetLineColor(1);
757 gr2->SetLineWidth(4);
758 gr2->SetMarkerStyle(21);
760 gr2->SetMaximum(1.001);
761 gr2->GetYaxis()->SetTitle(
"Efficiency");
762 gr2->SetTitle(
"SiStripHitEfficiency by Layer");
765 gr->GetXaxis()->SetNdivisions(36);
768 TPad*
overlay =
new TPad(
"overlay",
"", 0, 0, 1, 1);
771 overlay->SetFrameFillStyle(4000);
777 TLegend* leg =
new TLegend(0.70, 0.27, 0.88, 0.40);
778 leg->AddEntry(gr,
"Good Modules",
"p");
780 leg->AddEntry(gr2,
"All Modules",
"p");
781 leg->SetTextSize(0.020);
782 leg->SetFillColor(0);
785 c7->SaveAs(
"Summary.png");
786 c7->SaveAs(
"Summary.root");
790 template <
typename T>
792 LogDebug(
"SiStripHitEfficiencyHarvester")
793 <<
"nLayers = " <<
nLayers <<
" number of bins, gr1: " << gr->GetXaxis()->GetNbins()
794 <<
" number of bins, gr2: " << gr2->GetXaxis()->GetNbins() <<
" showRings: " <<
showRings_ 796 << boost::typeindex::type_id<T>().pretty_name();
798 for (
unsigned int k = 1;
k <
nLayers + 1;
k++) {
814 if constexpr (std::is_same_v<T, TGraphAsymmErrors*>) {
816 <<
"class name: " << gr->ClassName() <<
" expected TGraphAsymErrors" << std::endl;
832 <<
"class name: " << gr->ClassName() <<
" expected TH1F" << std::endl;
835 gr->GetXaxis()->SetBinLabel(
bin,
label.data());
836 gr2->GetXaxis()->SetBinLabel(
bin,
label.data());
843 bool doProfiles)
const {
844 std::vector<MonitorElement*> effVsVariable;
847 const auto& folderString = ::projFolder[theProj];
848 const auto& foundHistoString = ::projFoundHisto[theProj];
849 const auto& totalHistoString = ::projTotalHisto[theProj];
850 const auto& titleString = ::projTitle[theProj];
851 const auto& titleXString = ::projXtitle[theProj];
853 LogDebug(
"SiStripHitEfficiencyHarvester")
854 <<
" inside" << __PRETTY_FUNCTION__ <<
" from " << ::projFolder[theProj] <<
" " << __LINE__ << std::endl;
856 for (
unsigned int iLayer = 1; iLayer != (
showRings_ ? 20 : 22); ++iLayer) {
857 LogDebug(
"SiStripHitEfficiencyHarvester")
858 <<
"iLayer " << iLayer <<
" " <<
fmt::format(
"{}/{}/{}{}",
inputFolder_, folderString, foundHistoString, iLayer)
865 if (hfound ==
nullptr or htotal ==
nullptr) {
866 if (hfound ==
nullptr)
869 if (htotal ==
nullptr)
877 if (!hfound->getTH1F()->GetSumw2())
878 hfound->getTH1F()->Sumw2();
879 if (!htotal->getTH1F()->GetSumw2())
880 htotal->getTH1F()->Sumw2();
883 for (
int i = 0;
i != hfound->getNbinsX() + 1; ++
i) {
884 if (hfound->getBinContent(
i) == 0)
885 hfound->setBinContent(
i, 1
e-6);
886 if (htotal->getBinContent(
i) == 0)
887 htotal->setBinContent(
i, 1);
889 LogDebug(
"SiStripHitEfficiencyHarvester") <<
"Total hits for layer " << iLayer <<
" (" << folderString
890 <<
"): " << htotal->getEntries() <<
", found " << hfound->getEntries();
893 effVsVariable[iLayer] = booker.
book1D(
894 fmt::sprintf(
"eff%sLayer%s", folderString, lyrName),
895 fmt::sprintf(
"Efficiency vs %s for layer %s;%s;SiStrip Hit efficiency", titleString, lyrName, titleXString),
897 hfound->getAxisMin(),
898 hfound->getAxisMax());
902 LogDebug(
"SiStripHitEfficiencyHarvester")
903 <<
" bin 0 " << hfound->getAxisMin() <<
" bin last: " << hfound->getAxisMax() << std::endl;
905 for (
int i = 0;
i != hfound->getNbinsX() + 1; ++
i) {
906 const auto& den = htotal->getBinContent(
i);
907 const auto&
num = hfound->getBinContent(
i);
911 const auto& effPair = ::computeCPEfficiency(
num, den);
912 effVsVariable[iLayer]->setBinContent(
i, effPair.value());
913 effVsVariable[iLayer]->setBinError(
i, effPair.error());
915 LogDebug(
"SiStripHitEfficiencyHarvester")
916 << __PRETTY_FUNCTION__ <<
" " << lyrName <<
" bin:" <<
i <<
" err:" << effPair.error() << std::endl;
921 effVsVariable[iLayer]->getTH1F()->SetMinimum(
tkMapMin_);
925 TProfile*
profile = ::computeEff(hfound->getTH1F(), htotal->getTH1F(), lyrName);
928 fmt::sprintf(
"Efficiency vs %s for layer %s;%s;SiStrip Hit efficiency", titleString, lyrName, titleXString);
943 std::stringstream ssV[4][19],
952 ssV[
i][
comp] <<
" \t " << ((bc.
BadApvs) & 0
x1) <<
" " << ((bc.BadApvs >> 1) & 0
x1) <<
" ";
954 ssV[
i][
comp] <<
"x x " << ((bc.BadApvs >> 2) & 0
x1) <<
" " << ((bc.BadApvs >> 3) & 0
x1);
956 ssV[
i][
comp] << ((bc.BadApvs >> 2) & 0
x1) <<
" " << ((bc.BadApvs >> 3) & 0
x1) <<
" " << ((bc.BadApvs >> 4) & 0
x1)
957 <<
" " << ((bc.BadApvs >> 5) & 0
x1) <<
" ";
960 nBad[
i][0][2] += ((bc.BadApvs >> 5) & 0
x1) + ((bc.BadApvs >> 4) & 0
x1) + ((bc.BadApvs >> 3) & 0
x1) +
961 ((bc.BadApvs >> 2) & 0
x1) + ((bc.BadApvs >> 1) & 0
x1) + ((bc.BadApvs) & 0
x1);
962 nBad[
i][
comp][2] += ((bc.BadApvs >> 5) & 0
x1) + ((bc.BadApvs >> 4) & 0
x1) + ((bc.BadApvs >> 3) & 0
x1) +
963 ((bc.BadApvs >> 2) & 0
x1) + ((bc.BadApvs >> 1) & 0
x1) + ((bc.BadApvs) & 0
x1);
966 nBad[
i][0][1] += ((bc.BadFibers >> 2) & 0
x1) + ((bc.BadFibers >> 1) & 0
x1) + ((bc.BadFibers) & 0
x1);
967 nBad[
i][
comp][1] += ((bc.BadFibers >> 2) & 0
x1) + ((bc.BadFibers >> 1) & 0
x1) + ((bc.BadFibers) & 0
x1);
982 int nBadComp[4][19][4];
986 std::stringstream ssV[4][19];
988 for (
int i = 0;
i < 4; ++
i) {
990 for (
int j = 0;
j < 19; ++
j) {
992 for (
int k = 0;
k < 4; ++
k)
993 nBadComp[
i][
j][
k] = 0;
997 for (
const auto& bc :
quality.getBadComponentList()) {
1002 nTkBadComp[1] += ((bc.BadFibers >> 2) & 0
x1) + ((bc.BadFibers >> 1) & 0
x1) + ((bc.BadFibers) & 0
x1);
1004 nTkBadComp[2] += ((bc.BadApvs >> 5) & 0
x1) + ((bc.BadApvs >> 4) & 0
x1) + ((bc.BadApvs >> 3) & 0
x1) +
1005 ((bc.BadApvs >> 2) & 0
x1) + ((bc.BadApvs >> 1) & 0
x1) + ((bc.BadApvs) & 0
x1);
1007 DetId det(bc.detid);
1039 for (
auto rp =
quality.getRegistryVectorBegin(); rp !=
quality.getRegistryVectorEnd(); ++rp) {
1040 DetId det{rp->detid};
1042 int component = -999;
1043 switch (det.subdetId()) {
1046 component =
tTopo_->tibLayer(det);
1050 component =
tTopo_->tidSide(det) == 2 ?
tTopo_->tidWheel(det) :
tTopo_->tidWheel(det) + 3;
1054 component =
tTopo_->tobLayer(det);
1058 component =
tTopo_->tecSide(det) == 2 ?
tTopo_->tecWheel(det) :
tTopo_->tecWheel(det) + 9;
1064 const auto pQdvBegin =
quality.getDataVectorBegin();
1066 float percentage = 0;
1067 for (
int it = 0;
it < sqrange.second - sqrange.first;
it++) {
1068 unsigned int range =
quality.decode(*(sqrange.first +
it)).range;
1069 nTkBadComp[3] +=
range;
1070 nBadComp[subdet][0][3] +=
range;
1071 nBadComp[subdet][component][3] +=
range;
1072 percentage +=
range;
1074 if (percentage != 0)
1077 edm::LogError(
"SiStripHitEfficiencyHarvester") <<
"PROBLEM detid " << det.rawId() <<
" value " << percentage;
1081 std::ostringstream
ss;
1082 ss <<
"\n-----------------\nGlobal Info\n-----------------";
1083 ss <<
"\nBadComp \t Modules \tFibers " 1084 "\tApvs\tStrips\n----------------------------------------------------------------";
1085 ss <<
"\nTracker:\t\t" << nTkBadComp[0] <<
"\t" << nTkBadComp[1] <<
"\t" << nTkBadComp[2] <<
"\t" << nTkBadComp[3];
1086 ss <<
"\nTIB:\t\t\t" << nBadComp[0][0][0] <<
"\t" << nBadComp[0][0][1] <<
"\t" << nBadComp[0][0][2] <<
"\t" 1087 << nBadComp[0][0][3];
1088 ss <<
"\nTID:\t\t\t" << nBadComp[1][0][0] <<
"\t" << nBadComp[1][0][1] <<
"\t" << nBadComp[1][0][2] <<
"\t" 1089 << nBadComp[1][0][3];
1090 ss <<
"\nTOB:\t\t\t" << nBadComp[2][0][0] <<
"\t" << nBadComp[2][0][1] <<
"\t" << nBadComp[2][0][2] <<
"\t" 1091 << nBadComp[2][0][3];
1092 ss <<
"\nTEC:\t\t\t" << nBadComp[3][0][0] <<
"\t" << nBadComp[3][0][1] <<
"\t" << nBadComp[3][0][2] <<
"\t" 1093 << nBadComp[3][0][3];
1096 for (
int i = 1;
i < 5; ++
i)
1097 ss <<
"\nTIB Layer " <<
i <<
" :\t\t" << nBadComp[0][
i][0] <<
"\t" << nBadComp[0][
i][1] <<
"\t" << nBadComp[0][
i][2]
1098 <<
"\t" << nBadComp[0][
i][3];
1100 for (
int i = 1;
i < 4; ++
i)
1101 ss <<
"\nTID+ Disk " <<
i <<
" :\t\t" << nBadComp[1][
i][0] <<
"\t" << nBadComp[1][
i][1] <<
"\t" << nBadComp[1][
i][2]
1102 <<
"\t" << nBadComp[1][
i][3];
1103 for (
int i = 4;
i < 7; ++
i)
1104 ss <<
"\nTID- Disk " <<
i - 3 <<
" :\t\t" << nBadComp[1][
i][0] <<
"\t" << nBadComp[1][
i][1] <<
"\t" 1105 << nBadComp[1][
i][2] <<
"\t" << nBadComp[1][
i][3];
1107 for (
int i = 1;
i < 7; ++
i)
1108 ss <<
"\nTOB Layer " <<
i <<
" :\t\t" << nBadComp[2][
i][0] <<
"\t" << nBadComp[2][
i][1] <<
"\t" << nBadComp[2][
i][2]
1109 <<
"\t" << nBadComp[2][
i][3];
1111 for (
int i = 1;
i < 10; ++
i)
1112 ss <<
"\nTEC+ Disk " <<
i <<
" :\t\t" << nBadComp[3][
i][0] <<
"\t" << nBadComp[3][
i][1] <<
"\t" << nBadComp[3][
i][2]
1113 <<
"\t" << nBadComp[3][
i][3];
1114 for (
int i = 10;
i < 19; ++
i)
1115 ss <<
"\nTEC- Disk " <<
i - 9 <<
" :\t\t" << nBadComp[3][
i][0] <<
"\t" << nBadComp[3][
i][1] <<
"\t" 1116 << nBadComp[3][
i][2] <<
"\t" << nBadComp[3][
i][3];
1119 ss <<
"\n----------------------------------------------------------------\n\t\t Detid \tModules Fibers " 1120 "Apvs\n----------------------------------------------------------------";
1121 for (
int i = 1;
i < 5; ++
i)
1122 ss <<
"\nTIB Layer " <<
i <<
" :" << ssV[0][
i].
str();
1124 for (
int i = 1;
i < 4; ++
i)
1125 ss <<
"\nTID+ Disk " <<
i <<
" :" << ssV[1][
i].
str();
1126 for (
int i = 4;
i < 7; ++
i)
1127 ss <<
"\nTID- Disk " <<
i - 3 <<
" :" << ssV[1][
i].
str();
1129 for (
int i = 1;
i < 7; ++
i)
1130 ss <<
"\nTOB Layer " <<
i <<
" :" << ssV[2][
i].
str();
1132 for (
int i = 1;
i < 10; ++
i)
1133 ss <<
"\nTEC+ Disk " <<
i <<
" :" << ssV[3][
i].
str();
1134 for (
int i = 10;
i < 19; ++
i)
1135 ss <<
"\nTEC- Disk " <<
i - 9 <<
" :" << ssV[3][
i].
str();
1140 std::ofstream badModules;
1141 badModules.open(
"BadModules_NEW.log");
1142 badModules <<
"\n----------------------------------------------------------------\n\t\t Detid \tModules Fibers " 1143 "Apvs\n----------------------------------------------------------------";
1144 for (
int i = 1;
i < 5; ++
i)
1145 badModules <<
"\nTIB Layer " <<
i <<
" :" << ssV[0][
i].
str();
1147 for (
int i = 1;
i < 4; ++
i)
1148 badModules <<
"\nTID+ Disk " <<
i <<
" :" << ssV[1][
i].
str();
1149 for (
int i = 4;
i < 7; ++
i)
1150 badModules <<
"\nTID- Disk " <<
i - 3 <<
" :" << ssV[1][
i].
str();
1152 for (
int i = 1;
i < 7; ++
i)
1153 badModules <<
"\nTOB Layer " <<
i <<
" :" << ssV[2][
i].
str();
1155 for (
int i = 1;
i < 10; ++
i)
1156 badModules <<
"\nTEC+ Disk " <<
i <<
" :" << ssV[3][
i].
str();
1157 for (
int i = 10;
i < 19; ++
i)
1158 badModules <<
"\nTEC- Disk " <<
i - 9 <<
" :" << ssV[3][
i].
str();
1164 desc.add<
std::string>(
"inputFolder",
"AlCaReco/SiStripHitEfficiency");
1165 desc.add<
bool>(
"isAtPCL",
false);
1166 desc.add<
bool>(
"doStoreOnDB",
false);
1168 desc.add<
double>(
"Threshold", 0.1);
1170 desc.add<
int>(
"nModsMin", 5);
1171 desc.addUntracked<
bool>(
"doStoreOnTree",
false);
1172 desc.addUntracked<
bool>(
"AutoIneffModTagging",
false);
1173 desc.addUntracked<
double>(
"TkMapMin", 0.9);
1174 desc.addUntracked<
double>(
"EffPlotMin", 0.9);
1175 desc.addUntracked<
bool>(
"ShowRings",
false);
1176 desc.addUntracked<
bool>(
"ShowEndcapSides",
true);
1177 desc.addUntracked<
bool>(
"ShowTOB6TEC9",
false);
1178 desc.addUntracked<
bool>(
"ShowOnlyGoodModules",
false);
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
const bool doStoreOnTree_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
void setEffBinLabels(const T gr, const T gr2, const unsigned int nLayers) const
void makeSummary(DQMStore::IGetter &getter, DQMStore::IBooker &booker, bool doProfiles=false) const
int goodlayerfound[bounds::k_END_OF_LAYS_AND_RINGS]
int goodlayertotal[bounds::k_END_OF_LAYS_AND_RINGS]
virtual void setCurrentFolder(std::string const &fullpath)
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
std::unique_ptr< TrackerTopology > tTopo_
void endRun(edm::Run const &, edm::EventSetup const &) override
int alllayertotal[bounds::k_END_OF_LAYS_AND_RINGS]
virtual void setOption(const char *option)
void printAndWriteBadModules(const SiStripQuality &quality, const SiStripDetInfo &detInfo) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const bool autoIneffModTagging_
Log< level::Error, false > LogError
std::unordered_map< uint32_t, int > fedErrorCounts
const bool showEndcapSides_
const edm::ESGetToken< SiStripQuality, SiStripQualityRcd > stripQualityToken_
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
std::unique_ptr< TkHistoMap > FEDErrorOccupancy
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
def overlay(hists, ytitle, header, addon)
std::unique_ptr< TkDetMap > tkDetMap_
cond::Time_t currentTime() const
std::vector< DetId > stripDetIds_
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
const bool checkFedError(const DetId det)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
void printTotalStatistics(const std::array< long, bounds::k_END_OF_LAYERS > &layerFound, const std::array< long, bounds::k_END_OF_LAYERS > &layerTotal) const
unsigned int countTotalHits(const std::vector< MonitorElement *> &maps)
void writeBadStripPayload(const SiStripQuality &quality) const
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
#define DEFINE_FWK_MODULE(type)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
SiStripDetInfo read(std::string filePath)
Log< level::Warning, true > LogPrint
SiStripHitEfficiencyHarvester(const edm::ParameterSet &)
Log< level::Info, false > LogInfo
void setBadComponents(int i, int component, const SiStripQuality::BadComponent &BC, int NBadComponent[4][19][4])
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
void fillMapFromTkMap(const int nevents, const float threshold, const std::vector< DetId > &stripDetIds)
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
Constants and enumerated types for FED/FEC systems.
virtual TH1F * getTH1F() const
virtual MonitorElement * get(std::string const &fullpath) const
~SiStripHitEfficiencyHarvester() override=default
const unsigned int nTEClayers_
const std::string inputFolder_
const bool showOnlyGoodModules_
static const uint16_t STRIPS_PER_APV
std::pair< ContainerIterator, ContainerIterator > Range
std::unique_ptr< SiStripQuality > stripQuality_
int alllayerfound[bounds::k_END_OF_LAYS_AND_RINGS]
virtual int getNbinsX() const
get # of bins in X-axis
static constexpr char const *const kDefaultFile
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
const edm::ESGetToken< TkDetMap, TrackerTopologyRcd > tkDetMapToken_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
bool checkMapsValidity(const std::vector< MonitorElement *> &maps, const std::string &type) const
void makeSummaryVsVariable(DQMStore::IGetter &getter, DQMStore::IBooker &booker, ::projections theProj, bool doProfiles=true) const
const std::string record_
virtual double getBinContent(int binx) const
get content of bin (1-D)
SiStripHitEffData calibData_