CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
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...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 33 of file BeamSpotRcdPrinter.cc.

Constructor & Destructor Documentation

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

Definition at line 53 of file BeamSpotRcdPrinter.cc.

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

54  : m_connectionPool(),
55  m_condDb(iConfig.getParameter<std::string>("conditionDatabase")),
56  m_tagName(iConfig.getParameter<std::string>("tagName")),
57  m_startTime(iConfig.getParameter<unsigned long long>("startIOV")),
58  m_endTime(iConfig.getParameter<unsigned long long>("endIOV")),
59  m_output(iConfig.getParameter<std::string>("output")) {
62 }
cond::persistency::ConnectionPool m_connectionPool
void setParameters(const edm::ParameterSet &connectionPset)
unsigned long long m_startTime
unsigned long long m_endTime
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
BeamSpotRcdPrinter::~BeamSpotRcdPrinter ( )
override

Definition at line 64 of file BeamSpotRcdPrinter.cc.

64 {}

Member Function Documentation

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

Implements edm::one::EDAnalyzerBase.

Definition at line 66 of file BeamSpotRcdPrinter.cc.

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

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

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 146 of file BeamSpotRcdPrinter.cc.

146 {}
void BeamSpotRcdPrinter::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 127 of file BeamSpotRcdPrinter.cc.

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

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

Member Data Documentation

std::string BeamSpotRcdPrinter::m_condDb
private

Definition at line 43 of file BeamSpotRcdPrinter.cc.

Referenced by analyze().

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

Definition at line 42 of file BeamSpotRcdPrinter.cc.

Referenced by analyze(), and BeamSpotRcdPrinter().

unsigned long long BeamSpotRcdPrinter::m_endTime
private

Definition at line 48 of file BeamSpotRcdPrinter.cc.

Referenced by analyze().

std::string BeamSpotRcdPrinter::m_output
private

Definition at line 50 of file BeamSpotRcdPrinter.cc.

Referenced by analyze().

unsigned long long BeamSpotRcdPrinter::m_startTime
private

Definition at line 47 of file BeamSpotRcdPrinter.cc.

Referenced by analyze().

std::string BeamSpotRcdPrinter::m_tagName
private

Definition at line 44 of file BeamSpotRcdPrinter.cc.

Referenced by analyze().