CMS 3D CMS Logo

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

#include <L1CondDBPayloadWriterExt.h>

Inheritance diagram for L1CondDBPayloadWriterExt:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 L1CondDBPayloadWriterExt (const edm::ParameterSet &)
 
 ~L1CondDBPayloadWriterExt () 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::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
 
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

edm::ESGetToken< L1TriggerKeyExt, L1TriggerKeyExtRcdkey_token
 
bool m_logTransactions
 
bool m_newL1TriggerKeyListExt
 
bool m_overwriteKeys
 
bool m_writeConfigData
 
bool m_writeL1TriggerKeyExt
 
l1t::DataWriterExt 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

Definition at line 20 of file L1CondDBPayloadWriterExt.h.

Constructor & Destructor Documentation

◆ L1CondDBPayloadWriterExt()

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

Definition at line 10 of file L1CondDBPayloadWriterExt.cc.

11  : m_writeL1TriggerKeyExt(iConfig.getParameter<bool>("writeL1TriggerKeyExt")),
12  m_writeConfigData(iConfig.getParameter<bool>("writeConfigData")),
13  m_overwriteKeys(iConfig.getParameter<bool>("overwriteKeys")),
14  m_logTransactions(iConfig.getParameter<bool>("logTransactions")),
15  m_newL1TriggerKeyListExt(iConfig.getParameter<bool>("newL1TriggerKeyListExt")) {
16  //now do what ever initialization is needed
17  key_token = esConsumes<L1TriggerKeyExt, L1TriggerKeyExtRcd>();
18 }

References key_token.

◆ ~L1CondDBPayloadWriterExt()

L1CondDBPayloadWriterExt::~L1CondDBPayloadWriterExt ( )
override

Definition at line 20 of file L1CondDBPayloadWriterExt.cc.

20  {
21  // do anything here that needs to be done at desctruction time
22  // (e.g. close files, deallocate resources etc.)
23 }

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 26 of file L1CondDBPayloadWriterExt.cc.

26  {
27  using namespace edm;
28 
29  // Get L1TriggerKeyListExt and make a copy
30  L1TriggerKeyListExt oldKeyList;
31 
33  if (!m_writer.fillLastTriggerKeyList(oldKeyList)) {
34  edm::LogError("L1-O2O") << "Problem getting last L1TriggerKeyListExt";
35  }
36  }
37 
38  L1TriggerKeyListExt* keyList = nullptr;
39 
40  // Write L1TriggerKeyExt to ORCON with no IOV
43  // Before calling writePayload(), check if TSC key is already in
44  // L1TriggerKeyListExt. writePayload() will not catch this situation in
45  // the case of dummy configurations.
46  bool triggerKeyOK = true;
47  try {
48  // Get L1TriggerKeyExt
49  key = iSetup.get<L1TriggerKeyExtRcd>().get(key_token);
50  if (!m_overwriteKeys) {
51  triggerKeyOK = oldKeyList.token(key.tscKey()).empty();
52  }
53  } catch (l1t::DataAlreadyPresentException& ex) {
54  triggerKeyOK = false;
55  edm::LogVerbatim("L1-O2O") << ex.what();
56  }
57 
58  if (triggerKeyOK && m_writeL1TriggerKeyExt) {
59  edm::LogVerbatim("L1-O2O") << "Object key for L1TriggerKeyExtRcd@L1TriggerKeyExt: " << key.tscKey();
60  token = m_writer.writePayload(iSetup, "L1TriggerKeyExtRcd@L1TriggerKeyExt");
61  }
62 
63  // If L1TriggerKeyExt is invalid, then all configuration data is already in DB
64  bool throwException = false;
65 
66  if (!token.empty() || !m_writeL1TriggerKeyExt) {
67  // Record token in L1TriggerKeyListExt
69  keyList = new L1TriggerKeyListExt(oldKeyList);
70  if (!(keyList->addKey(key.tscKey(), token, m_overwriteKeys))) {
71  throw cond::Exception("L1CondDBPayloadWriter: TSC key " + key.tscKey() + " already in L1TriggerKeyListExt");
72  }
73  }
74 
75  if (m_writeConfigData) {
76  // Loop over record@type in L1TriggerKeyExt
77  L1TriggerKeyExt::RecordToKey::const_iterator it = key.recordToKeyMap().begin();
78  L1TriggerKeyExt::RecordToKey::const_iterator end = key.recordToKeyMap().end();
79 
80  for (; it != end; ++it) {
81  // Do nothing if object key is null.
82  if (it->second == L1TriggerKeyExt::kNullKey) {
83  edm::LogVerbatim("L1-O2O") << "L1CondDBPayloadWriter: null object key for " << it->first
84  << "; skipping this record.";
85  } else {
86  // Check key is new before writing
87  if (oldKeyList.token(it->first, it->second).empty() || m_overwriteKeys) {
88  // Write data to ORCON with no IOV
89  if (!oldKeyList.token(it->first, it->second).empty()) {
90  edm::LogVerbatim("L1-O2O") << "*** Overwriting payload: object key for " << it->first << ": "
91  << it->second;
92  } else {
93  edm::LogVerbatim("L1-O2O") << "object key for " << it->first << ": " << it->second;
94  }
95 
96  try {
97  token = m_writer.writePayload(iSetup, it->first);
98  } catch (l1t::DataInvalidException& ex) {
99  edm::LogVerbatim("L1-O2O") << ex.what() << " Skipping to next record.";
100 
101  throwException = true;
102 
103  continue;
104  }
105 
106  if (!token.empty()) {
107  // Record token in L1TriggerKeyListExt
108  if (!keyList) {
109  keyList = new L1TriggerKeyListExt(oldKeyList);
110  }
111 
112  if (!(keyList->addKey(it->first, it->second, token, m_overwriteKeys))) {
113  // This should never happen because of the check
114  // above, but just in case....
115  throw cond::Exception("L1CondDBPayloadWriter: subsystem key " + it->second + " for " + it->first +
116  " already in L1TriggerKeyListExt");
117  }
118  }
119  } else {
120  edm::LogVerbatim("L1-O2O") << "L1CondDBPayloadWriter: object key " << it->second << " for " << it->first
121  << " already in L1TriggerKeyListExt";
122  }
123  }
124  }
125  }
126  }
127 
128  if (keyList) {
129  // Write L1TriggerKeyListExt to ORCON
131  }
132 
133  if (throwException) {
134  throw l1t::DataInvalidException("Payload problem found.");
135  }
136 }

References L1TriggerKeyListExt::addKey(), relativeConstraints::empty, mps_fire::end, l1t::DataWriterExt::fillLastTriggerKeyList(), edm::EventSetup::get(), get, crabWrapper::key, key_token, L1TriggerKeyExt::kNullKey, m_logTransactions, m_newL1TriggerKeyListExt, m_overwriteKeys, m_writeConfigData, m_writeL1TriggerKeyExt, m_writer, AlCaHLTBitMon_QueryRunRegistry::string, cond::persistency::throwException(), L1TriggerKeyListExt::token(), unpackBuffers-CaloStage2::token, cms::Exception::what(), l1t::DataWriterExt::writeKeyList(), and l1t::DataWriterExt::writePayload().

◆ beginJob()

void L1CondDBPayloadWriterExt::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 139 of file L1CondDBPayloadWriterExt.cc.

139 {}

◆ endJob()

void L1CondDBPayloadWriterExt::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 142 of file L1CondDBPayloadWriterExt.cc.

142 {}

Member Data Documentation

◆ key_token

edm::ESGetToken<L1TriggerKeyExt, L1TriggerKeyExtRcd> L1CondDBPayloadWriterExt::key_token
private

Definition at line 35 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze(), and L1CondDBPayloadWriterExt().

◆ m_logTransactions

bool L1CondDBPayloadWriterExt::m_logTransactions
private

Definition at line 46 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

◆ m_newL1TriggerKeyListExt

bool L1CondDBPayloadWriterExt::m_newL1TriggerKeyListExt
private

Definition at line 49 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

◆ m_overwriteKeys

bool L1CondDBPayloadWriterExt::m_overwriteKeys
private

Definition at line 44 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

◆ m_writeConfigData

bool L1CondDBPayloadWriterExt::m_writeConfigData
private

Definition at line 41 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

◆ m_writeL1TriggerKeyExt

bool L1CondDBPayloadWriterExt::m_writeL1TriggerKeyExt
private

Definition at line 38 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

◆ m_writer

l1t::DataWriterExt L1CondDBPayloadWriterExt::m_writer
private

Definition at line 31 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

L1TriggerKeyListExt
Definition: L1TriggerKeyListExt.h:10
L1TriggerKeyExt::kNullKey
const static std::string kNullKey
Definition: L1TriggerKeyExt.h:30
edm
HLT enums.
Definition: AlignableModifier.h:19
L1TriggerKeyExtRcd
Definition: L1TriggerKeyExtRcd.h:8
l1t::DataAlreadyPresentException
Definition: Exception.h:32
L1CondDBPayloadWriterExt::m_writer
l1t::DataWriterExt m_writer
Definition: L1CondDBPayloadWriterExt.h:31
cms::Exception::what
char const * what() const noexcept override
Definition: Exception.cc:103
l1t::DataInvalidException
Definition: Exception.h:51
L1TriggerKeyListExt::addKey
bool addKey(const std::string &tscKey, const std::string &payloadToken, bool overwriteKey=false)
Definition: L1TriggerKeyListExt.cc:28
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
mps_fire.end
end
Definition: mps_fire.py:242
L1TriggerKeyExt
Definition: L1TriggerKeyExt.h:23
l1t::DataWriterExt::fillLastTriggerKeyList
bool fillLastTriggerKeyList(L1TriggerKeyListExt &output)
Definition: DataWriterExt.cc:148
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1CondDBPayloadWriterExt::m_newL1TriggerKeyListExt
bool m_newL1TriggerKeyListExt
Definition: L1CondDBPayloadWriterExt.h:49
cond::Exception
persistency::Exception Exception
Definition: Exception.h:25
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
L1CondDBPayloadWriterExt::m_overwriteKeys
bool m_overwriteKeys
Definition: L1CondDBPayloadWriterExt.h:44
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
l1t::DataWriterExt::writePayload
std::string writePayload(const edm::EventSetup &setup, const std::string &recordType)
Definition: DataWriterExt.cc:15
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
L1CondDBPayloadWriterExt::m_writeL1TriggerKeyExt
bool m_writeL1TriggerKeyExt
Definition: L1CondDBPayloadWriterExt.h:38
L1CondDBPayloadWriterExt::key_token
edm::ESGetToken< L1TriggerKeyExt, L1TriggerKeyExtRcd > key_token
Definition: L1CondDBPayloadWriterExt.h:35
L1CondDBPayloadWriterExt::m_logTransactions
bool m_logTransactions
Definition: L1CondDBPayloadWriterExt.h:46
crabWrapper.key
key
Definition: crabWrapper.py:19
L1CondDBPayloadWriterExt::m_writeConfigData
bool m_writeConfigData
Definition: L1CondDBPayloadWriterExt.h:41
l1t::DataWriterExt::writeKeyList
void writeKeyList(L1TriggerKeyListExt *keyList, edm::RunNumber_t sinceRun=0, bool logTransactions=false)
Definition: DataWriterExt.cc:49
L1TriggerKeyListExt::token
std::string token(const std::string &tscKey) const
Definition: L1TriggerKeyListExt.cc:69
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316