CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
HcalTPGCoderULUT Class Reference
Inheritance diagram for HcalTPGCoderULUT:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Types

typedef std::shared_ptr< HcalTPGCoderReturnType
 

Public Member Functions

 HcalTPGCoderULUT (const edm::ParameterSet &)
 
ReturnType produce (const HcalTPGRecord &)
 
 ~HcalTPGCoderULUT () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
template<typename Record >
void updateFromMayConsumes (unsigned int iIndex, const Record &iRecord)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer ()(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 

Private Types

using HostType = edm::ESProductHost< HcaluLUTTPGCoder, HcalDbRecord >
 

Private Member Functions

void buildCoder (const HcalTopology *, const HcalTimeSlew *, HcaluLUTTPGCoder *)
 

Private Attributes

edm::ESGetToken< HcalTimeSlew, HcalTimeSlewRecorddelayToken_
 
std::vector< uint32_t > FG_HF_thresholds_
 
edm::FileInPath fgfile_
 
edm::ReusableObjectHolder< HostTypeholder_
 
edm::FileInPath ifilename_
 
double linearLSB_QIE11_
 
double linearLSB_QIE11Overlap_
 
double linearLSB_QIE8_
 
bool linearLUTs_
 
bool LUTGenerationMode_
 
int maskBit_
 
bool read_Ascii_
 
bool read_FGLut_
 
bool read_XML_
 
edm::ESGetToken< HcalDbService, HcalDbRecordserviceToken_
 
edm::ESGetToken< HcalTopology, HcalRecNumberingRecordtopoToken_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy >>>
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 41 of file HcalTPGCoderULUT.cc.

Member Typedef Documentation

Definition at line 51 of file HcalTPGCoderULUT.cc.

typedef std::shared_ptr<HcalTPGCoder> HcalTPGCoderULUT::ReturnType

Definition at line 46 of file HcalTPGCoderULUT.cc.

Constructor & Destructor Documentation

HcalTPGCoderULUT::HcalTPGCoderULUT ( const edm::ParameterSet iConfig)

Definition at line 78 of file HcalTPGCoderULUT.cc.

References delayToken_, FG_HF_thresholds_, fgfile_, edm::ParameterSet::getParameter(), ifilename_, linearLSB_QIE11_, linearLSB_QIE11Overlap_, linearLSB_QIE8_, linearLUTs_, LUTGenerationMode_, maskBit_, read_Ascii_, read_FGLut_, read_XML_, serviceToken_, edm::ESProducer::setWhatProduced(), and topoToken_.

78  {
79  read_Ascii_ = iConfig.getParameter<bool>("read_Ascii_LUTs");
80  read_XML_ = iConfig.getParameter<bool>("read_XML_LUTs");
81  read_FGLut_ = iConfig.getParameter<bool>("read_FG_LUTs");
82  fgfile_ = iConfig.getParameter<edm::FileInPath>("FGLUTs");
83 
84  //the following line is needed to tell the framework what
85  // data is being produced
86  auto cc = setWhatProduced(this);
87  cc.setConsumes(topoToken_).setConsumes(delayToken_, edm::ESInputTag{"", "HBHE"});
88 
89  if (!(read_Ascii_ || read_XML_)) {
90  LUTGenerationMode_ = iConfig.getParameter<bool>("LUTGenerationMode");
91  linearLUTs_ = iConfig.getParameter<bool>("linearLUTs");
92  auto scales = iConfig.getParameter<edm::ParameterSet>("tpScales").getParameter<edm::ParameterSet>("HBHE");
93  linearLSB_QIE8_ = scales.getParameter<double>("LSBQIE8");
94  linearLSB_QIE11_ = scales.getParameter<double>("LSBQIE11");
95  linearLSB_QIE11Overlap_ = scales.getParameter<double>("LSBQIE11Overlap");
96  maskBit_ = iConfig.getParameter<int>("MaskBit");
97  FG_HF_thresholds_ = iConfig.getParameter<std::vector<uint32_t> >("FG_HF_thresholds");
98  cc.setConsumes(serviceToken_);
99  } else {
100  ifilename_ = iConfig.getParameter<edm::FileInPath>("inputLUTs");
101  }
102 }
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
edm::ESGetToken< HcalTimeSlew, HcalTimeSlewRecord > delayToken_
edm::FileInPath ifilename_
std::vector< uint32_t > FG_HF_thresholds_
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > topoToken_
edm::FileInPath fgfile_
edm::ESGetToken< HcalDbService, HcalDbRecord > serviceToken_
double linearLSB_QIE11Overlap_
HcalTPGCoderULUT::~HcalTPGCoderULUT ( )
override

Definition at line 126 of file HcalTPGCoderULUT.cc.

126  {
127  // do anything here that needs to be done at desctruction time
128  // (e.g. close files, deallocate resources etc.)
129 }

Member Function Documentation

void HcalTPGCoderULUT::buildCoder ( const HcalTopology topo,
const HcalTimeSlew delay,
HcaluLUTTPGCoder theCoder 
)
private

Definition at line 104 of file HcalTPGCoderULUT.cc.

References FG_HF_thresholds_, fgfile_, edm::FileInPath::fullPath(), ifilename_, HcaluLUTTPGCoder::init(), linearLSB_QIE11_, linearLSB_QIE11Overlap_, linearLSB_QIE8_, linearLUTs_, LUTGenerationMode_, maskBit_, read_Ascii_, read_FGLut_, read_XML_, HcaluLUTTPGCoder::setAllLinear(), HcaluLUTTPGCoder::setFGHFthresholds(), HcaluLUTTPGCoder::setLUTGenerationMode(), HcaluLUTTPGCoder::setMaskBit(), HcaluLUTTPGCoder::update(), and HcaluLUTTPGCoder::updateXML().

Referenced by produce().

104  {
105  using namespace edm::es;
106  theCoder->init(topo, delay);
107  if (read_Ascii_ || read_XML_) {
108  edm::LogInfo("HCAL") << "Using ASCII/XML LUTs" << ifilename_.fullPath() << " for HcalTPGCoderULUT initialization";
109  if (read_Ascii_) {
110  theCoder->update(ifilename_.fullPath().c_str());
111  } else if (read_XML_) {
112  theCoder->updateXML(ifilename_.fullPath().c_str());
113  }
114  // Read FG LUT and append to most significant bit 11
115  if (read_FGLut_) {
116  theCoder->update(fgfile_.fullPath().c_str(), true);
117  }
118  } else {
121  theCoder->setMaskBit(maskBit_);
123  }
124 }
edm::FileInPath ifilename_
void init(const HcalTopology *top, const HcalTimeSlew *delay)
void update(const HcalDbService &conditions)
void updateXML(const char *filename)
void setLUTGenerationMode(bool gen)
std::vector< uint32_t > FG_HF_thresholds_
void setMaskBit(int bit)
void setAllLinear(bool linear, double lsb8, double lsb11, double lsb11overlap)
edm::FileInPath fgfile_
std::string fullPath() const
Definition: FileInPath.cc:163
void setFGHFthresholds(const std::vector< uint32_t > &fgthresholds)
double linearLSB_QIE11Overlap_
HcalTPGCoderULUT::ReturnType HcalTPGCoderULUT::produce ( const HcalTPGRecord iRecord)

Definition at line 136 of file HcalTPGCoderULUT.cc.

References buildCoder(), DEFINE_FWK_EVENTSETUP_MODULE, delayToken_, fgfile_, edm::FileInPath::fullPath(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), h, holder_, query::host, edm::ReusableObjectHolder< T, Deleter >::makeOrGet(), read_Ascii_, read_FGLut_, read_XML_, serviceToken_, and topoToken_.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

136  {
137  auto host = holder_.makeOrGet([]() { return new HostType; });
138 
139  const auto& topo = iRecord.get(topoToken_);
140  const auto& delay = iRecord.getRecord<HcalDbRecord>().get(delayToken_);
141  if (read_Ascii_ || read_XML_) {
142  buildCoder(&topo, &delay, host.get());
143  } else {
144  host->ifRecordChanges<HcalDbRecord>(iRecord, [this, &topo, &delay, h = host.get()](auto const& rec) {
145  buildCoder(&topo, &delay, h);
146  h->update(rec.get(serviceToken_));
147  // Temporary update for FG Lut
148  // Will be moved to DB
149  if (read_FGLut_)
150  h->update(fgfile_.fullPath().c_str(), true);
151  });
152  }
153  return host;
154 }
host
Definition: query.py:115
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
edm::ESGetToken< HcalTimeSlew, HcalTimeSlewRecord > delayToken_
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
edm::ReusableObjectHolder< HostType > holder_
std::shared_ptr< T > makeOrGet(F iFunc)
If there isn&#39;t an object already available, creates a new one using iFunc.
edm::ESProductHost< HcaluLUTTPGCoder, HcalDbRecord > HostType
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > topoToken_
edm::FileInPath fgfile_
std::string fullPath() const
Definition: FileInPath.cc:163
void buildCoder(const HcalTopology *, const HcalTimeSlew *, HcaluLUTTPGCoder *)
edm::ESGetToken< HcalDbService, HcalDbRecord > serviceToken_

Member Data Documentation

edm::ESGetToken<HcalTimeSlew, HcalTimeSlewRecord> HcalTPGCoderULUT::delayToken_
private

Definition at line 58 of file HcalTPGCoderULUT.cc.

Referenced by HcalTPGCoderULUT(), and produce().

std::vector<uint32_t> HcalTPGCoderULUT::FG_HF_thresholds_
private

Definition at line 63 of file HcalTPGCoderULUT.cc.

Referenced by buildCoder(), and HcalTPGCoderULUT().

edm::FileInPath HcalTPGCoderULUT::fgfile_
private

Definition at line 64 of file HcalTPGCoderULUT.cc.

Referenced by buildCoder(), HcalTPGCoderULUT(), and produce().

edm::ReusableObjectHolder<HostType> HcalTPGCoderULUT::holder_
private

Definition at line 56 of file HcalTPGCoderULUT.cc.

Referenced by produce().

edm::FileInPath HcalTPGCoderULUT::ifilename_
private

Definition at line 64 of file HcalTPGCoderULUT.cc.

Referenced by buildCoder(), and HcalTPGCoderULUT().

double HcalTPGCoderULUT::linearLSB_QIE11_
private

Definition at line 61 of file HcalTPGCoderULUT.cc.

Referenced by buildCoder(), and HcalTPGCoderULUT().

double HcalTPGCoderULUT::linearLSB_QIE11Overlap_
private

Definition at line 61 of file HcalTPGCoderULUT.cc.

Referenced by buildCoder(), and HcalTPGCoderULUT().

double HcalTPGCoderULUT::linearLSB_QIE8_
private

Definition at line 61 of file HcalTPGCoderULUT.cc.

Referenced by buildCoder(), and HcalTPGCoderULUT().

bool HcalTPGCoderULUT::linearLUTs_
private

Definition at line 60 of file HcalTPGCoderULUT.cc.

Referenced by buildCoder(), and HcalTPGCoderULUT().

bool HcalTPGCoderULUT::LUTGenerationMode_
private

Definition at line 60 of file HcalTPGCoderULUT.cc.

Referenced by buildCoder(), and HcalTPGCoderULUT().

int HcalTPGCoderULUT::maskBit_
private

Definition at line 62 of file HcalTPGCoderULUT.cc.

Referenced by buildCoder(), and HcalTPGCoderULUT().

bool HcalTPGCoderULUT::read_Ascii_
private

Definition at line 60 of file HcalTPGCoderULUT.cc.

Referenced by buildCoder(), HcalTPGCoderULUT(), and produce().

bool HcalTPGCoderULUT::read_FGLut_
private

Definition at line 60 of file HcalTPGCoderULUT.cc.

Referenced by buildCoder(), HcalTPGCoderULUT(), and produce().

bool HcalTPGCoderULUT::read_XML_
private

Definition at line 60 of file HcalTPGCoderULUT.cc.

Referenced by buildCoder(), HcalTPGCoderULUT(), and produce().

edm::ESGetToken<HcalDbService, HcalDbRecord> HcalTPGCoderULUT::serviceToken_
private

Definition at line 59 of file HcalTPGCoderULUT.cc.

Referenced by HcalTPGCoderULUT(), and produce().

edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> HcalTPGCoderULUT::topoToken_
private

Definition at line 57 of file HcalTPGCoderULUT.cc.

Referenced by HcalTPGCoderULUT(), and produce().