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
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

bool m_logTransactions
 
bool m_newL1TriggerKeyListExt
 
bool m_overwriteKeys
 
RecordToWriterMap m_rcdToWriterMap
 
bool m_writeConfigData
 
bool m_writeL1TriggerKeyExt
 
edm::ESGetToken
< L1TriggerKeyExt,
L1TriggerKeyExtRcd
theL1TriggerKeyExtToken_
 

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< Bconsumes (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 ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
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 21 of file L1CondDBPayloadWriterExt.cc.

Constructor & Destructor Documentation

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

Definition at line 53 of file L1CondDBPayloadWriterExt.cc.

References edm::EDConsumerBase::consumesCollector(), edm::ParameterSet::getParameter(), m_rcdToWriterMap, and eostools::move().

54  : m_writeL1TriggerKeyExt(iConfig.getParameter<bool>("writeL1TriggerKeyExt")),
55  m_writeConfigData(iConfig.getParameter<bool>("writeConfigData")),
56  m_overwriteKeys(iConfig.getParameter<bool>("overwriteKeys")),
57  m_logTransactions(iConfig.getParameter<bool>("logTransactions")),
58  m_newL1TriggerKeyListExt(iConfig.getParameter<bool>("newL1TriggerKeyListExt")),
60  auto cc = consumesCollector();
61  for (const auto& sysWriter : iConfig.getParameter<std::vector<std::string>>("sysWriters")) {
62  //construct writer
63  DataWriterExtPtr writer = std::make_unique<l1t::DataWriterExt>(sysWriter);
64  writer->getWriter()->setToken(cc);
65  m_rcdToWriterMap[sysWriter] = std::move(writer); //the sysWriter holds info in 'rcd@prod' format
66  }
67 }
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
def move
Definition: eostools.py:511
std::unique_ptr< l1t::DataWriterExt > DataWriterExtPtr
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< L1TriggerKeyExt, L1TriggerKeyExtRcd > theL1TriggerKeyExtToken_
L1CondDBPayloadWriterExt::~L1CondDBPayloadWriterExt ( )
override

Definition at line 69 of file L1CondDBPayloadWriterExt.cc.

69  {
70  // do anything here that needs to be done at desctruction time
71  // (e.g. close files, deallocate resources etc.)
72 }

Member Function Documentation

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

Implements edm::one::EDAnalyzerBase.

Definition at line 75 of file L1CondDBPayloadWriterExt.cc.

References relativeConstraints::empty, edm::EventSetup::getData(), submitPVResolutionJobs::key, L1TriggerKeyExt::kNullKey, m_logTransactions, m_newL1TriggerKeyListExt, m_overwriteKeys, m_rcdToWriterMap, m_writeConfigData, m_writeL1TriggerKeyExt, or, AlCaHLTBitMon_QueryRunRegistry::string, theL1TriggerKeyExtToken_, cond::persistency::throwException(), unpackBuffers-CaloStage2::token, and cms::Exception::what().

75  {
76  using namespace edm;
77 
78  // Get L1TriggerKeyListExt and make a copy
79  L1TriggerKeyListExt oldKeyList;
80  l1t::DataWriterExt& m_writer = *m_rcdToWriterMap.at("L1TriggerKeyExtRcd@L1TriggerKeyExt");
81 
82  if (not(m_newL1TriggerKeyListExt or m_writer.fillLastTriggerKeyList(oldKeyList)))
83  edm::LogError("L1-O2O") << "Problem getting last L1TriggerKeyListExt";
84 
85  L1TriggerKeyListExt* keyList = nullptr;
86 
87  // Write L1TriggerKeyExt to ORCON with no IOV
90  // Before calling writePayload(), check if TSC key is already in
91  // L1TriggerKeyListExt. writePayload() will not catch this situation in
92  // the case of dummy configurations.
93  bool triggerKeyOK = true;
94  try {
95  // Get L1TriggerKeyExt
97  if (!m_overwriteKeys) {
98  triggerKeyOK = oldKeyList.token(key.tscKey()).empty();
99  }
100  } catch (l1t::DataAlreadyPresentException& ex) {
101  triggerKeyOK = false;
102  edm::LogVerbatim("L1-O2O") << ex.what();
103  }
104 
105  if (triggerKeyOK and m_writeL1TriggerKeyExt) {
106  edm::LogVerbatim("L1-O2O") << "Object key for L1TriggerKeyExtRcd@L1TriggerKeyExt: " << key.tscKey()
107  << " (about to run writePayload)";
108  token = m_writer.writePayload(iSetup);
109  }
110 
111  // If L1TriggerKeyExt is invalid (empty), then all configuration data is already in DB
112  // m_writeL1TriggerKeyExt the naming is misleading,
113  // the bool is used to say to the module whether it runs or not to update a L1TriggerKeyExtRcd
114  // (so if no payload for L1TriggerKeyExtRcd AND you run for updating L1TriggerKeyExtRcd ==> you have nothing to update)
115  if (token.empty() and m_writeL1TriggerKeyExt) {
116  edm::LogInfo("L1CondDBPayloadWriterExt::analyze") << " token = " << token;
117  return;
118  }
119 
120  // Record token in L1TriggerKeyListExt
121  if (m_writeL1TriggerKeyExt) {
122  keyList = new L1TriggerKeyListExt(oldKeyList);
123  if (not keyList->addKey(key.tscKey(), token, m_overwriteKeys))
124  throw cond::Exception("L1CondDBPayloadWriter: TSC key " + key.tscKey() + " already in L1TriggerKeyListExt");
125  }
126 
127  if (not m_writeConfigData) {
128  // Write L1TriggerKeyListExt to ORCON
129  if (keyList)
130  m_writer.writeKeyList(keyList, 0, m_logTransactions);
131  return;
132  }
133 
134  // Loop over record@type in L1TriggerKeyExt
135  // (as before make writers, try to write payload and if needed handle exceptions)
136 
137  // this is not needed maps have implemented begin and end methods for their iterators
138  // L1TriggerKeyExt::RecordToKey::const_iterator it = key.recordToKeyMap().begin();
139  // L1TriggerKeyExt::RecordToKey::const_iterator end = key.recordToKeyMap().end();
140  // for (; it != end; ++it) {
141 
142  bool throwException = false;
143  for (const auto& it : key.recordToKeyMap()) {
144  // If there isn't any WriterProxyT constructed for this rcd, continue
145  // (the missing rcds are left out for a reason - those are static that throw exceptions that cannot be handled in 12_3)
146  if (m_rcdToWriterMap.find(it.first) == m_rcdToWriterMap.end())
147  continue;
148 
149  // Do nothing if object key is null.
150  // (Panos) this might not be working as the "empty" keys are L1TriggerKeyExt::kEmptyKey (std::string(""))
151  if (it.second == L1TriggerKeyExt::kNullKey) {
152  edm::LogVerbatim("L1-O2O") << "L1CondDBPayloadWriter: null object key for " << it.first
153  << "; skipping this record.";
154  continue;
155  }
156 
157  // Check key is new before writing
158  if (oldKeyList.token(it.first, it.second).empty() || m_overwriteKeys) {
159  // Write data to ORCON with no IOV
160  if (!oldKeyList.token(it.first, it.second).empty()) {
161  edm::LogVerbatim("L1-O2O") << "*** Overwriting payload: object key for " << it.first << ": " << it.second;
162  } else {
163  edm::LogVerbatim("L1-O2O") << "object key for " << it.first << ": " << it.second;
164  }
165 
166  try {
167  edm::LogVerbatim("L1-O2O") << "about to run writePayload for " << it.first;
168  token = m_rcdToWriterMap.at(it.first)->writePayload(iSetup);
169  } catch (l1t::DataInvalidException& ex) {
170  edm::LogVerbatim("L1-O2O") << ex.what() << " Skipping to next record.";
171  throwException = true;
172  continue;
173  }
174 
175  if (!token.empty()) {
176  // Record token in L1TriggerKeyListExt
177  if (!keyList)
178  keyList = new L1TriggerKeyListExt(oldKeyList);
179  // The following should never happen because of the check
180  // above, but just in case....
181  if (!(keyList->addKey(it.first, it.second, token, m_overwriteKeys)))
182  throw cond::Exception("L1CondDBPayloadWriter")
183  << "subsystem key " << it.second << " for " << it.first << " already in L1TriggerKeyListExt";
184  }
185 
186  } else
187  edm::LogVerbatim("L1-O2O") << "L1CondDBPayloadWriter: object key " << it.second << " for " << it.first
188  << " already in L1TriggerKeyListExt";
189 
190  } // for rcds from keys
191 
192  if (keyList) // Write L1TriggerKeyListExt to ORCON
193  m_writer.writeKeyList(keyList, 0, m_logTransactions);
194 
195  if (throwException)
196  throw l1t::DataInvalidException("Payload problem found.");
197 }
persistency::Exception Exception
Definition: Exception.h:25
Log< level::Info, true > LogVerbatim
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
static const std::string kNullKey
Log< level::Error, false > LogError
bool getData(T &iHolder) const
Definition: EventSetup.h:122
tuple key
prepare the HTCondor submission files and eventually submit them
char const * what() const noexceptoverride
Definition: Exception.cc:103
Log< level::Info, false > LogInfo
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
edm::ESGetToken< L1TriggerKeyExt, L1TriggerKeyExtRcd > theL1TriggerKeyExtToken_
void L1CondDBPayloadWriterExt::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 200 of file L1CondDBPayloadWriterExt.cc.

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

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 203 of file L1CondDBPayloadWriterExt.cc.

203 {}

Member Data Documentation

bool L1CondDBPayloadWriterExt::m_logTransactions
private

Definition at line 44 of file L1CondDBPayloadWriterExt.cc.

Referenced by analyze().

bool L1CondDBPayloadWriterExt::m_newL1TriggerKeyListExt
private

Definition at line 47 of file L1CondDBPayloadWriterExt.cc.

Referenced by analyze().

bool L1CondDBPayloadWriterExt::m_overwriteKeys
private

Definition at line 42 of file L1CondDBPayloadWriterExt.cc.

Referenced by analyze().

RecordToWriterMap L1CondDBPayloadWriterExt::m_rcdToWriterMap
private

Definition at line 32 of file L1CondDBPayloadWriterExt.cc.

Referenced by analyze(), and L1CondDBPayloadWriterExt().

bool L1CondDBPayloadWriterExt::m_writeConfigData
private

Definition at line 39 of file L1CondDBPayloadWriterExt.cc.

Referenced by analyze().

bool L1CondDBPayloadWriterExt::m_writeL1TriggerKeyExt
private

Definition at line 36 of file L1CondDBPayloadWriterExt.cc.

Referenced by analyze().

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

Definition at line 50 of file L1CondDBPayloadWriterExt.cc.

Referenced by analyze().