CMS 3D CMS Logo

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

#include <CondTools/L1Trigger/interface/L1CondDBIOVWriter.h>

Inheritance diagram for L1CondDBIOVWriter:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 L1CondDBIOVWriter (const edm::ParameterSet &)
 
 ~L1CondDBIOVWriter () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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
 
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::vector< ModuleDescription const * > &modules, 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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices 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

bool m_forceUpdate
 
bool m_ignoreTriggerKey
 
bool m_logKeys
 
bool m_logTransactions
 
std::vector< std::string > m_recordTypes
 
std::string m_tscKey
 
l1t::DataWriter m_writer
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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>
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)
 
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

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 38 of file L1CondDBIOVWriter.h.

Constructor & Destructor Documentation

◆ L1CondDBIOVWriter()

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

Definition at line 49 of file L1CondDBIOVWriter.cc.

50  : m_tscKey(iConfig.getParameter<std::string>("tscKey")),
51  m_ignoreTriggerKey(iConfig.getParameter<bool>("ignoreTriggerKey")),
52  m_logKeys(iConfig.getParameter<bool>("logKeys")),
53  m_logTransactions(iConfig.getParameter<bool>("logTransactions")),
54  m_forceUpdate(iConfig.getParameter<bool>("forceUpdate")) {
55  //now do what ever initialization is needed
56  typedef std::vector<edm::ParameterSet> ToSave;
57  ToSave toSave = iConfig.getParameter<ToSave>("toPut");
58  for (ToSave::const_iterator it = toSave.begin(); it != toSave.end(); it++) {
59  std::string record = it->getParameter<std::string>("record");
60  std::string type = it->getParameter<std::string>("type");
61  m_recordTypes.push_back(record + "@" + type);
62  }
63 }

References edm::ParameterSet::getParameter(), m_recordTypes, GlobalPosition_Frontier_DevDB_cff::record, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~L1CondDBIOVWriter()

L1CondDBIOVWriter::~L1CondDBIOVWriter ( )
override

Definition at line 65 of file L1CondDBIOVWriter.cc.

65  {
66  // do anything here that needs to be done at desctruction time
67  // (e.g. close files, deallocate resources etc.)
68 }

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 75 of file L1CondDBIOVWriter.cc.

75  {
76  using namespace edm;
77 
78  // Get L1TriggerKeyList
79  L1TriggerKeyList keyList;
80  l1t::DataWriter dataWriter;
81  if (!dataWriter.fillLastTriggerKeyList(keyList)) {
82  edm::LogError("L1-O2O") << "Problem getting last L1TriggerKeyList";
83  }
84 
85  unsigned long long run = iEvent.id().run();
86 
87  L1TriggerKey::RecordToKey recordTypeToKeyMap;
88 
89  bool triggerKeyIOVUpdated = true;
90 
91  // Start log string, convert run number into string
92  std::stringstream ss;
93  ss << run;
94  std::string log = "KEYLOG runNumber=" + ss.str();
95  bool logRecords = true;
96 
97  if (!m_ignoreTriggerKey) {
98  if (!m_tscKey.empty()) {
99  edm::LogVerbatim("L1-O2O") << "Object key for L1TriggerKey@L1TriggerKeyRcd: " << m_tscKey;
100 
101  // Use TSC key and L1TriggerKeyList to find next run's
102  // L1TriggerKey token
103  std::string keyToken = keyList.token(m_tscKey);
104 
105  // Update IOV sequence for this token with since-time = new run
106  triggerKeyIOVUpdated = m_writer.updateIOV("L1TriggerKeyRcd", keyToken, run, m_logTransactions);
107 
108  // Read current L1TriggerKey directly from ORCON using token
110  m_writer.readObject(keyToken, key);
111 
112  recordTypeToKeyMap = key.recordToKeyMap();
113 
114  // Replace spaces in key with ?s. Do reverse substitution when
115  // making L1TriggerKey.
116  std::string tmpKey = m_tscKey;
117  replace(tmpKey.begin(), tmpKey.end(), ' ', '?');
118  log += " tscKey=" + tmpKey;
119  logRecords = false;
120  } else {
121  // For use with Run Settings, no corresponding L1TrigerKey in
122  // ORCON.
123 
124  // Get L1TriggerKey from EventSetup
126  iSetup.get<L1TriggerKeyRcd>().get(esKey);
127 
128  recordTypeToKeyMap = esKey->recordToKeyMap();
129  }
130  } else {
131  std::vector<std::string>::const_iterator recordTypeItr = m_recordTypes.begin();
132  std::vector<std::string>::const_iterator recordTypeEnd = m_recordTypes.end();
133 
134  for (; recordTypeItr != recordTypeEnd; ++recordTypeItr) {
135  recordTypeToKeyMap.insert(std::make_pair(*recordTypeItr, m_tscKey));
136  }
137  }
138 
139  // If L1TriggerKey IOV was already up to date, then so are all its
140  // sub-records.
141  bool throwException = false;
142 
143  if (triggerKeyIOVUpdated || m_forceUpdate) {
144  // Loop over record@type in L1TriggerKey
145  L1TriggerKey::RecordToKey::const_iterator itr = recordTypeToKeyMap.begin();
146  L1TriggerKey::RecordToKey::const_iterator end = recordTypeToKeyMap.end();
147 
148  for (; itr != end; ++itr) {
149  std::string recordType = itr->first;
150  std::string objectKey = itr->second;
151 
152  std::string recordName(recordType, 0, recordType.find_first_of("@"));
153 
154  if (logRecords) {
155  // Replace spaces in key with ?s. Do reverse substitution when
156  // making L1TriggerKey.
157  std::string tmpKey = objectKey;
158  replace(tmpKey.begin(), tmpKey.end(), ' ', '?');
159  log += " " + recordName + "Key=" + tmpKey;
160  }
161 
162  // Do nothing if object key is null.
163  if (objectKey == L1TriggerKey::kNullKey) {
164  edm::LogVerbatim("L1-O2O") << "L1CondDBIOVWriter: null object key for " << recordType
165  << "; skipping this record.";
166  } else {
167  // Find payload token
168  edm::LogVerbatim("L1-O2O") << "Object key for " << recordType << ": " << objectKey;
169 
170  std::string payloadToken = keyList.token(recordType, objectKey);
171  if (payloadToken.empty()) {
172  edm::LogVerbatim("L1-O2O") << "L1CondDBIOVWriter: empty payload token for " + recordType + ", key " +
173  objectKey;
174 
175  throwException = true;
176  } else {
178  }
179  }
180  }
181  }
182 
183  if (m_logKeys) {
184  edm::LogVerbatim("L1-O2O") << log;
185  }
186 
187  if (throwException) {
188  throw cond::Exception("L1CondDBIOVWriter: empty payload tokens");
189  }
190 }

References end, l1t::DataWriter::fillLastTriggerKeyList(), edm::EventSetup::get(), get, iEvent, crabWrapper::key, L1TriggerKey::kNullKey, dqm-mbProfile::log, m_forceUpdate, m_ignoreTriggerKey, m_logKeys, m_logTransactions, m_recordTypes, m_tscKey, m_writer, l1t::DataWriter::readObject(), align_cfg::recordName, L1TriggerKey::recordToKeyMap(), python.rootplot.root2matplotlib::replace(), writedatasetfile::run, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, cond::persistency::throwException(), L1TriggerKeyList::token(), and l1t::DataWriter::updateIOV().

◆ beginJob()

void L1CondDBIOVWriter::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 193 of file L1CondDBIOVWriter.cc.

193 {}

◆ endJob()

void L1CondDBIOVWriter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 196 of file L1CondDBIOVWriter.cc.

196 {}

Member Data Documentation

◆ m_forceUpdate

bool L1CondDBIOVWriter::m_forceUpdate
private

Definition at line 67 of file L1CondDBIOVWriter.h.

Referenced by analyze().

◆ m_ignoreTriggerKey

bool L1CondDBIOVWriter::m_ignoreTriggerKey
private

Definition at line 61 of file L1CondDBIOVWriter.h.

Referenced by analyze().

◆ m_logKeys

bool L1CondDBIOVWriter::m_logKeys
private

Definition at line 63 of file L1CondDBIOVWriter.h.

Referenced by analyze().

◆ m_logTransactions

bool L1CondDBIOVWriter::m_logTransactions
private

Definition at line 65 of file L1CondDBIOVWriter.h.

Referenced by analyze().

◆ m_recordTypes

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

Definition at line 54 of file L1CondDBIOVWriter.h.

Referenced by analyze(), and L1CondDBIOVWriter().

◆ m_tscKey

std::string L1CondDBIOVWriter::m_tscKey
private

Definition at line 50 of file L1CondDBIOVWriter.h.

Referenced by analyze().

◆ m_writer

l1t::DataWriter L1CondDBIOVWriter::m_writer
private

Definition at line 49 of file L1CondDBIOVWriter.h.

Referenced by analyze().

L1CondDBIOVWriter::m_ignoreTriggerKey
bool m_ignoreTriggerKey
Definition: L1CondDBIOVWriter.h:61
l1t::DataWriter::updateIOV
bool updateIOV(const std::string &esRecordName, const std::string &payloadToken, edm::RunNumber_t sinceRun, bool logTransactions=false)
Definition: DataWriter.cc:72
L1TriggerKeyRcd
Definition: L1TriggerKeyRcd.h:30
edm
HLT enums.
Definition: AlignableModifier.h:19
align_cfg.recordName
recordName
Definition: align_cfg.py:66
L1CondDBIOVWriter::m_recordTypes
std::vector< std::string > m_recordTypes
Definition: L1CondDBIOVWriter.h:54
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
L1CondDBIOVWriter::m_logKeys
bool m_logKeys
Definition: L1CondDBIOVWriter.h:63
L1TriggerKey::RecordToKey
std::map< std::string, std::string > RecordToKey
Definition: L1TriggerKey.h:25
end
#define end
Definition: vmac.h:39
L1TriggerKey
Definition: L1TriggerKey.h:23
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
L1TriggerKey::kNullKey
const static std::string kNullKey
Definition: L1TriggerKey.h:30
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
edm::ESHandle
Definition: DTSurvey.h:22
L1TriggerKey::recordToKeyMap
const RecordToKey & recordToKeyMap() const
Definition: L1TriggerKey.h:76
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1TriggerKeyList
Definition: L1TriggerKeyList.h:32
edm::LogError
Definition: MessageLogger.h:183
iEvent
int iEvent
Definition: GenABIO.cc:224
cond::Exception
persistency::Exception Exception
Definition: Exception.h:25
edm::LogVerbatim
Definition: MessageLogger.h:297
L1CondDBIOVWriter::m_forceUpdate
bool m_forceUpdate
Definition: L1CondDBIOVWriter.h:67
itr
std::vector< std::pair< float, float > >::iterator itr
Definition: HGCDigitizer.cc:28
L1CondDBIOVWriter::m_logTransactions
bool m_logTransactions
Definition: L1CondDBIOVWriter.h:65
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
l1t::DataWriter::readObject
void readObject(const std::string &payloadToken, T &outputObject)
Definition: DataWriter.h:72
type
type
Definition: HCALResponse.h:21
l1t::DataWriter::fillLastTriggerKeyList
bool fillLastTriggerKeyList(L1TriggerKeyList &output)
Definition: DataWriter.cc:147
writedatasetfile.run
run
Definition: writedatasetfile.py:27
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
cond::persistency::throwException
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
l1t::DataWriter
Definition: DataWriter.h:35
L1CondDBIOVWriter::m_tscKey
std::string m_tscKey
Definition: L1CondDBIOVWriter.h:50
L1TriggerKeyList::token
std::string token(const std::string &tscKey) const
Definition: L1TriggerKeyList.cc:96
crabWrapper.key
key
Definition: crabWrapper.py:19
L1CondDBIOVWriter::m_writer
l1t::DataWriter m_writer
Definition: L1CondDBIOVWriter.h:49
python.rootplot.root2matplotlib.replace
def replace(string, replacements)
Definition: root2matplotlib.py:444