CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
L1GctPrintLuts Class Reference

#include <L1Trigger/L1GlobalCaloTrigger/plugins/L1GctPrintLuts.cc>

Inheritance diagram for L1GctPrintLuts:
edm::EDAnalyzer edm::EDConsumerBase

Public Types

typedef L1GlobalCaloTrigger::lutPtr lutPtr
 typedefs More...
 
typedef L1GlobalCaloTrigger::lutPtrVector lutPtrVector
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 L1GctPrintLuts (const edm::ParameterSet &)
 
 ~L1GctPrintLuts () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
int configureGct (const edm::EventSetup &c)
 
void endJob () override
 

Private Attributes

L1GlobalCaloTriggerm_gct
 
std::string m_hfSumLutOutFileName
 
std::string m_htMissLutOutFileName
 
lutPtrVector m_jetEtCalibLuts
 
std::string m_jetRanksOutFileName
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Description: print Gct lookup table contents to a file

Definition at line 37 of file L1GctPrintLuts.h.

Member Typedef Documentation

◆ lutPtr

typedefs

Definition at line 40 of file L1GctPrintLuts.h.

◆ lutPtrVector

Definition at line 41 of file L1GctPrintLuts.h.

Constructor & Destructor Documentation

◆ L1GctPrintLuts()

L1GctPrintLuts::L1GctPrintLuts ( const edm::ParameterSet iConfig)
explicit

Definition at line 33 of file L1GctPrintLuts.cc.

34  : m_jetRanksOutFileName(iConfig.getUntrackedParameter<std::string>("jetRanksFilename", "gctJetRanksContents.txt")),
35  m_hfSumLutOutFileName(iConfig.getUntrackedParameter<std::string>("hfSumLutFilename", "gctHfSumLutContents.txt")),
37  iConfig.getUntrackedParameter<std::string>("htMissLutFilename", "gctHtMissLutContents.txt")),
40  // Fill the jetEtCalibLuts vector
41  lutPtr nextLut(new L1GctJetEtCalibrationLut());
42 
43  for (unsigned ieta = 0; ieta < L1GctJetFinderBase::COL_OFFSET; ieta++) {
44  nextLut->setEtaBin(ieta);
45  m_jetEtCalibLuts.push_back(nextLut);
46  nextLut.reset(new L1GctJetEtCalibrationLut());
47  }
48 }

References L1GctJetFinderBase::COL_OFFSET, LEDCalibrationChannels::ieta, and m_jetEtCalibLuts.

◆ ~L1GctPrintLuts()

L1GctPrintLuts::~L1GctPrintLuts ( )
override

Definition at line 50 of file L1GctPrintLuts.cc.

50  {
51  // do anything here that needs to be done at desctruction time
52  // (e.g. close files, deallocate resources etc.)
53 }

Member Function Documentation

◆ analyze()

void L1GctPrintLuts::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 60 of file L1GctPrintLuts.cc.

60  {
61  // get config data from EventSetup
62  // check this has been done successfully before proceeding
63  if (configureGct(iSetup) == 0) {
64  // Write to a new file
65  struct stat buffer;
66  if (!stat(m_jetRanksOutFileName.c_str(), &buffer)) {
67  edm::LogWarning("LutFileExists") << "File " << m_jetRanksOutFileName
68  << " already exists. It will not be overwritten." << std::endl;
69  } else {
70  std::ofstream file;
71  file.open(m_jetRanksOutFileName.c_str());
72 
73  if (file.good()) {
74  // Print the calibration lut contents
75  file << " Gct lookup table printout \n"
76  << "===========================\n\n"
77  << "Jet Et Calibration lut contents\n"
78  << std::endl;
79  for (unsigned ieta = 0; ieta < m_jetEtCalibLuts.size(); ieta++) {
80  file << *m_jetEtCalibLuts.at(ieta) << std::endl;
81  }
82  } else {
83  edm::LogWarning("LutFileError") << "Error opening file " << m_jetRanksOutFileName
84  << ". No lookup tables written." << std::endl;
85  }
86  file.close();
87  }
88 
89  if (!stat(m_hfSumLutOutFileName.c_str(), &buffer)) {
90  edm::LogWarning("LutFileExists") << "File " << m_hfSumLutOutFileName
91  << " already exists. It will not be overwritten." << std::endl;
92  } else {
93  std::ofstream file;
94  file.open(m_hfSumLutOutFileName.c_str());
95 
96  if (file.good()) {
97  // Print the Hf luts
98  file << "\n\n Hf ring jet bit count luts:" << std::endl;
99  file << "\n Positive eta, ring1" << std::endl;
101  << std::endl;
102  file << "\n Positive eta, ring2" << std::endl;
104  << std::endl;
105  file << "\n Negative eta, ring1" << std::endl;
107  << std::endl;
108  file << "\n Negative eta, ring2" << std::endl;
110  << std::endl;
111  file << "\n\n Hf Et sum luts:" << std::endl;
112  file << "\n Positive eta, ring1" << std::endl;
114  << std::endl;
115  file << "\n Positive eta, ring2" << std::endl;
117  << std::endl;
118  file << "\n Negative eta, ring1" << std::endl;
120  << std::endl;
121  file << "\n Negative eta, ring2" << std::endl;
123  << std::endl;
124  } else {
125  edm::LogWarning("LutFileError") << "Error opening file " << m_hfSumLutOutFileName
126  << ". No lookup tables written." << std::endl;
127  }
128  file.close();
129  }
130 
131  if (!stat(m_htMissLutOutFileName.c_str(), &buffer)) {
132  edm::LogWarning("LutFileExists") << "File " << m_htMissLutOutFileName
133  << " already exists. It will not be overwritten." << std::endl;
134  } else {
135  std::ofstream file;
136  file.open(m_htMissLutOutFileName.c_str());
137 
138  if (file.good()) {
139  // Print the HtMiss luts
140  file << "\n\n missing Ht lut:" << std::endl;
141  file << *m_gct->getEnergyFinalStage()->getHtMissLut() << std::endl;
142  } else {
143  edm::LogWarning("LutFileError") << "Error opening file " << m_hfSumLutOutFileName
144  << ". No lookup tables written." << std::endl;
145  }
146  file.close();
147  }
148  }
149 }

References L1GctHfEtSumsLut::bitCountNegEtaRing1, L1GctHfEtSumsLut::bitCountNegEtaRing2, L1GctHfEtSumsLut::bitCountPosEtaRing1, L1GctHfEtSumsLut::bitCountPosEtaRing2, edmScanValgrind::buffer, configureGct(), L1GctHfEtSumsLut::etSumNegEtaRing1, L1GctHfEtSumsLut::etSumNegEtaRing2, L1GctHfEtSumsLut::etSumPosEtaRing1, L1GctHfEtSumsLut::etSumPosEtaRing2, FrontierConditions_GlobalTag_cff::file, L1GctGlobalHfSumAlgos::getBCLut(), L1GlobalCaloTrigger::getEnergyFinalStage(), L1GctGlobalHfSumAlgos::getESLut(), L1GctGlobalEnergyAlgos::getHfSumProcessor(), L1GctGlobalEnergyAlgos::getHtMissLut(), LEDCalibrationChannels::ieta, m_gct, m_hfSumLutOutFileName, m_htMissLutOutFileName, m_jetEtCalibLuts, m_jetRanksOutFileName, and hgcalPlots::stat.

◆ beginJob()

void L1GctPrintLuts::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 153 of file L1GctPrintLuts.cc.

153 {}

◆ configureGct()

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

Definition at line 156 of file L1GctPrintLuts.cc.

156  {
157  int success = 0;
158 
159  if (success == 0) {
160  // get data from EventSetup
162  c.get<L1GctJetFinderParamsRcd>().get(jfPars); // which record?
163  edm::ESHandle<L1CaloEtScale> hfRingEtScale;
164  c.get<L1HfRingEtScaleRcd>().get(hfRingEtScale); // which record?
165  edm::ESHandle<L1CaloEtScale> htMissScale;
166  c.get<L1HtMissScaleRcd>().get(htMissScale); // which record?
167  // edm::ESHandle< L1GctChannelMask > chanMask ;
168  // c.get< L1GctChannelMaskRcd >().get( chanMask ) ; // which record?
170  c.get<L1JetEtScaleRcd>().get(etScale); // which record?
171 
172  if (jfPars.product() == nullptr) {
173  success = -1;
174  edm::LogWarning("L1GctConfigFailure")
175  << "Failed to find a L1GctJetFinderParamsRcd:L1GctJetFinderParams in EventSetup!" << std::endl;
176  }
177 
178  if (hfRingEtScale.product() == nullptr) {
179  success = -1;
180  edm::LogWarning("L1GctConfigFailure")
181  << "Failed to find a L1HfRingEtScaleRcd:L1CaloEtScale in EventSetup!" << std::endl;
182  }
183 
184  if (htMissScale.product() == nullptr) {
185  success = -1;
186  edm::LogWarning("L1GctConfigFailure")
187  << "Failed to find a L1HtMissScaleRcd:L1CaloEtScale in EventSetup!" << std::endl;
188  }
189 
190  // if (chanMask.product() == 0) {
191  // success = -1;
192  // edm::LogWarning("L1GctConfigFailure")
193  // << "Failed to find a L1GctChannelMaskRcd:L1GctChannelMask in EventSetup!" << std::endl;
194  // }
195 
196  if (success == 0) {
197  // tell the jet Et Luts about the scales
198  for (unsigned ieta = 0; ieta < m_jetEtCalibLuts.size(); ieta++) {
199  m_jetEtCalibLuts.at(ieta)->setFunction(jfPars.product());
200  m_jetEtCalibLuts.at(ieta)->setOutputEtScale(etScale.product());
201  }
202 
203  // pass all the setup info to the gct
205  m_gct->setJetFinderParams(jfPars.product());
206  m_gct->setHtMissScale(htMissScale.product());
207  m_gct->setupHfSumLuts(hfRingEtScale.product());
208  // m_gct->setChannelMask(chanMask.product());
209  }
210  }
211 
212  if (success != 0) {
213  edm::LogError("L1GctConfigError") << "Configuration failed - GCT emulator will not be run" << std::endl;
214  }
215  return success;
216 }

References HltBtagPostValidation_cff::c, photonValidator_cfi::etScale, get, LEDCalibrationChannels::ieta, m_gct, m_jetEtCalibLuts, edm::ESHandle< T >::product(), L1GlobalCaloTrigger::setHtMissScale(), L1GlobalCaloTrigger::setJetEtCalibrationLuts(), L1GlobalCaloTrigger::setJetFinderParams(), L1GlobalCaloTrigger::setupHfSumLuts(), and summarizeEdmComparisonLogfiles::success.

Referenced by analyze().

◆ endJob()

void L1GctPrintLuts::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 219 of file L1GctPrintLuts.cc.

219 {}

Member Data Documentation

◆ m_gct

L1GlobalCaloTrigger* L1GctPrintLuts::m_gct
private

Definition at line 61 of file L1GctPrintLuts.h.

Referenced by analyze(), and configureGct().

◆ m_hfSumLutOutFileName

std::string L1GctPrintLuts::m_hfSumLutOutFileName
private

Definition at line 57 of file L1GctPrintLuts.h.

Referenced by analyze().

◆ m_htMissLutOutFileName

std::string L1GctPrintLuts::m_htMissLutOutFileName
private

Definition at line 58 of file L1GctPrintLuts.h.

Referenced by analyze().

◆ m_jetEtCalibLuts

lutPtrVector L1GctPrintLuts::m_jetEtCalibLuts
private

Definition at line 64 of file L1GctPrintLuts.h.

Referenced by analyze(), configureGct(), and L1GctPrintLuts().

◆ m_jetRanksOutFileName

std::string L1GctPrintLuts::m_jetRanksOutFileName
private

Definition at line 56 of file L1GctPrintLuts.h.

Referenced by analyze().

L1GctGlobalEnergyAlgos::getHtMissLut
const L1GctHtMissLut * getHtMissLut() const
Definition: L1GctGlobalEnergyAlgos.h:139
L1GctJetFinderBase::COL_OFFSET
static const unsigned int COL_OFFSET
The index offset between columns.
Definition: L1GctJetFinderBase.h:112
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
L1GlobalCaloTrigger::getEnergyFinalStage
L1GctGlobalEnergyAlgos * getEnergyFinalStage() const
get the energy final stage
Definition: L1GlobalCaloTrigger.h:199
L1GctHfEtSumsLut::bitCountPosEtaRing1
Definition: L1GctHfEtSumsLut.h:25
L1GctPrintLuts::configureGct
int configureGct(const edm::EventSetup &c)
Definition: L1GctPrintLuts.cc:156
L1GctGlobalEnergyAlgos::getHfSumProcessor
L1GctGlobalHfSumAlgos * getHfSumProcessor() const
provide access to hf sum processor
Definition: L1GctGlobalEnergyAlgos.h:96
L1GctHfEtSumsLut::etSumNegEtaRing1
Definition: L1GctHfEtSumsLut.h:31
L1GctPrintLuts::m_jetRanksOutFileName
std::string m_jetRanksOutFileName
Definition: L1GctPrintLuts.h:56
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
L1GctHfEtSumsLut::etSumPosEtaRing1
Definition: L1GctHfEtSumsLut.h:29
L1GlobalCaloTrigger::setJetFinderParams
void setJetFinderParams(const L1GctJetFinderParams *const jfpars)
Definition: L1GlobalCaloTrigger.cc:308
L1GlobalCaloTrigger::setHtMissScale
void setHtMissScale(const L1CaloEtScale *const scale)
setup scale for missing Ht
Definition: L1GlobalCaloTrigger.cc:345
L1HfRingEtScaleRcd
Definition: L1HfRingEtScaleRcd.h:30
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
L1GctPrintLuts::lutPtr
L1GlobalCaloTrigger::lutPtr lutPtr
typedefs
Definition: L1GctPrintLuts.h:40
L1GctHfEtSumsLut::bitCountNegEtaRing1
Definition: L1GctHfEtSumsLut.h:27
L1GctJetEtCalibrationLut
Jet Et calibration LUT.
Definition: L1GctJetEtCalibrationLut.h:28
hgcalPlots.stat
stat
Definition: hgcalPlots.py:1111
L1GctJetLeafCard::hardwareJetFinder
Definition: L1GctJetLeafCard.h:31
L1GctPrintLuts::m_hfSumLutOutFileName
std::string m_hfSumLutOutFileName
Definition: L1GctPrintLuts.h:57
L1JetEtScaleRcd
Definition: L1JetEtScaleRcd.h:30
edm::ESHandle
Definition: DTSurvey.h:22
L1GctJetFinderParamsRcd
Definition: L1GctJetFinderParamsRcd.h:31
summarizeEdmComparisonLogfiles.success
success
Definition: summarizeEdmComparisonLogfiles.py:115
L1GctPrintLuts::m_htMissLutOutFileName
std::string m_htMissLutOutFileName
Definition: L1GctPrintLuts.h:58
L1GctHfEtSumsLut::bitCountPosEtaRing2
Definition: L1GctHfEtSumsLut.h:26
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
edm::LogError
Definition: MessageLogger.h:183
L1GctPrintLuts::m_jetEtCalibLuts
lutPtrVector m_jetEtCalibLuts
Definition: L1GctPrintLuts.h:64
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
get
#define get
L1GctGlobalHfSumAlgos::getBCLut
const L1GctHfBitCountsLut * getBCLut(const L1GctHfEtSumsLut::hfLutType type) const
Get lut pointers.
Definition: L1GctGlobalHfSumAlgos.cc:244
L1GlobalCaloTrigger::setupHfSumLuts
void setupHfSumLuts(const L1CaloEtScale *const scale)
setup Hf sum LUTs
Definition: L1GlobalCaloTrigger.cc:352
L1HtMissScaleRcd
Definition: L1HtMissScaleRcd.h:30
L1GctPrintLuts::m_gct
L1GlobalCaloTrigger * m_gct
Definition: L1GctPrintLuts.h:61
L1GlobalCaloTrigger::setJetEtCalibrationLuts
void setJetEtCalibrationLuts(const lutPtrVector &jfluts)
setup the Jet Calibration Luts
Definition: L1GlobalCaloTrigger.cc:324
L1GlobalCaloTrigger
Bit-level emulation of the Global Calorimeter Trigger.
Definition: L1GlobalCaloTrigger.h:44
L1GctHfEtSumsLut::bitCountNegEtaRing2
Definition: L1GctHfEtSumsLut.h:28
L1GctHfEtSumsLut::etSumPosEtaRing2
Definition: L1GctHfEtSumsLut.h:30
photonValidator_cfi.etScale
etScale
Definition: photonValidator_cfi.py:47
L1GctHfEtSumsLut::etSumNegEtaRing2
Definition: L1GctHfEtSumsLut.h:32
L1GctGlobalHfSumAlgos::getESLut
const L1GctHfEtSumsLut * getESLut(const L1GctHfEtSumsLut::hfLutType type) const
Definition: L1GctGlobalHfSumAlgos.cc:253