CMS 3D CMS Logo

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

Public Types

typedef std::unique_ptr< SiStripNoisesReturnType
 

Public Member Functions

ReturnType produce (const SiStripNoisesRcd &)
 
void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iov, edm::ValidityInterval &iValidity) override
 
 SiStripNoisesFakeESSource (const edm::ParameterSet &)
 
 ~SiStripNoisesFakeESSource () 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)
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
bool concurrentFinder () const
 
const eventsetup::ComponentDescriptiondescriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
 EventSetupRecordIntervalFinder (const EventSetupRecordIntervalFinder &)=delete
 
std::set< eventsetup::EventSetupRecordKeyfindingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
bool nonconcurrentAndIOVNeedsUpdate (const eventsetup::EventSetupRecordKey &key, const IOVSyncValue &syncValue) const
 
const EventSetupRecordIntervalFinderoperator= (const EventSetupRecordIntervalFinder &)=delete
 
void resetInterval (const eventsetup::EventSetupRecordKey &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder () noexcept(false)
 

Private Attributes

SiStripDetInfoFileReader m_detInfoFileReader
 
double m_noisePar0
 
SiStripFakeAPVParameters m_noisePar1
 
SiStripFakeAPVParameters m_noisePar2
 
uint32_t m_printDebug
 
bool m_stripLengthMode
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdm_tTopoToken
 

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)
 
- Protected Member Functions inherited from edm::EventSetupRecordIntervalFinder
template<class T >
void findingRecord ()
 
void findingRecordWithKey (const eventsetup::EventSetupRecordKey &)
 

Detailed Description

Description: "fake" SiStripNoises ESProducer

Implementation: Port of SiStripNoisesGenerator and templated fake ESSource to an edm::ESProducer

Definition at line 31 of file SiStripNoisesFakeESSource.cc.

Member Typedef Documentation

Definition at line 40 of file SiStripNoisesFakeESSource.cc.

Constructor & Destructor Documentation

SiStripNoisesFakeESSource::SiStripNoisesFakeESSource ( const edm::ParameterSet iConfig)

Definition at line 64 of file SiStripNoisesFakeESSource.cc.

References contentValuesFiles::fullPath, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_detInfoFileReader, m_noisePar0, m_noisePar1, m_noisePar2, m_printDebug, m_stripLengthMode, m_tTopoToken, and edm::ESProducer::setWhatProduced().

64  {
65  setWhatProduced(this).setConsumes(m_tTopoToken);
66  findingRecord<SiStripNoisesRcd>();
67 
68  m_stripLengthMode = iConfig.getParameter<bool>("StripLengthMode");
69 
70  if (!m_stripLengthMode) {
71  //parameters for random noise generation. not used if Strip length mode is chosen
72  m_noisePar0 = iConfig.getParameter<double>("MinPositiveNoise");
73  m_noisePar1 = SiStripFakeAPVParameters(iConfig, "MeanNoise");
74  m_noisePar2 = SiStripFakeAPVParameters(iConfig, "SigmaNoise");
75  } else {
76  //parameters for strip length proportional noise generation. not used if random mode is chosen
77  m_noisePar0 = iConfig.getParameter<double>("electronPerAdc");
78  m_noisePar1 = SiStripFakeAPVParameters(iConfig, "NoiseStripLengthSlope");
79  m_noisePar2 = SiStripFakeAPVParameters(iConfig, "NoiseStripLengthQuote");
80  }
81 
82  m_printDebug = iConfig.getUntrackedParameter<uint32_t>("printDebug", 5);
83 
85  SiStripDetInfoFileReader{iConfig.getParameter<edm::FileInPath>("SiStripDetInfoFile").fullPath()};
86 }
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
T getUntrackedParameter(std::string const &, T const &) const
SiStripDetInfoFileReader m_detInfoFileReader
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > m_tTopoToken
SiStripFakeAPVParameters m_noisePar1
SiStripFakeAPVParameters m_noisePar2
SiStripNoisesFakeESSource::~SiStripNoisesFakeESSource ( )
override

Definition at line 88 of file SiStripNoisesFakeESSource.cc.

88 {}

Member Function Documentation

SiStripNoisesFakeESSource::ReturnType SiStripNoisesFakeESSource::produce ( const SiStripNoisesRcd iRecord)

Definition at line 97 of file SiStripNoisesFakeESSource.cc.

References KineDebug3::count(), DEFINE_FWK_EVENTSETUP_SOURCE, SiStripFakeAPVParameters::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), SiStripDetInfoFileReader::getAllData(), SiStripFakeAPVParameters::getIndex(), dqmiolumiharvest::j, m_detInfoFileReader, m_noisePar0, m_noisePar1, m_noisePar2, m_printDebug, m_stripLengthMode, m_tTopoToken, SiStripPI::max, hgcalDigitizer_cfi::noise, and hgcalLayerClusters_cff::noises.

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

97  {
98  using namespace edm::es;
99 
100  const auto& tTopo = iRecord.get(m_tTopoToken);
101 
102  auto noises = std::make_unique<SiStripNoises>();
103 
104  uint32_t count{0};
105  for (const auto& elm : m_detInfoFileReader.getAllData()) {
106  //Generate Noises for det detid
107  SiStripNoises::InputVector theSiStripVector;
109 
110  if (m_stripLengthMode) {
111  // Use strip length
112  const double linearSlope{m_noisePar1.get(sl)};
113  const double linearQuote{m_noisePar2.get(sl)};
114  const double stripLength{elm.second.stripLength};
115  for (unsigned short j{0}; j < 128 * elm.second.nApvs; ++j) {
116  const float noise = (linearSlope * stripLength + linearQuote) / m_noisePar0;
117  if (count < m_printDebug)
118  printLog(elm.first, j, noise);
119  noises->setData(noise, theSiStripVector);
120  }
121  } else {
122  // Use random generator
123  const double meanN{m_noisePar1.get(sl)};
124  const double sigmaN{m_noisePar2.get(sl)};
125  for (unsigned short j{0}; j < 128 * elm.second.nApvs; ++j) {
126  const float noise = std::max(CLHEP::RandGauss::shoot(meanN, sigmaN), m_noisePar0);
127  if (count < m_printDebug)
128  printLog(elm.first, j, noise);
129  noises->setData(noise, theSiStripVector);
130  }
131  }
132  ++count;
133 
134  if (!noises->put(elm.first, theSiStripVector)) {
135  edm::LogError("SiStripNoisesFakeESSource::produce ") << " detid already exists";
136  }
137  }
138 
139  return noises;
140 }
std::vector< uint16_t > InputVector
Definition: SiStripNoises.h:50
SiStripDetInfoFileReader m_detInfoFileReader
static index getIndex(const TrackerTopology *tTopo, DetId id)
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > m_tTopoToken
double get(const index &idx) const
SiStripFakeAPVParameters m_noisePar1
const std::map< uint32_t, DetInfo > & getAllData() const
SiStripFakeAPVParameters m_noisePar2
void SiStripNoisesFakeESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey ,
const edm::IOVSyncValue iov,
edm::ValidityInterval iValidity 
)
overridevirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 90 of file SiStripNoisesFakeESSource.cc.

References edm::IOVSyncValue::beginOfTime(), and edm::IOVSyncValue::endOfTime().

92  {
93  iValidity = edm::ValidityInterval{iov.beginOfTime(), iov.endOfTime()};
94 }
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:82
static const IOVSyncValue & beginOfTime()
Definition: IOVSyncValue.cc:88

Member Data Documentation

SiStripDetInfoFileReader SiStripNoisesFakeESSource::m_detInfoFileReader
private

Definition at line 50 of file SiStripNoisesFakeESSource.cc.

Referenced by produce(), and SiStripNoisesFakeESSource().

double SiStripNoisesFakeESSource::m_noisePar0
private

Definition at line 46 of file SiStripNoisesFakeESSource.cc.

Referenced by produce(), and SiStripNoisesFakeESSource().

SiStripFakeAPVParameters SiStripNoisesFakeESSource::m_noisePar1
private

Definition at line 47 of file SiStripNoisesFakeESSource.cc.

Referenced by produce(), and SiStripNoisesFakeESSource().

SiStripFakeAPVParameters SiStripNoisesFakeESSource::m_noisePar2
private

Definition at line 48 of file SiStripNoisesFakeESSource.cc.

Referenced by produce(), and SiStripNoisesFakeESSource().

uint32_t SiStripNoisesFakeESSource::m_printDebug
private

Definition at line 49 of file SiStripNoisesFakeESSource.cc.

Referenced by produce(), and SiStripNoisesFakeESSource().

bool SiStripNoisesFakeESSource::m_stripLengthMode
private

Definition at line 45 of file SiStripNoisesFakeESSource.cc.

Referenced by produce(), and SiStripNoisesFakeESSource().

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SiStripNoisesFakeESSource::m_tTopoToken
private

Definition at line 44 of file SiStripNoisesFakeESSource.cc.

Referenced by produce(), and SiStripNoisesFakeESSource().