CMS 3D CMS Logo

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

Public Member Functions

 DD4hep_VolumeBasedMagneticFieldESProducer (const edm::ParameterSet &iConfig)
 
 DD4hep_VolumeBasedMagneticFieldESProducer (const DD4hep_VolumeBasedMagneticFieldESProducer &)=delete
 
const DD4hep_VolumeBasedMagneticFieldESProduceroperator= (const DD4hep_VolumeBasedMagneticFieldESProducer &)=delete
 
std::unique_ptr< MagneticFieldproduce (const IdealMagneticFieldRecord &iRecord)
 
- 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)
 

Private Attributes

const MagFieldConfig conf_
 
edm::ESGetToken< cms::DDCompactView, IdealMagneticFieldRecordcpvToken_
 
const bool debug_
 
edm::ESGetToken< MagneticField, IdealMagneticFieldRecordparamFieldToken_
 
edm::ParameterSet pset_
 
const bool useParametrizedTrackerField_
 
const std::string version_
 

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)
 

Detailed Description

Definition at line 28 of file DD4hep_VolumeBasedMagneticFieldESProducer.cc.

Constructor & Destructor Documentation

◆ DD4hep_VolumeBasedMagneticFieldESProducer() [1/2]

DD4hep_VolumeBasedMagneticFieldESProducer::DD4hep_VolumeBasedMagneticFieldESProducer ( const edm::ParameterSet iConfig)

Definition at line 52 of file DD4hep_VolumeBasedMagneticFieldESProducer.cc.

53  : pset_{iConfig},
54  debug_{iConfig.getUntrackedParameter<bool>("debugBuilder", false)},
55  useParametrizedTrackerField_{iConfig.getParameter<bool>("useParametrizedTrackerField")},
56  conf_{iConfig, debug_},
57  version_{iConfig.getParameter<std::string>("version")} {
58  LogTrace("MagGeoBuilder") << "info:Constructing a DD4hep_VolumeBasedMagneticFieldESProducer";
59 
60  auto cc = setWhatProduced(this, iConfig.getUntrackedParameter<std::string>("label", ""));
61  cpvToken_ = cc.consumes(edm::ESInputTag{"", "magfield"});
63  paramFieldToken_ = cc.consumes(edm::ESInputTag{"", iConfig.getParameter<std::string>("paramLabel")});
64  }
65 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
#define LogTrace(id)
T getUntrackedParameter(std::string const &, T const &) const
edm::ESGetToken< cms::DDCompactView, IdealMagneticFieldRecord > cpvToken_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > paramFieldToken_

◆ DD4hep_VolumeBasedMagneticFieldESProducer() [2/2]

magneticfield::DD4hep_VolumeBasedMagneticFieldESProducer::DD4hep_VolumeBasedMagneticFieldESProducer ( const DD4hep_VolumeBasedMagneticFieldESProducer )
delete

Member Function Documentation

◆ operator=()

const DD4hep_VolumeBasedMagneticFieldESProducer& magneticfield::DD4hep_VolumeBasedMagneticFieldESProducer::operator= ( const DD4hep_VolumeBasedMagneticFieldESProducer )
delete

◆ produce()

std::unique_ptr< MagneticField > DD4hep_VolumeBasedMagneticFieldESProducer::produce ( const IdealMagneticFieldRecord iRecord)

Definition at line 68 of file DD4hep_VolumeBasedMagneticFieldESProducer.cc.

References magneticfield::MagGeoBuilder::barrelLayers(), magneticfield::MagGeoBuilder::barrelVolumes(), magneticfield::MagGeoBuilder::build(), conf_, cpvToken_, debug_, cms::DDCompactView::detector(), magneticfield::MagGeoBuilder::endcapSectors(), magneticfield::MagGeoBuilder::endcapVolumes(), MagFieldConfig::geometryVersion, edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getTransientHandle(), MagFieldConfig::gridFiles, MagFieldConfig::keys, LogTrace, magneticfield::MagGeoBuilder::maxR(), magneticfield::MagGeoBuilder::maxZ(), paramFieldToken_, magneticfield::MagGeoBuilder::setGridFiles(), magneticfield::MagGeoBuilder::setScaling(), useParametrizedTrackerField_, MagFieldConfig::values, MagFieldConfig::version, and version_.

69  {
70  if (debug_) {
71  LogTrace("MagGeoBuilder") << "DD4hep_VolumeBasedMagneticFieldESProducer::produce() " << version_;
72  }
73 
75 
76  // Set scaling factors
77  if (!conf_.keys.empty()) {
78  builder.setScaling(conf_.keys, conf_.values);
79  }
80 
81  // Set specification for the grid tables to be used.
82  if (!conf_.gridFiles.empty()) {
83  builder.setGridFiles(conf_.gridFiles);
84  }
85 
86  auto cpv = iRecord.getTransientHandle(cpvToken_);
87  const cms::DDCompactView* cpvPtr = cpv.product();
88  const cms::DDDetector* det = cpvPtr->detector();
89  builder.build(det);
90  LogTrace("MagGeoBuilder") << "produce() finished build";
91 
92  // Get slave field (from ES)
93  const MagneticField* paramField = nullptr;
95  LogTrace("MagGeoBuilder") << "Getting MF for parametrized field";
96  paramField = &iRecord.get(paramFieldToken_);
97  }
98  return std::make_unique<VolumeBasedMagneticField>(conf_.geometryVersion,
99  builder.barrelLayers(),
100  builder.endcapSectors(),
101  builder.barrelVolumes(),
102  builder.endcapVolumes(),
103  builder.maxR(),
104  builder.maxZ(),
105  paramField,
106  false);
107 }
ESTransientHandle< ProductT > getTransientHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
const cms::DDDetector * detector() const
Definition: DDCompactView.h:34
std::vector< double > values
#define LogTrace(id)
magneticfield::TableFileMap gridFiles
Specification of which data table is to be used for each volume.
std::vector< int > keys
Scaling factors for the field in specific volumes.
edm::ESGetToken< cms::DDCompactView, IdealMagneticFieldRecord > cpvToken_
std::string version
Version of the data tables to be used.
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > paramFieldToken_
int geometryVersion
Version of the geometry to be used.
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const

Member Data Documentation

◆ conf_

const MagFieldConfig magneticfield::DD4hep_VolumeBasedMagneticFieldESProducer::conf_
private

Definition at line 43 of file DD4hep_VolumeBasedMagneticFieldESProducer.cc.

Referenced by produce().

◆ cpvToken_

edm::ESGetToken<cms::DDCompactView, IdealMagneticFieldRecord> magneticfield::DD4hep_VolumeBasedMagneticFieldESProducer::cpvToken_
private

Definition at line 46 of file DD4hep_VolumeBasedMagneticFieldESProducer.cc.

Referenced by produce().

◆ debug_

const bool magneticfield::DD4hep_VolumeBasedMagneticFieldESProducer::debug_
private

Definition at line 41 of file DD4hep_VolumeBasedMagneticFieldESProducer.cc.

Referenced by produce().

◆ paramFieldToken_

edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> magneticfield::DD4hep_VolumeBasedMagneticFieldESProducer::paramFieldToken_
private

Definition at line 45 of file DD4hep_VolumeBasedMagneticFieldESProducer.cc.

Referenced by produce().

◆ pset_

edm::ParameterSet magneticfield::DD4hep_VolumeBasedMagneticFieldESProducer::pset_
private

Definition at line 40 of file DD4hep_VolumeBasedMagneticFieldESProducer.cc.

◆ useParametrizedTrackerField_

const bool magneticfield::DD4hep_VolumeBasedMagneticFieldESProducer::useParametrizedTrackerField_
private

Definition at line 42 of file DD4hep_VolumeBasedMagneticFieldESProducer.cc.

Referenced by produce().

◆ version_

const std::string magneticfield::DD4hep_VolumeBasedMagneticFieldESProducer::version_
private

Definition at line 44 of file DD4hep_VolumeBasedMagneticFieldESProducer.cc.

Referenced by produce().