CMS 3D CMS Logo

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

#include <CondTools/L1O2OTestAnalyzer/src/L1O2OTestAnalyzer.cc>

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

Public Member Functions

 L1O2OTestAnalyzer (const edm::ParameterSet &)
 
 ~L1O2OTestAnalyzer () 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, L1TriggerKeyRcdl1TriggerKeyToken_
 
bool m_printESRecords
 
bool m_printL1TriggerKey
 
bool m_printL1TriggerKeyList
 
bool m_printPayloadTokens
 
std::vector< std::string > m_recordsToPrint
 

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

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

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

Definition at line 46 of file L1O2OTestAnalyzer.cc.

Constructor & Destructor Documentation

◆ L1O2OTestAnalyzer()

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

Definition at line 76 of file L1O2OTestAnalyzer.cc.

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

77  : m_printL1TriggerKey(iConfig.getParameter<bool>("printL1TriggerKey")),
78  m_printL1TriggerKeyList(iConfig.getParameter<bool>("printL1TriggerKeyList")),
79  m_printESRecords(iConfig.getParameter<bool>("printESRecords")),
80  m_printPayloadTokens(iConfig.getParameter<bool>("printPayloadTokens")),
81  m_recordsToPrint(iConfig.getParameter<std::vector<std::string> >("recordsToPrint")) {
82  //now do what ever initialization is needed
84 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< std::string > m_recordsToPrint
edm::ESGetToken< L1TriggerKey, L1TriggerKeyRcd > l1TriggerKeyToken_

◆ ~L1O2OTestAnalyzer()

L1O2OTestAnalyzer::~L1O2OTestAnalyzer ( )
override

Definition at line 86 of file L1O2OTestAnalyzer.cc.

86  {
87  // do anything here that needs to be done at desctruction time
88  // (e.g. close files, deallocate resources etc.)
89 }

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 96 of file L1O2OTestAnalyzer.cc.

References l1t::DataWriter::fillLastTriggerKeyList(), edm::EventSetup::getHandle(), iEvent, L1TriggerKey::kCSCTF, L1TriggerKey::kDTTF, crabWrapper::key, L1TriggerKey::kGCT, L1TriggerKey::kGMT, L1TriggerKey::kGT, L1TriggerKey::kRCT, L1TriggerKey::kRPC, L1TriggerKey::kTSP0, l1TriggerKeyToken_, dqm-mbProfile::log, m_printESRecords, m_printL1TriggerKey, m_printL1TriggerKeyList, m_printPayloadTokens, m_recordsToPrint, L1TriggerKeyList::objectKey(), L1TriggerKeyList::recordTypeToKeyToTokenMap(), python.rootplot.root2matplotlib::replace(), writedatasetfile::run, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, L1TriggerKeyList::tscKey(), L1TriggerKeyList::tscKeyToTokenMap(), and convertToRaw::writer.

96  {
97  using namespace edm;
98 
100  // ESHandle< L1TriggerKeyList > pList ;
101  // iSetup.get< L1TriggerKeyListRcd >().get( pList ) ;
102  L1TriggerKeyList pList;
103  l1t::DataWriter dataWriter;
104  if (!dataWriter.fillLastTriggerKeyList(pList)) {
105  edm::LogError("L1-O2O") << "Problem getting last L1TriggerKeyList";
106  }
107 
108  edm::LogInfo("L1-O2O") << "Found " << pList.tscKeyToTokenMap().size() << " TSC keys:" << std::endl;
109 
110  L1TriggerKeyList::KeyToToken::const_iterator iTSCKey = pList.tscKeyToTokenMap().begin();
111  L1TriggerKeyList::KeyToToken::const_iterator eTSCKey = pList.tscKeyToTokenMap().end();
112  for (; iTSCKey != eTSCKey; ++iTSCKey) {
113  edm::LogInfo("L1-O2O") << iTSCKey->first;
114  if (m_printPayloadTokens) {
115  edm::LogInfo("L1-O2O") << " " << iTSCKey->second;
116  }
117  edm::LogInfo("L1-O2O") << std::endl;
118  }
119  edm::LogInfo("L1-O2O") << std::endl;
120 
121  L1TriggerKeyList::RecordToKeyToToken::const_iterator iRec = pList.recordTypeToKeyToTokenMap().begin();
122  L1TriggerKeyList::RecordToKeyToToken::const_iterator eRec = pList.recordTypeToKeyToTokenMap().end();
123  for (; iRec != eRec; ++iRec) {
124  const L1TriggerKeyList::KeyToToken& keyTokenMap = iRec->second;
125  edm::LogInfo("L1-O2O") << "For record@type " << iRec->first << ", found " << keyTokenMap.size()
126  << " keys:" << std::endl;
127 
128  L1TriggerKeyList::KeyToToken::const_iterator iKey = keyTokenMap.begin();
129  L1TriggerKeyList::KeyToToken::const_iterator eKey = keyTokenMap.end();
130  for (; iKey != eKey; ++iKey) {
131  edm::LogInfo("L1-O2O") << iKey->first;
132  if (m_printPayloadTokens) {
133  edm::LogInfo("L1-O2O") << " " << iKey->second;
134  }
135  edm::LogInfo("L1-O2O") << std::endl;
136  }
137  edm::LogInfo("L1-O2O") << std::endl;
138  }
139  }
140 
141  if (m_printL1TriggerKey) {
142  try {
143  auto pKey = iSetup.getHandle(l1TriggerKeyToken_);
144 
145  edm::LogInfo("L1-O2O") << std::endl;
146  edm::LogInfo("L1-O2O") << "Current TSC key = " << pKey->tscKey() << std::endl << std::endl;
147 
148  edm::LogInfo("L1-O2O") << "Current subsystem keys:" << std::endl;
149  edm::LogInfo("L1-O2O") << "CSCTF " << pKey->subsystemKey(L1TriggerKey::kCSCTF) << std::endl;
150  edm::LogInfo("L1-O2O") << "DTTF " << pKey->subsystemKey(L1TriggerKey::kDTTF) << std::endl;
151  edm::LogInfo("L1-O2O") << "RPC " << pKey->subsystemKey(L1TriggerKey::kRPC) << std::endl;
152  edm::LogInfo("L1-O2O") << "GMT " << pKey->subsystemKey(L1TriggerKey::kGMT) << std::endl;
153  edm::LogInfo("L1-O2O") << "RCT " << pKey->subsystemKey(L1TriggerKey::kRCT) << std::endl;
154  edm::LogInfo("L1-O2O") << "GCT " << pKey->subsystemKey(L1TriggerKey::kGCT) << std::endl;
155  edm::LogInfo("L1-O2O") << "GT " << pKey->subsystemKey(L1TriggerKey::kGT) << std::endl;
156  edm::LogInfo("L1-O2O") << "TSP0 " << pKey->subsystemKey(L1TriggerKey::kTSP0) << std::endl << std::endl;
157 
158  edm::LogInfo("L1-O2O") << "Object keys:" << std::endl;
159  const L1TriggerKey::RecordToKey& recKeyMap = pKey->recordToKeyMap();
160  L1TriggerKey::RecordToKey::const_iterator iRec = recKeyMap.begin();
161  L1TriggerKey::RecordToKey::const_iterator eRec = recKeyMap.end();
162  for (; iRec != eRec; ++iRec) {
163  edm::LogInfo("L1-O2O") << iRec->first << " " << iRec->second << std::endl;
164  }
165  } catch (cms::Exception& ex) {
166  edm::LogError("L1-O2O") << "No L1TriggerKey found." << std::endl;
167  }
168  }
169 
170  if (m_printESRecords) {
171  // ESHandle< L1TriggerKeyList > pList ;
172  // iSetup.get< L1TriggerKeyListRcd >().get( pList ) ;
173 
174  L1TriggerKeyList pList;
175  l1t::DataWriter dataWriter;
176  if (!dataWriter.fillLastTriggerKeyList(pList)) {
177  edm::LogError("L1-O2O") << "Problem getting last L1TriggerKeyList";
178  }
179 
180  // Start log string, convert run number into string
181  unsigned long long run = iEvent.id().run();
182  std::stringstream ss;
183  ss << run;
184  std::string log = "runNumber=" + ss.str();
185 
187 
188  edm::LogInfo("L1-O2O") << std::endl << "Run Settings keys:" << std::endl;
189 
190  std::vector<std::string>::const_iterator iRec = m_recordsToPrint.begin();
191  std::vector<std::string>::const_iterator iEnd = m_recordsToPrint.end();
192  for (; iRec != iEnd; ++iRec) {
193  std::string payloadToken = writer.payloadToken(*iRec, iEvent.id().run());
195 
196  if (*iRec == "L1TriggerKeyRcd") {
197  key = pList.tscKey(payloadToken);
198  } else {
199  key = pList.objectKey(*iRec, payloadToken);
200  }
201 
202  edm::LogInfo("L1-O2O") << *iRec << " " << key;
203  if (m_printPayloadTokens) {
204  edm::LogInfo("L1-O2O") << " " << payloadToken;
205  }
206  edm::LogInfo("L1-O2O") << std::endl;
207 
208  // Replace spaces in key with ?s. Do reverse substitution when
209  // making L1TriggerKey.
210  replace(key.begin(), key.end(), ' ', '?');
211  log += " " + *iRec + "Key=" + key;
212  }
213 
214  edm::LogInfo("L1-O2O") << std::endl << log << std::endl;
215  }
216 }
std::map< std::string, std::string > RecordToKey
Definition: L1TriggerKey.h:25
def replace(string, replacements)
std::map< std::string, std::string > KeyToToken
const KeyToToken & tscKeyToTokenMap() const
Log< level::Error, false > LogError
const RecordToKeyToToken & recordTypeToKeyToTokenMap() const
int iEvent
Definition: GenABIO.cc:224
std::vector< std::string > m_recordsToPrint
edm::ESGetToken< L1TriggerKey, L1TriggerKeyRcd > l1TriggerKeyToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
bool fillLastTriggerKeyList(L1TriggerKeyList &output)
Definition: DataWriter.cc:147
std::string objectKey(const std::string &recordName, const std::string &payloadToken) const
Log< level::Info, false > LogInfo
HLT enums.
std::string tscKey(const std::string &triggerKeyPayloadToken) const

◆ beginJob()

void L1O2OTestAnalyzer::beginJob ( )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 219 of file L1O2OTestAnalyzer.cc.

219 {}

◆ endJob()

void L1O2OTestAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 222 of file L1O2OTestAnalyzer.cc.

222 {}

Member Data Documentation

◆ l1TriggerKeyToken_

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

Definition at line 62 of file L1O2OTestAnalyzer.cc.

Referenced by analyze(), and L1O2OTestAnalyzer().

◆ m_printESRecords

bool L1O2OTestAnalyzer::m_printESRecords
private

Definition at line 59 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

◆ m_printL1TriggerKey

bool L1O2OTestAnalyzer::m_printL1TriggerKey
private

Definition at line 57 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

◆ m_printL1TriggerKeyList

bool L1O2OTestAnalyzer::m_printL1TriggerKeyList
private

Definition at line 58 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

◆ m_printPayloadTokens

bool L1O2OTestAnalyzer::m_printPayloadTokens
private

Definition at line 60 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

◆ m_recordsToPrint

std::vector<std::string> L1O2OTestAnalyzer::m_recordsToPrint
private

Definition at line 61 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().