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 <iostream>
22 #include <memory>
23 #include <sstream>
24 
25 // user include files
28 
33 
35 
40 
49 
52 
53 //
54 // class decleration
55 //
56 
58  public:
61 
62 
63  private:
64  virtual void beginJob() override ;
65  virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
66  virtual void endJob() override ;
67 
68  // ----------member data ---------------------------
74 };
75 
76 //
77 // constants, enums and typedefs
78 //
79 
80 //
81 // static data member definitions
82 //
83 
84 //
85 // constructors and destructor
86 //
88  : m_prescalesKey( iConfig.getParameter< std::string >( "prescalesKey" ) ),
89  m_maskAlgoKey( iConfig.getParameter< std::string >( "maskAlgoKey" ) ),
90  m_maskTechKey( iConfig.getParameter< std::string >( "maskTechKey" ) ),
91  m_maskVetoAlgoKey( iConfig.getParameter< std::string >( "maskVetoAlgoKey" ) ),
92  m_maskVetoTechKey( iConfig.getParameter< std::string >( "maskVetoTechKey" ) )
93 {
94  //now do what ever initialization is needed
95 }
96 
97 
99 {
100 
101  // do anything here that needs to be done at desctruction time
102  // (e.g. close files, deallocate resources etc.)
103 
104 }
105 
106 
107 //
108 // member functions
109 //
110 
111 // ------------ method called to for each event ------------
112 void
114 {
115  using namespace edm;
116 
117  // Utility class
118  l1t::DataWriter dataWriter ;
119 
120  // Get most recent L1TriggerKeyList
121  L1TriggerKeyList keyList ;
122  dataWriter.fillLastTriggerKeyList( keyList ) ;
123 
124  // For the given GTRS key, find the corresponding payload tokens.
125  // Use the payload tokens to retrieve the corresponding objects.
126  // Call the print functions for these objects.
127 
128  if( !m_prescalesKey.empty() )
129  {
130  std::string pfAlgoToken = keyList.token( "L1GtPrescaleFactorsAlgoTrigRcd",
131  "L1GtPrescaleFactors",
132  m_prescalesKey ) ;
133  if( pfAlgoToken.empty() )
134  {
135  edm::LogError( "L1-O2O" ) << "No payload for L1GtPrescaleFactorsAlgoTrigRcd with key "
136  << m_prescalesKey ;
137  }
138  else
139  {
140  L1GtPrescaleFactors pfAlgo ;
141  dataWriter.readObject( pfAlgoToken, pfAlgo ) ;
142  pfAlgo.print( std::cout ) ;
143  }
144 
145  std::string pfTechToken = keyList.token( "L1GtPrescaleFactorsTechTrigRcd",
146  "L1GtPrescaleFactors",
147  m_prescalesKey ) ;
148  if( pfTechToken.empty() )
149  {
150  edm::LogError( "L1-O2O" ) << "No payload for L1GtPrescaleFactorsTechTrigRcd with key "
151  << m_prescalesKey ;
152  }
153  else
154  {
155  L1GtPrescaleFactors pfTech ;
156  dataWriter.readObject( pfTechToken, pfTech ) ;
157  pfTech.print( std::cout ) ;
158  }
159  }
160 
161  if( !m_maskAlgoKey.empty() )
162  {
163  std::string token = keyList.token( "L1GtTriggerMaskAlgoTrigRcd",
164  "L1GtTriggerMask",
165  m_maskAlgoKey ) ;
166  if( token.empty() )
167  {
168  edm::LogError( "L1-O2O" ) << "No payload for L1GtTriggerMaskAlgoTrigRcd with key "
169  << m_maskAlgoKey ;
170  }
171  else
172  {
173  L1GtTriggerMask mask ;
174  dataWriter.readObject( token, mask ) ;
175  mask.print( std::cout ) ;
176  }
177  }
178 
179  if( !m_maskTechKey.empty() )
180  {
181  std::string token = keyList.token( "L1GtTriggerMaskTechTrigRcd",
182  "L1GtTriggerMask",
183  m_maskTechKey ) ;
184  if( token.empty() )
185  {
186  edm::LogError( "L1-O2O" ) << "No payload for L1GtTriggerMaskTechTrigRcd with key "
187  << m_maskTechKey ;
188  }
189  else
190  {
191  L1GtTriggerMask mask ;
192  dataWriter.readObject( token, mask ) ;
193  mask.print( std::cout ) ;
194  }
195  }
196 
197  if( !m_maskVetoAlgoKey.empty() )
198  {
199  std::string token = keyList.token( "L1GtTriggerMaskVetoAlgoTrigRcd",
200  "L1GtTriggerMask",
202  if( token.empty() )
203  {
204  edm::LogError( "L1-O2O" ) << "No payload for L1GtTriggerMaskVetoAlgoTrigRcd with key "
205  << m_maskVetoAlgoKey ;
206  }
207  else
208  {
209  L1GtTriggerMask mask ;
210  dataWriter.readObject( token, mask ) ;
211  mask.print( std::cout ) ;
212  }
213  }
214 
215  if( !m_maskVetoTechKey.empty() )
216  {
217  std::string token = keyList.token( "L1GtTriggerMaskVetoTechTrigRcd",
218  "L1GtTriggerMask",
220  if( token.empty() )
221  {
222  edm::LogError( "L1-O2O" ) << "No payload for L1GtTriggerMaskVetoTechTrigRcd with key "
223  << m_maskVetoTechKey ;
224  }
225  else
226  {
227  L1GtTriggerMask mask ;
228  dataWriter.readObject( token, mask ) ;
229  mask.print( std::cout ) ;
230  }
231  }
232 }
233 
234 
235 // ------------ method called once each job just before starting event loop ------------
236 void
238 {
239 }
240 
241 // ------------ method called once each job just after ending the event loop ------------
242 void
244 }
245 
246 //define this as a plug-in
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void beginJob() override
void print(std::ostream &) const
print the mask
int iEvent
Definition: GenABIO.cc:230
void print(std::ostream &) const
print the prescale factors
virtual void endJob() override
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
tuple cout
Definition: gather_cfg.py:121
L1GtRunSettingsViewer(const edm::ParameterSet &)