CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  : m_testerPrescaleFactors(parSet.getParameter<bool>("TesterPrescaleFactors")),
53  m_testerTriggerMask(parSet.getParameter<bool>("TesterTriggerMask")),
54  m_testerTriggerVetoMask(parSet.getParameter<bool>("TesterTriggerVetoMask")),
55  m_retrieveInBeginRun(parSet.getParameter<bool>("RetrieveInBeginRun")),
56  m_retrieveInBeginLuminosityBlock(parSet.getParameter<bool>("RetrieveInBeginLuminosityBlock")),
57  m_retrieveInAnalyze(parSet.getParameter<bool>("RetrieveInAnalyze")),
58  m_printInBeginRun(parSet.getParameter<bool>("PrintInBeginRun")),
59  m_printInBeginLuminosityBlock(parSet.getParameter<bool>("PrintInBeginLuminosityBlock")),
60  m_printInAnalyze(parSet.getParameter<bool>("PrintInAnalyze")),
61  m_printOutput(parSet.getUntrackedParameter<int>("PrintOutput", 3)) {
62  // empty
63 }
64 
65 // destructor
67  // empty
68 }
69 
70 // begin job
72 
73 // begin run
76  retrieveL1EventSetup(evSetup);
77  }
78 
79  if (m_printInBeginRun) {
80  printL1EventSetup(evSetup);
81  }
82 }
83 
84 // begin luminosity block
86  const edm::EventSetup& evSetup) {
88  retrieveL1EventSetup(evSetup);
89  }
90 
92  printL1EventSetup(evSetup);
93  }
94 }
95 
96 // loop over events
98  if (m_retrieveInAnalyze) {
99  retrieveL1EventSetup(evSetup);
100  }
101 
102  if (m_printInAnalyze) {
103  printL1EventSetup(evSetup);
104  }
105 }
106 
107 // end luminosity block
109  const edm::EventSetup& evSetup) {}
110 
111 // end run
113 
114 // end job
116 
119  // get / update the prescale factors from the EventSetup
120 
122  evSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().get(l1GtPfAlgo);
123  m_l1GtPfAlgo = l1GtPfAlgo.product();
124 
126  evSetup.get<L1GtPrescaleFactorsTechTrigRcd>().get(l1GtPfTech);
127  m_l1GtPfTech = l1GtPfTech.product();
128  }
129 
130  if (m_testerTriggerMask) {
131  // get / update the trigger mask from the EventSetup
132 
134  evSetup.get<L1GtTriggerMaskAlgoTrigRcd>().get(l1GtTmAlgo);
135  m_l1GtTmAlgo = l1GtTmAlgo.product();
136 
138  evSetup.get<L1GtTriggerMaskTechTrigRcd>().get(l1GtTmTech);
139  m_l1GtTmTech = l1GtTmTech.product();
140  }
141 
143  edm::ESHandle<L1GtTriggerMask> l1GtTmVetoAlgo;
144  evSetup.get<L1GtTriggerMaskVetoAlgoTrigRcd>().get(l1GtTmVetoAlgo);
145  m_l1GtTmVetoAlgo = l1GtTmVetoAlgo.product();
146 
147  edm::ESHandle<L1GtTriggerMask> l1GtTmVetoTech;
148  evSetup.get<L1GtTriggerMaskVetoTechTrigRcd>().get(l1GtTmVetoTech);
149  m_l1GtTmVetoTech = l1GtTmVetoTech.product();
150  }
151 }
152 
154  // define an output stream to print into
155  // it can then be directed to whatever log level is desired
156  std::ostringstream myCout;
157 
159  myCout << "\nL1 GT prescale factors for algorithm triggers" << std::endl;
160  m_l1GtPfAlgo->print(myCout);
161 
162  myCout << "\nL1 GT prescale factors for technical triggers" << std::endl;
163  m_l1GtPfTech->print(myCout);
164  }
165 
166  //
167  if (m_testerTriggerMask) {
168  myCout << "\nL1 GT trigger masks for algorithm triggers" << std::endl;
169  m_l1GtTmAlgo->print(myCout);
170 
171  myCout << "\nL1 GT trigger masks for technical triggers" << std::endl;
172  m_l1GtTmTech->print(myCout);
173  }
174 
175  //
177  myCout << "\nL1 GT trigger veto masks for algorithm triggers" << std::endl;
178  m_l1GtTmVetoAlgo->print(myCout);
179 
180  myCout << "\nL1 GT trigger veto masks for technical triggers" << std::endl;
181  m_l1GtTmVetoTech->print(myCout);
182  }
183 
184  switch (m_printOutput) {
185  case 0: {
186  std::cout << myCout.str() << std::endl;
187 
188  }
189 
190  break;
191  case 1: {
192  LogTrace("L1GtPrescaleFactorsAndMasksTester") << myCout.str() << std::endl;
193 
194  } break;
195 
196  case 2: {
197  edm::LogVerbatim("L1GtPrescaleFactorsAndMasksTester") << myCout.str() << std::endl;
198 
199  }
200 
201  break;
202  case 3: {
203  edm::LogInfo("L1GtPrescaleFactorsAndMasksTester") << myCout.str();
204 
205  }
206 
207  break;
208  default: {
209  myCout << "\n\n L1GtPrescaleFactorsAndMasksTester: Error - no print output = " << m_printOutput
210  << " defined! \n Check available values in the cfi file."
211  << "\n"
212  << std::endl;
213 
214  } break;
215  }
216 }
Log< level::Info, true > LogVerbatim
const L1GtTriggerMask * m_l1GtTmAlgo
trigger masks &amp; veto masks
void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
end luminosity block
void print(std::ostream &) const
print the mask
bool m_retrieveInBeginRun
retrieve the records in beginRun, beginLuminosityBlock, analyze, respectively
#define LogTrace(id)
int iEvent
Definition: GenABIO.cc:224
void retrieveL1EventSetup(const edm::EventSetup &)
retrieve all the relevant L1 trigger event setup records
void print(std::ostream &) const
print the prescale factors
const L1GtPrescaleFactors * m_l1GtPfAlgo
prescale factors
void beginRun(const edm::Run &, const edm::EventSetup &) override
begin run
Log< level::Info, false > LogInfo
L1GtPrescaleFactorsAndMasksTester(const edm::ParameterSet &)
T const * product() const
Definition: ESHandle.h:86
bool m_printInBeginRun
print the records in beginRun, beginLuminosityBlock, analyze, respectively
T get() const
Definition: EventSetup.h:88
void endRun(const edm::Run &, const edm::EventSetup &) override
end run
void analyze(const edm::Event &, const edm::EventSetup &) override
analyze
tuple cout
Definition: gather_cfg.py:144
void printL1EventSetup(const edm::EventSetup &)
print the requred records
void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
begin luminosity block
Definition: Run.h:45