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 ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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 & itemsToGetFromEvent () 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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob () override
 
virtual 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 &)
 
- 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 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

Definition at line 29 of file L1O2OTestAnalyzerExt.cc.

Constructor & Destructor Documentation

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

Definition at line 48 of file L1O2OTestAnalyzerExt.cc.

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

Definition at line 60 of file L1O2OTestAnalyzerExt.cc.

61 {
62 
63  // do anything here that needs to be done at desctruction time
64  // (e.g. close files, deallocate resources etc.)
65 
66 }

Member Function Documentation

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

Definition at line 71 of file L1O2OTestAnalyzerExt.cc.

References gather_cfg::cout, l1t::DataWriterExt::fillLastTriggerKeyList(), edm::EventSetup::get(), edm::EventBase::id(), crabWrapper::key, L1TriggerKeyExt::kuGT, cmsBatch::log, m_printESRecords, m_printL1TriggerKeyExt, m_printL1TriggerKeyListExt, m_printPayloadTokens, m_recordsToPrint, L1TriggerKeyListExt::objectKey(), l1t::DataWriterExt::payloadToken(), L1TriggerKeyExt::recordToKeyMap(), L1TriggerKeyListExt::recordTypeToKeyToTokenMap(), python.rootplot.root2matplotlib::replace(), edm::EventID::run(), findQualityFiles::run, AlCaHLTBitMon_QueryRunRegistry::string, L1TriggerKeyExt::subsystemKey(), L1TriggerKeyListExt::tscKey(), L1TriggerKeyExt::tscKey(), L1TriggerKeyListExt::tscKeyToTokenMap(), and cscNeutronWriter_cfi::writer.

72 {
73  using namespace edm;
74 
76  {
77 // ESHandle< L1TriggerKeyListExt > pList ;
78 // iSetup.get< L1TriggerKeyListExtRcd >().get( pList ) ;
79  L1TriggerKeyListExt pList ;
80  l1t::DataWriterExt dataWriter ;
81  if( !dataWriter.fillLastTriggerKeyList( pList ) )
82  {
83  edm::LogError( "L1-O2O" )
84  << "Problem getting last L1TriggerKeyListExt" ;
85  }
86 
87  std::cout << "Found " << pList.tscKeyToTokenMap().size() << " TSC keys:"
88  << std::endl ;
89 
90  L1TriggerKeyListExt::KeyToToken::const_iterator iTSCKey =
91  pList.tscKeyToTokenMap().begin() ;
92  L1TriggerKeyListExt::KeyToToken::const_iterator eTSCKey =
93  pList.tscKeyToTokenMap().end() ;
94  for( ; iTSCKey != eTSCKey ; ++iTSCKey )
95  {
96  std::cout << iTSCKey->first ;
98  {
99  std::cout << " " << iTSCKey->second ;
100  }
101  std::cout << std::endl ;
102  }
103  std::cout << std::endl ;
104 
105  L1TriggerKeyListExt::RecordToKeyToToken::const_iterator iRec =
106  pList.recordTypeToKeyToTokenMap().begin() ;
107  L1TriggerKeyListExt::RecordToKeyToToken::const_iterator eRec =
108  pList.recordTypeToKeyToTokenMap().end() ;
109  for( ; iRec != eRec ; ++iRec )
110  {
111  const L1TriggerKeyListExt::KeyToToken& keyTokenMap = iRec->second ;
112  std::cout << "For record@type " << iRec->first << ", found "
113  << keyTokenMap.size() << " keys:" << std::endl ;
114 
115  L1TriggerKeyListExt::KeyToToken::const_iterator iKey = keyTokenMap.begin();
116  L1TriggerKeyListExt::KeyToToken::const_iterator eKey = keyTokenMap.end() ;
117  for( ; iKey != eKey ; ++iKey )
118  {
119  std::cout << iKey->first ;
121  {
122  std::cout << " " << iKey->second ;
123  }
124  std::cout << std::endl ;
125  }
126  std::cout << std::endl ;
127  }
128  }
129 
131  {
132  try
133  {
135  iSetup.get< L1TriggerKeyExtRcd >().get( pKey ) ;
136 
137  std::cout << std::endl ;
138  std::cout << "Current TSC key = " << pKey->tscKey()
139  << std::endl << std::endl ;
140 
141  std::cout << "Current subsystem keys:" << std::endl ;
142  std::cout << "TSP0 " << pKey->subsystemKey( L1TriggerKeyExt::kuGT )
143  << std::endl << std::endl ;
144 
145  std::cout << "Object keys:" << std::endl ;
146  const L1TriggerKeyExt::RecordToKey& recKeyMap = pKey->recordToKeyMap() ;
147  L1TriggerKeyExt::RecordToKey::const_iterator iRec = recKeyMap.begin() ;
148  L1TriggerKeyExt::RecordToKey::const_iterator eRec = recKeyMap.end() ;
149  for( ; iRec != eRec ; ++iRec )
150  {
151  std::cout << iRec->first << " " << iRec->second << std::endl ;
152  }
153  }
154  catch( cms::Exception& ex )
155  {
156  std::cout << "No L1TriggerKeyExt found." << std::endl ;
157  }
158  }
159 
160  if( m_printESRecords )
161  {
162 // ESHandle< L1TriggerKeyListExt > pList ;
163 // iSetup.get< L1TriggerKeyListExtRcd >().get( pList ) ;
164 
165  L1TriggerKeyListExt pList ;
166  l1t::DataWriterExt dataWriter ;
167  if( !dataWriter.fillLastTriggerKeyList( pList ) )
168  {
169  edm::LogError( "L1-O2O" )
170  << "Problem getting last L1TriggerKeyListExt" ;
171  }
172 
173  // Start log string, convert run number into string
174  unsigned long long run = iEvent.id().run() ;
175  std::stringstream ss ;
176  ss << run ;
177  std::string log = "runNumber=" + ss.str() ;
178 
180 
181  std::cout << std::endl << "Run Settings keys:" << std::endl ;
182 
183  std::vector< std::string >::const_iterator iRec =
184  m_recordsToPrint.begin() ;
185  std::vector< std::string >::const_iterator iEnd =
186  m_recordsToPrint.end() ;
187  for( ; iRec != iEnd ; ++iRec )
188  {
189  std::string payloadToken = writer.payloadToken( *iRec,
190  iEvent.id().run() );
191  std::string key ;
192 
193  if( *iRec == "L1TriggerKeyExtRcd" )
194  {
195  key = pList.tscKey( payloadToken ) ;
196  }
197  else
198  {
199  key = pList.objectKey( *iRec, payloadToken ) ;
200  }
201 
202  std::cout << *iRec << " " << key ;
204  {
205  std::cout << " " << payloadToken ;
206  }
207  std::cout << std::endl ;
208 
209  // Replace spaces in key with ?s. Do reverse substitution when
210  // making L1TriggerKeyExt.
211  replace( key.begin(), key.end(), ' ', '?' ) ;
212  log += " " + *iRec + "Key=" + key ;
213  }
214 
215  std::cout << std::endl << log << std::endl ;
216  }
217 }
RunNumber_t run() const
Definition: EventID.h:39
bool fillLastTriggerKeyList(L1TriggerKeyListExt &output)
def replace(string, replacements)
const KeyToToken & tscKeyToTokenMap() const
const RecordToKey & recordToKeyMap() const
std::map< std::string, std::string > KeyToToken
const std::string & subsystemKey(L1Subsystems subsystem) const
std::string payloadToken(const std::string &recordName, edm::RunNumber_t runNumber)
std::string tscKey(const std::string &triggerKeyPayloadToken) const
std::map< std::string, std::string > RecordToKey
std::vector< std::string > m_recordsToPrint
const T & get() const
Definition: EventSetup.h:56
std::string objectKey(const std::string &recordName, const std::string &payloadToken) const
edm::EventID id() const
Definition: EventBase.h:58
HLT enums.
const RecordToKeyToToken & recordTypeToKeyToTokenMap() const
const std::string & tscKey() const
void L1O2OTestAnalyzerExt::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 222 of file L1O2OTestAnalyzerExt.cc.

223 {
224 }
void L1O2OTestAnalyzerExt::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 228 of file L1O2OTestAnalyzerExt.cc.

References DEFINE_FWK_MODULE.

228  {
229 }

Member Data Documentation

bool L1O2OTestAnalyzerExt::m_printESRecords
private

Definition at line 43 of file L1O2OTestAnalyzerExt.cc.

Referenced by analyze().

bool L1O2OTestAnalyzerExt::m_printL1TriggerKeyExt
private

Definition at line 41 of file L1O2OTestAnalyzerExt.cc.

Referenced by analyze().

bool L1O2OTestAnalyzerExt::m_printL1TriggerKeyListExt
private

Definition at line 42 of file L1O2OTestAnalyzerExt.cc.

Referenced by analyze().

bool L1O2OTestAnalyzerExt::m_printPayloadTokens
private

Definition at line 44 of file L1O2OTestAnalyzerExt.cc.

Referenced by analyze().

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

Definition at line 45 of file L1O2OTestAnalyzerExt.cc.

Referenced by analyze().