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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (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::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 }

◆ ~L1O2OTestAnalyzer()

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

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 95 of file L1O2OTestAnalyzer.cc.

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 }

References gather_cfg::cout, l1t::DataWriter::fillLastTriggerKeyList(), edm::EventSetup::get(), get, iEvent, 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(), L1TriggerKey::recordToKeyMap(), L1TriggerKeyList::recordTypeToKeyToTokenMap(), python.rootplot.root2matplotlib::replace(), writedatasetfile::run, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, L1TriggerKey::subsystemKey(), L1TriggerKeyList::tscKey(), L1TriggerKey::tscKey(), L1TriggerKeyList::tscKeyToTokenMap(), and cscNeutronWriter_cfi::writer.

◆ beginJob()

void L1O2OTestAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 218 of file L1O2OTestAnalyzer.cc.

218 {}

◆ endJob()

void L1O2OTestAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 221 of file L1O2OTestAnalyzer.cc.

221 {}

Member Data Documentation

◆ m_printESRecords

bool L1O2OTestAnalyzer::m_printESRecords
private

Definition at line 60 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

◆ m_printL1TriggerKey

bool L1O2OTestAnalyzer::m_printL1TriggerKey
private

Definition at line 58 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

◆ m_printL1TriggerKeyList

bool L1O2OTestAnalyzer::m_printL1TriggerKeyList
private

Definition at line 59 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

◆ m_printPayloadTokens

bool L1O2OTestAnalyzer::m_printPayloadTokens
private

Definition at line 61 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

◆ m_recordsToPrint

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

Definition at line 62 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

L1TriggerKey::kRPC
Definition: L1TriggerKey.h:27
L1O2OTestAnalyzer::m_printL1TriggerKey
bool m_printL1TriggerKey
Definition: L1O2OTestAnalyzer.cc:58
L1TriggerKeyRcd
Definition: L1TriggerKeyRcd.h:30
edm
HLT enums.
Definition: AlignableModifier.h:19
L1TriggerKey::kGMT
Definition: L1TriggerKey.h:27
gather_cfg.cout
cout
Definition: gather_cfg.py:144
cscNeutronWriter_cfi.writer
writer
Definition: cscNeutronWriter_cfi.py:6
L1TriggerKey::RecordToKey
std::map< std::string, std::string > RecordToKey
Definition: L1TriggerKey.h:25
L1TriggerKeyList::recordTypeToKeyToTokenMap
const RecordToKeyToToken & recordTypeToKeyToTokenMap() const
Definition: L1TriggerKeyList.h:54
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
L1TriggerKey::kTSP0
Definition: L1TriggerKey.h:27
edm::ESHandle
Definition: DTSurvey.h:22
L1TriggerKey::recordToKeyMap
const RecordToKey & recordToKeyMap() const
Definition: L1TriggerKey.h:76
L1O2OTestAnalyzer::m_printESRecords
bool m_printESRecords
Definition: L1O2OTestAnalyzer.cc:60
L1TriggerKey::kRCT
Definition: L1TriggerKey.h:27
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1TriggerKeyList
Definition: L1TriggerKeyList.h:32
L1TriggerKey::kDTTF
Definition: L1TriggerKey.h:27
L1O2OTestAnalyzer::m_recordsToPrint
std::vector< std::string > m_recordsToPrint
Definition: L1O2OTestAnalyzer.cc:62
L1O2OTestAnalyzer::m_printL1TriggerKeyList
bool m_printL1TriggerKeyList
Definition: L1O2OTestAnalyzer.cc:59
L1TriggerKeyList::KeyToToken
std::map< std::string, std::string > KeyToToken
Definition: L1TriggerKeyList.h:37
iEvent
int iEvent
Definition: GenABIO.cc:224
L1TriggerKey::kGCT
Definition: L1TriggerKey.h:27
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
L1TriggerKey::tscKey
const std::string & tscKey() const
Definition: L1TriggerKey.h:69
L1TriggerKey::kGT
Definition: L1TriggerKey.h:27
l1t::DataWriter::fillLastTriggerKeyList
bool fillLastTriggerKeyList(L1TriggerKeyList &output)
Definition: DataWriter.cc:147
writedatasetfile.run
run
Definition: writedatasetfile.py:27
L1TriggerKeyList::tscKey
std::string tscKey(const std::string &triggerKeyPayloadToken) const
Definition: L1TriggerKeyList.cc:182
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
L1TriggerKey::kCSCTF
Definition: L1TriggerKey.h:27
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
l1t::DataWriter
Definition: DataWriter.h:35
L1TriggerKeyList::objectKey
std::string objectKey(const std::string &recordName, const std::string &payloadToken) const
Definition: L1TriggerKeyList.cc:162
cms::Exception
Definition: Exception.h:70
L1TriggerKey::subsystemKey
const std::string & subsystemKey(L1Subsystems subsystem) const
Definition: L1TriggerKey.h:71
L1TriggerKeyList::tscKeyToTokenMap
const KeyToToken & tscKeyToTokenMap() const
Definition: L1TriggerKeyList.h:52
crabWrapper.key
key
Definition: crabWrapper.py:19
L1O2OTestAnalyzer::m_printPayloadTokens
bool m_printPayloadTokens
Definition: L1O2OTestAnalyzer.cc:61
python.rootplot.root2matplotlib.replace
def replace(string, replacements)
Definition: root2matplotlib.py:444