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
25 
29 
31 
34 
36 
39 
42 
45 
46 // forward declarations
47 
48 namespace {
49  template <edm::Transition iTrans>
51  bool prescales,
52  bool masks,
53  bool vetoMasks) {
55  if (prescales) {
56  tokens.m_l1GtPfAlgo = iCC.esConsumes<iTrans>();
57  tokens.m_l1GtPfTech = iCC.esConsumes<iTrans>();
58  }
59  if (masks) {
60  tokens.m_l1GtTmAlgo = iCC.esConsumes<iTrans>();
61  tokens.m_l1GtTmTech = iCC.esConsumes<iTrans>();
62  }
63  if (vetoMasks) {
64  tokens.m_l1GtTmVetoAlgo = iCC.esConsumes<iTrans>();
65  tokens.m_l1GtTmVetoTech = iCC.esConsumes<iTrans>();
66  }
67  return tokens;
68  }
69 } // namespace
70 // constructor(s)
72  : m_testerPrescaleFactors(parSet.getParameter<bool>("TesterPrescaleFactors")),
73  m_testerTriggerMask(parSet.getParameter<bool>("TesterTriggerMask")),
74  m_testerTriggerVetoMask(parSet.getParameter<bool>("TesterTriggerVetoMask")),
75  m_retrieveInBeginRun(parSet.getParameter<bool>("RetrieveInBeginRun")),
76  m_retrieveInBeginLuminosityBlock(parSet.getParameter<bool>("RetrieveInBeginLuminosityBlock")),
77  m_retrieveInAnalyze(parSet.getParameter<bool>("RetrieveInAnalyze")),
78  m_printInBeginRun(parSet.getParameter<bool>("PrintInBeginRun")),
79  m_printInBeginLuminosityBlock(parSet.getParameter<bool>("PrintInBeginLuminosityBlock")),
80  m_printInAnalyze(parSet.getParameter<bool>("PrintInAnalyze")),
81  m_printOutput(parSet.getUntrackedParameter<int>("PrintOutput", 3)),
82  m_run(tokens<edm::Transition::BeginRun>(
83  consumesCollector(), m_testerPrescaleFactors, m_testerTriggerMask, m_testerTriggerVetoMask)),
84  m_lumi(tokens<edm::Transition::BeginLuminosityBlock>(
85  consumesCollector(), m_testerPrescaleFactors, m_testerTriggerMask, m_testerTriggerVetoMask)),
86  m_event(tokens<edm::Transition::Event>(
87  consumesCollector(), m_testerPrescaleFactors, m_testerTriggerMask, m_testerTriggerVetoMask)) {
88  // empty
89 }
90 
91 // begin run
94  retrieveL1EventSetup(evSetup, m_run);
95  }
96 
97  if (m_printInBeginRun) {
99  }
100 }
101 
102 // begin luminosity block
104  const edm::EventSetup& evSetup) {
106  retrieveL1EventSetup(evSetup, m_lumi);
107  }
108 
111  }
112 }
113 
114 // loop over events
116  if (m_retrieveInAnalyze) {
117  retrieveL1EventSetup(evSetup, m_event);
118  }
119 
120  if (m_printInAnalyze) {
122  }
123 }
124 
125 // end luminosity block
127  const edm::EventSetup& evSetup) {}
128 
129 // end run
131 
134  // get / update the prescale factors from the EventSetup
135 
136  m_l1GtPfAlgo = &evSetup.getData(tokens.m_l1GtPfAlgo);
137  m_l1GtPfTech = &evSetup.getData(tokens.m_l1GtPfTech);
138  }
139 
140  if (m_testerTriggerMask) {
141  // get / update the trigger mask from the EventSetup
142 
143  m_l1GtTmAlgo = &evSetup.getData(tokens.m_l1GtTmAlgo);
144  m_l1GtTmTech = &evSetup.getData(tokens.m_l1GtTmTech);
145  }
146 
148  m_l1GtTmVetoAlgo = &evSetup.getData(tokens.m_l1GtTmVetoAlgo);
149  m_l1GtTmVetoTech = &evSetup.getData(tokens.m_l1GtTmVetoTech);
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
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