CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
L1CondDBPayloadWriterExt Class Reference

#include <L1CondDBPayloadWriterExt.h>

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

Public Member Functions

 L1CondDBPayloadWriterExt (const edm::ParameterSet &)
 
 ~L1CondDBPayloadWriterExt () 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 final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const 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
 
bool wantsStreamRuns () const
 
 ~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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, 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::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,
L1TriggerKeyExtRcd
key_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::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< B > consumes (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 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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
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...
 
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 20 of file L1CondDBPayloadWriterExt.h.

Constructor & Destructor Documentation

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

Definition at line 10 of file L1CondDBPayloadWriterExt.cc.

References key_token.

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 }
edm::ESGetToken< L1TriggerKeyExt, L1TriggerKeyExtRcd > key_token
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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

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

Implements edm::one::EDAnalyzerBase.

Definition at line 26 of file L1CondDBPayloadWriterExt.cc.

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

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 }
persistency::Exception Exception
Definition: Exception.h:25
Log< level::Info, true > LogVerbatim
bool fillLastTriggerKeyList(L1TriggerKeyListExt &output)
static const std::string kNullKey
Log< level::Error, false > LogError
void writeKeyList(L1TriggerKeyListExt *keyList, edm::RunNumber_t sinceRun=0, bool logTransactions=false)
edm::ESGetToken< L1TriggerKeyExt, L1TriggerKeyExtRcd > key_token
tuple key
prepare the HTCondor submission files and eventually submit them
char const * what() const noexceptoverride
Definition: Exception.cc:103
std::string writePayload(const edm::EventSetup &setup, const std::string &recordType)
T get() const
Definition: EventSetup.h:88
string end
Definition: dataset.py:937
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
void L1CondDBPayloadWriterExt::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 139 of file L1CondDBPayloadWriterExt.cc.

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

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 142 of file L1CondDBPayloadWriterExt.cc.

142 {}

Member Data Documentation

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

Definition at line 35 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze(), and L1CondDBPayloadWriterExt().

bool L1CondDBPayloadWriterExt::m_logTransactions
private

Definition at line 46 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

bool L1CondDBPayloadWriterExt::m_newL1TriggerKeyListExt
private

Definition at line 49 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

bool L1CondDBPayloadWriterExt::m_overwriteKeys
private

Definition at line 44 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

bool L1CondDBPayloadWriterExt::m_writeConfigData
private

Definition at line 41 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

bool L1CondDBPayloadWriterExt::m_writeL1TriggerKeyExt
private

Definition at line 38 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().

l1t::DataWriterExt L1CondDBPayloadWriterExt::m_writer
private

Definition at line 31 of file L1CondDBPayloadWriterExt.h.

Referenced by analyze().