CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
L1O2OTestAnalyzerExt Class Reference
Inheritance diagram for L1O2OTestAnalyzerExt:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 L1O2OTestAnalyzerExt (const edm::ParameterSet &)
 
 ~L1O2OTestAnalyzerExt () 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::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
 
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_printL1TriggerKeyExt
 
bool m_printL1TriggerKeyListExt
 
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

Definition at line 29 of file L1O2OTestAnalyzerExt.cc.

Constructor & Destructor Documentation

◆ L1O2OTestAnalyzerExt()

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

Definition at line 47 of file L1O2OTestAnalyzerExt.cc.

48  : m_printL1TriggerKeyExt(iConfig.getParameter<bool>("printL1TriggerKeyExt")),
49  m_printL1TriggerKeyListExt(iConfig.getParameter<bool>("printL1TriggerKeyListExt")),
50  m_printESRecords(iConfig.getParameter<bool>("printESRecords")),
51  m_printPayloadTokens(iConfig.getParameter<bool>("printPayloadTokens")),
52  m_recordsToPrint(iConfig.getParameter<std::vector<std::string> >("recordsToPrint")) {
53  //now do what ever initialization is needed
54 }

◆ ~L1O2OTestAnalyzerExt()

L1O2OTestAnalyzerExt::~L1O2OTestAnalyzerExt ( )
override

Definition at line 56 of file L1O2OTestAnalyzerExt.cc.

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

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 62 of file L1O2OTestAnalyzerExt.cc.

62  {
63  using namespace edm;
64 
66  // ESHandle< L1TriggerKeyListExt > pList ;
67  // iSetup.get< L1TriggerKeyListExtRcd >().get( pList ) ;
68  L1TriggerKeyListExt pList;
69  l1t::DataWriterExt dataWriter;
70  if (!dataWriter.fillLastTriggerKeyList(pList)) {
71  edm::LogError("L1-O2O") << "Problem getting last L1TriggerKeyListExt";
72  }
73 
74  std::cout << "Found " << pList.tscKeyToTokenMap().size() << " TSC keys:" << std::endl;
75 
76  L1TriggerKeyListExt::KeyToToken::const_iterator iTSCKey = pList.tscKeyToTokenMap().begin();
77  L1TriggerKeyListExt::KeyToToken::const_iterator eTSCKey = pList.tscKeyToTokenMap().end();
78  for (; iTSCKey != eTSCKey; ++iTSCKey) {
79  std::cout << iTSCKey->first;
81  std::cout << " " << iTSCKey->second;
82  }
83  std::cout << std::endl;
84  }
85  std::cout << std::endl;
86 
87  L1TriggerKeyListExt::RecordToKeyToToken::const_iterator iRec = pList.recordTypeToKeyToTokenMap().begin();
88  L1TriggerKeyListExt::RecordToKeyToToken::const_iterator eRec = pList.recordTypeToKeyToTokenMap().end();
89  for (; iRec != eRec; ++iRec) {
90  const L1TriggerKeyListExt::KeyToToken& keyTokenMap = iRec->second;
91  std::cout << "For record@type " << iRec->first << ", found " << keyTokenMap.size() << " keys:" << std::endl;
92 
93  L1TriggerKeyListExt::KeyToToken::const_iterator iKey = keyTokenMap.begin();
94  L1TriggerKeyListExt::KeyToToken::const_iterator eKey = keyTokenMap.end();
95  for (; iKey != eKey; ++iKey) {
96  std::cout << iKey->first;
98  std::cout << " " << iKey->second;
99  }
100  std::cout << std::endl;
101  }
102  std::cout << std::endl;
103  }
104  }
105 
107  try {
109  iSetup.get<L1TriggerKeyExtRcd>().get(pKey);
110 
111  std::cout << std::endl;
112  std::cout << "Current TSC key = " << pKey->tscKey() << std::endl << std::endl;
113 
114  std::cout << "Current subsystem keys:" << std::endl;
115  std::cout << "TSP0 " << pKey->subsystemKey(L1TriggerKeyExt::kuGT) << std::endl << std::endl;
116 
117  std::cout << "Object keys:" << std::endl;
118  const L1TriggerKeyExt::RecordToKey& recKeyMap = pKey->recordToKeyMap();
119  L1TriggerKeyExt::RecordToKey::const_iterator iRec = recKeyMap.begin();
120  L1TriggerKeyExt::RecordToKey::const_iterator eRec = recKeyMap.end();
121  for (; iRec != eRec; ++iRec) {
122  std::cout << iRec->first << " " << iRec->second << std::endl;
123  }
124  } catch (cms::Exception& ex) {
125  std::cout << "No L1TriggerKeyExt found." << std::endl;
126  }
127  }
128 
129  if (m_printESRecords) {
130  // ESHandle< L1TriggerKeyListExt > pList ;
131  // iSetup.get< L1TriggerKeyListExtRcd >().get( pList ) ;
132 
133  L1TriggerKeyListExt pList;
134  l1t::DataWriterExt dataWriter;
135  if (!dataWriter.fillLastTriggerKeyList(pList)) {
136  edm::LogError("L1-O2O") << "Problem getting last L1TriggerKeyListExt";
137  }
138 
139  // Start log string, convert run number into string
140  unsigned long long run = iEvent.id().run();
141  std::stringstream ss;
142  ss << run;
143  std::string log = "runNumber=" + ss.str();
144 
146 
147  std::cout << std::endl << "Run Settings keys:" << std::endl;
148 
149  std::vector<std::string>::const_iterator iRec = m_recordsToPrint.begin();
150  std::vector<std::string>::const_iterator iEnd = m_recordsToPrint.end();
151  for (; iRec != iEnd; ++iRec) {
152  std::string payloadToken = writer.payloadToken(*iRec, iEvent.id().run());
154 
155  if (*iRec == "L1TriggerKeyExtRcd") {
156  key = pList.tscKey(payloadToken);
157  } else {
158  key = pList.objectKey(*iRec, payloadToken);
159  }
160 
161  std::cout << *iRec << " " << key;
162  if (m_printPayloadTokens) {
163  std::cout << " " << payloadToken;
164  }
165  std::cout << std::endl;
166 
167  // Replace spaces in key with ?s. Do reverse substitution when
168  // making L1TriggerKeyExt.
169  replace(key.begin(), key.end(), ' ', '?');
170  log += " " + *iRec + "Key=" + key;
171  }
172 
173  std::cout << std::endl << log << std::endl;
174  }
175 }

References gather_cfg::cout, l1t::DataWriterExt::fillLastTriggerKeyList(), edm::EventSetup::get(), get, iEvent, crabWrapper::key, L1TriggerKeyExt::kuGT, dqm-mbProfile::log, m_printESRecords, m_printL1TriggerKeyExt, m_printL1TriggerKeyListExt, m_printPayloadTokens, m_recordsToPrint, L1TriggerKeyListExt::objectKey(), L1TriggerKeyExt::recordToKeyMap(), L1TriggerKeyListExt::recordTypeToKeyToTokenMap(), python.rootplot.root2matplotlib::replace(), writedatasetfile::run, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, L1TriggerKeyExt::subsystemKey(), L1TriggerKeyListExt::tscKey(), L1TriggerKeyExt::tscKey(), L1TriggerKeyListExt::tscKeyToTokenMap(), and cscNeutronWriter_cfi::writer.

◆ beginJob()

void L1O2OTestAnalyzerExt::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 178 of file L1O2OTestAnalyzerExt.cc.

178 {}

◆ endJob()

void L1O2OTestAnalyzerExt::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 181 of file L1O2OTestAnalyzerExt.cc.

181 {}

Member Data Documentation

◆ m_printESRecords

bool L1O2OTestAnalyzerExt::m_printESRecords
private

Definition at line 42 of file L1O2OTestAnalyzerExt.cc.

Referenced by analyze().

◆ m_printL1TriggerKeyExt

bool L1O2OTestAnalyzerExt::m_printL1TriggerKeyExt
private

Definition at line 40 of file L1O2OTestAnalyzerExt.cc.

Referenced by analyze().

◆ m_printL1TriggerKeyListExt

bool L1O2OTestAnalyzerExt::m_printL1TriggerKeyListExt
private

Definition at line 41 of file L1O2OTestAnalyzerExt.cc.

Referenced by analyze().

◆ m_printPayloadTokens

bool L1O2OTestAnalyzerExt::m_printPayloadTokens
private

Definition at line 43 of file L1O2OTestAnalyzerExt.cc.

Referenced by analyze().

◆ m_recordsToPrint

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

Definition at line 44 of file L1O2OTestAnalyzerExt.cc.

Referenced by analyze().

L1TriggerKeyListExt
Definition: L1TriggerKeyListExt.h:10
L1TriggerKeyListExt::tscKeyToTokenMap
const KeyToToken & tscKeyToTokenMap() const
Definition: L1TriggerKeyListExt.h:30
L1TriggerKeyListExt::tscKey
std::string tscKey(const std::string &triggerKeyPayloadToken) const
Definition: L1TriggerKeyListExt.cc:155
edm
HLT enums.
Definition: AlignableModifier.h:19
L1TriggerKeyExt::subsystemKey
const std::string & subsystemKey(L1Subsystems subsystem) const
Definition: L1TriggerKeyExt.h:71
gather_cfg.cout
cout
Definition: gather_cfg.py:144
L1TriggerKeyExtRcd
Definition: L1TriggerKeyExtRcd.h:8
cscNeutronWriter_cfi.writer
writer
Definition: cscNeutronWriter_cfi.py:6
L1TriggerKeyExt::RecordToKey
std::map< std::string, std::string > RecordToKey
Definition: L1TriggerKeyExt.h:25
L1TriggerKeyExt::recordToKeyMap
const RecordToKey & recordToKeyMap() const
Definition: L1TriggerKeyExt.h:77
L1O2OTestAnalyzerExt::m_printESRecords
bool m_printESRecords
Definition: L1O2OTestAnalyzerExt.cc:42
L1TriggerKeyListExt::objectKey
std::string objectKey(const std::string &recordName, const std::string &payloadToken) const
Definition: L1TriggerKeyListExt.cc:135
L1O2OTestAnalyzerExt::m_recordsToPrint
std::vector< std::string > m_recordsToPrint
Definition: L1O2OTestAnalyzerExt.cc:44
L1TriggerKeyExt::tscKey
const std::string & tscKey() const
Definition: L1TriggerKeyExt.h:69
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
edm::ESHandle
Definition: DTSurvey.h:22
l1t::DataWriterExt::fillLastTriggerKeyList
bool fillLastTriggerKeyList(L1TriggerKeyListExt &output)
Definition: DataWriterExt.cc:148
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
L1O2OTestAnalyzerExt::m_printL1TriggerKeyListExt
bool m_printL1TriggerKeyListExt
Definition: L1O2OTestAnalyzerExt.cc:41
get
#define get
writedatasetfile.run
run
Definition: writedatasetfile.py:27
L1O2OTestAnalyzerExt::m_printPayloadTokens
bool m_printPayloadTokens
Definition: L1O2OTestAnalyzerExt.cc:43
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
L1TriggerKeyExt::kuGT
Definition: L1TriggerKeyExt.h:27
cms::Exception
Definition: Exception.h:70
L1O2OTestAnalyzerExt::m_printL1TriggerKeyExt
bool m_printL1TriggerKeyExt
Definition: L1O2OTestAnalyzerExt.cc:40
L1TriggerKeyListExt::KeyToToken
std::map< std::string, std::string > KeyToToken
Definition: L1TriggerKeyListExt.h:15
crabWrapper.key
key
Definition: crabWrapper.py:19
python.rootplot.root2matplotlib.replace
def replace(string, replacements)
Definition: root2matplotlib.py:444
l1t::DataWriterExt
Definition: DataWriterExt.h:35
L1TriggerKeyListExt::recordTypeToKeyToTokenMap
const RecordToKeyToToken & recordTypeToKeyToTokenMap() const
Definition: L1TriggerKeyListExt.h:32