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
L1CondDBPayloadWriter Class Reference

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

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

Public Member Functions

 L1CondDBPayloadWriter (const edm::ParameterSet &)
 
 ~L1CondDBPayloadWriter () 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< L1TriggerKey,
L1TriggerKeyRcd
l1TriggerKeyToken_
 
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::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

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

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

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

Usage: <usage>

Definition at line 40 of file L1CondDBPayloadWriter.h.

Constructor & Destructor Documentation

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

Definition at line 43 of file L1CondDBPayloadWriter.cc.

References edm::EDConsumerBase::esConsumes(), and l1TriggerKeyToken_.

44  : m_writeL1TriggerKey(iConfig.getParameter<bool>("writeL1TriggerKey")),
45  m_writeConfigData(iConfig.getParameter<bool>("writeConfigData")),
46  m_overwriteKeys(iConfig.getParameter<bool>("overwriteKeys")),
47  m_logTransactions(iConfig.getParameter<bool>("logTransactions")),
48  m_newL1TriggerKeyList(iConfig.getParameter<bool>("newL1TriggerKeyList")) {
49  //now do what ever initialization is needed
51 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< L1TriggerKey, L1TriggerKeyRcd > l1TriggerKeyToken_
L1CondDBPayloadWriter::~L1CondDBPayloadWriter ( )
override

Definition at line 53 of file L1CondDBPayloadWriter.cc.

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

Member Function Documentation

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

Implements edm::one::EDAnalyzerBase.

Definition at line 63 of file L1CondDBPayloadWriter.cc.

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

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

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 178 of file L1CondDBPayloadWriter.cc.

178 {}
void L1CondDBPayloadWriter::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 181 of file L1CondDBPayloadWriter.cc.

181 {}

Member Data Documentation

edm::ESGetToken<L1TriggerKey, L1TriggerKeyRcd> L1CondDBPayloadWriter::l1TriggerKeyToken_
private

Definition at line 68 of file L1CondDBPayloadWriter.h.

Referenced by analyze(), and L1CondDBPayloadWriter().

bool L1CondDBPayloadWriter::m_logTransactions
private

Definition at line 63 of file L1CondDBPayloadWriter.h.

Referenced by analyze().

bool L1CondDBPayloadWriter::m_newL1TriggerKeyList
private

Definition at line 66 of file L1CondDBPayloadWriter.h.

Referenced by analyze().

bool L1CondDBPayloadWriter::m_overwriteKeys
private

Definition at line 61 of file L1CondDBPayloadWriter.h.

Referenced by analyze().

bool L1CondDBPayloadWriter::m_writeConfigData
private

Definition at line 58 of file L1CondDBPayloadWriter.h.

Referenced by analyze().

bool L1CondDBPayloadWriter::m_writeL1TriggerKey
private

Definition at line 55 of file L1CondDBPayloadWriter.h.

Referenced by analyze().

l1t::DataWriter L1CondDBPayloadWriter::m_writer
private

Definition at line 51 of file L1CondDBPayloadWriter.h.

Referenced by analyze().