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 Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair< DataKey, edm::propagate_const< std::shared_ptr< DataProxy > > > > KeyedProxies
 
typedef std::vector< EventSetupRecordKeyKeys
 
typedef std::map< EventSetupRecordKey, KeyedProxiesRecordProxies
 

Public Member Functions

 HcalTPGCoderULUT (const edm::ParameterSet &)
 
ReturnType produce (const HcalTPGRecord &)
 
 ~HcalTPGCoderULUT () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer ()(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval) override
 overrides DataProxyProvider method More...
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
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 edm::ESHandle< HcalTimeSlew > &, HcaluLUTTPGCoder *)
 
void setupDBRecord (const HcalDbRecord &, HcaluLUTTPGCoder *)
 

Private Attributes

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_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::ESProducer
 ESProducer (const ESProducer &)=delete
 
ESProducer const & operator= (const ESProducer &)=delete
 
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 eventsetup::EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList) override
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 

Detailed Description

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

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

Definition at line 42 of file HcalTPGCoderULUT.cc.

Member Typedef Documentation

Definition at line 54 of file HcalTPGCoderULUT.cc.

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

Definition at line 47 of file HcalTPGCoderULUT.cc.

Constructor & Destructor Documentation

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

Definition at line 79 of file HcalTPGCoderULUT.cc.

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

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

Definition at line 124 of file HcalTPGCoderULUT.cc.

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

Member Function Documentation

void HcalTPGCoderULUT::buildCoder ( const HcalTopology topo,
const edm::ESHandle< HcalTimeSlew > &  delay,
HcaluLUTTPGCoder theCoder 
)
private

Definition at line 102 of file HcalTPGCoderULUT.cc.

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

Referenced by produce(), and setupDBRecord().

102  {
103  using namespace edm::es;
104  theCoder->init(topo, delay.product());
105  if (read_Ascii_ || read_XML_){
106  edm::LogInfo("HCAL") << "Using ASCII/XML LUTs" << ifilename_.fullPath() << " for HcalTPGCoderULUT initialization";
107  if (read_Ascii_) {
108  theCoder->update(ifilename_.fullPath().c_str());
109  } else if (read_XML_) {
110  theCoder->updateXML(ifilename_.fullPath().c_str());
111  }
112  // Read FG LUT and append to most significant bit 11
113  if (read_FGLut_) {
114  theCoder->update(fgfile_.fullPath().c_str(), true);
115  }
116  } else {
119  theCoder->setMaskBit(maskBit_);
121  }
122 }
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)
T const * product() const
Definition: ESHandle.h:86
double linearLSB_QIE11Overlap_
HcalTPGCoderULUT::ReturnType HcalTPGCoderULUT::produce ( const HcalTPGRecord iRecord)

Definition at line 137 of file HcalTPGCoderULUT.cc.

References buildCoder(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), h, holder_, query::host, edm::ReusableObjectHolder< T >::makeOrGet(), read_Ascii_, read_XML_, and setupDBRecord().

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

138 {
139  auto host = holder_.makeOrGet([]() {
140  return new HostType;
141  });
142 
143  if (read_Ascii_ || read_XML_) {
145  iRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
146  const HcalTopology* topo=&(*htopo);
147 
149  iRecord.getRecord<HcalDbRecord>().getRecord<HcalTimeSlewRecord>().get("HBHE", delay);
150 
151  buildCoder(topo, delay, host.get());
152  } else {
153  host->ifRecordChanges<HcalDbRecord>(iRecord,
154  [this,h=host.get()](auto const& rec) {
155  setupDBRecord(rec, h);
156  });
157  }
158  return host;
159 }
host
Definition: query.py:115
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
void buildCoder(const HcalTopology *, const edm::ESHandle< HcalTimeSlew > &, HcaluLUTTPGCoder *)
std::shared_ptr< T > makeOrGet(F iFunc)
If there isn&#39;t an object already available, creates a new one using iFunc.
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
void setupDBRecord(const HcalDbRecord &, HcaluLUTTPGCoder *)
edm::ReusableObjectHolder< HostType > holder_
edm::ESProductHost< HcaluLUTTPGCoder, HcalDbRecord > HostType
void HcalTPGCoderULUT::setupDBRecord ( const HcalDbRecord theRec,
HcaluLUTTPGCoder theCoder 
)
private

Definition at line 161 of file HcalTPGCoderULUT.cc.

References buildCoder(), DEFINE_FWK_EVENTSETUP_MODULE, fgfile_, edm::FileInPath::fullPath(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), read_FGLut_, and HcaluLUTTPGCoder::update().

Referenced by produce().

162  {
163  edm::ESHandle<HcalDbService> conditions;
164  theRec.get(conditions);
166  theRec.getRecord<HcalRecNumberingRecord>().get(htopo);
167  const HcalTopology* topo=&(*htopo);
168 
170  theRec.getRecord<HcalTimeSlewRecord>().get("HBHE", delay);
171 
172  buildCoder(topo, delay, theCoder);
173 
174  theCoder->update(*conditions);
175 
176  // Temporary update for FG Lut
177  // Will be moved to DB
178  if (read_FGLut_) theCoder->update(fgfile_.fullPath().c_str(),true);
179 }
void buildCoder(const HcalTopology *, const edm::ESHandle< HcalTimeSlew > &, HcaluLUTTPGCoder *)
void update(const HcalDbService &conditions)
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
edm::FileInPath fgfile_
std::string fullPath() const
Definition: FileInPath.cc:163

Member Data Documentation

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

Definition at line 64 of file HcalTPGCoderULUT.cc.

Referenced by buildCoder(), and HcalTPGCoderULUT().

edm::FileInPath HcalTPGCoderULUT::fgfile_
private

Definition at line 65 of file HcalTPGCoderULUT.cc.

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

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

Definition at line 60 of file HcalTPGCoderULUT.cc.

Referenced by produce().

edm::FileInPath HcalTPGCoderULUT::ifilename_
private

Definition at line 65 of file HcalTPGCoderULUT.cc.

Referenced by buildCoder(), and HcalTPGCoderULUT().

double HcalTPGCoderULUT::linearLSB_QIE11_
private

Definition at line 62 of file HcalTPGCoderULUT.cc.

Referenced by buildCoder(), and HcalTPGCoderULUT().

double HcalTPGCoderULUT::linearLSB_QIE11Overlap_
private

Definition at line 62 of file HcalTPGCoderULUT.cc.

Referenced by buildCoder(), and HcalTPGCoderULUT().

double HcalTPGCoderULUT::linearLSB_QIE8_
private

Definition at line 62 of file HcalTPGCoderULUT.cc.

Referenced by buildCoder(), and HcalTPGCoderULUT().

bool HcalTPGCoderULUT::linearLUTs_
private

Definition at line 61 of file HcalTPGCoderULUT.cc.

Referenced by buildCoder(), and HcalTPGCoderULUT().

bool HcalTPGCoderULUT::LUTGenerationMode_
private

Definition at line 61 of file HcalTPGCoderULUT.cc.

Referenced by buildCoder(), and HcalTPGCoderULUT().

int HcalTPGCoderULUT::maskBit_
private

Definition at line 63 of file HcalTPGCoderULUT.cc.

Referenced by buildCoder(), and HcalTPGCoderULUT().

bool HcalTPGCoderULUT::read_Ascii_
private

Definition at line 61 of file HcalTPGCoderULUT.cc.

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

bool HcalTPGCoderULUT::read_FGLut_
private

Definition at line 61 of file HcalTPGCoderULUT.cc.

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

bool HcalTPGCoderULUT::read_XML_
private

Definition at line 61 of file HcalTPGCoderULUT.cc.

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