CMS 3D CMS Logo

List of all members | Public Member Functions | Static 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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 

Private Attributes

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

Additional Inherited Members

- 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 >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
template<typename TFunc >
auto setWhatProduced (TFunc &&func, const es::Label &iLabel={})
 
template<typename TReturn , typename TRecord , typename TFunc , typename TDecorator >
ESConsumesCollectorT< TRecord > setWhatProduced (TFunc &&func, TDecorator &&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 55 of file DD4hep_VolumeBasedMagneticFieldESProducer.cc.

56  : pset_{iConfig},
57  debug_{iConfig.getUntrackedParameter<bool>("debugBuilder", false)},
58  useParametrizedTrackerField_{iConfig.getParameter<bool>("useParametrizedTrackerField")},
59  useMergeFileIfAvailable_{iConfig.getParameter<bool>("useMergeFileIfAvailable")},
60  conf_{iConfig, debug_},
61  version_{iConfig.getParameter<std::string>("version")} {
62  LogTrace("MagGeoBuilder") << "info:Constructing a DD4hep_VolumeBasedMagneticFieldESProducer";
63 
64  auto cc = setWhatProduced(this, iConfig.getUntrackedParameter<std::string>("label", ""));
65  cpvToken_ = cc.consumes(edm::ESInputTag{"", "magfield"});
67  paramFieldToken_ = cc.consumes(edm::ESInputTag{"", iConfig.getParameter<std::string>("paramLabel")});
68  }
69 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
#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

◆ fillDescriptions()

void DD4hep_VolumeBasedMagneticFieldESProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 113 of file DD4hep_VolumeBasedMagneticFieldESProducer.cc.

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addDefault(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

113  {
115  desc.addUntracked<bool>("debugBuilder", false);
116  desc.add<bool>("useMergeFileIfAvailable", true);
117  desc.add<bool>("useParametrizedTrackerField");
118  desc.addUntracked<std::string>("label", "");
119  desc.add<std::string>("version");
120  desc.add<std::string>("paramLabel");
121 
122  //from MagFieldConfig
123  desc.add<int>("geometryVersion");
124  {
126  sub.add<std::string>("volumes");
127  sub.add<std::string>("sectors");
128  sub.add<int>("master");
129  sub.add<std::string>("path");
130  desc.addVPSet("gridFiles", sub);
131  }
132  desc.add<std::vector<int> >("scalingVolumes");
133  desc.add<std::vector<double> >("scalingFactors");
134  //default used to be compatible with older configurations
135  desc.add<std::vector<double> >("paramData", std::vector<double>());
136 
137  descriptions.addDefault(desc);
138 }
void addDefault(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * add(U const &iLabel, T const &value)

◆ 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 72 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(), useMergeFileIfAvailable_, useParametrizedTrackerField_, MagFieldConfig::values, MagFieldConfig::version, and version_.

73  {
74  if (debug_) {
75  LogTrace("MagGeoBuilder") << "DD4hep_VolumeBasedMagneticFieldESProducer::produce() " << version_;
76  }
77 
79 
80  // Set scaling factors
81  if (!conf_.keys.empty()) {
82  builder.setScaling(conf_.keys, conf_.values);
83  }
84 
85  // Set specification for the grid tables to be used.
86  if (!conf_.gridFiles.empty()) {
87  builder.setGridFiles(conf_.gridFiles);
88  }
89 
90  auto cpv = iRecord.getTransientHandle(cpvToken_);
91  const cms::DDCompactView* cpvPtr = cpv.product();
92  const cms::DDDetector* det = cpvPtr->detector();
93  builder.build(det);
94  LogTrace("MagGeoBuilder") << "produce() finished build";
95 
96  // Get slave field (from ES)
97  const MagneticField* paramField = nullptr;
99  LogTrace("MagGeoBuilder") << "Getting MF for parametrized field";
100  paramField = &iRecord.get(paramFieldToken_);
101  }
102  return std::make_unique<VolumeBasedMagneticField>(conf_.geometryVersion,
103  builder.barrelLayers(),
104  builder.endcapSectors(),
105  builder.barrelVolumes(),
106  builder.endcapVolumes(),
107  builder.maxR(),
108  builder.maxZ(),
109  paramField,
110  false);
111 }
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 46 of file DD4hep_VolumeBasedMagneticFieldESProducer.cc.

Referenced by produce().

◆ cpvToken_

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

Definition at line 49 of file DD4hep_VolumeBasedMagneticFieldESProducer.cc.

Referenced by produce().

◆ debug_

const bool magneticfield::DD4hep_VolumeBasedMagneticFieldESProducer::debug_
private

Definition at line 43 of file DD4hep_VolumeBasedMagneticFieldESProducer.cc.

Referenced by produce().

◆ paramFieldToken_

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

Definition at line 48 of file DD4hep_VolumeBasedMagneticFieldESProducer.cc.

Referenced by produce().

◆ pset_

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

Definition at line 42 of file DD4hep_VolumeBasedMagneticFieldESProducer.cc.

◆ useMergeFileIfAvailable_

const bool magneticfield::DD4hep_VolumeBasedMagneticFieldESProducer::useMergeFileIfAvailable_
private

Definition at line 45 of file DD4hep_VolumeBasedMagneticFieldESProducer.cc.

Referenced by produce().

◆ useParametrizedTrackerField_

const bool magneticfield::DD4hep_VolumeBasedMagneticFieldESProducer::useParametrizedTrackerField_
private

Definition at line 44 of file DD4hep_VolumeBasedMagneticFieldESProducer.cc.

Referenced by produce().

◆ version_

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

Definition at line 47 of file DD4hep_VolumeBasedMagneticFieldESProducer.cc.

Referenced by produce().