66 boost::posix_time::ptime p_start, p_end;
67 p_start = boost::posix_time::time_from_string(
m_startTime);
68 p_end = boost::posix_time::time_from_string(
m_endTime);
71 if (startIov > endIov)
73 edm::LogInfo(
"SiStripDetVOffPrinter") <<
"[SiStripDetVOffPrinter::" << __func__ <<
"] " 74 <<
"Set start time " << startIov <<
" (" 75 << boost::posix_time::to_simple_string(p_start) <<
")" 76 <<
"\n ... Set end time " << endIov <<
" (" 77 << boost::posix_time::to_simple_string(p_end) <<
")";
80 edm::LogInfo(
"SiStripDetVOffPrinter") <<
"[SiStripDetVOffPrinter::" << __func__ <<
"] " 81 <<
"Query the condition database " <<
m_condDb;
87 std::vector<cond::Time_t> vTime;
90 edm::LogInfo(
"SiStripDetVOffPrinter") <<
"[SiStripDetVOffPrinter::" << __func__ <<
"] " 94 auto iiov =
iovs.find(startIov);
95 auto eiov =
iovs.find(endIov);
97 while (iiov !=
iovs.end() && (*iiov).since <= (*eiov).since) {
99 if ((*iiov).since < startIov) {
100 vTime.push_back(startIov);
102 vTime.push_back((*iiov).since);
106 ss << boost::posix_time::to_simple_string(
cond::time::to_boost((*iiov).since)) <<
" (" << (*iiov).since <<
")" 107 <<
", # HV Off=" << std::setw(6) <<
payload->getHVoffCounts() <<
", # LV Off=" << std::setw(6)
108 <<
payload->getLVoffCounts() << std::endl;
111 std::vector<uint32_t> detIds;
113 std::set<uint32_t> detIds_HVOff;
114 std::set<uint32_t> detIds_LVOff;
115 std::vector<uint32_t>::const_iterator
it = detIds.begin();
116 for (;
it != detIds.end(); ++
it) {
118 detIds_HVOff.insert(*
it);
120 detIds_LVOff.insert(*
it);
123 std::vector<cond::Time_t> vec;
143 vTime.push_back(endIov);
145 edm::LogInfo(
"SiStripDetVOffPrinter") <<
"[SiStripDetVOffPrinter::" << __func__ <<
"] " 146 <<
"Read " << niov <<
" IOVs from tag " <<
m_tagName 147 <<
" corresponding to the specified time interval.\n" 151 std::map<cond::Time_t, boost::posix_time::time_duration> mIOVsDuration;
152 std::vector<cond::Time_t>::const_iterator itTime = ++vTime.begin();
153 std::vector<cond::Time_t>::const_iterator itPreviousTime = vTime.begin();
155 for (; itTime != vTime.end(); ++itTime) {
157 itPreviousTime = itTime;
159 boost::posix_time::time_duration time_period =
168 edm::LogInfo(
"SiStripDetVOffPrinter") <<
"[SiStripDetVOffPrinter::" << __func__ <<
"] " <<
detidMap.size()
169 <<
" modules were Off at some point during the time interval";
173 std::map<uint32_t, std::vector<cond::Time_t> >::const_iterator itMap =
detidMap.begin();
174 for (; itMap !=
detidMap.end(); ++itMap) {
175 std::vector<cond::Time_t> vecTime = itMap->second;
177 boost::posix_time::time_duration cumul_time_HVOff(0, 0, 0, 0);
178 boost::posix_time::time_duration cumul_time_LVOff(0, 0, 0, 0);
180 std::vector<cond::Time_t>::const_iterator itTime = vecTime.begin();
181 for (; itTime != vecTime.end(); ++itTime) {
183 cumul_time_HVOff += mIOVsDuration[*itTime];
185 cumul_time_LVOff += mIOVsDuration[*itTime];
187 ss <<
"detId " << itMap->first <<
" #IOVs: " << vecTime.size() <<
" HVOff: " << cumul_time_HVOff <<
" " 188 << cumul_time_HVOff.total_milliseconds() * 100.0 / time_period.total_milliseconds() <<
"% " 189 <<
" LVOff: " << cumul_time_LVOff <<
" " 190 << cumul_time_LVOff.total_milliseconds() * 100.0 / time_period.total_milliseconds() <<
"%" << std::endl;
std::map< cond::Time_t, std::set< uint32_t > > iovMap_LVOff
std::map< uint32_t, std::vector< cond::Time_t > > detidMap
void start(bool readOnly=true)
std::unique_ptr< T > fetchPayload(const cond::Hash &payloadHash)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Transaction & transaction()
unsigned long long Time_t
std::map< cond::Time_t, std::set< uint32_t > > iovMap_HVOff
cond::persistency::ConnectionPool m_connectionPool
Session createSession(const std::string &connectionString, bool writeCapable=false)
Time_t from_boost(boost::posix_time::ptime bt)
IOVProxy readIov(const std::string &tag)
Log< level::Info, false > LogInfo
boost::posix_time::ptime to_boost(Time_t iValue)