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 29 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.

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

108  {
109  int success = 0;
110 
111  if (success == 0) {
112  // get data from EventSetup
118 
119  if (jfPars.product() == nullptr) {
120  success = -1;
121  if (m_verbose) {
122  edm::LogWarning("L1GctConfigFailure")
123  << "Failed to find a L1GctJetFinderParamsRcd:L1GctJetFinderParams in EventSetup!" << std::endl;
124  }
125  }
126 
127  if (chanMask.product() == nullptr) {
128  success = -1;
129  if (m_verbose) {
130  edm::LogWarning("L1GctConfigFailure")
131  << "Failed to find a L1GctChannelMaskRcd:L1GctChannelMask in EventSetup!" << std::endl;
132  }
133  }
134 
135  if (hfRingEtScale.product() == nullptr) {
136  success = -1;
137  if (m_verbose) {
138  edm::LogWarning("L1GctConfigFailure")
139  << "Failed to find a L1HfRingEtScaleRcd:L1HfRingEtScaleRcd in EventSetup!" << std::endl;
140  }
141  }
142 
143  if (success == 0) {
144  // tell the jet Et Luts about the scales
145  for (unsigned ieta = 0; ieta < m_jetEtCalibLuts.size(); ieta++) {
146  m_jetEtCalibLuts.at(ieta)->setFunction(jfPars.product());
147  m_jetEtCalibLuts.at(ieta)->setOutputEtScale(etScale.product());
148  }
149 
150  // pass all the setup info to the gct
151  m_gct->setJetEtCalibrationLuts(m_jetEtCalibLuts);
152  m_gct->setJetFinderParams(jfPars.product());
153  m_gct->setHtMissScale(htMissScale.product());
154  m_gct->setupHfSumLuts(hfRingEtScale.product());
155  m_gct->setChannelMask(chanMask.product());
156  }
157  }
158 
159  if (success != 0 && m_verbose) {
160  edm::LogError("L1GctConfigError") << "Configuration failed - GCT emulator will not be run" << std::endl;
161  }
162  return success;
163 }
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:157
Log< level::Warning, false > LogWarning
void L1GctEmulator::produce ( edm::Event e,
const edm::EventSetup c 
)
overrideprivate

Definition at line 165 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().

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