CMS 3D CMS Logo

PayloadInspector.cc
Go to the documentation of this file.
5 
6 #include <sstream>
7 #include <iostream>
8 #include <boost/python/extract.hpp>
9 
10 namespace cond {
11 
12  namespace payloadInspector {
13 
15 
17  std::string ret("");
18  auto im = m.find(key);
19  if (im != m.end())
20  ret = im->second;
21  return ret;
22  }
23 
24  constexpr const char* const ModuleVersion::label;
25 
27  : m_plotAnnotations(),
28  m_inputParams(),
29  m_tagNames(),
30  m_tagBoundaries(),
31  m_tagIovs(),
32  m_inputParamValues(),
33  m_data("") {}
34 
35  void PlotBase::addInputParam(const std::string& paramName) {
36  // maybe add a check for existing params - returning an Exception when found...
37  m_inputParams.insert(paramName);
38  }
39 
41 
43 
45 
47 
48  unsigned int PlotBase::ntags() const { return m_plotAnnotations.ntags; }
49 
50  bool PlotBase::isTwoTags() const { return m_plotAnnotations.ntags == 2; }
51 
52  boost::python::list PlotBase::inputParams() const {
53  boost::python::list tmp;
54  for (const auto& ip : m_inputParams) {
55  tmp.append(ip);
56  }
57  return tmp;
58  }
59 
60  void PlotBase::setInputParamValues(const boost::python::dict& values) {
61  for (const auto& ip : m_inputParams) {
62  if (values.has_key(ip)) {
63  std::string val = boost::python::extract<std::string>(values.get(ip));
64  m_inputParamValues.insert(std::make_pair(ip, val));
65  }
66  }
67  }
68 
69  std::string PlotBase::data() const { return m_data; }
70 
71  bool PlotBase::process(const std::string& connectionString, const boost::python::list& tagsWithTimeBoundaries) {
72  size_t nt = boost::python::len(tagsWithTimeBoundaries);
73  bool ret = false;
74  if (nt) {
75  std::vector<std::tuple<std::string, cond::Time_t, cond::Time_t> > tags;
76  tags.resize(nt);
77  for (size_t i = 0; i < nt; i++) {
78  boost::python::tuple entry = boost::python::extract<boost::python::tuple>(tagsWithTimeBoundaries[i]);
79  std::string tagName = boost::python::extract<std::string>(entry[0]);
80  std::string time0s = boost::python::extract<std::string>(entry[1]);
81  std::string time1s = boost::python::extract<std::string>(entry[2]);
82  cond::Time_t time0 = boost::lexical_cast<cond::Time_t>(time0s);
83  cond::Time_t time1 = boost::lexical_cast<cond::Time_t>(time1s);
84  tags[i] = std::make_tuple(tagName, time0, time1);
85  }
87  }
88  return ret;
89  }
90 
93  const std::vector<std::tuple<std::string, cond::Time_t, cond::Time_t> >& tagsWithTimeBoundaries) {
94  m_tagNames.clear();
95  m_tagBoundaries.clear();
96  m_tagIovs.clear();
97  init();
98 
99  std::vector<edm::ParameterSet> psets;
100  edm::ParameterSet pSet;
101  pSet.addParameter("@service_type", std::string("SiteLocalConfigService"));
102  psets.push_back(pSet);
103  static const edm::ServiceToken services(edm::ServiceRegistry::createSet(psets));
104  static const edm::ServiceRegistry::Operate operate(services);
105  bool ret = false;
106  size_t nt = tagsWithTimeBoundaries.size();
107  if (nt) {
111  m_tagNames.resize(nt);
112  m_tagBoundaries.resize(nt);
113  m_tagIovs.resize(nt);
114  for (size_t i = 0; i < nt; i++) {
115  const std::string& tagName = std::get<0>(tagsWithTimeBoundaries[i]);
116  cond::Time_t time0 = std::get<1>(tagsWithTimeBoundaries[i]);
117  cond::Time_t time1 = std::get<2>(tagsWithTimeBoundaries[i]);
118  m_tagNames[i] = tagName;
119  m_tagBoundaries[i] = std::make_pair(time0, time1);
120  auto proxy = m_dbSession.readIov(tagName);
121  proxy.selectRange(time0, time1, m_tagIovs[i]);
122  }
123  m_data = processData();
125  ret = true;
126  }
127  return ret;
128  }
129 
130  void PlotBase::init() {}
131 
133 
136  return info;
137  }
138 
139  const std::map<std::string, std::string>& PlotBase::inputParamValues() const { return m_inputParamValues; }
140 
142 
143  } // namespace payloadInspector
144 
145 } // namespace cond
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:367
cond::payloadInspector::PlotBase::m_data
std::string m_data
Definition: PayloadInspector.h:286
mps_fire.i
i
Definition: mps_fire.py:428
ConnectionPool.h
ServiceRegistry.h
cond::payloadInspector::PlotBase::process
bool process(const std::string &connectionString, const boost::python::list &tagsWithTimeBoundaries)
Definition: PayloadInspector.cc:71
nt
int nt
Definition: AMPTWrapper.h:42
cond::payloadInspector::PlotBase::payloadType
std::string payloadType() const
Definition: PayloadInspector.cc:40
cond::payloadInspector::PlotAnnotations::ntags
int ntags
Definition: PayloadInspector.h:55
mps_splice.entry
entry
Definition: mps_splice.py:68
PayloadInspector.h
cond::payloadInspector::PlotBase::m_dbSession
cond::persistency::Session m_dbSession
Definition: PayloadInspector.h:285
cond::payloadInspector::PlotBase::m_tagBoundaries
std::vector< std::pair< cond::Time_t, cond::Time_t > > m_tagBoundaries
Definition: PayloadInspector.h:279
cond::payloadInspector::PlotAnnotations::PLOT_TYPE_K
static constexpr const char *const PLOT_TYPE_K
Definition: PayloadInspector.h:45
cond::persistency::IOVProxy::selectRange
IOVArray selectRange(const cond::Time_t &begin, const cond::Time_t &end)
Definition: IOVProxy.cc:189
cond::payloadInspector::PlotAnnotations::get
std::string get(const std::string &key) const
Definition: PayloadInspector.cc:16
edm::ServiceRegistry::createSet
static ServiceToken createSet(std::vector< ParameterSet > &)
Definition: ServiceRegistry.cc:75
cond::payloadInspector::PlotBase::inputParamValues
const std::map< std::string, std::string > & inputParamValues() const
Definition: PayloadInspector.cc:139
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
cond::payloadInspector::PlotBase::inputParams
boost::python::list inputParams() const
Definition: PayloadInspector.cc:52
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
cond::persistency::ConnectionPool::createSession
Session createSession(const std::string &connectionString, bool writeCapable=false)
Definition: ConnectionPool.cc:158
cond::payloadInspector::PlotBase::exec_process
bool exec_process(const std::string &connectionString, const std::vector< std::tuple< std::string, cond::Time_t, cond::Time_t >> &tagsWithTimeBoundaries)
Definition: PayloadInspector.cc:91
edm::ServiceToken
Definition: ServiceToken.h:40
cond::payloadInspector::PlotAnnotations::m
std::map< std::string, std::string > m
Definition: PayloadInspector.h:54
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
cond::payloadInspector::PlotBase::ntags
unsigned int ntags() const
Definition: PayloadInspector.cc:48
cond::persistency::ConnectionPool
Definition: ConnectionPool.h:35
cond::payloadInspector::PlotBase::m_tagNames
std::vector< std::string > m_tagNames
Definition: PayloadInspector.h:278
cond::payloadInspector::PlotBase::dbSession
cond::persistency::Session dbSession()
Definition: PayloadInspector.cc:141
cond::payloadInspector::PlotBase::m_inputParamValues
std::map< std::string, std::string > m_inputParamValues
Definition: PayloadInspector.h:281
cond::payloadInspector::PlotBase::getTagInfo
cond::Tag_t getTagInfo(const std::string &tag)
Definition: PayloadInspector.cc:134
cond::payloadInspector::ModuleVersion::label
static constexpr const char *const label
Definition: PayloadInspector.h:187
cond::persistency::Session::readIov
IOVProxy readIov(const std::string &tag)
Definition: Session.cc:63
cond::payloadInspector::PlotBase::type
std::string type() const
Definition: PayloadInspector.cc:44
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond::payloadInspector::PlotBase::title
std::string title() const
Definition: PayloadInspector.cc:42
cond
Definition: plugin.cc:23
cond::payloadInspector::PlotBase::setInputParamValues
void setInputParamValues(const boost::python::dict &values)
Definition: PayloadInspector.cc:60
edm::ParameterSet
Definition: ParameterSet.h:47
cond::payloadInspector::PlotAnnotations::singleIov
bool singleIov
Definition: PayloadInspector.h:57
cond::persistency::Session
Definition: Session.h:63
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
cond::payloadInspector::PlotAnnotations::TITLE_K
static constexpr const char *const TITLE_K
Definition: PayloadInspector.h:46
edm::ParameterSet::addParameter
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:135
cond::persistency::Transaction::commit
void commit()
Definition: Session.cc:23
cond::payloadInspector::PlotBase::isTwoTags
bool isTwoTags() const
Definition: PayloadInspector.cc:50
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
cond::Tag_t
Definition: Types.h:58
cond::payloadInspector::PlotBase::m_inputParams
std::set< std::string > m_inputParams
Definition: PayloadInspector.h:277
cond::payloadInspector::PlotAnnotations::PAYLOAD_TYPE_K
static constexpr const char *const PAYLOAD_TYPE_K
Definition: PayloadInspector.h:47
cond::payloadInspector::PlotBase::init
virtual void init()
Definition: PayloadInspector.cc:130
cond::payloadInspector::PlotBase::m_tagIovs
std::vector< std::vector< std::tuple< cond::Time_t, cond::Hash > > > m_tagIovs
Definition: PayloadInspector.h:280
cond::payloadInspector::PlotBase::processData
virtual std::string processData()
Definition: PayloadInspector.cc:132
cond::payloadInspector::PlotBase::isSingleIov
bool isSingleIov() const
Definition: PayloadInspector.cc:46
cond::persistency::Session::transaction
Transaction & transaction()
Definition: Session.cc:52
cond::payloadInspector::PlotBase::data
std::string data() const
Definition: PayloadInspector.cc:69
cond::persistency::Transaction::start
void start(bool readOnly=true)
Definition: Session.cc:18
cond::time::time0
const boost::posix_time::ptime time0
Definition: TimeConversions.h:37
heppy_batch.val
val
Definition: heppy_batch.py:351
cond::payloadInspector::PlotBase::PlotBase
PlotBase()
Definition: PayloadInspector.cc:26
cond::payloadInspector::PlotAnnotations::PlotAnnotations
PlotAnnotations()
Definition: PayloadInspector.cc:14
triggerMatcherToHLTDebug_cfi.tags
tags
Definition: triggerMatcherToHLTDebug_cfi.py:9
ParameterSet.h
cond::payloadInspector::PlotBase::addInputParam
void addInputParam(const std::string &paramName)
Definition: PayloadInspector.cc:35
l1RCTOmdsFedVectorProducer_cfi.connectionString
connectionString
Definition: l1RCTOmdsFedVectorProducer_cfi.py:4
crabWrapper.key
key
Definition: crabWrapper.py:19
edm::ServiceRegistry::Operate
Definition: ServiceRegistry.h:40
cond::persistency::IOVProxy::tagInfo
cond::Tag_t tagInfo() const
Definition: IOVProxy.cc:245
JetPartonCorrections_cff.tagName
tagName
Definition: JetPartonCorrections_cff.py:12
cond::payloadInspector::PlotBase::m_plotAnnotations
PlotAnnotations m_plotAnnotations
Definition: PayloadInspector.h:276