25 : detCabling_(detCabling), tkDetMap_(tkDetMap), tTopo_(tTopo) {}
39 std::string tmap_title =
" Tracker Map from " + map_type;
48 if (map_type ==
"QTestAlarm") {
68 edm::LogError(
"SiStripTopLevelDirNotFound") <<
"I cannot find the SiStrip top level directory in the DQM file";
71 stripTopLevelDir_ = mechanicalview_dir.substr(0, mechanicalview_dir.find_last_of(
'/'));
97 tmap_title =
" Run: " +
sRunNumber +
", Tracker Map from " + map_type;
99 tmap_title =
" Tracker Map from " + map_type;
103 if (tkmapPset.
exists(
"TopModules"))
108 if (tkmapPset.
exists(
"numberTopModules"))
113 if (tkmapPset.
exists(
"topModLabel"))
118 if (map_type ==
"QTestAlarm") {
128 if (tkmapPset.
exists(
"mapMax"))
130 if (tkmapPset.
exists(
"mapMin"))
133 if (map_type ==
"ResidualsMean") {
136 edm::LogInfo(
"TkMapToBeSaved") <<
"Ready to save TkMap " << map_type << namesuffix <<
" with range set to "
138 trackerMap_->save(
true, 0.0000000001, 0.005, map_type + namesuffix +
".svg");
139 trackerMap_->save(
true, 0.0000000001, 0.005, map_type + namesuffix +
".png", 4500, 2400);
141 map_type =
"ResidualsRMS";
143 tmap_title =
" Run: " +
sRunNumber +
", Tracker Map from " + map_type;
145 tmap_title =
" Tracker Map from " + map_type;
149 edm::LogInfo(
"TkMapToBeSaved") <<
"Ready to save TkMap " << map_type << namesuffix
150 <<
" with range set to 0.0 - 1.0";
151 trackerMap_->save(
true, 0.0, 1.0, map_type + namesuffix +
".svg");
152 trackerMap_->save(
true, 0.0, 1.0, map_type + namesuffix +
".png", 4500, 2400);
155 map_type =
"ResidualsMean";
157 edm::LogInfo(
"TkMapToBeSaved") <<
"Ready to save TkMap " << map_type << namesuffix <<
" with range set to "
164 edm::LogInfo(
"PSUMapToBeSaved") <<
"Ready to save PSU TkMap " << map_type << namesuffix <<
" with range set to "
170 edm::LogInfo(
"FEDMapToBeSaved") <<
"Ready to save FED TkMap " << map_type << namesuffix <<
" with range set to "
187 std::map<unsigned int, std::string> badmodmap;
190 uint32_t detId_save = 0;
193 uint32_t detId =
module.first;
194 if (detId == 0 || detId == 0xFFFFFFFF)
196 if (detId_save != detId) {
198 bool isBad = stripQuality && stripQuality->
IsModuleBad(detId);
202 <<
"The detid " << detId <<
" was found already in the loop on SiStripDetCabling";
214 std::map<unsigned int, std::string>& badmodmap) {
215 std::ostringstream comment;
219 int rval, gval, bval;
225 comment <<
" PCLBadModule ";
230 if (
flag != 0 || isBad) {
233 badmodmap[det_id] = comment.str() +
layer;
249 std::vector<std::string> subdet_folder;
250 subdet_folder.push_back(
"TIB");
251 subdet_folder.push_back(
"TOB");
252 subdet_folder.push_back(
"TEC/MINUS");
253 subdet_folder.push_back(
"TEC/PLUS");
254 subdet_folder.push_back(
"TID/MINUS");
255 subdet_folder.push_back(
"TID/PLUS");
261 auto topNmodVec =
topModules_ ?
new std::vector<std::pair<float, uint32_t>>{} :
nullptr;
262 for (
auto const&
sd : subdet_folder) {
267 std::vector<std::string> layerVec = dqm_store.
getSubdirs();
268 for (
auto const&
layer : layerVec) {
269 if (
layer.find(
"BadModuleList") != std::string::npos)
274 for (
auto tkh : meVec) {
275 name = tkh->getName();
276 if (
name.find(
"TkHMap") == std::string::npos)
278 if (htype ==
"QTestAlarm") {
279 edm::LogError(
"ItShouldNotBeHere") <<
"QTestAlarm map: you should not be here!";
282 }
else if (
name.find(htype) != std::string::npos) {
287 if (tkhmap_me !=
nullptr) {
291 dqm_store.
cd(mechanicalview_dir);
300 std::vector<std::pair<float, uint32_t>>* topNmodVec) {
303 lname = lname.substr(lname.find(
"_T") + 1);
305 if (det_id.rawId() <= 0)
310 if (
name.find(
"Residuals") != std::string::npos) {
313 TProfile2D*
tp =
me->getTProfile2D();
315 tp->GetBinError(xyval.
ix, xyval.
iy) *
sqrt(
tp->GetBinEntries(
tp->GetBin(xyval.
ix, xyval.
iy)));
319 float fval_prov =
me->getBinContent(xyval.
ix, xyval.
iy);
323 fval =
me->getBinContent(xyval.
ix, xyval.
iy);
324 if (htype ==
"QTestAlarm") {
325 edm::LogError(
"ItShouldNotBeHere") <<
"QTestAlarm map: you should not be here!";
332 topNmodVec->emplace_back(fval, det_id);
343 uint32_t
const det_id,
344 std::ostringstream& comment) {
345 comment <<
"Module " << det_id;
350 comment <<
" FEDCHs ";
351 constexpr std::size_t indent_width{7ull};
353 for (
auto const conn : conns) {
355 comment << std::setw(3) <<
conn->fedId() <<
"/" << std::setw(2) <<
conn->fedCh() <<
" ";
362 }
else if (conns.size() == 1) {
364 }
else if (conns.size() == 2) {
381 if (dqm_store->
dirExists(subdet_folder)) {
382 badmodule_folder = subdet_folder +
"/BadModuleList";
383 LogDebug(
"SearchBadModule") << subdet_folder <<
" exists: " << badmodule_folder;
385 edm::LogError(
"SubDetFolderNotFound") << subdet_folder <<
" does not exist for detid " << det_id;
388 if (!dqm_store->
dirExists(badmodule_folder)) {
389 LogDebug(
"BadModuleFolderNotFound") << badmodule_folder <<
" does not exist for detid " << det_id;
392 std::ostringstream badmodule_path;
393 badmodule_path << badmodule_folder <<
"/" << det_id;
394 LogDebug(
"SearchBadModule") << badmodule_folder <<
" exists: " << badmodule_path.str();
396 auto const* bad_module_me = dqm_store->
get(badmodule_path.str());
398 LogDebug(
"SearchBadModule") <<
"Monitor Element found";
399 flag = bad_module_me->getIntValue();
402 comment << message.c_str();
413 std::map<std::string, float> tkhmap_value;
414 int qtalarm_flag = 0;
418 edm::LogError(
"SiStripTrackerMapCreator::createInfoFile") <<
"Tree not found!";
420 tkinfo_tree->Branch(
"DetId", &det_id,
"DetId/i");
421 for (
auto const& mapname : map_names) {
422 if (mapname ==
"QTestAlarm") {
424 tkinfo_tree->Branch(mapname.c_str(), &qtalarm_flag,
std::string(mapname +
"/I").c_str());
426 tkhmap_value[mapname] = -1.0;
427 tkinfo_tree->Branch(mapname.c_str(), &tkhmap_value[mapname],
std::string(mapname +
"/F").c_str());
437 <<
"I cannot find the SiStrip top level directory in the DQM file";
440 dirname = mechanicalview_dir.substr(0, mechanicalview_dir.find_last_of(
'/'));
441 edm::LogInfo(
"SiStripTrackerMapCreator::createInfoFile") <<
"SiStrip top level directory is " <<
dirname;
445 std::vector<TkHistoMap> tkHMaps;
447 uint32_t nHists = map_names.size();
449 for (uint32_t ih = 0; ih < nHists; ++ih) {
451 if (map_names.at(ih) !=
"QTestAlarm") {
452 std::string tkhmap_name =
"TkHMap_" + map_names.at(ih);
453 tkHMaps.at(ih).loadTkHistoMap(
dirname, tkhmap_name,
true);
458 for (
auto const id : detidList) {
460 for (uint32_t ih = 0; ih < nHists; ++ih) {
461 if (map_names.at(ih) ==
"QTestAlarm") {
464 tkhmap_value[map_names.at(ih)] = tkHMaps.at(ih).getValue(
id);
468 edm::LogError(
"SiStripTrackerMapCreator::createInfoFile") <<
"Tree not found!";
480 bool tibDone =
false, tidSide1Done =
false, tidSide2Done =
false, tobDone =
false, tecSide1Done =
false,
481 tecSide2Done =
false;
482 constexpr
unsigned int tibFirst = 369120277 - 1, tidSide1First = 402664197 - 1, tidSide2First = 402672389 - 1,
483 tobFirst = 436228134 - 1, tecSide1First = 470044965 - 1, tecSide2First = 470307109 - 1;
485 int ntib = 0, ntids1 = 0, ntids2 = 0, ntob = 0, ntecs1 = 0, ntecs2 = 0;
487 for (
auto const& badmod : badmodmap) {
508 edm::LogVerbatim(
"BadModuleList") <<
"--------------------------------------------------------------";
520 for (
auto const& badmod : badmodmap) {
521 if (!tibDone && badmod.first >= tibFirst) {
527 if (!tidSide1Done && badmod.first >= tidSide1First) {
533 if (!tidSide2Done && badmod.first >= tidSide2First) {
539 if (!tobDone && badmod.first >= tobFirst) {
545 if (!tecSide1Done && badmod.first >= tecSide1First) {
551 if (!tecSide2Done && badmod.first >= tecSide2First) {
562 if (topNmodVec.empty())
565 std::sort(topNmodVec.rbegin(), topNmodVec.rend());
570 edm::LogVerbatim(
"TopModules") <<
"------------------------------------------------------";
572 for (
auto const& aPair : topNmodVec) {
573 uint32_t det_id = aPair.second;
574 std::ostringstream comment;
597 edm::LogVerbatim(
"TopModules") <<
"------------------------------------------------------";
606 if (map_type.find(
"FractionOfBadChannels") != std::string::npos)
608 else if (map_type.find(
"NumberOfCluster") != std::string::npos)
610 else if (map_type.find(
"NumberOfDigi") != std::string::npos)
612 else if (map_type.find(
"NumberOfOffTrackCluster") != std::string::npos)
614 else if (map_type.find(
"NumberOfOnTrackCluster") != std::string::npos)
616 else if (map_type.find(
"StoNCorrOnTrack") != std::string::npos)