54 std::map<uint32_t, std::vector< cond::Time_t > >
detidMap;
78 boost::posix_time::ptime p_start, p_end;
79 p_start = boost::posix_time::time_from_string(
m_startTime);
80 p_end = boost::posix_time::time_from_string(
m_endTime);
83 if (startIov > endIov)
85 edm::LogInfo(
"SiStripDetVOffPrinter") <<
"[SiStripDetVOffPrinter::" << __func__ <<
"] " 86 <<
"Set start time " << startIov <<
" (" << boost::posix_time::to_simple_string(p_start) <<
")" 87 <<
"\n ... Set end time " << endIov <<
" (" << boost::posix_time::to_simple_string(p_end) <<
")" ;
90 edm::LogInfo(
"SiStripDetVOffPrinter") <<
"[SiStripDetVOffPrinter::" << __func__ <<
"] " 91 <<
"Query the condition database " <<
m_condDb;
97 std::vector< cond::Time_t > vTime;
100 edm::LogInfo(
"SiStripDetVOffPrinter") <<
"[SiStripDetVOffPrinter::" << __func__ <<
"] " 101 <<
"Reading IOVs from tag " <<
m_tagName;
103 auto iiov = iovProxy.
find(startIov);
104 auto eiov = iovProxy.
find(endIov);
106 while (iiov != iovProxy.
end() && (*iiov).since <= (*eiov).since){
108 if ((*iiov).since<startIov){
109 vTime.push_back(startIov);
111 vTime.push_back((*iiov).since);
116 <<
" (" << (*iiov).since <<
")" 117 <<
", # HV Off=" << std::setw(6) <<
payload->getHVoffCounts()
118 <<
", # LV Off=" << std::setw(6) <<
payload->getLVoffCounts() << std::endl;
121 std::vector<uint32_t> detIds;
123 std::set<uint32_t> detIds_HVOff;
124 std::set<uint32_t> detIds_LVOff;
125 std::vector<uint32_t>::const_iterator it = detIds.begin();
126 for( ; it!=detIds.end(); ++it ) {
127 if(
payload->IsModuleHVOff(*it) ) detIds_HVOff.insert(*it);
128 if(
payload->IsModuleLVOff(*it) ) detIds_LVOff.insert(*it);
131 std::vector< cond::Time_t > vec;
136 detidMap[*it].push_back(vTime.back());
151 vTime.push_back(endIov);
153 edm::LogInfo(
"SiStripDetVOffPrinter") <<
"[SiStripDetVOffPrinter::" << __func__ <<
"] " 154 <<
"Read " << niov <<
" IOVs from tag " << m_tagName <<
" corresponding to the specified time interval.\n" << ss.str();
158 std::map< cond::Time_t, boost::posix_time::time_duration > mIOVsDuration;
159 std::vector< cond::Time_t >::const_iterator itTime = ++vTime.begin();
160 std::vector< cond::Time_t >::const_iterator itPreviousTime = vTime.begin();
162 for( ; itTime!=vTime.end(); ++itTime ) {
164 itPreviousTime = itTime;
174 edm::LogInfo(
"SiStripDetVOffPrinter") <<
"[SiStripDetVOffPrinter::" << __func__ <<
"] " 175 <<
detidMap.size() <<
" modules were Off at some point during the time interval";
179 std::map<uint32_t, std::vector< cond::Time_t > >::const_iterator itMap =
detidMap.begin();
180 for( ; itMap!=
detidMap.end(); ++itMap ) {
181 std::vector< cond::Time_t > vecTime = itMap->second;
183 boost::posix_time::time_duration cumul_time_HVOff(0,0,0,0);
184 boost::posix_time::time_duration cumul_time_LVOff(0,0,0,0);
186 std::vector< cond::Time_t >::const_iterator itTime = vecTime.begin();
187 for( ; itTime!=vecTime.end(); ++itTime ) {
191 ss<<
"detId "<< itMap->first <<
" #IOVs: "<<vecTime.size()
192 <<
" HVOff: "<<cumul_time_HVOff<<
" "<<cumul_time_HVOff.total_milliseconds()*100.0/time_period.total_milliseconds()<<
"% " 193 <<
" LVOff: "<<cumul_time_LVOff<<
" "<<cumul_time_LVOff.total_milliseconds()*100.0/time_period.total_milliseconds()<<
"%"<<std::endl;
211 desc.
add<
std::string>(
"conditionDatabase",
"frontier://FrontierProd/CMS_CONDITIONS");
212 desc.
add<
std::string>(
"tagName",
"SiStripDetVOff_1hourDelay_v1_Validation");
220 descDBParameters.addUntracked<
int>(
"authenticationSystem",0);
221 descDBParameters.addUntracked<
std::string>(
"security",
"");
222 descDBParameters.addUntracked<
int>(
"messageLevel",0);
225 descriptions.
add(
"siStripDetVOffPrinter", desc);
T getParameter(std::string const &) const
std::map< uint32_t, std::vector< cond::Time_t > > detidMap
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
SiStripDetVOffPrinter(const edm::ParameterSet &iConfig)
#define DEFINE_FWK_MODULE(type)
void start(bool readOnly=true)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Transaction & transaction()
void setParameters(const edm::ParameterSet &connectionPset)
IOVProxy readIov(const std::string &tag, bool full=false)
std::map< cond::Time_t, std::set< uint32_t > > iovMap_HVOff
unsigned long long Time_t
void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup) override
cond::persistency::ConnectionPool m_connectionPool
Iterator find(cond::Time_t time)
Session createSession(const std::string &connectionString, bool writeCapable=false)
~SiStripDetVOffPrinter() override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Time_t from_boost(boost::posix_time::ptime bt)
edm::Service< SiStripDetInfoFileReader > detidReader
std::map< cond::Time_t, std::set< uint32_t > > iovMap_LVOff
void add(std::string const &label, ParameterSetDescription const &psetDescription)
boost::posix_time::ptime to_boost(Time_t iValue)
std::shared_ptr< T > fetchPayload(const cond::Hash &payloadHash)