CMS 3D CMS Logo

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

Public Types

typedef std::shared_ptr< SiStripLorentzAngleReturnType
 
- 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 SiStripLorentzAngleRcd &)
 
void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iov, edm::ValidityInterval &iValidity)
 
 SiStripLorentzAngleFakeESSource (const edm::ParameterSet &)
 
 ~SiStripLorentzAngleFakeESSource ()
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
virtual ~ESProducer ()(false)
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer () noexcept(false)
 
- 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
 
std::vector< double > m_StdDevs_TIB
 
std::vector< double > m_StdDevs_TOB
 
std::vector< double > m_TIB_EstimatedValuesMax
 
std::vector< double > m_TIB_EstimatedValuesMin
 
std::vector< double > m_TIB_PerCent_Errs
 
double m_TIBmeanPerCentError
 
double m_TIBmeanStdDev
 
double m_TIBmeanValueMax
 
double m_TIBmeanValueMin
 
std::vector< double > m_TOB_EstimatedValuesMax
 
std::vector< double > m_TOB_EstimatedValuesMin
 
std::vector< double > m_TOB_PerCent_Errs
 
double m_TOBmeanPerCentError
 
double m_TOBmeanStdDev
 
double m_TOBmeanValueMax
 
double m_TOBmeanValueMin
 
std::vector< bool > m_uniformTIB
 
std::vector< bool > m_uniformTOB
 

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())
 
virtual void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList)
 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: Generator of the ideal/fake conditions for the LorentzAngle.

It receives input values with layer granularity and it is able to perform gaussian smearing or use a uniform distribution at the module level. Depending on the parameters passed via cfg, it is able to generate the values per DetId with a gaussian distribution and a uniform distribution. When setting the sigma of the gaussian to 0 and passing a single value the generated values are fixed. For TID and TEC the decision to generate with a uniform distribution comes from the setting for the first layers of TIB and TOB.

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

Definition at line 34 of file SiStripLorentzAngleFakeESSource.cc.

Member Typedef Documentation

Definition at line 41 of file SiStripLorentzAngleFakeESSource.cc.

Constructor & Destructor Documentation

SiStripLorentzAngleFakeESSource::SiStripLorentzAngleFakeESSource ( const edm::ParameterSet iConfig)

Definition at line 111 of file SiStripLorentzAngleFakeESSource.cc.

References gather_cfg::cout, edm::ParameterSet::getParameter(), m_file, m_StdDevs_TIB, m_StdDevs_TOB, m_TIB_EstimatedValuesMax, m_TIB_EstimatedValuesMin, m_TIB_PerCent_Errs, m_TIBmeanPerCentError, m_TIBmeanStdDev, m_TIBmeanValueMax, m_TIBmeanValueMin, m_TOB_EstimatedValuesMax, m_TOB_EstimatedValuesMin, m_TOB_PerCent_Errs, m_TOBmeanPerCentError, m_TOBmeanStdDev, m_TOBmeanValueMax, m_TOBmeanValueMin, m_uniformTIB, m_uniformTOB, edm::ESProducer::setWhatProduced(), and create_public_lumi_plots::transform.

112 {
113  setWhatProduced(this);
114  findingRecord<SiStripLorentzAngleRcd>();
115 
116  m_TIB_EstimatedValuesMin = iConfig.getParameter<std::vector<double>>("TIB_EstimatedValuesMin");
117  m_TIB_EstimatedValuesMax = iConfig.getParameter<std::vector<double>>("TIB_EstimatedValuesMax");
118  m_TOB_EstimatedValuesMin = iConfig.getParameter<std::vector<double>>("TOB_EstimatedValuesMin");
119  m_TOB_EstimatedValuesMax = iConfig.getParameter<std::vector<double>>("TOB_EstimatedValuesMax");
120  m_TIB_PerCent_Errs = iConfig.getParameter<std::vector<double>>("TIB_PerCent_Errs");
121  m_TOB_PerCent_Errs = iConfig.getParameter<std::vector<double>>("TOB_PerCent_Errs");
122 
123  // If max values are passed they must be equal in number to the min values.
124  if ( ( ( ! m_TIB_EstimatedValuesMax.empty() ) && ( m_TIB_EstimatedValuesMin.size() != m_TIB_EstimatedValuesMax.size() ) )
125  || ( ( ! m_TOB_EstimatedValuesMax.empty() ) && ( m_TOB_EstimatedValuesMin.size() != m_TOB_EstimatedValuesMax.size() ) ) )
126  {
127  std::cout << "ERROR: size of min and max values is different" << std::endl;
128  std::cout << "TIB_EstimatedValuesMin.size() = " << m_TIB_EstimatedValuesMin.size() << ", TIB_EstimatedValuesMax.size() " << m_TIB_EstimatedValuesMax.size() << std::endl;
129  std::cout << "TOB_EstimatedValuesMin.size() = " << m_TOB_EstimatedValuesMin.size() << ", TOB_EstimatedValuesMax.size() " << m_TOB_EstimatedValuesMax.size() << std::endl;
130  }
131 
132  m_uniformTIB = std::vector<bool>(m_TIB_EstimatedValuesMin.size(), false);
133  m_uniformTOB = std::vector<bool>(m_TOB_EstimatedValuesMin.size(), false);
134  setUniform(m_TIB_EstimatedValuesMin, m_TIB_EstimatedValuesMax, m_uniformTIB);
135  setUniform(m_TOB_EstimatedValuesMin, m_TOB_EstimatedValuesMax, m_uniformTOB);
136 
137  // Compute standard deviations
138  m_StdDevs_TIB = std::vector<double>(m_TIB_EstimatedValuesMin.size(), 0);
139  m_StdDevs_TOB = std::vector<double>(m_TOB_EstimatedValuesMin.size(), 0);
140  transform(m_TIB_EstimatedValuesMin.begin(), m_TIB_EstimatedValuesMin.end(), m_TIB_PerCent_Errs.begin(), m_StdDevs_TIB.begin(), computeSigma);
141  transform(m_TOB_EstimatedValuesMin.begin(), m_TOB_EstimatedValuesMin.end(), m_TOB_PerCent_Errs.begin(), m_StdDevs_TOB.begin(), computeSigma);
142 
143  // Compute mean values to be used with TID and TEC
144  m_TIBmeanValueMin = std::accumulate(m_TIB_EstimatedValuesMin.begin(), m_TIB_EstimatedValuesMin.end(), 0.)/double(m_TIB_EstimatedValuesMin.size());
145  m_TIBmeanValueMax = std::accumulate(m_TIB_EstimatedValuesMax.begin(), m_TIB_EstimatedValuesMax.end(), 0.)/double(m_TIB_EstimatedValuesMax.size());
146  m_TOBmeanValueMin = std::accumulate(m_TOB_EstimatedValuesMin.begin(), m_TOB_EstimatedValuesMin.end(), 0.)/double(m_TOB_EstimatedValuesMin.size());
147  m_TOBmeanValueMax = std::accumulate(m_TOB_EstimatedValuesMax.begin(), m_TOB_EstimatedValuesMax.end(), 0.)/double(m_TOB_EstimatedValuesMax.size());
148  m_TIBmeanPerCentError = std::accumulate(m_TIB_PerCent_Errs.begin(), m_TIB_PerCent_Errs.end(), 0.)/double(m_TIB_PerCent_Errs.size());
149  m_TOBmeanPerCentError = std::accumulate(m_TOB_PerCent_Errs.begin(), m_TOB_PerCent_Errs.end(), 0.)/double(m_TOB_PerCent_Errs.size());
150  m_TIBmeanStdDev = (m_TIBmeanPerCentError/100)*m_TIBmeanValueMin;
151  m_TOBmeanStdDev = (m_TOBmeanPerCentError/100)*m_TOBmeanValueMin;
152 
153  m_file = iConfig.getParameter<edm::FileInPath>("file");
154 }
T getParameter(std::string const &) const
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
SiStripLorentzAngleFakeESSource::~SiStripLorentzAngleFakeESSource ( )

Definition at line 156 of file SiStripLorentzAngleFakeESSource.cc.

156 {}

Member Function Documentation

SiStripLorentzAngleFakeESSource::ReturnType SiStripLorentzAngleFakeESSource::produce ( const SiStripLorentzAngleRcd iRecord)

Definition at line 165 of file SiStripLorentzAngleFakeESSource.cc.

References DEFINE_FWK_EVENTSETUP_SOURCE, edm::FileInPath::fullPath(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), m_file, m_StdDevs_TIB, m_StdDevs_TOB, m_TIB_EstimatedValuesMax, m_TIB_EstimatedValuesMin, m_TIBmeanStdDev, m_TIBmeanValueMax, m_TIBmeanValueMin, m_TOB_EstimatedValuesMax, m_TOB_EstimatedValuesMin, m_TOBmeanStdDev, m_TOBmeanValueMax, m_TOBmeanValueMin, m_uniformTIB, m_uniformTOB, matplotRender::reader, DetId::subdetId(), StripSubdetector::TEC, TrackerTopology::tecRing(), StripSubdetector::TIB, TrackerTopology::tibLayer(), StripSubdetector::TID, StripSubdetector::TOB, and TrackerTopology::tobLayer().

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

166 {
167  using namespace edm::es;
168 
170  iRecord.getRecord<TrackerTopologyRcd>().get(tTopo);
171 
172  std::shared_ptr<SiStripLorentzAngle> lorentzAngle{new SiStripLorentzAngle};
173 
175 
176  for ( const auto& detId : reader.getAllDetIds() ) {
177  const DetId detectorId = DetId(detId);
178  const int subDet = detectorId.subdetId();
179 
180  float mobi{0.};
181 
182  if ( subDet == int(StripSubdetector::TIB) ) {
183  const int layerId = tTopo->tibLayer(detectorId) -1;
184  mobi = hallMobility(m_TIB_EstimatedValuesMin[layerId], m_TIB_EstimatedValuesMax[layerId], m_StdDevs_TIB[layerId], m_uniformTIB[layerId]);
185  } else if ( subDet == int(StripSubdetector::TOB) ) {
186  const int layerId = tTopo->tobLayer(detectorId) -1;
187  mobi = hallMobility(m_TOB_EstimatedValuesMin[layerId], m_TOB_EstimatedValuesMax[layerId], m_StdDevs_TOB[layerId], m_uniformTOB[layerId]);
188  } else if ( subDet == int (StripSubdetector::TID) ) {
189  // ATTENTION: as of now the uniform generation for TID is decided by the setting for layer 0 of TIB
191  }
192  if ( subDet == int(StripSubdetector::TEC) ) {
193  if ( tTopo->tecRing(detectorId) < 5 ) {
194  // ATTENTION: as of now the uniform generation for TEC is decided by the setting for layer 0 of TIB
196  } else {
197  // ATTENTION: as of now the uniform generation for TEC is decided by the setting for layer 0 of TOB
199  }
200  }
201 
202  if ( ! lorentzAngle->putLorentzAngle(detId, mobi) ) {
203  edm::LogError("SiStripLorentzAngleFakeESSource::produce ") << " detid already exists";
204  }
205  }
206 
207  return lorentzAngle;
208 }
unsigned int tibLayer(const DetId &id) const
unsigned int tecRing(const DetId &id) const
ring id
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
std::string fullPath() const
Definition: FileInPath.cc:184
unsigned int tobLayer(const DetId &id) const
void SiStripLorentzAngleFakeESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey ,
const edm::IOVSyncValue iov,
edm::ValidityInterval iValidity 
)
virtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 158 of file SiStripLorentzAngleFakeESSource.cc.

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

159 {
160  iValidity = edm::ValidityInterval{iov.beginOfTime(), iov.endOfTime()};
161 }
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
static const IOVSyncValue & beginOfTime()

Member Data Documentation

edm::FileInPath SiStripLorentzAngleFakeESSource::m_file
private

Definition at line 64 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

std::vector<double> SiStripLorentzAngleFakeESSource::m_StdDevs_TIB
private

Definition at line 51 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

std::vector<double> SiStripLorentzAngleFakeESSource::m_StdDevs_TOB
private

Definition at line 52 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

std::vector<double> SiStripLorentzAngleFakeESSource::m_TIB_EstimatedValuesMax
private

Definition at line 46 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

std::vector<double> SiStripLorentzAngleFakeESSource::m_TIB_EstimatedValuesMin
private

Definition at line 45 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

std::vector<double> SiStripLorentzAngleFakeESSource::m_TIB_PerCent_Errs
private

Definition at line 49 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by SiStripLorentzAngleFakeESSource().

double SiStripLorentzAngleFakeESSource::m_TIBmeanPerCentError
private

Definition at line 59 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by SiStripLorentzAngleFakeESSource().

double SiStripLorentzAngleFakeESSource::m_TIBmeanStdDev
private

Definition at line 61 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

double SiStripLorentzAngleFakeESSource::m_TIBmeanValueMax
private

Definition at line 56 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

double SiStripLorentzAngleFakeESSource::m_TIBmeanValueMin
private

Definition at line 55 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

std::vector<double> SiStripLorentzAngleFakeESSource::m_TOB_EstimatedValuesMax
private

Definition at line 48 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

std::vector<double> SiStripLorentzAngleFakeESSource::m_TOB_EstimatedValuesMin
private

Definition at line 47 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

std::vector<double> SiStripLorentzAngleFakeESSource::m_TOB_PerCent_Errs
private

Definition at line 50 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by SiStripLorentzAngleFakeESSource().

double SiStripLorentzAngleFakeESSource::m_TOBmeanPerCentError
private

Definition at line 60 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by SiStripLorentzAngleFakeESSource().

double SiStripLorentzAngleFakeESSource::m_TOBmeanStdDev
private

Definition at line 62 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

double SiStripLorentzAngleFakeESSource::m_TOBmeanValueMax
private

Definition at line 58 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

double SiStripLorentzAngleFakeESSource::m_TOBmeanValueMin
private

Definition at line 57 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

std::vector<bool> SiStripLorentzAngleFakeESSource::m_uniformTIB
private

Definition at line 53 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

std::vector<bool> SiStripLorentzAngleFakeESSource::m_uniformTOB
private

Definition at line 54 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().