test
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 | Private Member Functions | Private Attributes
magneticfield::AutoMagneticFieldESProducer Class Reference

#include <AutoMagneticFieldESProducer.h>

Inheritance diagram for magneticfield::AutoMagneticFieldESProducer:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 AutoMagneticFieldESProducer (const edm::ParameterSet &)
 
std::auto_ptr< MagneticFieldproduce (const IdealMagneticFieldRecord &)
 
 ~AutoMagneticFieldESProducer ()
 
- 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

edm::ParameterSet pset
 

Private Member Functions

std::string closerModel (float current)
 

Private Attributes

std::vector< std::string > maps
 
std::vector< int > nominalCurrents
 

Additional Inherited Members

- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair
< DataKey,
edm::propagate_const
< std::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 22 of file AutoMagneticFieldESProducer.h.

Constructor & Destructor Documentation

AutoMagneticFieldESProducer::AutoMagneticFieldESProducer ( const edm::ParameterSet iConfig)

Definition at line 30 of file AutoMagneticFieldESProducer.cc.

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

30  : pset(iConfig) {
32  nominalCurrents = pset.getUntrackedParameter<vector<int> >("nominalCurrents");
33  maps = pset.getUntrackedParameter<vector<string> >("mapLabels");
34 
35  if (maps.size()==0 || (maps.size() != nominalCurrents.size())) {
36  throw cms::Exception("InvalidParameter") << "Invalid values for parameters \"nominalCurrents\" and \"maps\"";
37  }
38 }
T getUntrackedParameter(std::string const &, T const &) const
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
AutoMagneticFieldESProducer::~AutoMagneticFieldESProducer ( )

Definition at line 41 of file AutoMagneticFieldESProducer.cc.

42 {
43 }

Member Function Documentation

std::string AutoMagneticFieldESProducer::closerModel ( float  current)
private

Definition at line 79 of file AutoMagneticFieldESProducer.cc.

References i, maps, and nominalCurrents.

Referenced by produce().

79  {
80  int i=0;
81  for(;i<(int)maps.size()-1;i++) {
82  if(2*current < nominalCurrents[i]+nominalCurrents[i+1] )
83  return maps[i];
84  }
85  return maps[i];
86 }
int i
Definition: DBlmapReader.cc:9
std::auto_ptr< MagneticField > AutoMagneticFieldESProducer::produce ( const IdealMagneticFieldRecord iRecord)

Definition at line 47 of file AutoMagneticFieldESProducer.cc.

References closerModel(), edm::eventsetup::EventSetupRecord::get(), edm::ParameterSet::getParameter(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), python.rootplot.argparse::message, edm::ESHandle< class >::product(), pset, mps_fire::result, and alignCSCRings::s.

48 {
49  float current = pset.getParameter<int>("valueOverride");
50 
51  string message;
52 
53  if (current < 0) {
54  ESHandle<RunInfo> rInfo;
55  iRecord.getRecord<RunInfoRcd>().get(rInfo);
56  current = rInfo->m_avg_current;
57  message = " (from RunInfo DB)";
58  } else {
59  message = " (from valueOverride card)";
60  }
61 
62  string model = closerModel(current);
63 
64  edm::LogInfo("MagneticField|AutoMagneticField") << "Current: " << current << message << "; using map with label: " << model;
65 
66 
68 
69  iRecord.get(model,map);
70 
71  MagneticField* result = map.product()->clone();
72 
73  std::auto_ptr<MagneticField> s(result);
74 
75  return s;
76 }
T getParameter(std::string const &) const
tuple result
Definition: mps_fire.py:84
void get(HolderT &iHolder) const
T const * product() const
Definition: ESHandle.h:86

Member Data Documentation

std::vector<std::string> magneticfield::AutoMagneticFieldESProducer::maps
private

Definition at line 33 of file AutoMagneticFieldESProducer.h.

Referenced by AutoMagneticFieldESProducer(), and closerModel().

std::vector<int> magneticfield::AutoMagneticFieldESProducer::nominalCurrents
private

Definition at line 32 of file AutoMagneticFieldESProducer.h.

Referenced by AutoMagneticFieldESProducer(), and closerModel().

edm::ParameterSet magneticfield::AutoMagneticFieldESProducer::pset

Definition at line 29 of file AutoMagneticFieldESProducer.h.

Referenced by AutoMagneticFieldESProducer(), and produce().