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
 
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 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 char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &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 24 of file AutoParametrizedMagneticFieldProducer.cc.

Constructor & Destructor Documentation

◆ AutoParametrizedMagneticFieldProducer()

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

Definition at line 42 of file AutoParametrizedMagneticFieldProducer.cc.

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 }

References edm::ParameterSet::getParameter().

◆ ~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.

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 }

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

Referenced by produce().

◆ produce()

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

Definition at line 54 of file AutoParametrizedMagneticFieldProducer.cc.

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 }

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

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().

magneticfield::AutoParametrizedMagneticFieldProducer::runInfoToken_
edm::ESGetToken< RunInfo, RunInfoRcd > runInfoToken_
Definition: AutoParametrizedMagneticFieldProducer.cc:36
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:29
mps_fire.i
i
Definition: mps_fire.py:428
ParametrizedMagneticFieldFactory::get
static std::unique_ptr< MagneticField > get(std::string version, const edm::ParameterSet &parameters)
HLT_FULL_cff.scale
scale
Definition: HLT_FULL_cff.py:6637
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
magneticfield::AutoParametrizedMagneticFieldProducer::version_
const std::string version_
Definition: AutoParametrizedMagneticFieldProducer.cc:32
magneticfield::AutoParametrizedMagneticFieldProducer::closerNominaCurrent
int closerNominaCurrent(float current) const
Definition: AutoParametrizedMagneticFieldProducer.cc:94
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
cc
magneticfield::AutoParametrizedMagneticFieldProducer::currentOverride_
const int currentOverride_
Definition: AutoParametrizedMagneticFieldProducer.cc:33
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:103
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
createfilelist.int
int
Definition: createfilelist.py:10
magneticfield::AutoParametrizedMagneticFieldProducer::nominalCurrents_
const std::array< int, 7 > nominalCurrents_
Definition: AutoParametrizedMagneticFieldProducer.cc:34
Exception
Definition: hltDiff.cc:246
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37