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
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESProxyIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(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

SiStripDetInfo m_detInfo
 
double m_noisePar0
 
SiStripFakeAPVParameters m_noisePar1
 
SiStripFakeAPVParameters m_noisePar2
 
uint32_t m_printDebug
 
bool m_stripLengthMode
 
const 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={})
 
void usesResources (std::vector< std::string > const &)
 
- 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

◆ ReturnType

Definition at line 40 of file SiStripNoisesFakeESSource.cc.

Constructor & Destructor Documentation

◆ SiStripNoisesFakeESSource()

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

Definition at line 64 of file SiStripNoisesFakeESSource.cc.

References edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_detInfo, m_noisePar0, m_noisePar1, m_noisePar2, m_printDebug, m_stripLengthMode, and SiStripDetInfoFileReader::read().

65  : m_tTopoToken(setWhatProduced(this).consumes()) {
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 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::string fullPath() const
Definition: FileInPath.cc:161
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > m_tTopoToken
T getUntrackedParameter(std::string const &, T const &) const
SiStripDetInfo read(std::string filePath)
SiStripFakeAPVParameters m_noisePar1
SiStripFakeAPVParameters m_noisePar2

◆ ~SiStripNoisesFakeESSource()

SiStripNoisesFakeESSource::~SiStripNoisesFakeESSource ( )
override

Definition at line 87 of file SiStripNoisesFakeESSource.cc.

87 {}

Member Function Documentation

◆ produce()

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

Definition at line 96 of file SiStripNoisesFakeESSource.cc.

References submitPVResolutionJobs::count, SiStripFakeAPVParameters::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), SiStripDetInfo::getAllData(), SiStripFakeAPVParameters::getIndex(), dqmiolumiharvest::j, m_detInfo, m_noisePar0, m_noisePar1, m_noisePar2, m_printDebug, m_stripLengthMode, m_tTopoToken, SiStripPI::max, hgchebackDigitizer_cfi::noise, and hgcalLayerClusters_cfi::noises.

96  {
97  using namespace edm::es;
98 
99  const auto& tTopo = iRecord.get(m_tTopoToken);
100 
101  auto noises = std::make_unique<SiStripNoises>();
102 
103  uint32_t count{0};
104  for (const auto& elm : m_detInfo.getAllData()) {
105  //Generate Noises for det detid
106  SiStripNoises::InputVector theSiStripVector;
108 
109  if (m_stripLengthMode) {
110  // Use strip length
111  const double linearSlope{m_noisePar1.get(sl)};
112  const double linearQuote{m_noisePar2.get(sl)};
113  const double stripLength{elm.second.stripLength};
114  for (unsigned short j{0}; j < 128 * elm.second.nApvs; ++j) {
115  const float noise = (linearSlope * stripLength + linearQuote) / m_noisePar0;
116  if (count < m_printDebug)
117  printLog(elm.first, j, noise);
118  noises->setData(noise, theSiStripVector);
119  }
120  } else {
121  // Use random generator
122  const double meanN{m_noisePar1.get(sl)};
123  const double sigmaN{m_noisePar2.get(sl)};
124  for (unsigned short j{0}; j < 128 * elm.second.nApvs; ++j) {
125  const float noise = std::max(CLHEP::RandGauss::shoot(meanN, sigmaN), m_noisePar0);
126  if (count < m_printDebug)
127  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:50
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > m_tTopoToken
static index getIndex(const TrackerTopology *tTopo, DetId id)
Log< level::Error, false > LogError
double get(const index &idx) const
const std::map< uint32_t, DetInfo > & getAllData() const noexcept
SiStripFakeAPVParameters m_noisePar1
SiStripFakeAPVParameters m_noisePar2
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const

◆ setIntervalFor()

void SiStripNoisesFakeESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey ,
const edm::IOVSyncValue iov,
edm::ValidityInterval iValidity 
)
overridevirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 89 of file SiStripNoisesFakeESSource.cc.

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

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

Member Data Documentation

◆ m_detInfo

SiStripDetInfo SiStripNoisesFakeESSource::m_detInfo
private

Definition at line 50 of file SiStripNoisesFakeESSource.cc.

Referenced by produce(), and SiStripNoisesFakeESSource().

◆ m_noisePar0

double SiStripNoisesFakeESSource::m_noisePar0
private

Definition at line 46 of file SiStripNoisesFakeESSource.cc.

Referenced by produce(), and SiStripNoisesFakeESSource().

◆ m_noisePar1

SiStripFakeAPVParameters SiStripNoisesFakeESSource::m_noisePar1
private

Definition at line 47 of file SiStripNoisesFakeESSource.cc.

Referenced by produce(), and SiStripNoisesFakeESSource().

◆ m_noisePar2

SiStripFakeAPVParameters SiStripNoisesFakeESSource::m_noisePar2
private

Definition at line 48 of file SiStripNoisesFakeESSource.cc.

Referenced by produce(), and SiStripNoisesFakeESSource().

◆ m_printDebug

uint32_t SiStripNoisesFakeESSource::m_printDebug
private

Definition at line 49 of file SiStripNoisesFakeESSource.cc.

Referenced by produce(), and SiStripNoisesFakeESSource().

◆ m_stripLengthMode

bool SiStripNoisesFakeESSource::m_stripLengthMode
private

Definition at line 45 of file SiStripNoisesFakeESSource.cc.

Referenced by produce(), and SiStripNoisesFakeESSource().

◆ m_tTopoToken

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

Definition at line 44 of file SiStripNoisesFakeESSource.cc.

Referenced by produce().