CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
L1GctEmulator Class Reference

#include <src/L1Trigger/GlobalCaloTrigger/src/L1GctEmulator.h>

Inheritance diagram for L1GctEmulator:
edm::stream::EDProducer<>

Public Types

typedef L1GlobalCaloTrigger::lutPtr lutPtr
 typedefs More...
 
typedef
L1GlobalCaloTrigger::lutPtrVector 
lutPtrVector
 
- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Public Member Functions

 L1GctEmulator (const edm::ParameterSet &ps)
 constructor More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

int configureGct (const edm::EventSetup &c)
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 

Private Attributes

edm::ESGetToken
< L1GctChannelMask,
L1GctChannelMaskRcd
m_chanMaskToken
 
const std::string m_conditionsLabel
 
edm::EDGetTokenT
< L1CaloEmCollection
m_emToken
 
edm::ESGetToken< L1CaloEtScale,
L1JetEtScaleRcd
m_etScaleToken
 
std::unique_ptr
< L1GlobalCaloTrigger
m_gct
 
edm::ESGetToken< L1CaloEtScale,
L1HfRingEtScaleRcd
m_hfRingEtScaleToken
 
edm::ESGetToken< L1CaloEtScale,
L1HtMissScaleRcd
m_htMissScaleToken
 
std::string m_inputLabel
 
lutPtrVector m_jetEtCalibLuts
 
edm::ESGetToken
< L1GctJetFinderParams,
L1GctJetFinderParamsRcd
m_jfParsToken
 
edm::EDGetTokenT
< L1CaloRegionCollection
m_regionToken
 
const bool m_verbose
 
const bool m_writeInternalData
 

Detailed Description

Description: Framework module that runs the GCT bit-level emulator

Implementation: An EDProducer that contains an instance of L1GlobalCaloTrigger.

Definition at line 40 of file L1GctEmulator.h.

Member Typedef Documentation

typedefs

Definition at line 43 of file L1GctEmulator.h.

Definition at line 44 of file L1GctEmulator.h.

Constructor & Destructor Documentation

L1GctEmulator::L1GctEmulator ( const edm::ParameterSet ps)
explicit

constructor

Definition at line 28 of file L1GctEmulator.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), L1GctJetLeafCard::hardwareJetFinder, beam_dqm_sourceclient-live_cfg::inputTag, m_chanMaskToken, m_conditionsLabel, m_emToken, m_etScaleToken, m_gct, m_hfRingEtScaleToken, m_htMissScaleToken, m_inputLabel, m_jetEtCalibLuts, m_jfParsToken, m_regionToken, m_verbose, L1GctJetFinderParams::NUMBER_ETA_VALUES, AlCaHLTBitMon_QueryRunRegistry::string, and L1GctJetLeafCard::tdrJetFinder.

29  : m_jetEtCalibLuts(),
30  m_writeInternalData(ps.getParameter<bool>("writeInternalData")),
31  m_verbose(ps.getUntrackedParameter<bool>("verbose", false)),
32  m_conditionsLabel(ps.getParameter<std::string>("conditionsLabel")) {
33  // list of products
34  produces<L1GctEmCandCollection>("isoEm");
35  produces<L1GctEmCandCollection>("nonIsoEm");
36  produces<L1GctJetCandCollection>("cenJets");
37  produces<L1GctJetCandCollection>("forJets");
38  produces<L1GctJetCandCollection>("tauJets");
39  produces<L1GctInternJetDataCollection>();
40  produces<L1GctEtTotalCollection>();
41  produces<L1GctEtHadCollection>();
42  produces<L1GctEtMissCollection>();
43  produces<L1GctHtMissCollection>();
44  produces<L1GctInternEtSumCollection>();
45  produces<L1GctInternHtMissCollection>();
46  produces<L1GctHFBitCountsCollection>();
47  produces<L1GctHFRingEtSumsCollection>();
48 
49  // get the input label
51  m_inputLabel = inputTag.label();
52 
53  // Get the number of bunch crossings to be processed
54  int firstBx = -ps.getParameter<unsigned>("preSamples");
55  int lastBx = ps.getParameter<unsigned>("postSamples");
56 
57  // instantiate the GCT. Argument selects the type of jetFinder to be used.
59  std::string jfTypeStr = ps.getParameter<std::string>("jetFinderType");
60  if (jfTypeStr == "tdrJetFinder") {
62  } else if (jfTypeStr != "hardwareJetFinder") {
63  edm::LogWarning("L1GctEmulatorSetup")
64  << "Unrecognised jetFinder option " << jfTypeStr << "\nHardware jetFinder will be used";
65  }
66  bool hwTest = ps.getParameter<bool>("hardwareTest");
67  if (hwTest) {
68  unsigned mask = ps.getUntrackedParameter<unsigned>("jetLeafMask", 0);
69  m_gct = std::make_unique<L1GlobalCaloTrigger>(jfType, mask);
70  edm::LogWarning("L1GctEmulatorSetup") << "Emulator has been configured in hardware test mode with mask " << mask
71  << "\nThis mode should NOT be used for Physics studies!";
72  } else {
73  m_gct = std::make_unique<L1GlobalCaloTrigger>(jfType);
74  }
75  m_gct->setBxRange(firstBx, lastBx);
76 
77  // Fill the jetEtCalibLuts vector
78  lutPtr nextLut(new L1GctJetEtCalibrationLut());
79 
80  for (unsigned ieta = 0; ieta < L1GctJetFinderParams::NUMBER_ETA_VALUES; ieta++) {
81  nextLut->setEtaBin(ieta);
82  m_jetEtCalibLuts.push_back(nextLut);
83  nextLut.reset(new L1GctJetEtCalibrationLut());
84  }
85 
86  // Setup the tau algorithm parameters
87  bool useImprovedTauAlgo = ps.getParameter<bool>("useImprovedTauAlgorithm");
88  bool ignoreTauVetoBitsForIsolation = ps.getParameter<bool>("ignoreRCTTauVetoBitsForIsolation");
89  m_gct->setupTauAlgo(useImprovedTauAlgo, ignoreTauVetoBitsForIsolation);
90 
91  // set verbosity (not implemented yet!)
92  // m_gct->setVerbose(m_verbose);
93 
94  // print debug info?
95  if (m_verbose) {
96  m_gct->print();
97  }
98  m_emToken = consumes<L1CaloEmCollection>(inputTag);
99  m_regionToken = consumes<L1CaloRegionCollection>(inputTag);
100  m_jfParsToken = esConsumes<L1GctJetFinderParams, L1GctJetFinderParamsRcd>(edm::ESInputTag("", m_conditionsLabel));
101  m_chanMaskToken = esConsumes<L1GctChannelMask, L1GctChannelMaskRcd>(edm::ESInputTag("", m_conditionsLabel));
102  m_etScaleToken = esConsumes<L1CaloEtScale, L1JetEtScaleRcd>(edm::ESInputTag("", m_conditionsLabel));
103  m_htMissScaleToken = esConsumes<L1CaloEtScale, L1HtMissScaleRcd>(edm::ESInputTag("", m_conditionsLabel));
104  m_hfRingEtScaleToken = esConsumes<L1CaloEtScale, L1HfRingEtScaleRcd>(edm::ESInputTag("", m_conditionsLabel));
105 }
T getUntrackedParameter(std::string const &, T const &) const
edm::ESGetToken< L1GctJetFinderParams, L1GctJetFinderParamsRcd > m_jfParsToken
Definition: L1GctEmulator.h:60
edm::EDGetTokenT< L1CaloEmCollection > m_emToken
Definition: L1GctEmulator.h:56
Jet Et calibration LUT.
L1GlobalCaloTrigger::lutPtr lutPtr
typedefs
Definition: L1GctEmulator.h:43
edm::ESGetToken< L1CaloEtScale, L1HfRingEtScaleRcd > m_hfRingEtScaleToken
Definition: L1GctEmulator.h:64
edm::ESGetToken< L1CaloEtScale, L1HtMissScaleRcd > m_htMissScaleToken
Definition: L1GctEmulator.h:63
const std::string m_conditionsLabel
Definition: L1GctEmulator.h:79
edm::ESGetToken< L1GctChannelMask, L1GctChannelMaskRcd > m_chanMaskToken
Definition: L1GctEmulator.h:61
std::unique_ptr< L1GlobalCaloTrigger > m_gct
Definition: L1GctEmulator.h:67
static const unsigned NUMBER_ETA_VALUES
Number of eta bins used in correction.
const bool m_verbose
Definition: L1GctEmulator.h:76
lutPtrVector m_jetEtCalibLuts
Definition: L1GctEmulator.h:70
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::string m_inputLabel
Definition: L1GctEmulator.h:55
edm::ESGetToken< L1CaloEtScale, L1JetEtScaleRcd > m_etScaleToken
Definition: L1GctEmulator.h:62
Log< level::Warning, false > LogWarning
const bool m_writeInternalData
Definition: L1GctEmulator.h:73
edm::EDGetTokenT< L1CaloRegionCollection > m_regionToken
Definition: L1GctEmulator.h:57

Member Function Documentation

int L1GctEmulator::configureGct ( const edm::EventSetup c)
private

Definition at line 107 of file L1GctEmulator.cc.

References edm::EventSetup::getHandle(), m_chanMaskToken, m_etScaleToken, m_gct, m_hfRingEtScaleToken, m_htMissScaleToken, m_jetEtCalibLuts, m_jfParsToken, m_verbose, edm::ESHandle< class >::product(), and summarizeEdmComparisonLogfiles::success.

Referenced by produce().

107  {
108  int success = 0;
109 
110  if (success == 0) {
111  // get data from EventSetup
117 
118  if (jfPars.product() == nullptr) {
119  success = -1;
120  if (m_verbose) {
121  edm::LogWarning("L1GctConfigFailure")
122  << "Failed to find a L1GctJetFinderParamsRcd:L1GctJetFinderParams in EventSetup!" << std::endl;
123  }
124  }
125 
126  if (chanMask.product() == nullptr) {
127  success = -1;
128  if (m_verbose) {
129  edm::LogWarning("L1GctConfigFailure")
130  << "Failed to find a L1GctChannelMaskRcd:L1GctChannelMask in EventSetup!" << std::endl;
131  }
132  }
133 
134  if (hfRingEtScale.product() == nullptr) {
135  success = -1;
136  if (m_verbose) {
137  edm::LogWarning("L1GctConfigFailure")
138  << "Failed to find a L1HfRingEtScaleRcd:L1HfRingEtScaleRcd in EventSetup!" << std::endl;
139  }
140  }
141 
142  if (success == 0) {
143  // tell the jet Et Luts about the scales
144  for (unsigned ieta = 0; ieta < m_jetEtCalibLuts.size(); ieta++) {
145  m_jetEtCalibLuts.at(ieta)->setFunction(jfPars.product());
146  m_jetEtCalibLuts.at(ieta)->setOutputEtScale(etScale.product());
147  }
148 
149  // pass all the setup info to the gct
150  m_gct->setJetEtCalibrationLuts(m_jetEtCalibLuts);
151  m_gct->setJetFinderParams(jfPars.product());
152  m_gct->setHtMissScale(htMissScale.product());
153  m_gct->setupHfSumLuts(hfRingEtScale.product());
154  m_gct->setChannelMask(chanMask.product());
155  }
156  }
157 
158  if (success != 0 && m_verbose) {
159  edm::LogError("L1GctConfigError") << "Configuration failed - GCT emulator will not be run" << std::endl;
160  }
161  return success;
162 }
edm::ESGetToken< L1GctJetFinderParams, L1GctJetFinderParamsRcd > m_jfParsToken
Definition: L1GctEmulator.h:60
Log< level::Error, false > LogError
edm::ESGetToken< L1CaloEtScale, L1HfRingEtScaleRcd > m_hfRingEtScaleToken
Definition: L1GctEmulator.h:64
edm::ESGetToken< L1CaloEtScale, L1HtMissScaleRcd > m_htMissScaleToken
Definition: L1GctEmulator.h:63
edm::ESGetToken< L1GctChannelMask, L1GctChannelMaskRcd > m_chanMaskToken
Definition: L1GctEmulator.h:61
std::unique_ptr< L1GlobalCaloTrigger > m_gct
Definition: L1GctEmulator.h:67
const bool m_verbose
Definition: L1GctEmulator.h:76
lutPtrVector m_jetEtCalibLuts
Definition: L1GctEmulator.h:70
T const * product() const
Definition: ESHandle.h:86
edm::ESGetToken< L1CaloEtScale, L1JetEtScaleRcd > m_etScaleToken
Definition: L1GctEmulator.h:62
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
Log< level::Warning, false > LogWarning
void L1GctEmulator::produce ( edm::Event e,
const edm::EventSetup c 
)
overrideprivate

Definition at line 164 of file L1GctEmulator.cc.

References configureGct(), edm::Event::getByToken(), edm::HandleBase::isValid(), m_emToken, m_gct, m_inputLabel, m_regionToken, m_verbose, m_writeInternalData, eostools::move(), and edm::Event::put().

164  {
165  // The emulator will always produce output collections, which get filled as long as
166  // the setup and input data are present. Start by making empty output collections.
167 
168  // create the em and jet collections
169  std::unique_ptr<L1GctEmCandCollection> isoEmResult(new L1GctEmCandCollection());
170  std::unique_ptr<L1GctEmCandCollection> nonIsoEmResult(new L1GctEmCandCollection());
171  std::unique_ptr<L1GctJetCandCollection> cenJetResult(new L1GctJetCandCollection());
172  std::unique_ptr<L1GctJetCandCollection> forJetResult(new L1GctJetCandCollection());
173  std::unique_ptr<L1GctJetCandCollection> tauJetResult(new L1GctJetCandCollection());
174 
175  // create the energy sum digis
176  std::unique_ptr<L1GctEtTotalCollection> etTotResult(new L1GctEtTotalCollection());
177  std::unique_ptr<L1GctEtHadCollection> etHadResult(new L1GctEtHadCollection());
178  std::unique_ptr<L1GctEtMissCollection> etMissResult(new L1GctEtMissCollection());
179  std::unique_ptr<L1GctHtMissCollection> htMissResult(new L1GctHtMissCollection());
180 
181  // create the Hf sums digis
182  std::unique_ptr<L1GctHFBitCountsCollection> hfBitCountResult(new L1GctHFBitCountsCollection());
183  std::unique_ptr<L1GctHFRingEtSumsCollection> hfRingEtSumResult(new L1GctHFRingEtSumsCollection());
184 
185  // create internal data collections
186  std::unique_ptr<L1GctInternJetDataCollection> internalJetResult(new L1GctInternJetDataCollection());
187  std::unique_ptr<L1GctInternEtSumCollection> internalEtSumResult(new L1GctInternEtSumCollection());
188  std::unique_ptr<L1GctInternHtMissCollection> internalHtMissResult(new L1GctInternHtMissCollection());
189 
190  // get config data from EventSetup.
191  // check this has been done successfully before proceeding
192  if (configureGct(c) == 0) {
193  // get the RCT data
196  bool gotEm = e.getByToken(m_emToken, em);
197  bool gotRgn = e.getByToken(m_regionToken, rgn);
198 
199  // check the data
200  if (!gotEm && m_verbose) {
201  edm::LogError("L1GctInputFailedError") << "Failed to get em candidates with label " << m_inputLabel
202  << " - GCT emulator will not be run" << std::endl;
203  }
204 
205  if (!gotRgn && m_verbose) {
206  edm::LogError("L1GctInputFailedError")
207  << "Failed to get calo regions with label " << m_inputLabel << " - GCT emulator will not be run" << std::endl;
208  }
209 
210  if (gotEm && !em.isValid()) {
211  gotEm = false;
212  if (m_verbose) {
213  edm::LogError("L1GctInputFailedError") << "isValid() flag set to false for em candidates with label "
214  << m_inputLabel << " - GCT emulator will not be run" << std::endl;
215  }
216  }
217 
218  if (gotRgn && !rgn.isValid()) {
219  gotRgn = false;
220  if (m_verbose) {
221  edm::LogError("L1GctInputFailedError") << "isValid() flag set to false for calo regions with label "
222  << m_inputLabel << " - GCT emulator will not be run" << std::endl;
223  }
224  }
225 
226  // if all is ok, proceed with GCT processing
227  if (gotEm && gotRgn) {
228  // reset the GCT internal buffers
229  m_gct->reset();
230 
231  // fill the GCT source cards
232  m_gct->fillEmCands(*em);
233  m_gct->fillRegions(*rgn);
234 
235  // process the event
236  m_gct->process();
237 
238  // fill the em and jet collections
239  *isoEmResult = m_gct->getIsoElectrons();
240  *nonIsoEmResult = m_gct->getNonIsoElectrons();
241  *cenJetResult = m_gct->getCentralJets();
242  *forJetResult = m_gct->getForwardJets();
243  *tauJetResult = m_gct->getTauJets();
244 
245  // fill the energy sum digis
246  *etTotResult = m_gct->getEtSumCollection();
247  *etHadResult = m_gct->getEtHadCollection();
248  *etMissResult = m_gct->getEtMissCollection();
249  *htMissResult = m_gct->getHtMissCollection();
250 
251  // fill the Hf sums digis
252  *hfBitCountResult = m_gct->getHFBitCountsCollection();
253  *hfRingEtSumResult = m_gct->getHFRingEtSumsCollection();
254 
255  // fill internal data collections if required
256  if (m_writeInternalData) {
257  *internalJetResult = m_gct->getInternalJets();
258  *internalEtSumResult = m_gct->getInternalEtSums();
259  *internalHtMissResult = m_gct->getInternalHtMiss();
260  }
261  }
262  }
263 
264  // put the collections into the event
265  e.put(std::move(isoEmResult), "isoEm");
266  e.put(std::move(nonIsoEmResult), "nonIsoEm");
267  e.put(std::move(cenJetResult), "cenJets");
268  e.put(std::move(forJetResult), "forJets");
269  e.put(std::move(tauJetResult), "tauJets");
270  e.put(std::move(etTotResult));
271  e.put(std::move(etHadResult));
272  e.put(std::move(etMissResult));
273  e.put(std::move(htMissResult));
274  e.put(std::move(hfBitCountResult));
275  e.put(std::move(hfRingEtSumResult));
276 
277  e.put(std::move(internalJetResult));
278  e.put(std::move(internalEtSumResult));
279  e.put(std::move(internalHtMissResult));
280 }
edm::EDGetTokenT< L1CaloEmCollection > m_emToken
Definition: L1GctEmulator.h:56
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
std::vector< L1GctEtMiss > L1GctEtMissCollection
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
std::vector< L1GctHFRingEtSums > L1GctHFRingEtSumsCollection
std::vector< L1GctEtHad > L1GctEtHadCollection
std::vector< L1GctInternHtMiss > L1GctInternHtMissCollection
Log< level::Error, false > LogError
std::vector< L1GctEtTotal > L1GctEtTotalCollection
std::vector< L1GctHFBitCounts > L1GctHFBitCountsCollection
std::vector< L1GctJetCand > L1GctJetCandCollection
def move
Definition: eostools.py:511
std::unique_ptr< L1GlobalCaloTrigger > m_gct
Definition: L1GctEmulator.h:67
bool isValid() const
Definition: HandleBase.h:70
const bool m_verbose
Definition: L1GctEmulator.h:76
std::vector< L1GctHtMiss > L1GctHtMissCollection
std::vector< L1GctInternJetData > L1GctInternJetDataCollection
std::string m_inputLabel
Definition: L1GctEmulator.h:55
std::vector< L1GctInternEtSum > L1GctInternEtSumCollection
int configureGct(const edm::EventSetup &c)
const bool m_writeInternalData
Definition: L1GctEmulator.h:73
edm::EDGetTokenT< L1CaloRegionCollection > m_regionToken
Definition: L1GctEmulator.h:57
std::vector< L1GctEmCand > L1GctEmCandCollection

Member Data Documentation

edm::ESGetToken<L1GctChannelMask, L1GctChannelMaskRcd> L1GctEmulator::m_chanMaskToken
private

Definition at line 61 of file L1GctEmulator.h.

Referenced by configureGct(), and L1GctEmulator().

const std::string L1GctEmulator::m_conditionsLabel
private

Definition at line 79 of file L1GctEmulator.h.

Referenced by L1GctEmulator().

edm::EDGetTokenT<L1CaloEmCollection> L1GctEmulator::m_emToken
private

Definition at line 56 of file L1GctEmulator.h.

Referenced by L1GctEmulator(), and produce().

edm::ESGetToken<L1CaloEtScale, L1JetEtScaleRcd> L1GctEmulator::m_etScaleToken
private

Definition at line 62 of file L1GctEmulator.h.

Referenced by configureGct(), and L1GctEmulator().

std::unique_ptr<L1GlobalCaloTrigger> L1GctEmulator::m_gct
private

Definition at line 67 of file L1GctEmulator.h.

Referenced by configureGct(), L1GctEmulator(), and produce().

edm::ESGetToken<L1CaloEtScale, L1HfRingEtScaleRcd> L1GctEmulator::m_hfRingEtScaleToken
private

Definition at line 64 of file L1GctEmulator.h.

Referenced by configureGct(), and L1GctEmulator().

edm::ESGetToken<L1CaloEtScale, L1HtMissScaleRcd> L1GctEmulator::m_htMissScaleToken
private

Definition at line 63 of file L1GctEmulator.h.

Referenced by configureGct(), and L1GctEmulator().

std::string L1GctEmulator::m_inputLabel
private

Definition at line 55 of file L1GctEmulator.h.

Referenced by L1GctEmulator(), and produce().

lutPtrVector L1GctEmulator::m_jetEtCalibLuts
private

Definition at line 70 of file L1GctEmulator.h.

Referenced by configureGct(), and L1GctEmulator().

edm::ESGetToken<L1GctJetFinderParams, L1GctJetFinderParamsRcd> L1GctEmulator::m_jfParsToken
private

Definition at line 60 of file L1GctEmulator.h.

Referenced by configureGct(), and L1GctEmulator().

edm::EDGetTokenT<L1CaloRegionCollection> L1GctEmulator::m_regionToken
private

Definition at line 57 of file L1GctEmulator.h.

Referenced by L1GctEmulator(), and produce().

const bool L1GctEmulator::m_verbose
private

Definition at line 76 of file L1GctEmulator.h.

Referenced by configureGct(), L1GctEmulator(), and produce().

const bool L1GctEmulator::m_writeInternalData
private

Definition at line 73 of file L1GctEmulator.h.

Referenced by produce().