93 boost::posix_time::ptime p_start, p_end;
96 p_end = boost::posix_time::second_clock::universal_time();
100 p_start = boost::posix_time::time_from_string(
m_startTime);
101 p_end = boost::posix_time::time_from_string(
m_endTime);
105 if (startIov > endIov)
108 <<
"[SiStripDetVOffTrendPlotter::" << __func__ <<
"] " 109 <<
"Set start IOV " << startIov <<
" (" << boost::posix_time::to_simple_string(p_start) <<
")" 110 <<
"\n ... Set end IOV " << endIov <<
" (" << boost::posix_time::to_simple_string(p_end) <<
")";
113 edm::LogInfo(
"SiStripDetVOffTrendPlotter") <<
"[SiStripDetVOffTrendPlotter::" << __func__ <<
"] " 114 <<
"Query the condition database " <<
m_condDb;
119 std::vector<TGraph *> hvgraphs, lvgraphs;
120 TLegend *leg_hv =
new TLegend(0.6, 0.87, 0.99, 0.99);
121 TLegend *leg_lv =
new TLegend(0.6, 0.87, 0.99, 0.99);
122 for (
unsigned itag = 0; itag <
m_plotTags.size(); ++itag) {
126 std::vector<double> vTime;
127 std::vector<double> vHVOffPercent, vLVOffPercent;
130 edm::LogInfo(
"SiStripDetVOffTrendPlotter") <<
"[SiStripDetVOffTrendPlotter::" << __func__ <<
"] " 131 <<
"Reading IOVs from tag " <<
tag;
133 auto iiov = iovProxy.
find(startIov);
134 auto eiov = iovProxy.
find(endIov);
136 while (iiov != iovProxy.
end() && (*iiov).since <= (*eiov).since) {
138 if ((*iiov).since < startIov)
143 vHVOffPercent.push_back(1.0 *
payload->getHVoffCounts() / num_modules);
144 vLVOffPercent.push_back(1.0 *
payload->getLVoffCounts() / num_modules);
149 <<
", # HV Off=" << std::setw(6) <<
payload->getHVoffCounts() <<
", # LV Off=" << std::setw(6)
150 <<
payload->getLVoffCounts() << std::endl;
155 <<
"[SiStripDetVOffTrendPlotter::" << __func__ <<
"] " 156 <<
"Read " << niov <<
" IOVs from tag " << tag <<
" in the specified interval.";
158 TGraph *
hv =
new TGraph(vTime.size(), vTime.data(), vHVOffPercent.data());
159 prepGraph(hv, TString(
"HVOff_") + tag,
";UTC;Fraction of HV off", color);
160 leg_hv->AddEntry(hv, tag.data(),
"LP");
162 TGraph *lv =
new TGraph(vTime.size(), vTime.data(), vLVOffPercent.data());
163 prepGraph(lv, TString(
"LVOff_") + tag,
";UTC;Fraction of LV off", color);
164 leg_lv->AddEntry(lv, tag.data(),
"LP");
166 hvgraphs.push_back(hv);
167 lvgraphs.push_back(lv);
173 TCanvas
c(
"c",
"c", 1800, 1200);
174 c.SetTopMargin(0.12);
175 c.SetBottomMargin(0.08);
178 for (
const auto hv : hvgraphs) {
179 if (hv == hvgraphs.front())
191 c.Print((
"HVOff_" + plot_postfix).
data());
194 for (
const auto lv : lvgraphs) {
195 if (lv == lvgraphs.front())
205 c.Print((
"LVOff_" + plot_postfix).
data());
void dumpCSV(bool isHV, std::size_t nModules)
void start(bool readOnly=true)
std::unique_ptr< T > fetchPayload(const cond::Hash &payloadHash)
std::vector< std::string > m_plotTags
Transaction & transaction()
void prepGraph(TGraph *gr, TString name, TString title, Color_t color)
IOVProxy readIov(const std::string &tag, bool full=false)
unsigned long long Time_t
std::string formatIOV(cond::Time_t iov, std::string format="%Y-%m-%d__%H_%M_%S")
std::vector< uint32_t > getSiStripDetIds(const GeometricDet &geomDet)
Iterator find(cond::Time_t time)
Session createSession(const std::string &connectionString, bool writeCapable=false)
Time_t from_boost(boost::posix_time::ptime bt)
std::map< cond::Time_t, std::map< std::string, std::pair< int, int > > > iovMap
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)