CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
std::auto_ptr< MagneticFieldproduce (const IdealMagneticFieldRecord &)
 
 ~AutoParametrizedMagneticFieldProducer ()
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
virtual ~ESProducer ()
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer ()
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider ()
 

Public Attributes

std::vector< int > nominalCurrents
 
edm::ParameterSet pset
 

Additional Inherited Members

- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair
< DataKey, boost::shared_ptr
< DataProxy > > > 
KeyedProxies
 
typedef std::vector
< EventSetupRecordKey
Keys
 
typedef std::map
< EventSetupRecordKey,
KeyedProxies
RecordProxies
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
void setWhatProduced (T *iThis, const es::Label &iLabel=es::Label())
 
template<typename T >
void setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
void setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
void setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel=es::Label())
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::auto_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::auto_ptr< eventsetup::ProxyFactoryBase > &iFactory, const std::string &iLabel=std::string())
 
virtual void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList)
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 

Detailed Description

Definition at line 29 of file AutoParametrizedMagneticFieldProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 46 of file AutoParametrizedMagneticFieldProducer.cc.

References edm::ParameterSet::getUntrackedParameter(), nominalCurrents, pset, edm::ESProducer::setWhatProduced(), and AlCaHLTBitMon_QueryRunRegistry::string.

46  : pset(iConfig) {
48  nominalCurrents={-1, 0,9558,14416,16819,18268,19262};
49  // nominalLabels ={"3.8T","0T","2T", "3T", "3.5T", "3.8T", "4T"};
50 }
T getUntrackedParameter(std::string const &, T const &) const
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
magneticfield::AutoParametrizedMagneticFieldProducer::~AutoParametrizedMagneticFieldProducer ( )
inline

Definition at line 33 of file AutoParametrizedMagneticFieldProducer.cc.

33 {}

Member Function Documentation

int AutoParametrizedMagneticFieldProducer::closerNominaCurrent ( float  current)

Definition at line 98 of file AutoParametrizedMagneticFieldProducer.cc.

References i, and nominalCurrents.

Referenced by produce().

98  {
99  int i=0;
100  for(;i<(int)nominalCurrents.size()-1;i++) {
101  if(2*current < nominalCurrents[i]+nominalCurrents[i+1] )
102  return nominalCurrents[i];
103  }
104  return nominalCurrents[i];
105 }
int i
Definition: DBlmapReader.cc:9
std::auto_ptr< MagneticField > AutoParametrizedMagneticFieldProducer::produce ( const IdealMagneticFieldRecord iRecord)

Definition at line 53 of file AutoParametrizedMagneticFieldProducer.cc.

References closerNominaCurrent(), cond::rpcobimon::current, alignCSCRings::e, edm::hlt::Exception, ParametrizedMagneticFieldFactory::get(), edm::ParameterSet::getParameter(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), python.rootplot.argparse::message, Parameters::parameters, pset, pileupReCalc_HLTpaths::scale, and relval_steps::version.

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

Member Data Documentation

std::vector<int> magneticfield::AutoParametrizedMagneticFieldProducer::nominalCurrents
edm::ParameterSet magneticfield::AutoParametrizedMagneticFieldProducer::pset