49 std::map<uint32_t, std::vector<cond::Time_t> >
detidMap;
54 m_condDb(iConfig.getParameter<
std::
string>(
"conditionDatabase")),
55 m_tagName(iConfig.getParameter<
std::
string>(
"tagName")),
56 m_startTime(iConfig.getParameter<
std::
string>(
"startTime")),
57 m_endTime(iConfig.getParameter<
std::
string>(
"endTime")),
58 m_output(iConfig.getParameter<
std::
string>(
"output")) {
67 boost::posix_time::ptime p_start, p_end;
68 p_start = boost::posix_time::time_from_string(
m_startTime);
69 p_end = boost::posix_time::time_from_string(
m_endTime);
72 if (startIov > endIov)
74 edm::LogInfo(
"SiStripDetVOffPrinter") <<
"[SiStripDetVOffPrinter::" << __func__ <<
"] "
75 <<
"Set start time " << startIov <<
" ("
76 << boost::posix_time::to_simple_string(p_start) <<
")"
77 <<
"\n ... Set end time " << endIov <<
" ("
78 << boost::posix_time::to_simple_string(p_end) <<
")";
81 edm::LogInfo(
"SiStripDetVOffPrinter") <<
"[SiStripDetVOffPrinter::" << __func__ <<
"] "
82 <<
"Query the condition database " <<
m_condDb;
88 std::vector<cond::Time_t> vTime;
91 edm::LogInfo(
"SiStripDetVOffPrinter") <<
"[SiStripDetVOffPrinter::" << __func__ <<
"] "
95 auto iiov = iovs.
find(startIov);
96 auto eiov = iovs.find(endIov);
98 while (iiov != iovs.end() && (*iiov).since <= (*eiov).since) {
100 if ((*iiov).since < startIov) {
101 vTime.push_back(startIov);
103 vTime.push_back((*iiov).since);
107 ss << boost::posix_time::to_simple_string(
cond::time::to_boost((*iiov).since)) <<
" (" << (*iiov).since <<
")"
108 <<
", # HV Off=" << std::setw(6) <<
payload->getHVoffCounts() <<
", # LV Off=" << std::setw(6)
109 <<
payload->getLVoffCounts() << std::endl;
112 std::vector<uint32_t> detIds;
114 std::set<uint32_t> detIds_HVOff;
115 std::set<uint32_t> detIds_LVOff;
116 std::vector<uint32_t>::const_iterator it = detIds.begin();
117 for (; it != detIds.end(); ++it) {
118 if (
payload->IsModuleHVOff(*it))
119 detIds_HVOff.insert(*it);
120 if (
payload->IsModuleLVOff(*it))
121 detIds_LVOff.insert(*it);
124 std::vector<cond::Time_t> vec;
129 detidMap[*it].push_back(vTime.back());
144 vTime.push_back(endIov);
146 edm::LogInfo(
"SiStripDetVOffPrinter") <<
"[SiStripDetVOffPrinter::" << __func__ <<
"] "
147 <<
"Read " << niov <<
" IOVs from tag " <<
m_tagName
148 <<
" corresponding to the specified time interval.\n"
152 std::map<cond::Time_t, boost::posix_time::time_duration> mIOVsDuration;
153 std::vector<cond::Time_t>::const_iterator itTime = ++vTime.begin();
154 std::vector<cond::Time_t>::const_iterator itPreviousTime = vTime.begin();
156 for (; itTime != vTime.end(); ++itTime) {
158 itPreviousTime = itTime;
160 boost::posix_time::time_duration time_period =
169 edm::LogInfo(
"SiStripDetVOffPrinter") <<
"[SiStripDetVOffPrinter::" << __func__ <<
"] " <<
detidMap.size()
170 <<
" modules were Off at some point during the time interval";
174 std::map<uint32_t, std::vector<cond::Time_t> >::const_iterator itMap =
detidMap.begin();
175 for (; itMap !=
detidMap.end(); ++itMap) {
176 std::vector<cond::Time_t> vecTime = itMap->second;
178 boost::posix_time::time_duration cumul_time_HVOff(0, 0, 0, 0);
179 boost::posix_time::time_duration cumul_time_LVOff(0, 0, 0, 0);
181 std::vector<cond::Time_t>::const_iterator itTime = vecTime.begin();
182 for (; itTime != vecTime.end(); ++itTime) {
184 cumul_time_HVOff += mIOVsDuration[*itTime];
186 cumul_time_LVOff += mIOVsDuration[*itTime];
188 ss <<
"detId " << itMap->first <<
" #IOVs: " << vecTime.size() <<
" HVOff: " << cumul_time_HVOff <<
" "
189 << cumul_time_HVOff.total_milliseconds() * 100.0 / time_period.total_milliseconds() <<
"% "
190 <<
" LVOff: " << cumul_time_LVOff <<
" "
191 << cumul_time_LVOff.total_milliseconds() * 100.0 / time_period.total_milliseconds() <<
"%" << std::endl;
206 desc.
add<
std::string>(
"conditionDatabase",
"frontier://FrontierProd/CMS_CONDITIONS");
207 desc.
add<
std::string>(
"tagName",
"SiStripDetVOff_1hourDelay_v1_Validation");
215 descDBParameters.addUntracked<
int>(
"authenticationSystem", 0);
216 descDBParameters.addUntracked<
std::string>(
"security",
"");
217 descDBParameters.addUntracked<
int>(
"messageLevel", 0);
220 descriptions.
add(
"siStripDetVOffPrinter", desc);