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::shared_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 ()
 
 ~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

edm::FileInPath m_file
 
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
template<typename T >
void setWhatProduced (T *iThis, const es::Label &iLabel=es::Label())
 
template<typename T >
void setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
void setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
void setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel=es::Label())
 
- 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 62 of file SiStripNoisesFakeESSource.cc.

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

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

Definition at line 85 of file SiStripNoisesFakeESSource.cc.

85 {}

Member Function Documentation

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

Definition at line 94 of file SiStripNoisesFakeESSource.cc.

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

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

95 {
96  using namespace edm::es;
97 
99  iRecord.getRecord<TrackerTopologyRcd>().get(tTopo);
100 
101  std::shared_ptr<SiStripNoises> noises{new SiStripNoises};
102 
104 
105  uint32_t count{0};
106  for ( const auto& elm : reader.getAllData() ) {
107  //Generate Noises for det detid
108  SiStripNoises::InputVector theSiStripVector;
110 
111  if ( m_stripLengthMode ) {
112  // Use strip length
113  const double linearSlope{m_noisePar1.get(sl)};
114  const double linearQuote{m_noisePar2.get(sl)};
115  const double stripLength{elm.second.stripLength};
116  for ( unsigned short j{0}; j < 128*elm.second.nApvs; ++j ) {
117  const float noise = (linearSlope*stripLength + linearQuote) / m_noisePar0;
118  if ( count < m_printDebug ) 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 ) printLog(elm.first, j, noise);
128  noises->setData(noise, theSiStripVector);
129  }
130  }
131  ++count;
132 
133  if ( ! noises->put(elm.first, theSiStripVector) ) {
134  edm::LogError("SiStripNoisesFakeESSource::produce ") << " detid already exists";
135  }
136  }
137 
138  return noises;
139 }
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
std::string fullPath() const
Definition: FileInPath.cc:184
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 87 of file SiStripNoisesFakeESSource.cc.

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

88 {
89  iValidity = edm::ValidityInterval{iov.beginOfTime(), iov.endOfTime()};
90 }
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
static const IOVSyncValue & beginOfTime()

Member Data Documentation

edm::FileInPath SiStripNoisesFakeESSource::m_file
private

Definition at line 44 of file SiStripNoisesFakeESSource.cc.

Referenced by produce(), and SiStripNoisesFakeESSource().

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 45 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().