27 tkDetMap_ = tkDetMapHandle.
product();
46 trackerMap_ = std::make_unique<TrackerMap>(tkmapPset, fedcabling, tTopo);
47 std::string tmap_title =
" Tracker Map from " + map_type;
58 if (map_type ==
"QTestAlarm") {
78 edm::LogError(
"SiStripTopLevelDirNotFound") <<
"I cannot find the SiStrip top level directory in the DQM file";
81 stripTopLevelDir_ = mechanicalview_dir.substr(0, mechanicalview_dir.find_last_of(
"/"));
96 trackerMap_ = std::make_unique<TrackerMap>(tkmapPset, fedcabling, tTopo);
107 std::stringstream
ss;
113 tmap_title =
" Run: " +
sRunNumber +
", Tracker Map from " + map_type;
115 tmap_title =
" Tracker Map from " + map_type;
119 if (tkmapPset.
exists(
"TopModules"))
124 if (tkmapPset.
exists(
"numberTopModules"))
129 if (tkmapPset.
exists(
"topModLabel"))
134 if (map_type ==
"QTestAlarm") {
144 if (tkmapPset.
exists(
"mapMax"))
146 if (tkmapPset.
exists(
"mapMin"))
149 if (map_type ==
"ResidualsMean") {
152 edm::LogInfo(
"TkMapToBeSaved") <<
"Ready to save TkMap " << map_type << namesuffix <<
" with range set to "
154 trackerMap_->save(
true, 0.0000000001, 0.005, map_type + namesuffix +
".svg");
155 trackerMap_->save(
true, 0.0000000001, 0.005, map_type + namesuffix +
".png", 4500, 2400);
157 map_type =
"ResidualsRMS";
159 tmap_title =
" Run: " +
sRunNumber +
", Tracker Map from " + map_type;
161 tmap_title =
" Tracker Map from " + map_type;
165 edm::LogInfo(
"TkMapToBeSaved") <<
"Ready to save TkMap " << map_type << namesuffix
166 <<
" with range set to 0.0 - 1.0";
167 trackerMap_->save(
true, 0.0, 1.0, map_type + namesuffix +
".svg");
168 trackerMap_->save(
true, 0.0, 1.0, map_type + namesuffix +
".png", 4500, 2400);
170 edm::LogInfo(
"TkMapToBeSaved") <<
"Ready to save TkMap " << map_type << namesuffix <<
" with range set to "
177 edm::LogInfo(
"PSUMapToBeSaved") <<
"Ready to save PSU TkMap " << map_type << namesuffix <<
" with range set to "
183 edm::LogInfo(
"FEDMapToBeSaved") <<
"Ready to save FED TkMap " << map_type << namesuffix <<
" with range set to "
211 std::map<unsigned int, std::string> badmodmap;
214 uint32_t detId_save = 0;
217 uint32_t detId =
module.first;
218 if (detId == 0 || detId == 0xFFFFFFFF)
220 if (detId_save != detId) {
226 <<
"The detid " << detId <<
" was found already in the loop on SiStripDetCabling";
239 std::map<unsigned int, std::string>& badmodmap) {
244 int rval, gval, bval;
255 if (
flag != 0 || isBad) {
257 std::string layer =
" Layer " + std::to_string(lay);
258 badmodmap[det_id] =
comment.str() + layer;
276 std::vector<std::string> subdet_folder;
277 subdet_folder.push_back(
"TIB");
278 subdet_folder.push_back(
"TOB");
279 subdet_folder.push_back(
"TEC/MINUS");
280 subdet_folder.push_back(
"TEC/PLUS");
281 subdet_folder.push_back(
"TID/MINUS");
282 subdet_folder.push_back(
"TID/PLUS");
288 auto topNmodVec =
topModules_ ?
new std::vector<std::pair<float, uint32_t>>{} :
nullptr;
289 for (
auto const&
sd : subdet_folder) {
294 std::vector<std::string> layerVec = dqm_store.
getSubdirs();
295 for (
auto const& layer : layerVec) {
296 if (layer.find(
"BadModuleList") != std::string::npos)
298 std::vector<MonitorElement*> meVec = dqm_store.
getContents(layer);
301 for (
auto tkh : meVec) {
302 name = tkh->getName();
303 if (
name.find(
"TkHMap") == std::string::npos)
305 if (htype ==
"QTestAlarm") {
306 edm::LogError(
"ItShouldNotBeHere") <<
"QTestAlarm map: you should not be here!";
309 }
else if (
name.find(htype) != std::string::npos) {
314 if (tkhmap_me !=
nullptr) {
318 dqm_store.
cd(mechanicalview_dir);
327 std::vector<std::pair<float, uint32_t>>* topNmodVec) {
330 lname = lname.substr(lname.find(
"_T") + 1);
332 if (det_id.rawId() <= 0)
337 if (
name.find(
"Residuals") != std::string::npos) {
340 TProfile2D*
tp =
me->getTProfile2D();
342 tp->GetBinError(xyval.
ix, xyval.
iy) *
sqrt(
tp->GetBinEntries(
tp->GetBin(xyval.
ix, xyval.
iy)));
346 float fval_prov =
me->getBinContent(xyval.
ix, xyval.
iy);
350 fval =
me->getBinContent(xyval.
ix, xyval.
iy);
351 if (htype ==
"QTestAlarm") {
352 edm::LogError(
"ItShouldNotBeHere") <<
"QTestAlarm map: you should not be here!";
359 topNmodVec->emplace_back(fval, det_id);
370 uint32_t
const det_id,
373 comment <<
"Module " << det_id;
379 constexpr std::size_t indent_width{7ull};
381 for (
auto const conn : conns) {
383 comment << std::setw(3) <<
conn->fedId() <<
"/" << std::setw(2) <<
conn->fedCh() <<
" ";
390 }
else if (conns.size() == 1) {
392 }
else if (conns.size() == 2) {
409 if (dqm_store->
dirExists(subdet_folder)) {
410 badmodule_folder = subdet_folder +
"/BadModuleList";
411 LogDebug(
"SearchBadModule") << subdet_folder <<
" exists: " << badmodule_folder;
413 edm::LogError(
"SubDetFolderNotFound") << subdet_folder <<
" does not exist for detid " << det_id;
416 if (!dqm_store->
dirExists(badmodule_folder)) {
417 LogDebug(
"BadModuleFolderNotFound") << badmodule_folder <<
" does not exist for detid " << det_id;
420 std::ostringstream badmodule_path;
421 badmodule_path << badmodule_folder <<
"/" << det_id;
422 LogDebug(
"SearchBadModule") << badmodule_folder <<
" exists: " << badmodule_path.str();
424 auto const* bad_module_me = dqm_store->
get(badmodule_path.str());
426 LogDebug(
"SearchBadModule") <<
"Monitor Element found";
427 flag = bad_module_me->getIntValue();
440 std::map<std::string, float> tkhmap_value;
441 int qtalarm_flag = 0;
445 edm::LogError(
"SiStripTrackerMapCreator::createInfoFile") <<
"Tree not found!";
447 tkinfo_tree->Branch(
"DetId", &det_id,
"DetId/i");
448 for (
auto const& mapname : map_names) {
449 if (mapname ==
"QTestAlarm") {
451 tkinfo_tree->Branch(mapname.c_str(), &qtalarm_flag,
std::string(mapname +
"/I").c_str());
453 tkhmap_value[mapname] = -1.0;
454 tkinfo_tree->Branch(mapname.c_str(), &tkhmap_value[mapname],
std::string(mapname +
"/F").c_str());
464 <<
"I cannot find the SiStrip top level directory in the DQM file";
467 dirname = mechanicalview_dir.substr(0, mechanicalview_dir.find_last_of(
"/"));
468 edm::LogInfo(
"SiStripTrackerMapCreator::createInfoFile") <<
"SiStrip top level directory is " <<
dirname;
472 std::vector<TkHistoMap> tkHMaps;
474 uint32_t nHists = map_names.size();
476 for (uint32_t ih = 0; ih < nHists; ++ih) {
478 if (map_names.at(ih) !=
"QTestAlarm") {
479 std::string tkhmap_name =
"TkHMap_" + map_names.at(ih);
480 tkHMaps.at(ih).loadTkHistoMap(
dirname, tkhmap_name,
true);
487 for (
auto const id : detidList) {
489 for (uint32_t ih = 0; ih < nHists; ++ih) {
490 if (map_names.at(ih) ==
"QTestAlarm") {
493 tkhmap_value[map_names.at(ih)] = tkHMaps.at(ih).getValue(
id);
497 edm::LogError(
"SiStripTrackerMapCreator::createInfoFile") <<
"Tree not found!";
514 bool tibDone =
false, tidSide1Done =
false, tidSide2Done =
false, tobDone =
false, tecSide1Done =
false,
515 tecSide2Done =
false;
516 constexpr
unsigned int tibFirst = 369120277 - 1, tidSide1First = 402664197 - 1, tidSide2First = 402672389 - 1,
517 tobFirst = 436228134 - 1, tecSide1First = 470044965 - 1, tecSide2First = 470307109 - 1;
519 int ntib = 0, ntids1 = 0, ntids2 = 0, ntob = 0, ntecs1 = 0, ntecs2 = 0;
521 for (
auto const& badmod : badmodmap) {
526 if (tTopo->
tidSide(ssdetid) == 1)
528 if (tTopo->
tidSide(ssdetid) == 2)
534 if (tTopo->
tecSide(ssdetid) == 1)
536 if (tTopo->
tecSide(ssdetid) == 2)
542 edm::LogVerbatim(
"BadModuleList") <<
"--------------------------------------------------------------";
554 for (
auto const& badmod : badmodmap) {
555 if (!tibDone && badmod.first >= tibFirst) {
561 if (!tidSide1Done && badmod.first >= tidSide1First) {
567 if (!tidSide2Done && badmod.first >= tidSide2First) {
573 if (!tobDone && badmod.first >= tobFirst) {
579 if (!tecSide1Done && badmod.first >= tecSide1First) {
585 if (!tecSide2Done && badmod.first >= tecSide2First) {
602 if (topNmodVec.empty())
605 std::sort(topNmodVec.rbegin(), topNmodVec.rend());
610 edm::LogVerbatim(
"TopModules") <<
"------------------------------------------------------";
612 for (
auto const& aPair : topNmodVec) {
613 uint32_t det_id = aPair.second;
620 if (tTopo->
tidSide(ssdetid) == 1)
622 if (tTopo->
tidSide(ssdetid) == 2)
628 if (tTopo->
tecSide(ssdetid) == 1)
630 if (tTopo->
tecSide(ssdetid) == 2)
637 edm::LogVerbatim(
"TopModules") <<
"------------------------------------------------------";
646 if (map_type.find(
"FractionOfBadChannels") != std::string::npos)
648 else if (map_type.find(
"NumberOfCluster") != std::string::npos)
650 else if (map_type.find(
"NumberOfDigi") != std::string::npos)
652 else if (map_type.find(
"NumberOfOffTrackCluster") != std::string::npos)
654 else if (map_type.find(
"NumberOfOnTrackCluster") != std::string::npos)
656 else if (map_type.find(
"StoNCorrOnTrack") != std::string::npos)