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
L1O2OTestAnalyzer Class Reference

#include <CondTools/L1O2OTestAnalyzer/src/L1O2OTestAnalyzer.cc>

Inheritance diagram for L1O2OTestAnalyzer:
edm::EDAnalyzer

Public Member Functions

 L1O2OTestAnalyzer (const edm::ParameterSet &)
 
 ~L1O2OTestAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 

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
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

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

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

Definition at line 48 of file L1O2OTestAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 78 of file L1O2OTestAnalyzer.cc.

79  : m_printL1TriggerKey( iConfig.getParameter<bool> ("printL1TriggerKey") ),
80  m_printL1TriggerKeyList( iConfig.getParameter<bool> ("printL1TriggerKeyList") ),
81  m_printESRecords( iConfig.getParameter<bool> ("printESRecords") ),
82  m_printPayloadTokens( iConfig.getParameter<bool> ("printPayloadTokens") ),
83  m_recordsToPrint( iConfig.getParameter< std::vector< std::string > >(
84  "recordsToPrint" ) )
85 {
86  //now do what ever initialization is needed
87 }
T getParameter(std::string const &) const
std::vector< std::string > m_recordsToPrint
L1O2OTestAnalyzer::~L1O2OTestAnalyzer ( )

Definition at line 90 of file L1O2OTestAnalyzer.cc.

91 {
92 
93  // do anything here that needs to be done at desctruction time
94  // (e.g. close files, deallocate resources etc.)
95 
96 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 105 of file L1O2OTestAnalyzer.cc.

References gather_cfg::cout, l1t::DataWriter::fillLastTriggerKeyList(), edm::EventSetup::get(), edm::EventBase::id(), L1TriggerKey::kCSCTF, L1TriggerKey::kDTTF, combine::key, L1TriggerKey::kGCT, L1TriggerKey::kGMT, L1TriggerKey::kGT, L1TriggerKey::kRCT, L1TriggerKey::kRPC, L1TriggerKey::kTSP0, create_public_lumi_plots::log, m_printESRecords, m_printL1TriggerKey, m_printL1TriggerKeyList, m_printPayloadTokens, m_recordsToPrint, L1TriggerKeyList::objectKey(), l1t::DataWriter::payloadToken(), L1TriggerKeyList::recordTypeToKeyToTokenMap(), python.rootplot.root2matplotlib::replace(), edm::EventID::run(), DTTTrigCorrFirst::run, L1TriggerKeyList::tscKey(), and L1TriggerKeyList::tscKeyToTokenMap().

106 {
107  using namespace edm;
108 
110  {
111 // ESHandle< L1TriggerKeyList > pList ;
112 // iSetup.get< L1TriggerKeyListRcd >().get( pList ) ;
113  L1TriggerKeyList pList ;
114  l1t::DataWriter dataWriter ;
115  if( !dataWriter.fillLastTriggerKeyList( pList ) )
116  {
117  edm::LogError( "L1-O2O" )
118  << "Problem getting last L1TriggerKeyList" ;
119  }
120 
121  std::cout << "Found " << pList.tscKeyToTokenMap().size() << " TSC keys:"
122  << std::endl ;
123 
124  L1TriggerKeyList::KeyToToken::const_iterator iTSCKey =
125  pList.tscKeyToTokenMap().begin() ;
126  L1TriggerKeyList::KeyToToken::const_iterator eTSCKey =
127  pList.tscKeyToTokenMap().end() ;
128  for( ; iTSCKey != eTSCKey ; ++iTSCKey )
129  {
130  std::cout << iTSCKey->first ;
132  {
133  std::cout << " " << iTSCKey->second ;
134  }
135  std::cout << std::endl ;
136  }
137  std::cout << std::endl ;
138 
139  L1TriggerKeyList::RecordToKeyToToken::const_iterator iRec =
140  pList.recordTypeToKeyToTokenMap().begin() ;
141  L1TriggerKeyList::RecordToKeyToToken::const_iterator eRec =
142  pList.recordTypeToKeyToTokenMap().end() ;
143  for( ; iRec != eRec ; ++iRec )
144  {
145  const L1TriggerKeyList::KeyToToken& keyTokenMap = iRec->second ;
146  std::cout << "For record@type " << iRec->first << ", found "
147  << keyTokenMap.size() << " keys:" << std::endl ;
148 
149  L1TriggerKeyList::KeyToToken::const_iterator iKey = keyTokenMap.begin();
150  L1TriggerKeyList::KeyToToken::const_iterator eKey = keyTokenMap.end() ;
151  for( ; iKey != eKey ; ++iKey )
152  {
153  std::cout << iKey->first ;
155  {
156  std::cout << " " << iKey->second ;
157  }
158  std::cout << std::endl ;
159  }
160  std::cout << std::endl ;
161  }
162  }
163 
164  if( m_printL1TriggerKey )
165  {
166  try
167  {
169  iSetup.get< L1TriggerKeyRcd >().get( pKey ) ;
170 
171  std::cout << std::endl ;
172  std::cout << "Current TSC key = " << pKey->tscKey()
173  << std::endl << std::endl ;
174 
175  std::cout << "Current subsystem keys:" << std::endl ;
176  std::cout << "CSCTF " << pKey->subsystemKey( L1TriggerKey::kCSCTF )
177  << std::endl ;
178  std::cout << "DTTF " << pKey->subsystemKey( L1TriggerKey::kDTTF )
179  << std::endl ;
180  std::cout << "RPC " << pKey->subsystemKey( L1TriggerKey::kRPC )
181  << std::endl ;
182  std::cout << "GMT " << pKey->subsystemKey( L1TriggerKey::kGMT )
183  << std::endl ;
184  std::cout << "RCT " << pKey->subsystemKey( L1TriggerKey::kRCT )
185  << std::endl ;
186  std::cout << "GCT " << pKey->subsystemKey( L1TriggerKey::kGCT )
187  << std::endl ;
188  std::cout << "GT " << pKey->subsystemKey( L1TriggerKey::kGT )
189  << std::endl ;
190  std::cout << "TSP0 " << pKey->subsystemKey( L1TriggerKey::kTSP0 )
191  << std::endl << std::endl ;
192 
193  std::cout << "Object keys:" << std::endl ;
194  const L1TriggerKey::RecordToKey& recKeyMap = pKey->recordToKeyMap() ;
195  L1TriggerKey::RecordToKey::const_iterator iRec = recKeyMap.begin() ;
196  L1TriggerKey::RecordToKey::const_iterator eRec = recKeyMap.end() ;
197  for( ; iRec != eRec ; ++iRec )
198  {
199  std::cout << iRec->first << " " << iRec->second << std::endl ;
200  }
201  }
202  catch( cms::Exception& ex )
203  {
204  std::cout << "No L1TriggerKey found." << std::endl ;
205  }
206  }
207 
208  if( m_printESRecords )
209  {
210 // ESHandle< L1TriggerKeyList > pList ;
211 // iSetup.get< L1TriggerKeyListRcd >().get( pList ) ;
212 
213  L1TriggerKeyList pList ;
214  l1t::DataWriter dataWriter ;
215  if( !dataWriter.fillLastTriggerKeyList( pList ) )
216  {
217  edm::LogError( "L1-O2O" )
218  << "Problem getting last L1TriggerKeyList" ;
219  }
220 
221  // Start log string, convert run number into string
222  unsigned long long run = iEvent.id().run() ;
223  std::stringstream ss ;
224  ss << run ;
225  std::string log = "runNumber=" + ss.str() ;
226 
227  l1t::DataWriter writer ;
228 
229  std::cout << std::endl << "Run Settings keys:" << std::endl ;
230 
231  std::vector< std::string >::const_iterator iRec =
232  m_recordsToPrint.begin() ;
233  std::vector< std::string >::const_iterator iEnd =
234  m_recordsToPrint.end() ;
235  for( ; iRec != iEnd ; ++iRec )
236  {
237  std::string payloadToken = writer.payloadToken( *iRec,
238  iEvent.id().run() );
239  std::string key ;
240 
241  if( *iRec == "L1TriggerKeyRcd" )
242  {
243  key = pList.tscKey( payloadToken ) ;
244  }
245  else
246  {
247  key = pList.objectKey( *iRec, payloadToken ) ;
248  }
249 
250  std::cout << *iRec << " " << key ;
252  {
253  std::cout << " " << payloadToken ;
254  }
255  std::cout << std::endl ;
256 
257  // Replace spaces in key with ?s. Do reverse substitution when
258  // making L1TriggerKey.
259  replace( key.begin(), key.end(), ' ', '?' ) ;
260  log += " " + *iRec + "Key=" + key ;
261  }
262 
263  std::cout << std::endl << log << std::endl ;
264  }
265 }
RunNumber_t run() const
Definition: EventID.h:42
std::map< std::string, std::string > RecordToKey
Definition: L1TriggerKey.h:24
std::map< std::string, std::string > KeyToToken
std::string payloadToken(const std::string &recordName, edm::RunNumber_t runNumber)
Definition: DataWriter.cc:153
std::string tscKey(const std::string &triggerKeyPayloadToken) const
const RecordToKeyToToken & recordTypeToKeyToTokenMap() const
std::string objectKey(const std::string &recordName, const std::string &payloadToken) const
bool fillLastTriggerKeyList(L1TriggerKeyList &output)
Definition: DataWriter.cc:210
std::vector< std::string > m_recordsToPrint
const T & get() const
Definition: EventSetup.h:55
const KeyToToken & tscKeyToTokenMap() const
edm::EventID id() const
Definition: EventBase.h:56
list key
Definition: combine.py:13
tuple cout
Definition: gather_cfg.py:121
void L1O2OTestAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 270 of file L1O2OTestAnalyzer.cc.

271 {
272 }
void L1O2OTestAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 276 of file L1O2OTestAnalyzer.cc.

276  {
277 }

Member Data Documentation

bool L1O2OTestAnalyzer::m_printESRecords
private

Definition at line 62 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

bool L1O2OTestAnalyzer::m_printL1TriggerKey
private

Definition at line 60 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

bool L1O2OTestAnalyzer::m_printL1TriggerKeyList
private

Definition at line 61 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

bool L1O2OTestAnalyzer::m_printPayloadTokens
private

Definition at line 63 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().

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

Definition at line 64 of file L1O2OTestAnalyzer.cc.

Referenced by analyze().