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 
32 
34 
37 
39 
42 
45 
48 
49 // forward declarations
50 
51 namespace {
52  template <edm::Transition iTrans>
54  bool prescales,
55  bool masks,
56  bool vetoMasks) {
58  if (prescales) {
59  tokens.m_l1GtPfAlgo = iCC.esConsumes<iTrans>();
60  tokens.m_l1GtPfTech = iCC.esConsumes<iTrans>();
61  }
62  if (masks) {
63  tokens.m_l1GtTmAlgo = iCC.esConsumes<iTrans>();
64  tokens.m_l1GtTmTech = iCC.esConsumes<iTrans>();
65  }
66  if (vetoMasks) {
67  tokens.m_l1GtTmVetoAlgo = iCC.esConsumes<iTrans>();
68  tokens.m_l1GtTmVetoTech = iCC.esConsumes<iTrans>();
69  }
70  return tokens;
71  }
72 } // namespace
73 // constructor(s)
75  : m_testerPrescaleFactors(parSet.getParameter<bool>("TesterPrescaleFactors")),
76  m_testerTriggerMask(parSet.getParameter<bool>("TesterTriggerMask")),
77  m_testerTriggerVetoMask(parSet.getParameter<bool>("TesterTriggerVetoMask")),
78  m_retrieveInBeginRun(parSet.getParameter<bool>("RetrieveInBeginRun")),
79  m_retrieveInBeginLuminosityBlock(parSet.getParameter<bool>("RetrieveInBeginLuminosityBlock")),
80  m_retrieveInAnalyze(parSet.getParameter<bool>("RetrieveInAnalyze")),
81  m_printInBeginRun(parSet.getParameter<bool>("PrintInBeginRun")),
82  m_printInBeginLuminosityBlock(parSet.getParameter<bool>("PrintInBeginLuminosityBlock")),
83  m_printInAnalyze(parSet.getParameter<bool>("PrintInAnalyze")),
84  m_printOutput(parSet.getUntrackedParameter<int>("PrintOutput", 3)),
85  m_run(tokens<edm::Transition::BeginRun>(
86  consumesCollector(), m_testerPrescaleFactors, m_testerTriggerMask, m_testerTriggerVetoMask)),
87  m_lumi(tokens<edm::Transition::BeginLuminosityBlock>(
88  consumesCollector(), m_testerPrescaleFactors, m_testerTriggerMask, m_testerTriggerVetoMask)),
89  m_event(tokens<edm::Transition::Event>(
90  consumesCollector(), m_testerPrescaleFactors, m_testerTriggerMask, m_testerTriggerVetoMask)) {
91  // empty
92 }
93 
94 // begin run
97  retrieveL1EventSetup(evSetup, m_run);
98  }
99 
100  if (m_printInBeginRun) {
102  }
103 }
104 
105 // begin luminosity block
107  const edm::EventSetup& evSetup) {
109  retrieveL1EventSetup(evSetup, m_lumi);
110  }
111 
114  }
115 }
116 
117 // loop over events
119  if (m_retrieveInAnalyze) {
120  retrieveL1EventSetup(evSetup, m_event);
121  }
122 
123  if (m_printInAnalyze) {
125  }
126 }
127 
128 // end luminosity block
130  const edm::EventSetup& evSetup) {}
131 
132 // end run
134 
137  // get / update the prescale factors from the EventSetup
138 
139  m_l1GtPfAlgo = &evSetup.getData(tokens.m_l1GtPfAlgo);
140  m_l1GtPfTech = &evSetup.getData(tokens.m_l1GtPfTech);
141  }
142 
143  if (m_testerTriggerMask) {
144  // get / update the trigger mask from the EventSetup
145 
146  m_l1GtTmAlgo = &evSetup.getData(tokens.m_l1GtTmAlgo);
147  m_l1GtTmTech = &evSetup.getData(tokens.m_l1GtTmTech);
148  }
149 
151  m_l1GtTmVetoAlgo = &evSetup.getData(tokens.m_l1GtTmVetoAlgo);
152  m_l1GtTmVetoTech = &evSetup.getData(tokens.m_l1GtTmVetoTech);
153  }
154 }
155 
157  // define an output stream to print into
158  // it can then be directed to whatever log level is desired
159  std::ostringstream myCout;
160 
162  myCout << "\nL1 GT prescale factors for algorithm triggers" << std::endl;
163  m_l1GtPfAlgo->print(myCout);
164 
165  myCout << "\nL1 GT prescale factors for technical triggers" << std::endl;
166  m_l1GtPfTech->print(myCout);
167  }
168 
169  //
170  if (m_testerTriggerMask) {
171  myCout << "\nL1 GT trigger masks for algorithm triggers" << std::endl;
172  m_l1GtTmAlgo->print(myCout);
173 
174  myCout << "\nL1 GT trigger masks for technical triggers" << std::endl;
175  m_l1GtTmTech->print(myCout);
176  }
177 
178  //
180  myCout << "\nL1 GT trigger veto masks for algorithm triggers" << std::endl;
181  m_l1GtTmVetoAlgo->print(myCout);
182 
183  myCout << "\nL1 GT trigger veto masks for technical triggers" << std::endl;
184  m_l1GtTmVetoTech->print(myCout);
185  }
186 
187  switch (m_printOutput) {
188  case 0: {
189  std::cout << myCout.str() << std::endl;
190 
191  }
192 
193  break;
194  case 1: {
195  LogTrace("L1GtPrescaleFactorsAndMasksTester") << myCout.str() << std::endl;
196 
197  } break;
198 
199  case 2: {
200  edm::LogVerbatim("L1GtPrescaleFactorsAndMasksTester") << myCout.str() << std::endl;
201 
202  }
203 
204  break;
205  case 3: {
206  edm::LogInfo("L1GtPrescaleFactorsAndMasksTester") << myCout.str();
207 
208  }
209 
210  break;
211  default: {
212  myCout << "\n\n L1GtPrescaleFactorsAndMasksTester: Error - no print output = " << m_printOutput
213  << " defined! \n Check available values in the cfi file."
214  << "\n"
215  << std::endl;
216 
217  } break;
218  }
219 }
Log< level::Info, true > LogVerbatim
edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskVetoAlgoTrigRcd > m_l1GtTmVetoAlgo
const L1GtTriggerMask * m_l1GtTmAlgo
trigger masks & veto masks
void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
end luminosity block
edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskVetoTechTrigRcd > m_l1GtTmVetoTech
edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskAlgoTrigRcd > m_l1GtTmAlgo
bool m_retrieveInBeginRun
retrieve the records in beginRun, beginLuminosityBlock, analyze, respectively
#define LogTrace(id)
edm::ESGetToken< L1GtPrescaleFactors, L1GtPrescaleFactorsAlgoTrigRcd > m_l1GtPfAlgo
edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskTechTrigRcd > m_l1GtTmTech
int iEvent
Definition: GenABIO.cc:224
void print(std::ostream &) const
print the mask
const L1GtPrescaleFactors * m_l1GtPfAlgo
prescale factors
Transition
Definition: Transition.h:12
void beginRun(const edm::Run &, const edm::EventSetup &) override
begin run
bool getData(T &iHolder) const
Definition: EventSetup.h:122
Log< level::Info, false > LogInfo
L1GtPrescaleFactorsAndMasksTester(const edm::ParameterSet &)
bool m_printInBeginRun
print the records in beginRun, beginLuminosityBlock, analyze, respectively
void print(std::ostream &) const
print the prescale factors
HLT enums.
void endRun(const edm::Run &, const edm::EventSetup &) override
end run
void printL1EventSetup()
print the requred records
void analyze(const edm::Event &, const edm::EventSetup &) override
analyze
void retrieveL1EventSetup(const edm::EventSetup &, const Tokens &)
retrieve all the relevant L1 trigger event setup records
void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
begin luminosity block
Definition: Run.h:45
edm::ESGetToken< L1GtPrescaleFactors, L1GtPrescaleFactorsTechTrigRcd > m_l1GtPfTech