CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
magneticfield::VolumeBasedMagneticFieldESProducerFromDB Class Reference
Inheritance diagram for magneticfield::VolumeBasedMagneticFieldESProducerFromDB:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

std::auto_ptr< MagneticFieldproduce (const IdealMagneticFieldRecord &iRecord)
 
 VolumeBasedMagneticFieldESProducerFromDB (const edm::ParameterSet &iConfig)
 
- 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 ()
 

Private Member Functions

std::string closerNominalLabel (float current)
 
const
VolumeBasedMagneticFieldESProducerFromDB
operator= (const VolumeBasedMagneticFieldESProducerFromDB &)
 
 VolumeBasedMagneticFieldESProducerFromDB (const VolumeBasedMagneticFieldESProducerFromDB &)
 

Private Attributes

std::vector< int > nominalCurrents
 
std::vector< std::string > nominalLabels
 
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 51 of file VolumeBasedMagneticFieldESProducerFromDB.cc.

Constructor & Destructor Documentation

VolumeBasedMagneticFieldESProducerFromDB::VolumeBasedMagneticFieldESProducerFromDB ( const edm::ParameterSet iConfig)

Definition at line 71 of file VolumeBasedMagneticFieldESProducerFromDB.cc.

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

71  : pset(iConfig)
72 {
74  nominalCurrents={-1, 0,9558,14416,16819,18268,19262};
75  nominalLabels ={"3.8T","0T","2T", "3T", "3.5T", "3.8T", "4T"};
76 }
T getUntrackedParameter(std::string const &, T const &) const
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
magneticfield::VolumeBasedMagneticFieldESProducerFromDB::VolumeBasedMagneticFieldESProducerFromDB ( const VolumeBasedMagneticFieldESProducerFromDB )
private

Member Function Documentation

std::string VolumeBasedMagneticFieldESProducerFromDB::closerNominalLabel ( float  current)
private

Definition at line 158 of file VolumeBasedMagneticFieldESProducerFromDB.cc.

References i, nominalCurrents, and nominalLabels.

Referenced by produce().

158  {
159 
160  int i=0;
161  for(;i<(int)nominalLabels.size()-1;i++) {
162  if(2*current < nominalCurrents[i]+nominalCurrents[i+1] )
163  return nominalLabels[i];
164  }
165  return nominalLabels[i];
166 }
int i
Definition: DBlmapReader.cc:9
const VolumeBasedMagneticFieldESProducerFromDB& magneticfield::VolumeBasedMagneticFieldESProducerFromDB::operator= ( const VolumeBasedMagneticFieldESProducerFromDB )
private
std::auto_ptr< MagneticField > VolumeBasedMagneticFieldESProducerFromDB::produce ( const IdealMagneticFieldRecord iRecord)

Definition at line 81 of file VolumeBasedMagneticFieldESProducerFromDB.cc.

References MagGeoBuilderFromDDD::barrelLayers(), MagGeoBuilderFromDDD::barrelVolumes(), MagGeoBuilderFromDDD::build(), DDLParser::clearFiles(), closerNominalLabel(), dbtoconf::conf, gather_cfg::cout, cond::rpcobimon::current, debug, MagGeoBuilderFromDDD::endcapSectors(), MagGeoBuilderFromDDD::endcapVolumes(), MagFieldConfig::geometryVersion, ParametrizedMagneticFieldFactory::get(), DDLParser::getDDLSAX2FileHandler(), edm::ParameterSet::getParameter(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), edm::ParameterSet::getUntrackedParameter(), MagFieldConfig::gridFiles, DDI::Singleton< I >::instance(), MagFieldConfig::keys, MagGeoBuilderFromDDD::maxR(), MagGeoBuilderFromDDD::maxZ(), python.rootplot.argparse::message, DDLParser::parse(), geometryXMLtoCSV::parser, pset, alignCSCRings::s, MagGeoBuilderFromDDD::setGridFiles(), MagGeoBuilderFromDDD::setScaling(), DDLSAX2Handler::setUserNS(), MagFieldConfig::slaveFieldParameters, MagFieldConfig::slaveFieldVersion, MagFieldConfig::values, and MagFieldConfig::version.

82 {
83 
84  bool debug = pset.getUntrackedParameter<bool>("debugBuilder", false);
85 
86  // Get value of the current from condition DB
87  float current = pset.getParameter<int>("valueOverride");
88  string message;
89  if (current < 0) {
90  ESHandle<RunInfo> rInfo;
91  iRecord.getRecord<RunInfoRcd>().get(rInfo);
92  current = rInfo->m_avg_current;
93  message = " (from RunInfo DB)";
94  } else {
95  message = " (from valueOverride card)";
96  }
97  string configLabel = closerNominalLabel(current);
98  edm::LogInfo("MagneticField|AutoMagneticField") << "Current: " << current << message << "; using map configuration with label: " << configLabel;
99 
100  // Get configuration
101  ESHandle<MagFieldConfig> confESH;
102  iRecord.getRecord<MagFieldConfigRcd>().get(configLabel, confESH);
103  const MagFieldConfig* conf = &*confESH;
104 
105  if (debug) {
106  cout << "VolumeBasedMagneticFieldESProducerFromDB::produce() " << conf->version << endl;
107  }
108 
109 
110  // Get the parametrized field
111  std::auto_ptr<MagneticField> paramField = ParametrizedMagneticFieldFactory::get(conf->slaveFieldVersion, conf->slaveFieldParameters);
112 
113 
114  if (conf->version == "parametrizedMagneticField") {
115  // The map consist of only the parametrization in this case
116  return paramField;
117  } else {
118  // Full VolumeBased map + parametrization
119  MagGeoBuilderFromDDD builder(conf->version,
120  conf->geometryVersion,
121  debug);
122 
123  // Set scaling factors
124  if (conf->keys.size() != 0) {
125  builder.setScaling(conf->keys, conf->values);
126  }
127 
128  // Set specification for the grid tables to be used.
129  if (conf->gridFiles.size()!=0) {
130  builder.setGridFiles(conf->gridFiles);
131  }
132 
133  // Build the geomeytry (DDDCompactView) from the DB blob
134  // (code taken from GeometryReaders/XMLIdealGeometryESSource/src/XMLIdealMagneticFieldGeometryESProducer.cc)
136  iRecord.getRecord<MFGeometryFileRcd>().get( boost::lexical_cast<string>(conf->geometryVersion), gdd );
137 
138  DDName ddName("cmsMagneticField:MAGF");
139  DDLogicalPart rootNode(ddName);
140  DDRootDef::instance().set(rootNode);
141  std::auto_ptr<DDCompactView> cpv(new DDCompactView(rootNode));
142  DDLParser parser(*cpv);
143  parser.getDDLSAX2FileHandler()->setUserNS(true);
144  parser.clearFiles();
145  std::unique_ptr<std::vector<unsigned char> > tb = (*gdd).getUncompressedBlob();
146  parser.parse(*tb, tb->size());
147  cpv->lockdown();
148 
149  builder.build(*cpv);
150 
151  // Build the VB map. Ownership of the parametrization is transferred to it, so and auto_ptr is released
152  std::auto_ptr<MagneticField> s(new VolumeBasedMagneticField(conf->geometryVersion,builder.barrelLayers(), builder.endcapSectors(), builder.barrelVolumes(), builder.endcapVolumes(), builder.maxR(), builder.maxZ(), paramField.release(), true));
153  return s;
154  }
155 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
type of data representation of DDCompactView
Definition: DDCompactView.h:77
std::vector< double > values
static std::auto_ptr< MagneticField > get(std::string version, const edm::ParameterSet &parameters)
magneticfield::TableFileMap gridFiles
Specification of which data table is to be used for each volume.
std::string slaveFieldVersion
Label or type of the tracker parametrization.
static value_type & instance()
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
std::vector< int > keys
Scaling factors for the field in specific volumes.
tuple conf
Definition: dbtoconf.py:185
DDLParser is the main class of Detector Description Language Parser.
Definition: DDLParser.h:64
#define debug
Definition: HDRShower.cc:19
std::string version
Version of the data tables to be used.
int geometryVersion
Version of the geometry to be used.
tuple cout
Definition: gather_cfg.py:121
std::vector< double > slaveFieldParameters

Member Data Documentation

std::vector<int> magneticfield::VolumeBasedMagneticFieldESProducerFromDB::nominalCurrents
private
std::vector<std::string> magneticfield::VolumeBasedMagneticFieldESProducerFromDB::nominalLabels
private
edm::ParameterSet magneticfield::VolumeBasedMagneticFieldESProducerFromDB::pset
private