CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
BeamSpotRcdPrinter Class Reference
Inheritance diagram for BeamSpotRcdPrinter:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &evt, const edm::EventSetup &evtSetup) override
 
 BeamSpotRcdPrinter (const edm::ParameterSet &iConfig)
 
void endJob () override
 
 ~BeamSpotRcdPrinter () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

std::string m_condDb
 
cond::persistency::ConnectionPool m_connectionPool
 
unsigned long long m_endTime
 
std::string m_output
 
unsigned long long m_startTime
 
std::string m_tagName
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 34 of file BeamSpotRcdPrinter.cc.

Constructor & Destructor Documentation

◆ BeamSpotRcdPrinter()

BeamSpotRcdPrinter::BeamSpotRcdPrinter ( const edm::ParameterSet iConfig)
explicit

Definition at line 54 of file BeamSpotRcdPrinter.cc.

55  : m_connectionPool(),
56  m_condDb(iConfig.getParameter<std::string>("conditionDatabase")),
57  m_tagName(iConfig.getParameter<std::string>("tagName")),
58  m_startTime(iConfig.getParameter<unsigned long long>("startIOV")),
59  m_endTime(iConfig.getParameter<unsigned long long>("endIOV")),
60  m_output(iConfig.getParameter<std::string>("output")) {
63 }

References cond::persistency::ConnectionPool::configure(), edm::ParameterSet::getParameter(), m_connectionPool, and cond::persistency::ConnectionPool::setParameters().

◆ ~BeamSpotRcdPrinter()

BeamSpotRcdPrinter::~BeamSpotRcdPrinter ( )
override

Definition at line 65 of file BeamSpotRcdPrinter.cc.

65 {}

Member Function Documentation

◆ analyze()

void BeamSpotRcdPrinter::analyze ( const edm::Event evt,
const edm::EventSetup evtSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 67 of file BeamSpotRcdPrinter.cc.

67  {
68  cond::Time_t startIov = m_startTime;
69  cond::Time_t endIov = m_endTime;
70  if (startIov > endIov)
71  throw cms::Exception("endTime must be greater than startTime!");
72  edm::LogInfo("BeamSpotRcdPrinter") << "[BeamSpotRcdPrinter::" << __func__ << "] "
73  << "Set start time " << startIov << "\n ... Set end time " << endIov;
74 
75  // open db session
76  edm::LogInfo("BeamSpotRcdPrinter") << "[BeamSpotRcdPrinter::" << __func__ << "] "
77  << "Query the condition database " << m_condDb;
79  condDbSession.transaction().start(true);
80 
81  std::stringstream ss;
82  // list of times with new IOVs within the time range
83  std::vector<cond::Time_t> vTime;
84 
85  // query the database
86  edm::LogInfo("BeamSpotRcdPrinter") << "[BeamSpotRcdPrinter::" << __func__ << "] "
87  << "Reading IOVs from tag " << m_tagName;
88  cond::persistency::IOVProxy iovProxy = condDbSession.readIov(m_tagName); // load all?
89  auto iovs = iovProxy.selectAll();
90  auto iiov = iovs.find(startIov);
91  auto eiov = iovs.find(endIov);
92  int niov = 0;
93  while (iiov != iovs.end() && (*iiov).since <= (*eiov).since) {
94  // convert cond::Time_t to seconds since epoch
95  if ((*iiov).since < startIov) {
96  vTime.push_back(startIov);
97  } else {
98  vTime.push_back((*iiov).since);
99  }
100  auto payload = condDbSession.fetchPayload<BeamSpotObjects>((*iiov).payloadId);
101  auto runLS = BSPrintUtils::unpack((*iiov).since);
102  // print IOVs summary
103  ss << runLS.first << "," << runLS.second << " (" << (*iiov).since << ")"
104  << " [hash: " << (*iiov).payloadId << "] \n"
105  << *payload << std::endl;
106 
107  ++iiov;
108  ++niov;
109  }
110 
111  vTime.push_back(endIov); // used to compute last IOV duration
112 
113  edm::LogInfo("BeamSpotRcdPrinter") << "[BeamSpotRcdPrinter::" << __func__ << "] "
114  << "Read " << niov << " IOVs from tag " << m_tagName
115  << " corresponding to the specified time interval.\n\n"
116  << ss.str();
117 
118  condDbSession.transaction().commit();
119 
120  if (!m_output.empty()) {
121  std::ofstream fout;
122  fout.open(m_output);
123  fout << ss.str();
124  fout.close();
125  }
126 }

References cond::persistency::Transaction::commit(), cond::persistency::ConnectionPool::createSession(), Exception, cond::persistency::Session::fetchPayload(), cond::persistency::IOVArray::find(), groupFilesInBlocks::fout, m_condDb, m_connectionPool, m_endTime, m_output, m_startTime, m_tagName, jets_cff::payload, cond::persistency::Session::readIov(), cond::persistency::IOVProxy::selectAll(), contentValuesCheck::ss, cond::persistency::Transaction::start(), cond::persistency::Session::transaction(), and BSPrintUtils::unpack().

◆ endJob()

void BeamSpotRcdPrinter::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 147 of file BeamSpotRcdPrinter.cc.

147 {}

◆ fillDescriptions()

void BeamSpotRcdPrinter::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 128 of file BeamSpotRcdPrinter.cc.

128  {
130  desc.add<std::string>("conditionDatabase", "frontier://FrontierProd/CMS_CONDITIONS");
131  desc.add<std::string>("tagName", "BeamSpotObjects_PCL_byLumi_v0_prompt");
132  desc.add<unsigned long long>("startIOV", 1406859487478481);
133  desc.add<unsigned long long>("endIOV", 1406876667347162);
134  desc.add<std::string>("output", "summary.txt");
135  desc.add<std::string>("connect", "");
136 
137  edm::ParameterSetDescription descDBParameters;
138  descDBParameters.addUntracked<std::string>("authenticationPath", "");
139  descDBParameters.addUntracked<int>("authenticationSystem", 0);
140  descDBParameters.addUntracked<std::string>("security", "");
141  descDBParameters.addUntracked<int>("messageLevel", 0);
142 
143  desc.add<edm::ParameterSetDescription>("DBParameters", descDBParameters);
144  descriptions.add("BeamSpotRcdPrinter", desc);
145 }

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addUntracked(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ m_condDb

std::string BeamSpotRcdPrinter::m_condDb
private

Definition at line 44 of file BeamSpotRcdPrinter.cc.

Referenced by analyze().

◆ m_connectionPool

cond::persistency::ConnectionPool BeamSpotRcdPrinter::m_connectionPool
private

Definition at line 43 of file BeamSpotRcdPrinter.cc.

Referenced by analyze(), and BeamSpotRcdPrinter().

◆ m_endTime

unsigned long long BeamSpotRcdPrinter::m_endTime
private

Definition at line 49 of file BeamSpotRcdPrinter.cc.

Referenced by analyze().

◆ m_output

std::string BeamSpotRcdPrinter::m_output
private

Definition at line 51 of file BeamSpotRcdPrinter.cc.

Referenced by analyze().

◆ m_startTime

unsigned long long BeamSpotRcdPrinter::m_startTime
private

Definition at line 48 of file BeamSpotRcdPrinter.cc.

Referenced by analyze().

◆ m_tagName

std::string BeamSpotRcdPrinter::m_tagName
private

Definition at line 45 of file BeamSpotRcdPrinter.cc.

Referenced by analyze().

edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
BeamSpotRcdPrinter::m_connectionPool
cond::persistency::ConnectionPool m_connectionPool
Definition: BeamSpotRcdPrinter.cc:43
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
cond::persistency::ConnectionPool::createSession
Session createSession(const std::string &connectionString, bool writeCapable=false)
Definition: ConnectionPool.cc:174
cond::persistency::IOVProxy::selectAll
IOVArray selectAll()
Definition: IOVProxy.cc:181
cond::persistency::Session::fetchPayload
std::unique_ptr< T > fetchPayload(const cond::Hash &payloadHash)
Definition: Session.h:213
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
cond::persistency::IOVArray::find
Iterator find(cond::Time_t time) const
Definition: IOVProxy.cc:101
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
jets_cff.payload
payload
Definition: jets_cff.py:32
cond::persistency::Session::readIov
IOVProxy readIov(const std::string &tag)
Definition: Session.cc:63
cond::persistency::IOVProxy
Definition: IOVProxy.h:92
edm::ParameterSetDescription::addUntracked
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:100
edm::ParameterSet
Definition: ParameterSet.h:47
BeamSpotRcdPrinter::m_tagName
std::string m_tagName
Definition: BeamSpotRcdPrinter.cc:45
cond::persistency::Session
Definition: Session.h:63
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
groupFilesInBlocks.fout
fout
Definition: groupFilesInBlocks.py:162
cond::persistency::Transaction::commit
void commit()
Definition: Session.cc:23
cond::persistency::ConnectionPool::setParameters
void setParameters(const edm::ParameterSet &connectionPset)
Definition: ConnectionPool.cc:43
BeamSpotObjects
Definition: BeamSpotObjects.h:20
cond::persistency::ConnectionPool::configure
void configure()
Definition: ConnectionPool.cc:129
BeamSpotRcdPrinter::m_condDb
std::string m_condDb
Definition: BeamSpotRcdPrinter.cc:44
BeamSpotRcdPrinter::m_endTime
unsigned long long m_endTime
Definition: BeamSpotRcdPrinter.cc:49
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
BSPrintUtils::unpack
std::pair< unsigned int, unsigned int > unpack(cond::Time_t since)
Definition: BeamSpotRcdPrinter.cc:26
cond::persistency::Session::transaction
Transaction & transaction()
Definition: Session.cc:52
cond::persistency::Transaction::start
void start(bool readOnly=true)
Definition: Session.cc:18
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
BeamSpotRcdPrinter::m_output
std::string m_output
Definition: BeamSpotRcdPrinter.cc:51
Exception
Definition: hltDiff.cc:245
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
BeamSpotRcdPrinter::m_startTime
unsigned long long m_startTime
Definition: BeamSpotRcdPrinter.cc:48