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 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

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 ()
 
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)
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
const eventsetup::ComponentDescriptiondescriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
std::set< eventsetup::EventSetupRecordKeyfindingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder () noexcept(false)
 

Private Attributes

double m_noisePar0
 
SiStripFakeAPVParameters m_noisePar1
 
SiStripFakeAPVParameters m_noisePar2
 
uint32_t m_printDebug
 
bool m_stripLengthMode
 

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 &)
 
- 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 29 of file SiStripNoisesFakeESSource.cc.

Member Typedef Documentation

Definition at line 36 of file SiStripNoisesFakeESSource.cc.

Constructor & Destructor Documentation

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

Definition at line 61 of file SiStripNoisesFakeESSource.cc.

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

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

Definition at line 83 of file SiStripNoisesFakeESSource.cc.

83 {}

Member Function Documentation

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

Definition at line 92 of file SiStripNoisesFakeESSource.cc.

References KineDebug3::count(), DEFINE_FWK_EVENTSETUP_SOURCE, SiStripFakeAPVParameters::get(), SiStripFakeAPVParameters::getIndex(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), m_noisePar0, m_noisePar1, m_noisePar2, m_printDebug, m_stripLengthMode, SiStripPI::max, hgcalLayerClusters_cff::noises, edm::ESHandle< T >::product(), and matplotRender::reader.

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

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

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 85 of file SiStripNoisesFakeESSource.cc.

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

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

Member Data Documentation

double SiStripNoisesFakeESSource::m_noisePar0
private

Definition at line 41 of file SiStripNoisesFakeESSource.cc.

Referenced by produce(), and SiStripNoisesFakeESSource().

SiStripFakeAPVParameters SiStripNoisesFakeESSource::m_noisePar1
private

Definition at line 42 of file SiStripNoisesFakeESSource.cc.

Referenced by produce(), and SiStripNoisesFakeESSource().

SiStripFakeAPVParameters SiStripNoisesFakeESSource::m_noisePar2
private

Definition at line 43 of file SiStripNoisesFakeESSource.cc.

Referenced by produce(), and SiStripNoisesFakeESSource().

uint32_t SiStripNoisesFakeESSource::m_printDebug
private

Definition at line 44 of file SiStripNoisesFakeESSource.cc.

Referenced by produce(), and SiStripNoisesFakeESSource().

bool SiStripNoisesFakeESSource::m_stripLengthMode
private

Definition at line 40 of file SiStripNoisesFakeESSource.cc.

Referenced by produce(), and SiStripNoisesFakeESSource().