CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GtPrescaleFactorsAndMasksTester.cc
Go to the documentation of this file.
1 
17 // this class header
19 
20 // system include files
21 #include <iomanip>
22 
23 // user include files
24 // base class
26 
29 
32 
34 
37 
39 
42 
45 
48 
49 // forward declarations
50 
51 // constructor(s)
53  const edm::ParameterSet& parSet) :
54  m_testerPrescaleFactors(
55  parSet.getParameter<bool> ("TesterPrescaleFactors")),
56  m_testerTriggerMask(parSet.getParameter<bool> ("TesterTriggerMask")),
57  m_testerTriggerVetoMask(
58  parSet.getParameter<bool> ("TesterTriggerVetoMask")),
59  m_retrieveInBeginRun(
60  parSet.getParameter<bool> ("RetrieveInBeginRun")),
61  m_retrieveInBeginLuminosityBlock(
62  parSet.getParameter<bool> ("RetrieveInBeginLuminosityBlock")),
63  m_retrieveInAnalyze(parSet.getParameter<bool> ("RetrieveInAnalyze")),
64  m_printInBeginRun(parSet.getParameter<bool> ("PrintInBeginRun")),
65  m_printInBeginLuminosityBlock(
66  parSet.getParameter<bool> ("PrintInBeginLuminosityBlock")),
67  m_printInAnalyze(parSet.getParameter<bool> ("PrintInAnalyze")),
68  m_printOutput(parSet.getUntrackedParameter<int> ("PrintOutput", 3)) {
69  // empty
70 }
71 
72 // destructor
74  // empty
75 }
76 
77 // begin job
79 
80 }
81 
82 // begin run
84  const edm::EventSetup& evSetup) {
85 
87  retrieveL1EventSetup(evSetup);
88  }
89 
90  if (m_printInBeginRun) {
91  printL1EventSetup(evSetup);
92  }
93 
94 }
95 
96 // begin luminosity block
98  const edm::LuminosityBlock& iLumiBlock, const edm::EventSetup& evSetup) {
99 
101  retrieveL1EventSetup(evSetup);
102  }
103 
105  printL1EventSetup(evSetup);
106  }
107 
108 }
109 
110 // loop over events
112  const edm::EventSetup& evSetup) {
113 
114  if (m_retrieveInAnalyze) {
115  retrieveL1EventSetup(evSetup);
116  }
117 
118  if (m_printInAnalyze) {
119  printL1EventSetup(evSetup);
120  }
121 
122 }
123 
124 // end luminosity block
126  const edm::LuminosityBlock& iLumiBlock, const edm::EventSetup& evSetup) {
127 
128 }
129 
130 // end run
132  const edm::EventSetup& evSetup) {
133 
134 }
135 
136 // end job
138 
139 }
140 
142  const edm::EventSetup& evSetup) {
143 
145 
146  // get / update the prescale factors from the EventSetup
147 
149  evSetup.get<L1GtPrescaleFactorsAlgoTrigRcd> ().get(l1GtPfAlgo);
150  m_l1GtPfAlgo = l1GtPfAlgo.product();
151 
153  evSetup.get<L1GtPrescaleFactorsTechTrigRcd> ().get(l1GtPfTech);
154  m_l1GtPfTech = l1GtPfTech.product();
155  }
156 
157  if (m_testerTriggerMask) {
158  // get / update the trigger mask from the EventSetup
159 
161  evSetup.get<L1GtTriggerMaskAlgoTrigRcd> ().get(l1GtTmAlgo);
162  m_l1GtTmAlgo = l1GtTmAlgo.product();
163 
165  evSetup.get<L1GtTriggerMaskTechTrigRcd> ().get(l1GtTmTech);
166  m_l1GtTmTech = l1GtTmTech.product();
167  }
168 
170  edm::ESHandle<L1GtTriggerMask> l1GtTmVetoAlgo;
171  evSetup.get<L1GtTriggerMaskVetoAlgoTrigRcd> ().get(l1GtTmVetoAlgo);
172  m_l1GtTmVetoAlgo = l1GtTmVetoAlgo.product();
173 
174  edm::ESHandle<L1GtTriggerMask> l1GtTmVetoTech;
175  evSetup.get<L1GtTriggerMaskVetoTechTrigRcd> ().get(l1GtTmVetoTech);
176  m_l1GtTmVetoTech = l1GtTmVetoTech.product();
177  }
178 
179 }
180 
182  const edm::EventSetup& evSetup) {
183 
184  // define an output stream to print into
185  // it can then be directed to whatever log level is desired
186  std::ostringstream myCout;
187 
189 
190  myCout << "\nL1 GT prescale factors for algorithm triggers"
191  << std::endl;
192  m_l1GtPfAlgo->print(myCout);
193 
194  myCout << "\nL1 GT prescale factors for technical triggers"
195  << std::endl;
196  m_l1GtPfTech->print(myCout);
197  }
198 
199  //
200  if (m_testerTriggerMask) {
201  myCout << "\nL1 GT trigger masks for algorithm triggers" << std::endl;
202  m_l1GtTmAlgo->print(myCout);
203 
204  myCout << "\nL1 GT trigger masks for technical triggers" << std::endl;
205  m_l1GtTmTech->print(myCout);
206 
207  }
208 
209  //
211  myCout << "\nL1 GT trigger veto masks for algorithm triggers"
212  << std::endl;
213  m_l1GtTmVetoAlgo->print(myCout);
214 
215  myCout << "\nL1 GT trigger veto masks for technical triggers"
216  << std::endl;
217  m_l1GtTmVetoTech->print(myCout);
218 
219  }
220 
221  switch (m_printOutput) {
222  case 0: {
223 
224  std::cout << myCout.str() << std::endl;
225 
226  }
227 
228  break;
229  case 1: {
230 
231  LogTrace("L1GtPrescaleFactorsAndMasksTester") << myCout.str()
232  << std::endl;
233 
234  }
235  break;
236 
237  case 2: {
238 
239  edm::LogVerbatim("L1GtPrescaleFactorsAndMasksTester")
240  << myCout.str() << std::endl;
241 
242  }
243 
244  break;
245  case 3: {
246 
247  edm::LogInfo("L1GtPrescaleFactorsAndMasksTester") << myCout.str();
248 
249  }
250 
251  break;
252  default: {
253  myCout
254  << "\n\n L1GtPrescaleFactorsAndMasksTester: Error - no print output = "
255  << m_printOutput
256  << " defined! \n Check available values in the cfi file."
257  << "\n" << std::endl;
258 
259  }
260  break;
261  }
262 
263 }
void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
end luminosity block
void analyze(const edm::Event &, const edm::EventSetup &)
analyze
const L1GtTriggerMask * m_l1GtTmAlgo
trigger masks &amp; veto masks
void print(std::ostream &) const
print the mask
bool m_retrieveInBeginRun
retrieve the records in beginRun, beginLuminosityBlock, analyze, respectively
int iEvent
Definition: GenABIO.cc:243
void retrieveL1EventSetup(const edm::EventSetup &)
retrieve all the relevant L1 trigger event setup records
void print(std::ostream &) const
print the prescale factors
void beginRun(const edm::Run &, const edm::EventSetup &)
begin run
const L1GtPrescaleFactors * m_l1GtPfAlgo
prescale factors
void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
begin luminosity block
#define LogTrace(id)
L1GtPrescaleFactorsAndMasksTester(const edm::ParameterSet &)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
bool m_printInBeginRun
print the records in beginRun, beginLuminosityBlock, analyze, respectively
tuple cout
Definition: gather_cfg.py:121
void printL1EventSetup(const edm::EventSetup &)
print the requred records
void endRun(const edm::Run &, const edm::EventSetup &)
end run
Definition: Run.h:33