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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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_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 wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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<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)
 

Detailed Description

Definition at line 15 of file L1CondDBPayloadWriterExt.h.

Constructor & Destructor Documentation

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 }
T getParameter(std::string const &) const
L1CondDBPayloadWriterExt::~L1CondDBPayloadWriterExt ( )
override

Definition at line 19 of file L1CondDBPayloadWriterExt.cc.

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

Member Function Documentation

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

Definition at line 25 of file L1CondDBPayloadWriterExt.cc.

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

25  {
26  using namespace edm;
27 
28  // Get L1TriggerKeyListExt and make a copy
29  L1TriggerKeyListExt oldKeyList;
30 
32  if (!m_writer.fillLastTriggerKeyList(oldKeyList)) {
33  edm::LogError("L1-O2O") << "Problem getting last L1TriggerKeyListExt";
34  }
35  }
36 
37  L1TriggerKeyListExt* keyList = nullptr;
38 
39  // Write L1TriggerKeyExt to ORCON with no IOV
42 
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  iSetup.get<L1TriggerKeyExtRcd>().get(key);
50 
51  if (!m_overwriteKeys) {
52  triggerKeyOK = oldKeyList.token(key->tscKey()).empty();
53  }
54  } catch (l1t::DataAlreadyPresentException& ex) {
55  triggerKeyOK = false;
56  edm::LogVerbatim("L1-O2O") << ex.what();
57  }
58 
59  if (triggerKeyOK && m_writeL1TriggerKeyExt) {
60  edm::LogVerbatim("L1-O2O") << "Object key for L1TriggerKeyExtRcd@L1TriggerKeyExt: " << key->tscKey();
61  token = m_writer.writePayload(iSetup, "L1TriggerKeyExtRcd@L1TriggerKeyExt");
62  }
63 
64  // If L1TriggerKeyExt is invalid, then all configuration data is already in DB
65  bool throwException = false;
66 
67  if (!token.empty() || !m_writeL1TriggerKeyExt) {
68  // Record token in L1TriggerKeyListExt
70  keyList = new L1TriggerKeyListExt(oldKeyList);
71  if (!(keyList->addKey(key->tscKey(), token, m_overwriteKeys))) {
72  throw cond::Exception("L1CondDBPayloadWriter: TSC key " + key->tscKey() + " already in L1TriggerKeyListExt");
73  }
74  }
75 
76  if (m_writeConfigData) {
77  // Loop over record@type in L1TriggerKeyExt
78  L1TriggerKeyExt::RecordToKey::const_iterator it = key->recordToKeyMap().begin();
79  L1TriggerKeyExt::RecordToKey::const_iterator end = key->recordToKeyMap().end();
80 
81  for (; it != end; ++it) {
82  // Do nothing if object key is null.
83  if (it->second == L1TriggerKeyExt::kNullKey) {
84  edm::LogVerbatim("L1-O2O") << "L1CondDBPayloadWriter: null object key for " << it->first
85  << "; skipping this record.";
86  } else {
87  // Check key is new before writing
88  if (oldKeyList.token(it->first, it->second).empty() || m_overwriteKeys) {
89  // Write data to ORCON with no IOV
90  if (!oldKeyList.token(it->first, it->second).empty()) {
91  edm::LogVerbatim("L1-O2O") << "*** Overwriting payload: object key for " << it->first << ": "
92  << it->second;
93  } else {
94  edm::LogVerbatim("L1-O2O") << "object key for " << it->first << ": " << it->second;
95  }
96 
97  try {
98  token = m_writer.writePayload(iSetup, it->first);
99  } catch (l1t::DataInvalidException& ex) {
100  edm::LogVerbatim("L1-O2O") << ex.what() << " Skipping to next record.";
101 
102  throwException = true;
103 
104  continue;
105  }
106 
107  if (!token.empty()) {
108  // Record token in L1TriggerKeyListExt
109  if (!keyList) {
110  keyList = new L1TriggerKeyListExt(oldKeyList);
111  }
112 
113  if (!(keyList->addKey(it->first, it->second, token, m_overwriteKeys))) {
114  // This should never happen because of the check
115  // above, but just in case....
116  throw cond::Exception("L1CondDBPayloadWriter: subsystem key " + it->second + " for " + it->first +
117  " already in L1TriggerKeyListExt");
118  }
119  }
120  } else {
121  edm::LogVerbatim("L1-O2O") << "L1CondDBPayloadWriter: object key " << it->second << " for " << it->first
122  << " already in L1TriggerKeyListExt";
123  }
124  }
125  }
126  }
127  }
128 
129  if (keyList) {
130  // Write L1TriggerKeyListExt to ORCON
132  }
133 
134  if (throwException) {
135  throw l1t::DataInvalidException("Payload problem found.");
136  }
137 }
persistency::Exception Exception
Definition: Exception.h:25
bool fillLastTriggerKeyList(L1TriggerKeyListExt &output)
static const std::string kNullKey
char const * what() const override
Definition: Exception.cc:103
void writeKeyList(L1TriggerKeyListExt *keyList, edm::RunNumber_t sinceRun=0, bool logTransactions=false)
const RecordToKey & recordToKeyMap() const
#define end
Definition: vmac.h:39
std::string writePayload(const edm::EventSetup &setup, const std::string &recordType)
HLT enums.
T get() const
Definition: EventSetup.h:73
bool addKey(const std::string &tscKey, const std::string &payloadToken, bool overwriteKey=false)
const std::string & tscKey() const
std::string token(const std::string &tscKey) const
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
void L1CondDBPayloadWriterExt::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 140 of file L1CondDBPayloadWriterExt.cc.

140 {}
void L1CondDBPayloadWriterExt::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 143 of file L1CondDBPayloadWriterExt.cc.

143 {}

Member Data Documentation

bool L1CondDBPayloadWriterExt::m_logTransactions
private

Definition at line 38 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

bool L1CondDBPayloadWriterExt::m_newL1TriggerKeyListExt
private

Definition at line 41 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

bool L1CondDBPayloadWriterExt::m_overwriteKeys
private

Definition at line 36 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

bool L1CondDBPayloadWriterExt::m_writeConfigData
private

Definition at line 33 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

bool L1CondDBPayloadWriterExt::m_writeL1TriggerKeyExt
private

Definition at line 30 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

l1t::DataWriterExt L1CondDBPayloadWriterExt::m_writer
private

Definition at line 26 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().