CMS 3D CMS Logo

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

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

Inheritance diagram for L1CondDBPayloadWriter:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 L1CondDBPayloadWriter (const edm::ParameterSet &)
 
 ~L1CondDBPayloadWriter () 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
 
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::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_logTransactions
 
bool m_newL1TriggerKeyList
 
bool m_overwriteKeys
 
bool m_writeConfigData
 
bool m_writeL1TriggerKey
 
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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
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 = 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

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

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

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

Usage: <usage>

Definition at line 38 of file L1CondDBPayloadWriter.h.

Constructor & Destructor Documentation

◆ L1CondDBPayloadWriter()

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

Definition at line 47 of file L1CondDBPayloadWriter.cc.

48  : m_writeL1TriggerKey(iConfig.getParameter<bool>("writeL1TriggerKey")),
49  m_writeConfigData(iConfig.getParameter<bool>("writeConfigData")),
50  m_overwriteKeys(iConfig.getParameter<bool>("overwriteKeys")),
51  m_logTransactions(iConfig.getParameter<bool>("logTransactions")),
52  m_newL1TriggerKeyList(iConfig.getParameter<bool>("newL1TriggerKeyList")) {
53  //now do what ever initialization is needed
54 }

◆ ~L1CondDBPayloadWriter()

L1CondDBPayloadWriter::~L1CondDBPayloadWriter ( )
override

Definition at line 56 of file L1CondDBPayloadWriter.cc.

56  {
57  // do anything here that needs to be done at desctruction time
58  // (e.g. close files, deallocate resources etc.)
59 }

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 66 of file L1CondDBPayloadWriter.cc.

66  {
67  using namespace edm;
68 
69  // Get L1TriggerKeyList and make a copy
70  L1TriggerKeyList oldKeyList;
71 
72  if (!m_newL1TriggerKeyList) {
73  if (!m_writer.fillLastTriggerKeyList(oldKeyList)) {
74  edm::LogError("L1-O2O") << "Problem getting last L1TriggerKeyList";
75  }
76  }
77 
78  L1TriggerKeyList* keyList = nullptr;
79 
80  // Write L1TriggerKey to ORCON with no IOV
83 
84  // Before calling writePayload(), check if TSC key is already in
85  // L1TriggerKeyList. writePayload() will not catch this situation in
86  // the case of dummy configurations.
87  bool triggerKeyOK = true;
88  try {
89  // Get L1TriggerKey
90  iSetup.get<L1TriggerKeyRcd>().get(key);
91 
92  if (!m_overwriteKeys) {
93  triggerKeyOK = oldKeyList.token(key->tscKey()).empty();
94  }
95  } catch (l1t::DataAlreadyPresentException& ex) {
96  triggerKeyOK = false;
97  edm::LogVerbatim("L1-O2O") << ex.what();
98  }
99 
100  if (triggerKeyOK && m_writeL1TriggerKey) {
101  edm::LogVerbatim("L1-O2O") << "Object key for L1TriggerKeyRcd@L1TriggerKey: " << key->tscKey();
102  token = m_writer.writePayload(iSetup, "L1TriggerKeyRcd@L1TriggerKey");
103  }
104 
105  // If L1TriggerKey is invalid, then all configuration data is already in DB
106  bool throwException = false;
107 
108  if (!token.empty() || !m_writeL1TriggerKey) {
109  // Record token in L1TriggerKeyList
110  if (m_writeL1TriggerKey) {
111  keyList = new L1TriggerKeyList(oldKeyList);
112  if (!(keyList->addKey(key->tscKey(), token, m_overwriteKeys))) {
113  throw cond::Exception("L1CondDBPayloadWriter: TSC key " + key->tscKey() + " already in L1TriggerKeyList");
114  }
115  }
116 
117  if (m_writeConfigData) {
118  // Loop over record@type in L1TriggerKey
119  L1TriggerKey::RecordToKey::const_iterator it = key->recordToKeyMap().begin();
120  L1TriggerKey::RecordToKey::const_iterator end = key->recordToKeyMap().end();
121 
122  for (; it != end; ++it) {
123  // Do nothing if object key is null.
124  if (it->second == L1TriggerKey::kNullKey) {
125  edm::LogVerbatim("L1-O2O") << "L1CondDBPayloadWriter: null object key for " << it->first
126  << "; skipping this record.";
127  } else {
128  // Check key is new before writing
129  if (oldKeyList.token(it->first, it->second).empty() || m_overwriteKeys) {
130  // Write data to ORCON with no IOV
131  if (!oldKeyList.token(it->first, it->second).empty()) {
132  edm::LogVerbatim("L1-O2O") << "*** Overwriting payload: object key for " << it->first << ": "
133  << it->second;
134  } else {
135  edm::LogVerbatim("L1-O2O") << "object key for " << it->first << ": " << it->second;
136  }
137 
138  try {
139  token = m_writer.writePayload(iSetup, it->first);
140  } catch (l1t::DataInvalidException& ex) {
141  edm::LogVerbatim("L1-O2O") << ex.what() << " Skipping to next record.";
142 
143  throwException = true;
144 
145  continue;
146  }
147 
148  if (!token.empty()) {
149  // Record token in L1TriggerKeyList
150  if (!keyList) {
151  keyList = new L1TriggerKeyList(oldKeyList);
152  }
153 
154  if (!(keyList->addKey(it->first, it->second, token, m_overwriteKeys))) {
155  // This should never happen because of the check
156  // above, but just in case....
157  throw cond::Exception("L1CondDBPayloadWriter: subsystem key " + it->second + " for " + it->first +
158  " already in L1TriggerKeyList");
159  }
160  }
161  } else {
162  edm::LogVerbatim("L1-O2O") << "L1CondDBPayloadWriter: object key " << it->second << " for " << it->first
163  << " already in L1TriggerKeyList";
164  }
165  }
166  }
167  }
168  }
169 
170  if (keyList) {
171  // Write L1TriggerKeyList to ORCON
173  }
174 
175  if (throwException) {
176  throw l1t::DataInvalidException("Payload problem found.");
177  }
178 }

References L1TriggerKeyList::addKey(), relativeConstraints::empty, mps_fire::end, l1t::DataWriter::fillLastTriggerKeyList(), edm::EventSetup::get(), get, crabWrapper::key, L1TriggerKey::kNullKey, m_logTransactions, m_newL1TriggerKeyList, m_overwriteKeys, m_writeConfigData, m_writeL1TriggerKey, m_writer, AlCaHLTBitMon_QueryRunRegistry::string, cond::persistency::throwException(), L1TriggerKeyList::token(), unpackBuffers-CaloStage2::token, cms::Exception::what(), l1t::DataWriter::writeKeyList(), and l1t::DataWriter::writePayload().

◆ beginJob()

void L1CondDBPayloadWriter::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 181 of file L1CondDBPayloadWriter.cc.

181 {}

◆ endJob()

void L1CondDBPayloadWriter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 184 of file L1CondDBPayloadWriter.cc.

184 {}

Member Data Documentation

◆ m_logTransactions

bool L1CondDBPayloadWriter::m_logTransactions
private

Definition at line 61 of file L1CondDBPayloadWriter.h.

Referenced by analyze().

◆ m_newL1TriggerKeyList

bool L1CondDBPayloadWriter::m_newL1TriggerKeyList
private

Definition at line 64 of file L1CondDBPayloadWriter.h.

Referenced by analyze().

◆ m_overwriteKeys

bool L1CondDBPayloadWriter::m_overwriteKeys
private

Definition at line 59 of file L1CondDBPayloadWriter.h.

Referenced by analyze().

◆ m_writeConfigData

bool L1CondDBPayloadWriter::m_writeConfigData
private

Definition at line 56 of file L1CondDBPayloadWriter.h.

Referenced by analyze().

◆ m_writeL1TriggerKey

bool L1CondDBPayloadWriter::m_writeL1TriggerKey
private

Definition at line 53 of file L1CondDBPayloadWriter.h.

Referenced by analyze().

◆ m_writer

l1t::DataWriter L1CondDBPayloadWriter::m_writer
private

Definition at line 49 of file L1CondDBPayloadWriter.h.

Referenced by analyze().

L1CondDBPayloadWriter::m_logTransactions
bool m_logTransactions
Definition: L1CondDBPayloadWriter.h:61
L1CondDBPayloadWriter::m_writeL1TriggerKey
bool m_writeL1TriggerKey
Definition: L1CondDBPayloadWriter.h:53
L1CondDBPayloadWriter::m_writeConfigData
bool m_writeConfigData
Definition: L1CondDBPayloadWriter.h:56
L1TriggerKeyRcd
Definition: L1TriggerKeyRcd.h:30
edm
HLT enums.
Definition: AlignableModifier.h:19
L1TriggerKeyList::addKey
bool addKey(const std::string &tscKey, const std::string &payloadToken, bool overwriteKey=false)
Definition: L1TriggerKeyList.cc:55
l1t::DataAlreadyPresentException
Definition: Exception.h:32
L1CondDBPayloadWriter::m_writer
l1t::DataWriter m_writer
Definition: L1CondDBPayloadWriter.h:49
cms::Exception::what
char const * what() const noexcept override
Definition: Exception.cc:103
l1t::DataInvalidException
Definition: Exception.h:51
L1TriggerKey::kNullKey
const static std::string kNullKey
Definition: L1TriggerKey.h:30
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
l1t::DataWriter::writeKeyList
void writeKeyList(L1TriggerKeyList *keyList, edm::RunNumber_t sinceRun=0, bool logTransactions=false)
Definition: DataWriter.cc:49
mps_fire.end
end
Definition: mps_fire.py:242
edm::ESHandle
Definition: DTSurvey.h:22
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1CondDBPayloadWriter::m_newL1TriggerKeyList
bool m_newL1TriggerKeyList
Definition: L1CondDBPayloadWriter.h:64
L1TriggerKeyList
Definition: L1TriggerKeyList.h:32
l1t::DataWriter::writePayload
std::string writePayload(const edm::EventSetup &setup, const std::string &recordType)
Definition: DataWriter.cc:15
cond::Exception
persistency::Exception Exception
Definition: Exception.h:25
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
L1CondDBPayloadWriter::m_overwriteKeys
bool m_overwriteKeys
Definition: L1CondDBPayloadWriter.h:59
l1t::DataWriter::fillLastTriggerKeyList
bool fillLastTriggerKeyList(L1TriggerKeyList &output)
Definition: DataWriter.cc:147
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
cond::persistency::throwException
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
L1TriggerKeyList::token
std::string token(const std::string &tscKey) const
Definition: L1TriggerKeyList.cc:96
crabWrapper.key
key
Definition: crabWrapper.py:19
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:318