CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
L1CondDBIOVWriterExt Class Reference

#include <L1CondDBIOVWriterExt.h>

Inheritance diagram for L1CondDBIOVWriterExt:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 L1CondDBIOVWriterExt (const edm::ParameterSet &)
 
 ~L1CondDBIOVWriterExt () 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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept 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 noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 

Private Attributes

edm::ESGetToken< L1TriggerKeyExt, L1TriggerKeyExtRcdl1TriggerKeyExtToken_
 
bool m_forceUpdate
 
bool m_ignoreTriggerKey
 
bool m_logKeys
 
bool m_logTransactions
 
std::vector< std::string > m_recordTypes
 
std::string m_rsKey
 
std::string m_tscKey
 l1t::DataWriter m_writer ; More...
 
l1t::DataWriterExt m_writer
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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< Bconsumes (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 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 ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
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 19 of file L1CondDBIOVWriterExt.h.

Constructor & Destructor Documentation

◆ L1CondDBIOVWriterExt()

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

Definition at line 13 of file L1CondDBIOVWriterExt.cc.

References edm::EDConsumerBase::esConsumes(), edm::ParameterSet::getParameter(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, l1TriggerKeyExtToken_, m_recordTypes, AlCaHarvesting_cff::record, and AlCaHLTBitMon_QueryRunRegistry::string.

14  : m_tscKey(iConfig.getParameter<std::string>("tscKey")),
15  m_rsKey(iConfig.getParameter<std::string>("rsKey")),
16  m_ignoreTriggerKey(iConfig.getParameter<bool>("ignoreTriggerKey")),
17  m_logKeys(iConfig.getParameter<bool>("logKeys")),
18  m_logTransactions(iConfig.getParameter<bool>("logTransactions")),
19  m_forceUpdate(iConfig.getParameter<bool>("forceUpdate")) {
20  //now do what ever initialization is needed
21  typedef std::vector<edm::ParameterSet> ToSave;
22  ToSave toSave = iConfig.getParameter<ToSave>("toPut");
23  for (ToSave::const_iterator it = toSave.begin(); it != toSave.end(); it++) {
24  std::string record = it->getParameter<std::string>("record");
25  std::string type = it->getParameter<std::string>("type");
26  m_recordTypes.push_back(record + "@" + type);
27  }
29 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< std::string > m_recordTypes
edm::ESGetToken< L1TriggerKeyExt, L1TriggerKeyExtRcd > l1TriggerKeyExtToken_
std::string m_tscKey
l1t::DataWriter m_writer ;

◆ ~L1CondDBIOVWriterExt()

L1CondDBIOVWriterExt::~L1CondDBIOVWriterExt ( )
override

Definition at line 31 of file L1CondDBIOVWriterExt.cc.

31  {
32  // do anything here that needs to be done at desctruction time
33  // (e.g. close files, deallocate resources etc.)
34 }

Member Function Documentation

◆ analyze()

void L1CondDBIOVWriterExt::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 37 of file L1CondDBIOVWriterExt.cc.

References mps_fire::end, l1t::DataWriterExt::fillLastTriggerKeyList(), edm::EventSetup::getHandle(), iEvent, submitPVResolutionJobs::key, L1TriggerKeyExt::kNullKey, l1TriggerKeyExtToken_, dqm-mbProfile::log, m_forceUpdate, m_ignoreTriggerKey, m_logKeys, m_logTransactions, m_recordTypes, m_rsKey, m_tscKey, m_writer, l1t::DataWriterExt::readObject(), align_cfg::recordName, python.rootplot.root2matplotlib::replace(), writedatasetfile::run, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, cond::persistency::throwException(), L1TriggerKeyListExt::token(), and l1t::DataWriterExt::updateIOV().

37  {
38  using namespace edm;
39 
40  // Get L1TriggerKeyListExt
41  L1TriggerKeyListExt keyList;
42  l1t::DataWriterExt dataWriter;
43  if (!dataWriter.fillLastTriggerKeyList(keyList)) {
44  edm::LogError("L1-O2O") << "Problem getting last L1TriggerKeyListExt";
45  }
46 
47  unsigned long long run = iEvent.id().run();
48 
49  L1TriggerKeyExt::RecordToKey recordTypeToKeyMap;
50 
51  bool triggerKeyIOVUpdated = true;
52 
53  // Start log string, convert run number into string
54  std::stringstream ss;
55  ss << run;
56  std::string log = "KEYLOG runNumber=" + ss.str();
57  bool logRecords = true;
58 
59  std::string m_Key = m_tscKey + ":" + m_rsKey;
60 
61  if (!m_ignoreTriggerKey) {
62  if (!m_tscKey.empty() && !m_rsKey.empty()) {
63  edm::LogVerbatim("L1-O2O") << "Object key for L1TriggerKeyExt@L1TriggerKeyExtRcd: " << m_tscKey << " : "
64  << m_rsKey;
65 
66  // Use TSC key and L1TriggerKeyListExt to find next run's
67  // L1TriggerKey token
68  std::string keyToken = keyList.token(m_Key);
69 
70  // Update IOV sequence for this token with since-time = new run
71  triggerKeyIOVUpdated = m_writer.updateIOV("L1TriggerKeyExtRcd", keyToken, run, m_logTransactions);
72 
73  // Read current L1TriggerKeyExt directly from ORCON using token
75  m_writer.readObject(keyToken, key);
76 
77  recordTypeToKeyMap = key.recordToKeyMap();
78 
79  // Replace spaces in key with ?s. Do reverse substitution when
80  // making L1TriggerKeyExt.
81  std::string tmpKey = m_Key;
82  replace(tmpKey.begin(), tmpKey.end(), ' ', '?');
83  log += " tscKey:rsKey=" + tmpKey;
84  logRecords = false;
85  } else {
86  // For use with Run Settings, no corresponding L1TrigerKey in
87  // ORCON.
88 
89  // Get L1TriggerKeyExt from EventSetup
90  auto esKey = iSetup.getHandle(l1TriggerKeyExtToken_);
91 
92  recordTypeToKeyMap = esKey->recordToKeyMap();
93  }
94  } else {
95  std::vector<std::string>::const_iterator recordTypeItr = m_recordTypes.begin();
96  std::vector<std::string>::const_iterator recordTypeEnd = m_recordTypes.end();
97 
98  for (; recordTypeItr != recordTypeEnd; ++recordTypeItr) {
99  recordTypeToKeyMap.insert(std::make_pair(*recordTypeItr, m_Key));
100  }
101  }
102 
103  // If L1TriggerKeyExt IOV was already up to date, then so are all its
104  // sub-records.
105  bool throwException = false;
106 
107  if (triggerKeyIOVUpdated || m_forceUpdate) {
108  // Loop over record@type in L1TriggerKeyExt
109  L1TriggerKeyExt::RecordToKey::const_iterator itr = recordTypeToKeyMap.begin();
110  L1TriggerKeyExt::RecordToKey::const_iterator end = recordTypeToKeyMap.end();
111 
112  for (; itr != end; ++itr) {
113  std::string recordType = itr->first;
114  std::string objectKey = itr->second;
115 
116  std::string recordName(recordType, 0, recordType.find_first_of('@'));
117 
118  if (logRecords) {
119  // Replace spaces in key with ?s. Do reverse substitution when
120  // making L1TriggerKeyExt.
121  std::string tmpKey = objectKey;
122  replace(tmpKey.begin(), tmpKey.end(), ' ', '?');
123  log += " " + recordName + "Key=" + tmpKey;
124  }
125 
126  // Do nothing if object key is null.
127  if (objectKey == L1TriggerKeyExt::kNullKey) {
128  edm::LogVerbatim("L1-O2O") << "L1CondDBIOVWriterExt: null object key for " << recordType
129  << "; skipping this record.";
130  } else {
131  // Find payload token
132  edm::LogVerbatim("L1-O2O") << "Object key for " << recordType << ": " << objectKey;
133 
134  std::string payloadToken = keyList.token(recordType, objectKey);
135  if (payloadToken.empty()) {
136  edm::LogVerbatim("L1-O2O") << "L1CondDBIOVWriterExt: empty payload token for " + recordType + ", key " +
137  objectKey;
138 
139  throwException = true;
140  } else {
142  }
143  }
144  }
145  }
146 
147  if (m_logKeys) {
148  edm::LogVerbatim("L1-O2O") << log;
149  }
150 
151  if (throwException) {
152  throw cond::Exception("L1CondDBIOVWriterExt: empty payload tokens");
153  }
154 }
persistency::Exception Exception
Definition: Exception.h:25
void readObject(const std::string &payloadToken, T &outputObject)
Definition: DataWriterExt.h:81
Log< level::Info, true > LogVerbatim
bool fillLastTriggerKeyList(L1TriggerKeyListExt &output)
static const std::string kNullKey
def replace(string, replacements)
Log< level::Error, false > LogError
bool updateIOV(const std::string &esRecordName, const std::string &payloadToken, edm::RunNumber_t sinceRun, bool logTransactions=false)
int iEvent
Definition: GenABIO.cc:224
std::vector< std::string > m_recordTypes
key
prepare the HTCondor submission files and eventually submit them
edm::ESGetToken< L1TriggerKeyExt, L1TriggerKeyExtRcd > l1TriggerKeyExtToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
std::map< std::string, std::string > RecordToKey
std::string m_tscKey
l1t::DataWriter m_writer ;
std::string token(const std::string &tscKey) const
l1t::DataWriterExt m_writer
HLT enums.
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12

◆ beginJob()

void L1CondDBIOVWriterExt::beginJob ( )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 157 of file L1CondDBIOVWriterExt.cc.

157 {}

◆ endJob()

void L1CondDBIOVWriterExt::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 160 of file L1CondDBIOVWriterExt.cc.

160 {}

Member Data Documentation

◆ l1TriggerKeyExtToken_

edm::ESGetToken<L1TriggerKeyExt, L1TriggerKeyExtRcd> L1CondDBIOVWriterExt::l1TriggerKeyExtToken_
private

Definition at line 52 of file L1CondDBIOVWriterExt.h.

Referenced by analyze(), and L1CondDBIOVWriterExt().

◆ m_forceUpdate

bool L1CondDBIOVWriterExt::m_forceUpdate
private

Definition at line 50 of file L1CondDBIOVWriterExt.h.

Referenced by analyze().

◆ m_ignoreTriggerKey

bool L1CondDBIOVWriterExt::m_ignoreTriggerKey
private

Definition at line 44 of file L1CondDBIOVWriterExt.h.

Referenced by analyze().

◆ m_logKeys

bool L1CondDBIOVWriterExt::m_logKeys
private

Definition at line 46 of file L1CondDBIOVWriterExt.h.

Referenced by analyze().

◆ m_logTransactions

bool L1CondDBIOVWriterExt::m_logTransactions
private

Definition at line 48 of file L1CondDBIOVWriterExt.h.

Referenced by analyze().

◆ m_recordTypes

std::vector<std::string> L1CondDBIOVWriterExt::m_recordTypes
private

Definition at line 37 of file L1CondDBIOVWriterExt.h.

Referenced by analyze(), and L1CondDBIOVWriterExt().

◆ m_rsKey

std::string L1CondDBIOVWriterExt::m_rsKey
private

Definition at line 33 of file L1CondDBIOVWriterExt.h.

Referenced by analyze().

◆ m_tscKey

std::string L1CondDBIOVWriterExt::m_tscKey
private

l1t::DataWriter m_writer ;

Definition at line 33 of file L1CondDBIOVWriterExt.h.

Referenced by analyze().

◆ m_writer

l1t::DataWriterExt L1CondDBIOVWriterExt::m_writer
private

Definition at line 30 of file L1CondDBIOVWriterExt.h.

Referenced by analyze().