CMS 3D CMS Logo

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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Public Member Functions

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

Private Member Functions

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

Private Attributes

const std::string m_conditionsLabel
 
edm::EDGetTokenT< L1CaloEmCollectionm_emToken
 
std::unique_ptr< L1GlobalCaloTriggerm_gct
 
std::string m_inputLabel
 
lutPtrVector m_jetEtCalibLuts
 
edm::EDGetTokenT< L1CaloRegionCollectionm_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 30 of file L1GctEmulator.h.

Member Typedef Documentation

◆ lutPtr

typedefs

Definition at line 33 of file L1GctEmulator.h.

◆ lutPtrVector

Definition at line 34 of file L1GctEmulator.h.

Constructor & Destructor Documentation

◆ L1GctEmulator()

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

constructor

Definition at line 39 of file L1GctEmulator.cc.

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

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), L1GctJetLeafCard::hardwareJetFinder, LEDCalibrationChannels::ieta, SimL1EmulatorRepack_Full_cff::inputTag, m_emToken, m_gct, m_inputLabel, m_jetEtCalibLuts, m_regionToken, m_verbose, L1GctJetFinderParams::NUMBER_ETA_VALUES, AlCaHLTBitMon_QueryRunRegistry::string, and L1GctJetLeafCard::tdrJetFinder.

Member Function Documentation

◆ configureGct()

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

Definition at line 113 of file L1GctEmulator.cc.

113  {
114  int success = 0;
115 
116  if (success == 0) {
117  // get data from EventSetup
119  c.get<L1GctJetFinderParamsRcd>().get(m_conditionsLabel, jfPars); // which record?
121  c.get<L1GctChannelMaskRcd>().get(m_conditionsLabel, chanMask); // which record?
123  c.get<L1JetEtScaleRcd>().get(m_conditionsLabel, etScale); // which record?
124  edm::ESHandle<L1CaloEtScale> htMissScale;
125  c.get<L1HtMissScaleRcd>().get(m_conditionsLabel, htMissScale); // which record?
126  edm::ESHandle<L1CaloEtScale> hfRingEtScale;
127  c.get<L1HfRingEtScaleRcd>().get(m_conditionsLabel, hfRingEtScale); // which record?
128 
129  if (jfPars.product() == nullptr) {
130  success = -1;
131  if (m_verbose) {
132  edm::LogWarning("L1GctConfigFailure")
133  << "Failed to find a L1GctJetFinderParamsRcd:L1GctJetFinderParams in EventSetup!" << std::endl;
134  }
135  }
136 
137  if (chanMask.product() == nullptr) {
138  success = -1;
139  if (m_verbose) {
140  edm::LogWarning("L1GctConfigFailure")
141  << "Failed to find a L1GctChannelMaskRcd:L1GctChannelMask in EventSetup!" << std::endl;
142  }
143  }
144 
145  if (hfRingEtScale.product() == nullptr) {
146  success = -1;
147  if (m_verbose) {
148  edm::LogWarning("L1GctConfigFailure")
149  << "Failed to find a L1HfRingEtScaleRcd:L1HfRingEtScaleRcd in EventSetup!" << std::endl;
150  }
151  }
152 
153  if (success == 0) {
154  // tell the jet Et Luts about the scales
155  for (unsigned ieta = 0; ieta < m_jetEtCalibLuts.size(); ieta++) {
156  m_jetEtCalibLuts.at(ieta)->setFunction(jfPars.product());
157  m_jetEtCalibLuts.at(ieta)->setOutputEtScale(etScale.product());
158  }
159 
160  // pass all the setup info to the gct
161  m_gct->setJetEtCalibrationLuts(m_jetEtCalibLuts);
162  m_gct->setJetFinderParams(jfPars.product());
163  m_gct->setHtMissScale(htMissScale.product());
164  m_gct->setupHfSumLuts(hfRingEtScale.product());
165  m_gct->setChannelMask(chanMask.product());
166  }
167  }
168 
169  if (success != 0 && m_verbose) {
170  edm::LogError("L1GctConfigError") << "Configuration failed - GCT emulator will not be run" << std::endl;
171  }
172  return success;
173 }

References HltBtagPostValidation_cff::c, photonValidator_cfi::etScale, get, LEDCalibrationChannels::ieta, m_conditionsLabel, m_gct, m_jetEtCalibLuts, m_verbose, edm::ESHandle< T >::product(), and summarizeEdmComparisonLogfiles::success.

Referenced by produce().

◆ produce()

void L1GctEmulator::produce ( edm::Event e,
const edm::EventSetup c 
)
overrideprivate

Definition at line 175 of file L1GctEmulator.cc.

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

References HltBtagPostValidation_cff::c, configureGct(), MillePedeFileConverter_cfg::e, edm::HandleBase::isValid(), m_emToken, m_gct, m_inputLabel, m_regionToken, m_verbose, m_writeInternalData, and eostools::move().

Member Data Documentation

◆ m_conditionsLabel

const std::string L1GctEmulator::m_conditionsLabel
private

Definition at line 62 of file L1GctEmulator.h.

Referenced by configureGct().

◆ m_emToken

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

Definition at line 46 of file L1GctEmulator.h.

Referenced by L1GctEmulator(), and produce().

◆ m_gct

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

Definition at line 50 of file L1GctEmulator.h.

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

◆ m_inputLabel

std::string L1GctEmulator::m_inputLabel
private

Definition at line 45 of file L1GctEmulator.h.

Referenced by L1GctEmulator(), and produce().

◆ m_jetEtCalibLuts

lutPtrVector L1GctEmulator::m_jetEtCalibLuts
private

Definition at line 53 of file L1GctEmulator.h.

Referenced by configureGct(), and L1GctEmulator().

◆ m_regionToken

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

Definition at line 47 of file L1GctEmulator.h.

Referenced by L1GctEmulator(), and produce().

◆ m_verbose

const bool L1GctEmulator::m_verbose
private

Definition at line 59 of file L1GctEmulator.h.

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

◆ m_writeInternalData

const bool L1GctEmulator::m_writeInternalData
private

Definition at line 56 of file L1GctEmulator.h.

Referenced by produce().

L1GctJetLeafCard::jetFinderType
jetFinderType
Definition: L1GctJetLeafCard.h:31
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
L1GctInternEtSumCollection
std::vector< L1GctInternEtSum > L1GctInternEtSumCollection
Definition: L1GctCollections.h:25
L1GctEmulator::m_regionToken
edm::EDGetTokenT< L1CaloRegionCollection > m_regionToken
Definition: L1GctEmulator.h:47
L1GctEmulator::m_inputLabel
std::string m_inputLabel
Definition: L1GctEmulator.h:45
L1GctEmulator::m_emToken
edm::EDGetTokenT< L1CaloEmCollection > m_emToken
Definition: L1GctEmulator.h:46
L1GctJetCandCollection
std::vector< L1GctJetCand > L1GctJetCandCollection
Definition: L1GctCollections.h:31
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle
Definition: AssociativeIterator.h:50
L1GctJetLeafCard::tdrJetFinder
Definition: L1GctJetLeafCard.h:31
L1HfRingEtScaleRcd
Definition: L1HfRingEtScaleRcd.h:30
L1GctEmulator::m_verbose
const bool m_verbose
Definition: L1GctEmulator.h:59
L1GctEtMissCollection
std::vector< L1GctEtMiss > L1GctEtMissCollection
Definition: L1GctCollections.h:34
L1GctEmulator::m_gct
std::unique_ptr< L1GlobalCaloTrigger > m_gct
Definition: L1GctEmulator.h:50
L1GctJetEtCalibrationLut
Jet Et calibration LUT.
Definition: L1GctJetEtCalibrationLut.h:28
L1GctEmulator::lutPtr
L1GlobalCaloTrigger::lutPtr lutPtr
typedefs
Definition: L1GctEmulator.h:33
L1GctJetLeafCard::hardwareJetFinder
Definition: L1GctJetLeafCard.h:31
L1GctInternHtMissCollection
std::vector< L1GctInternHtMiss > L1GctInternHtMissCollection
Definition: L1GctCollections.h:27
L1GctChannelMaskRcd
Definition: L1GctChannelMaskRcd.h:12
L1JetEtScaleRcd
Definition: L1JetEtScaleRcd.h:30
edm::ESHandle
Definition: DTSurvey.h:22
L1GctJetFinderParamsRcd
Definition: L1GctJetFinderParamsRcd.h:31
summarizeEdmComparisonLogfiles.success
success
Definition: summarizeEdmComparisonLogfiles.py:115
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
L1GctEtTotalCollection
std::vector< L1GctEtTotal > L1GctEtTotalCollection
Definition: L1GctCollections.h:35
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
edm::LogError
Definition: MessageLogger.h:183
L1GctEmulator::m_conditionsLabel
const std::string m_conditionsLabel
Definition: L1GctEmulator.h:62
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
L1GctHFBitCountsCollection
std::vector< L1GctHFBitCounts > L1GctHFBitCountsCollection
Definition: L1GctCollections.h:39
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
L1HtMissScaleRcd
Definition: L1HtMissScaleRcd.h:30
eostools.move
def move(src, dest)
Definition: eostools.py:511
L1GctEmCandCollection
std::vector< L1GctEmCand > L1GctEmCandCollection
Definition: L1GctCollections.h:30
L1GctEmulator::m_jetEtCalibLuts
lutPtrVector m_jetEtCalibLuts
Definition: L1GctEmulator.h:53
L1GctInternJetDataCollection
std::vector< L1GctInternJetData > L1GctInternJetDataCollection
Definition: L1GctCollections.h:24
L1GctEtHadCollection
std::vector< L1GctEtHad > L1GctEtHadCollection
Definition: L1GctCollections.h:33
SimL1EmulatorRepack_Full_cff.inputTag
inputTag
Definition: SimL1EmulatorRepack_Full_cff.py:56
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
L1GctHFRingEtSumsCollection
std::vector< L1GctHFRingEtSums > L1GctHFRingEtSumsCollection
Definition: L1GctCollections.h:38
L1GctEmulator::configureGct
int configureGct(const edm::EventSetup &c)
Definition: L1GctEmulator.cc:113
edm::InputTag
Definition: InputTag.h:15
L1GctJetFinderParams::NUMBER_ETA_VALUES
static const unsigned NUMBER_ETA_VALUES
Number of eta bins used in correction.
Definition: L1GctJetFinderParams.h:12
L1GctHtMissCollection
std::vector< L1GctHtMiss > L1GctHtMissCollection
Definition: L1GctCollections.h:36
L1GctEmulator::m_writeInternalData
const bool m_writeInternalData
Definition: L1GctEmulator.h:56
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
photonValidator_cfi.etScale
etScale
Definition: photonValidator_cfi.py:47