CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
magneticfield::AutoParametrizedMagneticFieldProducer Class Reference
Inheritance diagram for magneticfield::AutoParametrizedMagneticFieldProducer:
edm::ESProducer edm::ESProductResolverFactoryProducer edm::eventsetup::ESProductResolverProvider

Public Member Functions

 AutoParametrizedMagneticFieldProducer (const edm::ParameterSet &)
 
int closerNominaCurrent (float current) const
 
std::unique_ptr< MagneticFieldproduce (const IdealMagneticFieldRecord &)
 
 ~AutoParametrizedMagneticFieldProducer () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
 ESProducer (ESProducer &&)=delete
 
ESResolverIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProduceroperator= (const ESProducer &)=delete
 
ESProduceroperator= (ESProducer &&)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESResolverIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProductResolverFactoryProducer
 ESProductResolverFactoryProducer ()
 
 ESProductResolverFactoryProducer (const ESProductResolverFactoryProducer &)=delete
 
const ESProductResolverFactoryProduceroperator= (const ESProductResolverFactoryProducer &)=delete
 
 ~ESProductResolverFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
void createKeyedResolvers (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
const ComponentDescriptiondescription () const
 
 ESProductResolverProvider ()
 
 ESProductResolverProvider (const ESProductResolverProvider &)=delete
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedResolverskeyedResolvers (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const ESProductResolverProvideroperator= (const ESProductResolverProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~ESProductResolverProvider () noexcept(false)
 

Public Attributes

const int currentOverride_
 
const std::array< int, 7 > nominalCurrents_
 
edm::ESGetToken< RunInfo, RunInfoRcdrunInfoToken_
 
const std::string version_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProductResolverFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::ESProductResolverProvider
using KeyedResolversVector = std::vector< std::pair< DataKey, std::shared_ptr< ESProductResolver > >>
 
- Protected Member Functions inherited from edm::ESProducer
ESConsumesInfoconsumesInfoPushBackNew ()
 
unsigned int consumesInfoSize () const
 
template<typename CallbackT , typename TList , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>> iCallback, const TList *, const TRecord *iRecord, const es::Label &iLabel)
 
template<typename CallbackT , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>>, const eventsetup::produce::Null *, const TRecord *, const es::Label &)
 
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 TDecorator >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TDecorator &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::ESProductResolverFactoryProducer
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::ESProductResolverFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedResolversVector registerResolvers (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::ESProductResolverProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 

Detailed Description

Definition at line 24 of file AutoParametrizedMagneticFieldProducer.cc.

Constructor & Destructor Documentation

◆ AutoParametrizedMagneticFieldProducer()

AutoParametrizedMagneticFieldProducer::AutoParametrizedMagneticFieldProducer ( const edm::ParameterSet iConfig)

Definition at line 42 of file AutoParametrizedMagneticFieldProducer.cc.

References edm::ParameterSet::getParameter().

43  : version_{iConfig.getParameter<string>("version")},
44  currentOverride_{iConfig.getParameter<int>("valueOverride")},
45  nominalCurrents_{{-1, 0, 9558, 14416, 16819, 18268, 19262}}
46 // nominalLabels_{["3.8T","0T","2T", "3T", "3.5T", "3.8T", "4T"}}
47 {
48  auto cc = setWhatProduced(this, iConfig.getUntrackedParameter<std::string>("label", ""));
49  if (currentOverride_ < 0) {
50  runInfoToken_ = cc.consumes();
51  }
52 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
T getUntrackedParameter(std::string const &, T const &) const

◆ ~AutoParametrizedMagneticFieldProducer()

magneticfield::AutoParametrizedMagneticFieldProducer::~AutoParametrizedMagneticFieldProducer ( )
inlineoverride

Definition at line 27 of file AutoParametrizedMagneticFieldProducer.cc.

27 {}

Member Function Documentation

◆ closerNominaCurrent()

int AutoParametrizedMagneticFieldProducer::closerNominaCurrent ( float  current) const

Definition at line 94 of file AutoParametrizedMagneticFieldProducer.cc.

References mps_fire::i, createfilelist::int, and nominalCurrents_.

Referenced by produce().

94  {
95  int i = 0;
96  for (; i < (int)nominalCurrents_.size() - 1; i++) {
97  if (2 * current < nominalCurrents_[i] + nominalCurrents_[i + 1])
98  return nominalCurrents_[i];
99  }
100  return nominalCurrents_[i];
101 }

◆ produce()

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

Definition at line 54 of file AutoParametrizedMagneticFieldProducer.cc.

References closerNominaCurrent(), currentOverride_, MillePedeFileConverter_cfg::e, Exception, ParametrizedMagneticFieldFactory::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), runInfoToken_, pfClustersFromCombinedCaloHF_cfi::scale, BeamSplash_cfg::version, and version_.

54  {
55  // Get value of the current from condition DB
56  float current = currentOverride_;
57  string message;
58  if (current < 0) {
59  current = iRecord.get(runInfoToken_).m_avg_current;
60  message = " (from RunInfo DB)";
61  } else {
62  message = " (from valueOverride card)";
63  }
64  float cnc = closerNominaCurrent(current);
65 
66  edm::LogInfo("MagneticField") << "Current: " << current << message << "; using map for: " << cnc;
67 
68  vector<double> parameters;
69 
70  auto version = version_;
71  if (cnc == 0) {
72  version = "Uniform";
73  parameters.push_back(0);
74  } else if (version == "Parabolic") {
75  parameters.push_back(3.8114); //c1
76  parameters.push_back(-3.94991e-06); //b0
77  parameters.push_back(7.53701e-06); //b1
78  parameters.push_back(2.43878e-11); //a
79  if (cnc !=
80  18268) { // Linear scaling for B!= 3.8T; note that just c1, b0 and b1 have to be scaled to get linear scaling
81  double scale = double(cnc) / double(18268);
82  parameters[0] *= scale;
83  parameters[1] *= scale;
84  parameters[2] *= scale;
85  }
86  } else {
87  //Other parametrizations are not relevant here and not supported
88  throw cms::Exception("InvalidParameter") << "version " << version << " is not supported";
89  }
90 
92 }
static std::unique_ptr< MagneticField > get(std::string version, const edm::ParameterSet &parameters)
Log< level::Info, false > LogInfo
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const

Member Data Documentation

◆ currentOverride_

const int magneticfield::AutoParametrizedMagneticFieldProducer::currentOverride_

Definition at line 33 of file AutoParametrizedMagneticFieldProducer.cc.

Referenced by produce().

◆ nominalCurrents_

const std::array<int, 7> magneticfield::AutoParametrizedMagneticFieldProducer::nominalCurrents_

Definition at line 34 of file AutoParametrizedMagneticFieldProducer.cc.

Referenced by closerNominaCurrent().

◆ runInfoToken_

edm::ESGetToken<RunInfo, RunInfoRcd> magneticfield::AutoParametrizedMagneticFieldProducer::runInfoToken_

Definition at line 36 of file AutoParametrizedMagneticFieldProducer.cc.

Referenced by produce().

◆ version_

const std::string magneticfield::AutoParametrizedMagneticFieldProducer::version_

Definition at line 32 of file AutoParametrizedMagneticFieldProducer.cc.

Referenced by produce().