CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GtRunSettingsViewer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1GtRunSettingsViewer
4 // Class: L1GtRunSettingsViewer
5 //
13 //
14 // Original Author: Werner Man-Li Sun
15 // Created: Thu May 19 04:32:54 CEST 2011
16 //
17 //
18 
19 
20 // system include files
21 #include <memory>
22 #include <sstream>
23 
24 // user include files
27 
32 
34 
39 
48 
51 
52 //
53 // class decleration
54 //
55 
57  public:
60 
61 
62  private:
63  virtual void beginJob() ;
64  virtual void analyze(const edm::Event&, const edm::EventSetup&);
65  virtual void endJob() ;
66 
67  // ----------member data ---------------------------
68  std::string m_prescalesKey ;
69  std::string m_maskAlgoKey ;
70  std::string m_maskTechKey ;
71  std::string m_maskVetoAlgoKey ;
72  std::string m_maskVetoTechKey ;
73 };
74 
75 //
76 // constants, enums and typedefs
77 //
78 
79 //
80 // static data member definitions
81 //
82 
83 //
84 // constructors and destructor
85 //
87  : m_prescalesKey( iConfig.getParameter< std::string >( "prescalesKey" ) ),
88  m_maskAlgoKey( iConfig.getParameter< std::string >( "maskAlgoKey" ) ),
89  m_maskTechKey( iConfig.getParameter< std::string >( "maskTechKey" ) ),
90  m_maskVetoAlgoKey( iConfig.getParameter< std::string >( "maskVetoAlgoKey" ) ),
91  m_maskVetoTechKey( iConfig.getParameter< std::string >( "maskVetoTechKey" ) )
92 {
93  //now do what ever initialization is needed
94 }
95 
96 
98 {
99 
100  // do anything here that needs to be done at desctruction time
101  // (e.g. close files, deallocate resources etc.)
102 
103 }
104 
105 
106 //
107 // member functions
108 //
109 
110 // ------------ method called to for each event ------------
111 void
113 {
114  using namespace edm;
115 
116  // Utility class
117  l1t::DataWriter dataWriter ;
118 
119  // Get most recent L1TriggerKeyList
120  L1TriggerKeyList keyList ;
121  dataWriter.fillLastTriggerKeyList( keyList ) ;
122 
123  // For the given GTRS key, find the corresponding payload tokens.
124  // Use the payload tokens to retrieve the corresponding objects.
125  // Call the print functions for these objects.
126 
127  if( !m_prescalesKey.empty() )
128  {
129  std::string pfAlgoToken = keyList.token( "L1GtPrescaleFactorsAlgoTrigRcd",
130  "L1GtPrescaleFactors",
131  m_prescalesKey ) ;
132  if( pfAlgoToken.empty() )
133  {
134  edm::LogError( "L1-O2O" ) << "No payload for L1GtPrescaleFactorsAlgoTrigRcd with key "
135  << m_prescalesKey ;
136  }
137  else
138  {
139  L1GtPrescaleFactors pfAlgo ;
140  dataWriter.readObject( pfAlgoToken, pfAlgo ) ;
141  pfAlgo.print( std::cout ) ;
142  }
143 
144  std::string pfTechToken = keyList.token( "L1GtPrescaleFactorsTechTrigRcd",
145  "L1GtPrescaleFactors",
146  m_prescalesKey ) ;
147  if( pfTechToken.empty() )
148  {
149  edm::LogError( "L1-O2O" ) << "No payload for L1GtPrescaleFactorsTechTrigRcd with key "
150  << m_prescalesKey ;
151  }
152  else
153  {
154  L1GtPrescaleFactors pfTech ;
155  dataWriter.readObject( pfTechToken, pfTech ) ;
156  pfTech.print( std::cout ) ;
157  }
158  }
159 
160  if( !m_maskAlgoKey.empty() )
161  {
162  std::string token = keyList.token( "L1GtTriggerMaskAlgoTrigRcd",
163  "L1GtTriggerMask",
164  m_maskAlgoKey ) ;
165  if( token.empty() )
166  {
167  edm::LogError( "L1-O2O" ) << "No payload for L1GtTriggerMaskAlgoTrigRcd with key "
168  << m_maskAlgoKey ;
169  }
170  else
171  {
172  L1GtTriggerMask mask ;
173  dataWriter.readObject( token, mask ) ;
174  mask.print( std::cout ) ;
175  }
176  }
177 
178  if( !m_maskTechKey.empty() )
179  {
180  std::string token = keyList.token( "L1GtTriggerMaskTechTrigRcd",
181  "L1GtTriggerMask",
182  m_maskTechKey ) ;
183  if( token.empty() )
184  {
185  edm::LogError( "L1-O2O" ) << "No payload for L1GtTriggerMaskTechTrigRcd with key "
186  << m_maskTechKey ;
187  }
188  else
189  {
190  L1GtTriggerMask mask ;
191  dataWriter.readObject( token, mask ) ;
192  mask.print( std::cout ) ;
193  }
194  }
195 
196  if( !m_maskVetoAlgoKey.empty() )
197  {
198  std::string token = keyList.token( "L1GtTriggerMaskVetoAlgoTrigRcd",
199  "L1GtTriggerMask",
201  if( token.empty() )
202  {
203  edm::LogError( "L1-O2O" ) << "No payload for L1GtTriggerMaskVetoAlgoTrigRcd with key "
204  << m_maskVetoAlgoKey ;
205  }
206  else
207  {
208  L1GtTriggerMask mask ;
209  dataWriter.readObject( token, mask ) ;
210  mask.print( std::cout ) ;
211  }
212  }
213 
214  if( !m_maskVetoTechKey.empty() )
215  {
216  std::string token = keyList.token( "L1GtTriggerMaskVetoTechTrigRcd",
217  "L1GtTriggerMask",
219  if( token.empty() )
220  {
221  edm::LogError( "L1-O2O" ) << "No payload for L1GtTriggerMaskVetoTechTrigRcd with key "
222  << m_maskVetoTechKey ;
223  }
224  else
225  {
226  L1GtTriggerMask mask ;
227  dataWriter.readObject( token, mask ) ;
228  mask.print( std::cout ) ;
229  }
230  }
231 }
232 
233 
234 // ------------ method called once each job just before starting event loop ------------
235 void
237 {
238 }
239 
240 // ------------ method called once each job just after ending the event loop ------------
241 void
243 }
244 
245 //define this as a plug-in
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void print(std::ostream &) const
print the mask
int iEvent
Definition: GenABIO.cc:243
void print(std::ostream &) const
print the prescale factors
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::string token(const std::string &tscKey) const
tuple cout
Definition: gather_cfg.py:121
L1GtRunSettingsViewer(const edm::ParameterSet &)