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::EDAnalyzer edm::EDConsumerBase

Public Member Functions

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

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

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

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

Definition at line 47 of file L1O2OTestAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 76 of file L1O2OTestAnalyzer.cc.

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

Definition at line 85 of file L1O2OTestAnalyzer.cc.

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

Member Function Documentation

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

Definition at line 95 of file L1O2OTestAnalyzer.cc.

References gather_cfg::cout, l1t::DataWriter::fillLastTriggerKeyList(), edm::EventSetup::get(), edm::EventBase::id(), L1TriggerKey::kCSCTF, L1TriggerKey::kDTTF, crabWrapper::key, L1TriggerKey::kGCT, L1TriggerKey::kGMT, L1TriggerKey::kGT, L1TriggerKey::kRCT, L1TriggerKey::kRPC, L1TriggerKey::kTSP0, dqm-mbProfile::log, m_printESRecords, m_printL1TriggerKey, m_printL1TriggerKeyList, m_printPayloadTokens, m_recordsToPrint, L1TriggerKeyList::objectKey(), l1t::DataWriter::payloadToken(), L1TriggerKey::recordToKeyMap(), L1TriggerKeyList::recordTypeToKeyToTokenMap(), python.rootplot.root2matplotlib::replace(), writedatasetfile::run, edm::EventID::run(), contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, L1TriggerKey::subsystemKey(), L1TriggerKeyList::tscKey(), L1TriggerKey::tscKey(), L1TriggerKeyList::tscKeyToTokenMap(), and cscNeutronWriter_cfi::writer.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 218 of file L1O2OTestAnalyzer.cc.

218 {}
void L1O2OTestAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 221 of file L1O2OTestAnalyzer.cc.

References DEFINE_FWK_MODULE.

221 {}

Member Data Documentation

bool L1O2OTestAnalyzer::m_printESRecords
private

Definition at line 60 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

bool L1O2OTestAnalyzer::m_printL1TriggerKey
private

Definition at line 58 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

bool L1O2OTestAnalyzer::m_printL1TriggerKeyList
private

Definition at line 59 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

bool L1O2OTestAnalyzer::m_printPayloadTokens
private

Definition at line 61 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

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

Definition at line 62 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().