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);
154 edm::LogInfo(
"TkMapToBeSaved") <<
"Ready to save TkMap " << map_type << namesuffix <<
" with range set to "
161 edm::LogInfo(
"PSUMapToBeSaved") <<
"Ready to save PSU TkMap " << map_type << namesuffix <<
" with range set to "
167 edm::LogInfo(
"FEDMapToBeSaved") <<
"Ready to save FED TkMap " << map_type << namesuffix <<
" with range set to "
184 std::map<unsigned int, std::string> badmodmap;
187 uint32_t detId_save = 0;
190 uint32_t detId = module.first;
191 if (detId == 0 || detId == 0xFFFFFFFF)
193 if (detId_save != detId) {
195 bool isBad = stripQuality && stripQuality->
IsModuleBad(detId);
199 <<
"The detid " << detId <<
" was found already in the loop on SiStripDetCabling";
211 std::map<unsigned int, std::string>& badmodmap) {
212 std::ostringstream comment;
216 int rval, gval, bval;
222 comment <<
" PCLBadModule ";
227 if (
flag != 0 || isBad) {
230 badmodmap[det_id] = comment.str() +
layer;
246 std::vector<std::string> subdet_folder;
247 subdet_folder.push_back(
"TIB");
248 subdet_folder.push_back(
"TOB");
249 subdet_folder.push_back(
"TEC/MINUS");
250 subdet_folder.push_back(
"TEC/PLUS");
251 subdet_folder.push_back(
"TID/MINUS");
252 subdet_folder.push_back(
"TID/PLUS");
258 auto topNmodVec =
topModules_ ?
new std::vector<std::pair<float, uint32_t>>{} :
nullptr;
259 for (
auto const&
sd : subdet_folder) {
264 std::vector<std::string> layerVec = dqm_store.
getSubdirs();
265 for (
auto const&
layer : layerVec) {
266 if (
layer.find(
"BadModuleList") != std::string::npos)
271 for (
auto tkh : meVec) {
272 name = tkh->getName();
273 if (
name.find(
"TkHMap") == std::string::npos)
275 if (htype ==
"QTestAlarm") {
276 edm::LogError(
"ItShouldNotBeHere") <<
"QTestAlarm map: you should not be here!";
279 }
else if (
name.find(htype) != std::string::npos) {
284 if (tkhmap_me !=
nullptr) {
288 dqm_store.
cd(mechanicalview_dir);
297 std::vector<std::pair<float, uint32_t>>* topNmodVec) {
300 lname = lname.substr(lname.find(
"_T") + 1);
302 if (det_id.rawId() <= 0)
307 if (
name.find(
"Residuals") != std::string::npos) {
310 TProfile2D*
tp =
me->getTProfile2D();
312 tp->GetBinError(xyval.
ix, xyval.
iy) *
sqrt(
tp->GetBinEntries(
tp->GetBin(xyval.
ix, xyval.
iy)));
316 float fval_prov =
me->getBinContent(xyval.
ix, xyval.
iy);
320 fval =
me->getBinContent(xyval.
ix, xyval.
iy);
321 if (htype ==
"QTestAlarm") {
322 edm::LogError(
"ItShouldNotBeHere") <<
"QTestAlarm map: you should not be here!";
329 topNmodVec->emplace_back(fval, det_id);
340 uint32_t
const det_id,
341 std::ostringstream& comment) {
342 comment <<
"Module " << det_id;
347 comment <<
" FEDCHs ";
348 constexpr std::size_t indent_width{7ull};
350 for (
auto const conn : conns) {
352 comment << std::setw(3) <<
conn->fedId() <<
"/" << std::setw(2) <<
conn->fedCh() <<
" ";
359 }
else if (conns.size() == 1) {
361 }
else if (conns.size() == 2) {
378 if (dqm_store->
dirExists(subdet_folder)) {
379 badmodule_folder = subdet_folder +
"/BadModuleList";
380 LogDebug(
"SearchBadModule") << subdet_folder <<
" exists: " << badmodule_folder;
382 edm::LogError(
"SubDetFolderNotFound") << subdet_folder <<
" does not exist for detid " << det_id;
385 if (!dqm_store->
dirExists(badmodule_folder)) {
386 LogDebug(
"BadModuleFolderNotFound") << badmodule_folder <<
" does not exist for detid " << det_id;
389 std::ostringstream badmodule_path;
390 badmodule_path << badmodule_folder <<
"/" << det_id;
391 LogDebug(
"SearchBadModule") << badmodule_folder <<
" exists: " << badmodule_path.str();
393 auto const* bad_module_me = dqm_store->
get(badmodule_path.str());
395 LogDebug(
"SearchBadModule") <<
"Monitor Element found";
396 flag = bad_module_me->getIntValue();
399 comment << message.c_str();
410 std::map<std::string, float> tkhmap_value;
411 int qtalarm_flag = 0;
415 edm::LogError(
"SiStripTrackerMapCreator::createInfoFile") <<
"Tree not found!";
417 tkinfo_tree->Branch(
"DetId", &det_id,
"DetId/i");
418 for (
auto const& mapname : map_names) {
419 if (mapname ==
"QTestAlarm") {
421 tkinfo_tree->Branch(mapname.c_str(), &qtalarm_flag,
std::string(mapname +
"/I").c_str());
423 tkhmap_value[mapname] = -1.0;
424 tkinfo_tree->Branch(mapname.c_str(), &tkhmap_value[mapname],
std::string(mapname +
"/F").c_str());
434 <<
"I cannot find the SiStrip top level directory in the DQM file";
437 dirname = mechanicalview_dir.substr(0, mechanicalview_dir.find_last_of(
'/'));
438 edm::LogInfo(
"SiStripTrackerMapCreator::createInfoFile") <<
"SiStrip top level directory is " <<
dirname;
442 std::vector<TkHistoMap> tkHMaps;
444 uint32_t nHists = map_names.size();
446 for (uint32_t ih = 0; ih < nHists; ++ih) {
448 if (map_names.at(ih) !=
"QTestAlarm") {
449 std::string tkhmap_name =
"TkHMap_" + map_names.at(ih);
450 tkHMaps.at(ih).loadTkHistoMap(
dirname, tkhmap_name,
true);
455 for (
auto const id : detidList) {
457 for (uint32_t ih = 0; ih < nHists; ++ih) {
458 if (map_names.at(ih) ==
"QTestAlarm") {
461 tkhmap_value[map_names.at(ih)] = tkHMaps.at(ih).getValue(
id);
465 edm::LogError(
"SiStripTrackerMapCreator::createInfoFile") <<
"Tree not found!";
477 bool tibDone =
false, tidSide1Done =
false, tidSide2Done =
false, tobDone =
false, tecSide1Done =
false,
478 tecSide2Done =
false;
479 constexpr
unsigned int tibFirst = 369120277 - 1, tidSide1First = 402664197 - 1, tidSide2First = 402672389 - 1,
480 tobFirst = 436228134 - 1, tecSide1First = 470044965 - 1, tecSide2First = 470307109 - 1;
482 int ntib = 0, ntids1 = 0, ntids2 = 0, ntob = 0, ntecs1 = 0, ntecs2 = 0;
484 for (
auto const& badmod : badmodmap) {
505 edm::LogVerbatim(
"BadModuleList") <<
"--------------------------------------------------------------";
517 for (
auto const& badmod : badmodmap) {
518 if (!tibDone && badmod.first >= tibFirst) {
524 if (!tidSide1Done && badmod.first >= tidSide1First) {
530 if (!tidSide2Done && badmod.first >= tidSide2First) {
536 if (!tobDone && badmod.first >= tobFirst) {
542 if (!tecSide1Done && badmod.first >= tecSide1First) {
548 if (!tecSide2Done && badmod.first >= tecSide2First) {
559 if (topNmodVec.empty())
562 std::sort(topNmodVec.rbegin(), topNmodVec.rend());
567 edm::LogVerbatim(
"TopModules") <<
"------------------------------------------------------";
569 for (
auto const& aPair : topNmodVec) {
570 uint32_t det_id = aPair.second;
571 std::ostringstream comment;
594 edm::LogVerbatim(
"TopModules") <<
"------------------------------------------------------";
603 if (map_type.find(
"FractionOfBadChannels") != std::string::npos)
605 else if (map_type.find(
"NumberOfCluster") != std::string::npos)
607 else if (map_type.find(
"NumberOfDigi") != std::string::npos)
609 else if (map_type.find(
"NumberOfOffTrackCluster") != std::string::npos)
611 else if (map_type.find(
"NumberOfOnTrackCluster") != std::string::npos)
613 else if (map_type.find(
"StoNCorrOnTrack") != std::string::npos)