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::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

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
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
template<typename Record >
void updateFromMayConsumes (unsigned int iIndex, const Record &iRecord)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer ()(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 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::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={})
 
- 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 24 of file AutoParametrizedMagneticFieldProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 42 of file AutoParametrizedMagneticFieldProducer.cc.

References currentOverride_, edm::ParameterSet::getParameter(), nominalCurrents_, runInfoToken_, edm::ESProducer::setWhatProduced(), and AlCaHLTBitMon_QueryRunRegistry::string.

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  cc.setConsumes(runInfoToken_);
51  }
52 }
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
T getUntrackedParameter(std::string const &, T const &) const
magneticfield::AutoParametrizedMagneticFieldProducer::~AutoParametrizedMagneticFieldProducer ( )
inlineoverride

Definition at line 27 of file AutoParametrizedMagneticFieldProducer.cc.

27 {}

Member Function Documentation

int AutoParametrizedMagneticFieldProducer::closerNominaCurrent ( float  current) const

Definition at line 95 of file AutoParametrizedMagneticFieldProducer.cc.

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

Referenced by produce().

95  {
96  int i = 0;
97  for (; i < (int)nominalCurrents_.size() - 1; i++) {
98  if (2 * current < nominalCurrents_[i] + nominalCurrents_[i + 1])
99  return nominalCurrents_[i];
100  }
101  return nominalCurrents_[i];
102 }
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_, Scenarios_cff::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|AutoParametrizedMagneticField")
67  << "Current: " << current << message << "; using map for: " << cnc;
68 
69  vector<double> parameters;
70 
71  auto version = version_;
72  if (cnc == 0) {
73  version = "Uniform";
74  parameters.push_back(0);
75  } else if (version == "Parabolic") {
76  parameters.push_back(3.8114); //c1
77  parameters.push_back(-3.94991e-06); //b0
78  parameters.push_back(7.53701e-06); //b1
79  parameters.push_back(2.43878e-11); //a
80  if (cnc !=
81  18268) { // Linear scaling for B!= 3.8T; note that just c1, b0 and b1 have to be scaled to get linear scaling
82  double scale = double(cnc) / double(18268);
83  parameters[0] *= scale;
84  parameters[1] *= scale;
85  parameters[2] *= scale;
86  }
87  } else {
88  //Other parametrizations are not relevant here and not supported
89  throw cms::Exception("InvalidParameter") << "version " << version << " is not supported";
90  }
91 
93 }
static std::unique_ptr< MagneticField > get(std::string version, const edm::ParameterSet &parameters)
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const

Member Data Documentation

const int magneticfield::AutoParametrizedMagneticFieldProducer::currentOverride_
const std::array<int, 7> magneticfield::AutoParametrizedMagneticFieldProducer::nominalCurrents_
edm::ESGetToken<RunInfo, RunInfoRcd> magneticfield::AutoParametrizedMagneticFieldProducer::runInfoToken_
const std::string magneticfield::AutoParametrizedMagneticFieldProducer::version_

Definition at line 32 of file AutoParametrizedMagneticFieldProducer.cc.

Referenced by produce().