CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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

Implements edm::EDAnalyzer.

Definition at line 71 of file L1O2OTestAnalyzerExt.cc.

References gather_cfg::cout, l1t::DataWriterExt::fillLastTriggerKeyList(), edm::EventSetup::get(), edm::EventBase::id(), relval_steps::key, L1TriggerKeyExt::kuGT, dqm-mbProfile::log, m_printESRecords, m_printL1TriggerKeyExt, m_printL1TriggerKeyListExt, m_printPayloadTokens, m_recordsToPrint, L1TriggerKeyListExt::objectKey(), l1t::DataWriterExt::payloadToken(), L1TriggerKeyListExt::recordTypeToKeyToTokenMap(), python.rootplot.root2matplotlib::replace(), edm::EventID::run(), DTTTrigCorrFirst::run, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, L1TriggerKeyListExt::tscKey(), and L1TriggerKeyListExt::tscKeyToTokenMap().

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 
179  l1t::DataWriterExt writer ;
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)
const KeyToToken & tscKeyToTokenMap() const
std::map< std::string, std::string > KeyToToken
std::string payloadToken(const std::string &recordName, edm::RunNumber_t runNumber)
std::string tscKey(const std::string &triggerKeyPayloadToken) const
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
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:59
const RecordToKeyToToken & recordTypeToKeyToTokenMap() const
tuple cout
Definition: gather_cfg.py:145
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.

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().