CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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::unique_ptr
< SiStripLorentzAngle
ReturnType
 

Public Member Functions

ReturnType produce (const SiStripLorentzAngleRcd &)
 
void setIntervalFor (const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iov, edm::ValidityInterval &iValidity) override
 
 SiStripLorentzAngleFakeESSource (const edm::ParameterSet &)
 
 ~SiStripLorentzAngleFakeESSource () 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::ComponentDescription
descriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
 EventSetupRecordIntervalFinder (const EventSetupRecordIntervalFinder &)=delete
 
std::set
< eventsetup::EventSetupRecordKey
findingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
bool nonconcurrentAndIOVNeedsUpdate (const eventsetup::EventSetupRecordKey &key, const IOVSyncValue &syncValue) const
 
const
EventSetupRecordIntervalFinder
operator= (const EventSetupRecordIntervalFinder &)=delete
 
void resetInterval (const eventsetup::EventSetupRecordKey &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder () noexcept(false)
 

Private Attributes

edm::ESGetToken< GeometricDet,
IdealGeometryRecord
m_geomDetToken
 
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
 
edm::ESGetToken
< TrackerTopology,
TrackerTopologyRcd
m_tTopoToken
 
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 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: 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 38 of file SiStripLorentzAngleFakeESSource.cc.

Member Typedef Documentation

Definition at line 47 of file SiStripLorentzAngleFakeESSource.cc.

Constructor & Destructor Documentation

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

Definition at line 114 of file SiStripLorentzAngleFakeESSource.cc.

References gather_cfg::cout, edm::ParameterSet::getParameter(), m_geomDetToken, 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_tTopoToken, m_uniformTIB, m_uniformTOB, edm::ESProducer::setWhatProduced(), and HcalDetIdTransform::transform().

114  {
115  auto cc = setWhatProduced(this);
116  m_tTopoToken = cc.consumes();
117  m_geomDetToken = cc.consumes();
118  findingRecord<SiStripLorentzAngleRcd>();
119 
120  m_TIB_EstimatedValuesMin = iConfig.getParameter<std::vector<double>>("TIB_EstimatedValuesMin");
121  m_TIB_EstimatedValuesMax = iConfig.getParameter<std::vector<double>>("TIB_EstimatedValuesMax");
122  m_TOB_EstimatedValuesMin = iConfig.getParameter<std::vector<double>>("TOB_EstimatedValuesMin");
123  m_TOB_EstimatedValuesMax = iConfig.getParameter<std::vector<double>>("TOB_EstimatedValuesMax");
124  m_TIB_PerCent_Errs = iConfig.getParameter<std::vector<double>>("TIB_PerCent_Errs");
125  m_TOB_PerCent_Errs = iConfig.getParameter<std::vector<double>>("TOB_PerCent_Errs");
126 
127  // If max values are passed they must be equal in number to the min values.
128  if (((!m_TIB_EstimatedValuesMax.empty()) && (m_TIB_EstimatedValuesMin.size() != m_TIB_EstimatedValuesMax.size())) ||
129  ((!m_TOB_EstimatedValuesMax.empty()) && (m_TOB_EstimatedValuesMin.size() != m_TOB_EstimatedValuesMax.size()))) {
130  std::cout << "ERROR: size of min and max values is different" << std::endl;
131  std::cout << "TIB_EstimatedValuesMin.size() = " << m_TIB_EstimatedValuesMin.size()
132  << ", TIB_EstimatedValuesMax.size() " << m_TIB_EstimatedValuesMax.size() << std::endl;
133  std::cout << "TOB_EstimatedValuesMin.size() = " << m_TOB_EstimatedValuesMin.size()
134  << ", TOB_EstimatedValuesMax.size() " << m_TOB_EstimatedValuesMax.size() << std::endl;
135  }
136 
137  m_uniformTIB = std::vector<bool>(m_TIB_EstimatedValuesMin.size(), false);
138  m_uniformTOB = std::vector<bool>(m_TOB_EstimatedValuesMin.size(), false);
139  setUniform(m_TIB_EstimatedValuesMin, m_TIB_EstimatedValuesMax, m_uniformTIB);
140  setUniform(m_TOB_EstimatedValuesMin, m_TOB_EstimatedValuesMax, m_uniformTOB);
141 
142  // Compute standard deviations
143  m_StdDevs_TIB = std::vector<double>(m_TIB_EstimatedValuesMin.size(), 0);
144  m_StdDevs_TOB = std::vector<double>(m_TOB_EstimatedValuesMin.size(), 0);
145  transform(m_TIB_EstimatedValuesMin.begin(),
146  m_TIB_EstimatedValuesMin.end(),
147  m_TIB_PerCent_Errs.begin(),
148  m_StdDevs_TIB.begin(),
149  computeSigma);
150  transform(m_TOB_EstimatedValuesMin.begin(),
151  m_TOB_EstimatedValuesMin.end(),
152  m_TOB_PerCent_Errs.begin(),
153  m_StdDevs_TOB.begin(),
154  computeSigma);
155 
156  // Compute mean values to be used with TID and TEC
157  m_TIBmeanValueMin = std::accumulate(m_TIB_EstimatedValuesMin.begin(), m_TIB_EstimatedValuesMin.end(), 0.) /
158  double(m_TIB_EstimatedValuesMin.size());
159  m_TIBmeanValueMax = std::accumulate(m_TIB_EstimatedValuesMax.begin(), m_TIB_EstimatedValuesMax.end(), 0.) /
160  double(m_TIB_EstimatedValuesMax.size());
161  m_TOBmeanValueMin = std::accumulate(m_TOB_EstimatedValuesMin.begin(), m_TOB_EstimatedValuesMin.end(), 0.) /
162  double(m_TOB_EstimatedValuesMin.size());
163  m_TOBmeanValueMax = std::accumulate(m_TOB_EstimatedValuesMax.begin(), m_TOB_EstimatedValuesMax.end(), 0.) /
164  double(m_TOB_EstimatedValuesMax.size());
166  std::accumulate(m_TIB_PerCent_Errs.begin(), m_TIB_PerCent_Errs.end(), 0.) / double(m_TIB_PerCent_Errs.size());
168  std::accumulate(m_TOB_PerCent_Errs.begin(), m_TOB_PerCent_Errs.end(), 0.) / double(m_TOB_PerCent_Errs.size());
169  m_TIBmeanStdDev = (m_TIBmeanPerCentError / 100) * m_TIBmeanValueMin;
170  m_TOBmeanStdDev = (m_TOBmeanPerCentError / 100) * m_TOBmeanValueMin;
171 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
edm::ESGetToken< GeometricDet, IdealGeometryRecord > m_geomDetToken
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > m_tTopoToken
tuple cout
Definition: gather_cfg.py:144
unsigned transform(const HcalDetId &id, unsigned transformCode)
SiStripLorentzAngleFakeESSource::~SiStripLorentzAngleFakeESSource ( )
override

Definition at line 173 of file SiStripLorentzAngleFakeESSource.cc.

173 {}

Member Function Documentation

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

Definition at line 182 of file SiStripLorentzAngleFakeESSource.cc.

References edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), TrackerGeometryUtils::getSiStripDetIds(), m_geomDetToken, 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_tTopoToken, m_uniformTIB, m_uniformTOB, DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, and StripSubdetector::TOB.

183  {
184  using namespace edm::es;
185 
186  const auto& geomDet = iRecord.getRecord<TrackerTopologyRcd>().get(m_geomDetToken);
187  const auto& tTopo = iRecord.get(m_tTopoToken);
188 
189  auto lorentzAngle = std::make_unique<SiStripLorentzAngle>();
190 
191  for (const auto detId : TrackerGeometryUtils::getSiStripDetIds(geomDet)) {
192  const DetId detectorId = DetId(detId);
193  const int subDet = detectorId.subdetId();
194 
195  float mobi{0.};
196 
197  if (subDet == int(StripSubdetector::TIB)) {
198  const int layerId = tTopo.tibLayer(detectorId) - 1;
199  mobi = hallMobility(m_TIB_EstimatedValuesMin[layerId],
200  m_TIB_EstimatedValuesMax[layerId],
201  m_StdDevs_TIB[layerId],
202  m_uniformTIB[layerId]);
203  } else if (subDet == int(StripSubdetector::TOB)) {
204  const int layerId = tTopo.tobLayer(detectorId) - 1;
205  mobi = hallMobility(m_TOB_EstimatedValuesMin[layerId],
206  m_TOB_EstimatedValuesMax[layerId],
207  m_StdDevs_TOB[layerId],
208  m_uniformTOB[layerId]);
209  } else if (subDet == int(StripSubdetector::TID)) {
210  // ATTENTION: as of now the uniform generation for TID is decided by the setting for layer 0 of TIB
212  }
213  if (subDet == int(StripSubdetector::TEC)) {
214  if (tTopo.tecRing(detectorId) < 5) {
215  // ATTENTION: as of now the uniform generation for TEC is decided by the setting for layer 0 of TIB
217  } else {
218  // ATTENTION: as of now the uniform generation for TEC is decided by the setting for layer 0 of TOB
220  }
221  }
222 
223  if (!lorentzAngle->putLorentzAngle(detId, mobi)) {
224  edm::LogError("SiStripLorentzAngleFakeESSource::produce ") << " detid already exists";
225  }
226  }
227 
228  return lorentzAngle;
229 }
static constexpr auto TEC
edm::ESGetToken< GeometricDet, IdealGeometryRecord > m_geomDetToken
Log< level::Error, false > LogError
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
std::vector< uint32_t > getSiStripDetIds(const GeometricDet &geomDet)
Definition: utils.cc:5
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static constexpr auto TOB
Definition: DetId.h:17
static constexpr auto TIB
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > m_tTopoToken
static constexpr auto TID
void SiStripLorentzAngleFakeESSource::setIntervalFor ( const edm::eventsetup::EventSetupRecordKey ,
const edm::IOVSyncValue iov,
edm::ValidityInterval iValidity 
)
overridevirtual

Implements edm::EventSetupRecordIntervalFinder.

Definition at line 175 of file SiStripLorentzAngleFakeESSource.cc.

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

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

Member Data Documentation

edm::ESGetToken<GeometricDet, IdealGeometryRecord> SiStripLorentzAngleFakeESSource::m_geomDetToken
private

Definition at line 70 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

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

Definition at line 57 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

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

Definition at line 58 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

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

Definition at line 52 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

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

Definition at line 51 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

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

Definition at line 55 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by SiStripLorentzAngleFakeESSource().

double SiStripLorentzAngleFakeESSource::m_TIBmeanPerCentError
private

Definition at line 65 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by SiStripLorentzAngleFakeESSource().

double SiStripLorentzAngleFakeESSource::m_TIBmeanStdDev
private

Definition at line 67 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

double SiStripLorentzAngleFakeESSource::m_TIBmeanValueMax
private

Definition at line 62 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

double SiStripLorentzAngleFakeESSource::m_TIBmeanValueMin
private

Definition at line 61 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

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

Definition at line 54 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

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

Definition at line 53 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

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

Definition at line 56 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by SiStripLorentzAngleFakeESSource().

double SiStripLorentzAngleFakeESSource::m_TOBmeanPerCentError
private

Definition at line 66 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by SiStripLorentzAngleFakeESSource().

double SiStripLorentzAngleFakeESSource::m_TOBmeanStdDev
private

Definition at line 68 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

double SiStripLorentzAngleFakeESSource::m_TOBmeanValueMax
private

Definition at line 64 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

double SiStripLorentzAngleFakeESSource::m_TOBmeanValueMin
private

Definition at line 63 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

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

Definition at line 69 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

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

Definition at line 59 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().

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

Definition at line 60 of file SiStripLorentzAngleFakeESSource.cc.

Referenced by produce(), and SiStripLorentzAngleFakeESSource().