80 boost::posix_time::ptime p_start, p_end;
83 p_end = boost::posix_time::second_clock::universal_time();
84 p_start = p_end - boost::posix_time::hours(
m_interval);
87 p_start = boost::posix_time::time_from_string(
m_startTime);
88 p_end = boost::posix_time::time_from_string(
m_endTime);
92 if (startIov > endIov)
94 edm::LogInfo(
"SiStripDetVOffTrendPlotter") <<
"[SiStripDetVOffTrendPlotter::" << __func__ <<
"] "
95 <<
"Set start IOV " << startIov <<
" (" << boost::posix_time::to_simple_string(p_start) <<
")"
96 <<
"\n ... Set end IOV " << endIov <<
" (" << boost::posix_time::to_simple_string(p_end) <<
")" ;
99 edm::LogInfo(
"SiStripDetVOffTrendPlotter") <<
"[SiStripDetVOffTrendPlotter::" << __func__ <<
"] "
100 <<
"Query the condition database " <<
m_condDb;
105 std::vector<TGraph*> hvgraphs, lvgraphs;
106 TLegend *leg_hv =
new TLegend(0.75, 0.87, 0.99, 0.99);
107 TLegend *leg_lv =
new TLegend(0.75, 0.87, 0.99, 0.99);
108 for (
unsigned itag=0; itag<
m_plotTags.size(); ++itag){
112 std::vector<double> vTime;
113 std::vector<double> vHVOffPercent, vLVOffPercent;
116 edm::LogInfo(
"SiStripDetVOffTrendPlotter") <<
"[SiStripDetVOffTrendPlotter::" << __func__ <<
"] "
117 <<
"Reading IOVs from tag " <<
tag;
119 auto iiov = iovProxy.
find(startIov);
120 auto eiov = iovProxy.
find(endIov);
122 while (iiov != iovProxy.
end() && iiov != eiov){
126 vHVOffPercent.push_back( 1.0*payload->getHVoffCounts()/num_modules );
127 vLVOffPercent.push_back( 1.0*payload->getLVoffCounts()/num_modules );
130 <<
" (" << (*iiov).since <<
")"
131 <<
", # HV Off=" << std::setw(6) << payload->getHVoffCounts()
132 <<
", # LV Off=" << std::setw(6) << payload->getLVoffCounts() << std::endl;
136 edm::LogInfo(
"SiStripDetVOffTrendPlotter") <<
"[SiStripDetVOffTrendPlotter::" << __func__ <<
"] "
137 <<
"Read " << niov <<
" IOVs from tag " << tag <<
" in the specified interval.";
139 TGraph *
hv =
new TGraph(vTime.size(), vTime.data(), vHVOffPercent.data());
140 prepGraph(hv, TString(
"HVOff_")+tag,
";UTC;Fraction of HV off",
color);
141 leg_hv->AddEntry(hv, tag.data(),
"LP");
143 TGraph *lv =
new TGraph(vTime.size(), vTime.data(), vLVOffPercent.data());
144 prepGraph(lv, TString(
"LVOff_")+tag,
";UTC;Fraction of LV off",
color);
145 leg_lv->AddEntry(lv, tag.data(),
"LP");
147 hvgraphs.push_back(hv);
148 lvgraphs.push_back(lv);
154 TCanvas
c(
"c",
"c", 900, 600);
155 c.SetTopMargin(0.12);
156 c.SetBottomMargin(0.08);
159 for (
const auto hv : hvgraphs){
160 if (hv==hvgraphs.front())
173 for (
const auto lv : lvgraphs){
174 if (lv==hvgraphs.front())
boost::shared_ptr< T > fetchPayload(const cond::Hash &payloadHash)
void start(bool readOnly=true)
std::vector< std::string > m_plotTags
Transaction & transaction()
void prepGraph(TGraph *gr, TString name, TString title, Color_t color)
edm::Service< SiStripDetInfoFileReader > detidReader
IOVProxy readIov(const std::string &tag, bool full=false)
unsigned long long Time_t
const std::vector< uint32_t > & getAllDetIds() const
std::string formatIOV(cond::Time_t iov, std::string format="%Y-%m-%d__%H_%M_%S")
Iterator find(cond::Time_t time)
Session createSession(const std::string &connectionString, bool writeCapable=false)
Time_t from_boost(boost::posix_time::ptime bt)
cond::persistency::ConnectionPool m_connectionPool
const std::vector< Color_t > PLOT_COLORS
char data[epos_bytes_allocation]
boost::posix_time::ptime to_boost(Time_t iValue)
cond::UnpackedTime unpack(cond::Time_t iValue)