CMS 3D CMS Logo

L1GtPrescaleFactorsAndMasksTester.cc
Go to the documentation of this file.
1 
15 // this class header
17 
18 // system include files
19 #include <iomanip>
20 #include <iostream>
21 
22 // user include files
23 // base class
25 
28 
31 
33 
36 
38 
41 
44 
47 
48 // forward declarations
49 
50 // constructor(s)
52  const edm::ParameterSet& parSet) :
53  m_testerPrescaleFactors(
54  parSet.getParameter<bool> ("TesterPrescaleFactors")),
55  m_testerTriggerMask(parSet.getParameter<bool> ("TesterTriggerMask")),
56  m_testerTriggerVetoMask(
57  parSet.getParameter<bool> ("TesterTriggerVetoMask")),
58  m_retrieveInBeginRun(
59  parSet.getParameter<bool> ("RetrieveInBeginRun")),
60  m_retrieveInBeginLuminosityBlock(
61  parSet.getParameter<bool> ("RetrieveInBeginLuminosityBlock")),
62  m_retrieveInAnalyze(parSet.getParameter<bool> ("RetrieveInAnalyze")),
63  m_printInBeginRun(parSet.getParameter<bool> ("PrintInBeginRun")),
64  m_printInBeginLuminosityBlock(
65  parSet.getParameter<bool> ("PrintInBeginLuminosityBlock")),
66  m_printInAnalyze(parSet.getParameter<bool> ("PrintInAnalyze")),
67  m_printOutput(parSet.getUntrackedParameter<int> ("PrintOutput", 3)) {
68  // empty
69 }
70 
71 // destructor
73  // empty
74 }
75 
76 // begin job
78 
79 }
80 
81 // begin run
83  const edm::EventSetup& evSetup) {
84 
86  retrieveL1EventSetup(evSetup);
87  }
88 
89  if (m_printInBeginRun) {
90  printL1EventSetup(evSetup);
91  }
92 
93 }
94 
95 // begin luminosity block
97  const edm::LuminosityBlock& iLumiBlock, const edm::EventSetup& evSetup) {
98 
100  retrieveL1EventSetup(evSetup);
101  }
102 
104  printL1EventSetup(evSetup);
105  }
106 
107 }
108 
109 // loop over events
111  const edm::EventSetup& evSetup) {
112 
113  if (m_retrieveInAnalyze) {
114  retrieveL1EventSetup(evSetup);
115  }
116 
117  if (m_printInAnalyze) {
118  printL1EventSetup(evSetup);
119  }
120 
121 }
122 
123 // end luminosity block
125  const edm::LuminosityBlock& iLumiBlock, const edm::EventSetup& evSetup) {
126 
127 }
128 
129 // end run
131  const edm::EventSetup& evSetup) {
132 
133 }
134 
135 // end job
137 
138 }
139 
141  const edm::EventSetup& evSetup) {
142 
144 
145  // get / update the prescale factors from the EventSetup
146 
148  evSetup.get<L1GtPrescaleFactorsAlgoTrigRcd> ().get(l1GtPfAlgo);
149  m_l1GtPfAlgo = l1GtPfAlgo.product();
150 
152  evSetup.get<L1GtPrescaleFactorsTechTrigRcd> ().get(l1GtPfTech);
153  m_l1GtPfTech = l1GtPfTech.product();
154  }
155 
156  if (m_testerTriggerMask) {
157  // get / update the trigger mask from the EventSetup
158 
160  evSetup.get<L1GtTriggerMaskAlgoTrigRcd> ().get(l1GtTmAlgo);
161  m_l1GtTmAlgo = l1GtTmAlgo.product();
162 
164  evSetup.get<L1GtTriggerMaskTechTrigRcd> ().get(l1GtTmTech);
165  m_l1GtTmTech = l1GtTmTech.product();
166  }
167 
169  edm::ESHandle<L1GtTriggerMask> l1GtTmVetoAlgo;
170  evSetup.get<L1GtTriggerMaskVetoAlgoTrigRcd> ().get(l1GtTmVetoAlgo);
171  m_l1GtTmVetoAlgo = l1GtTmVetoAlgo.product();
172 
173  edm::ESHandle<L1GtTriggerMask> l1GtTmVetoTech;
174  evSetup.get<L1GtTriggerMaskVetoTechTrigRcd> ().get(l1GtTmVetoTech);
175  m_l1GtTmVetoTech = l1GtTmVetoTech.product();
176  }
177 
178 }
179 
181  const edm::EventSetup& evSetup) {
182 
183  // define an output stream to print into
184  // it can then be directed to whatever log level is desired
185  std::ostringstream myCout;
186 
188 
189  myCout << "\nL1 GT prescale factors for algorithm triggers"
190  << std::endl;
191  m_l1GtPfAlgo->print(myCout);
192 
193  myCout << "\nL1 GT prescale factors for technical triggers"
194  << std::endl;
195  m_l1GtPfTech->print(myCout);
196  }
197 
198  //
199  if (m_testerTriggerMask) {
200  myCout << "\nL1 GT trigger masks for algorithm triggers" << std::endl;
201  m_l1GtTmAlgo->print(myCout);
202 
203  myCout << "\nL1 GT trigger masks for technical triggers" << std::endl;
204  m_l1GtTmTech->print(myCout);
205 
206  }
207 
208  //
210  myCout << "\nL1 GT trigger veto masks for algorithm triggers"
211  << std::endl;
212  m_l1GtTmVetoAlgo->print(myCout);
213 
214  myCout << "\nL1 GT trigger veto masks for technical triggers"
215  << std::endl;
216  m_l1GtTmVetoTech->print(myCout);
217 
218  }
219 
220  switch (m_printOutput) {
221  case 0: {
222 
223  std::cout << myCout.str() << std::endl;
224 
225  }
226 
227  break;
228  case 1: {
229 
230  LogTrace("L1GtPrescaleFactorsAndMasksTester") << myCout.str()
231  << std::endl;
232 
233  }
234  break;
235 
236  case 2: {
237 
238  edm::LogVerbatim("L1GtPrescaleFactorsAndMasksTester")
239  << myCout.str() << std::endl;
240 
241  }
242 
243  break;
244  case 3: {
245 
246  edm::LogInfo("L1GtPrescaleFactorsAndMasksTester") << myCout.str();
247 
248  }
249 
250  break;
251  default: {
252  myCout
253  << "\n\n L1GtPrescaleFactorsAndMasksTester: Error - no print output = "
254  << m_printOutput
255  << " defined! \n Check available values in the cfi file."
256  << "\n" << std::endl;
257 
258  }
259  break;
260  }
261 
262 }
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 & 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:230
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:56
bool m_printInBeginRun
print the records in beginRun, beginLuminosityBlock, analyze, respectively
void printL1EventSetup(const edm::EventSetup &)
print the requred records
void endRun(const edm::Run &, const edm::EventSetup &)
end run
T const * product() const
Definition: ESHandle.h:86
Definition: Run.h:42