#include <VolumeBasedMagneticFieldESProducer.h>
Public Member Functions | |
std::auto_ptr< MagneticField > | produce (const IdealMagneticFieldRecord &iRecord) |
VolumeBasedMagneticFieldESProducer (const edm::ParameterSet &iConfig) | |
Private Member Functions | |
std::vector< unsigned > | expandList (const std::string &list) |
const VolumeBasedMagneticFieldESProducer & | operator= (const VolumeBasedMagneticFieldESProducer &) |
VolumeBasedMagneticFieldESProducer (const VolumeBasedMagneticFieldESProducer &) | |
Private Attributes | |
edm::ParameterSet | pset |
Definition at line 23 of file VolumeBasedMagneticFieldESProducer.h.
VolumeBasedMagneticFieldESProducer::VolumeBasedMagneticFieldESProducer | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 31 of file VolumeBasedMagneticFieldESProducer.cc.
References edm::ParameterSet::getUntrackedParameter(), pset, edm::ESProducer::setWhatProduced(), and AlCaHLTBitMon_QueryRunRegistry::string.
: pset(iConfig) { setWhatProduced(this, pset.getUntrackedParameter<std::string>("label","")); }
magneticfield::VolumeBasedMagneticFieldESProducer::VolumeBasedMagneticFieldESProducer | ( | const VolumeBasedMagneticFieldESProducer & | ) | [private] |
vector< unsigned > VolumeBasedMagneticFieldESProducer::expandList | ( | const std::string & | list | ) | [private] |
Definition at line 110 of file VolumeBasedMagneticFieldESProducer.cc.
References end, i, gen::k, split, dqm_diff::start, and makeHLTPrescaleTable::values.
Referenced by produce().
{ typedef vector<string> vstring; vector<unsigned> values; vstring v1; boost::split(v1, list, boost::is_any_of(",")); for (vstring::const_iterator i= v1.begin(); i!=v1.end(); ++i){ vstring v2; boost::split(v2, *i, boost::is_any_of("-")); unsigned start = boost::lexical_cast<unsigned>(v2.front()); unsigned end = boost::lexical_cast<unsigned>(v2.back()); if ((v2.size()>2) || (start>end)) { edm::LogError("BADconfiguration") << "VolumeBasedMagneticFieldESProducer: malformed configuration" << list << endl; abort(); } for (unsigned k = start; k<=end; ++k){ values.push_back(k); } } return values; }
const VolumeBasedMagneticFieldESProducer& magneticfield::VolumeBasedMagneticFieldESProducer::operator= | ( | const VolumeBasedMagneticFieldESProducer & | ) | [private] |
std::auto_ptr< MagneticField > VolumeBasedMagneticFieldESProducer::produce | ( | const IdealMagneticFieldRecord & | iRecord | ) |
Definition at line 37 of file VolumeBasedMagneticFieldESProducer.cc.
References MagGeoBuilderFromDDD::barrelLayers(), MagGeoBuilderFromDDD::barrelVolumes(), MagGeoBuilderFromDDD::build(), filterCSVwithJSON::copy, gather_cfg::cout, debug, MagGeoBuilderFromDDD::endcapSectors(), MagGeoBuilderFromDDD::endcapVolumes(), expandList(), edm::eventsetup::EventSetupRecord::get(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, j, relativeConstraints::keys, autoMagneticFieldProducer_cfi::master, MagGeoBuilderFromDDD::maxR(), MagGeoBuilderFromDDD::maxZ(), getHLTPrescaleColumns::path, edm::ESHandle< T >::product(), pset, alignCSCRings::s, mergeVDriftHistosByStation::sectors, MagGeoBuilderFromDDD::setGridFiles(), MagGeoBuilderFromDDD::setScaling(), AlCaHLTBitMon_QueryRunRegistry::string, makeHLTPrescaleTable::values, and autoMagneticFieldProducer_cfi::volumes.
{ bool debug = pset.getUntrackedParameter<bool>("debugBuilder", false); if (debug) { cout << "VolumeBasedMagneticFieldESProducer::produce() " << pset.getParameter<std::string>("version") << endl; } edm::ESTransientHandle<DDCompactView> cpv; iRecord.get("magfield",cpv ); MagGeoBuilderFromDDD builder(pset.getParameter<std::string>("version"), pset.getParameter<int>("geometryVersion"), debug); // Get scaling factors vector<int> keys = pset.getParameter<vector<int> >("scalingVolumes"); vector<double> values = pset.getParameter<vector<double> >("scalingFactors"); if (keys.size() != 0) { builder.setScaling(keys, values); } // Get specification for the grid tables to be used. typedef vector<edm::ParameterSet> VPSet; { VPSet fileSpec = pset.getParameter<VPSet>("gridFiles"); if (fileSpec.size()!=0) { auto_ptr<TableFileMap> gridFiles(new TableFileMap); for(VPSet::const_iterator rule = fileSpec.begin(); rule != fileSpec.end(); ++rule){ string s_volumes = rule->getParameter<string>("volumes"); string s_sectors = rule->getParameter<string>("sectors"); // 0 means all volumes int master = rule->getParameter<int>("master"); string path = rule->getParameter<string>("path"); vector<unsigned> volumes = expandList(s_volumes); vector<unsigned> sectors = expandList(s_sectors); if (debug) { cout << s_volumes << endl; copy(volumes.begin(), volumes.end(), ostream_iterator<unsigned>(cout, " ")); cout << endl; cout << s_sectors << endl; copy(sectors.begin(), sectors.end(), ostream_iterator<unsigned>(cout, " ")); cout << endl; } for (vector<unsigned>::iterator i = volumes.begin(); i!=volumes.end(); ++i){ for (vector<unsigned>::iterator j = sectors.begin(); j!=sectors.end(); ++j){ unsigned vpacked = (*i)*100+(*j); if (gridFiles->find(vpacked)==gridFiles->end()) { (*gridFiles)[vpacked] = make_pair(path, master); } else { edm::LogError("BADconfiguration") << "ERROR: VolumeBasedMagneticFieldESProducer: malformed gridFiles config parameter"; abort(); } } } } builder.setGridFiles(gridFiles); // gridFiles passed by reference, which is required to exist until } } builder.build(*cpv); // Get slave field edm::ESHandle<MagneticField> paramField; if (pset.getParameter<bool>("useParametrizedTrackerField")) {; iRecord.get(pset.getParameter<string>("paramLabel"),paramField); } std::auto_ptr<MagneticField> s(new VolumeBasedMagneticField(pset,builder.barrelLayers(), builder.endcapSectors(), builder.barrelVolumes(), builder.endcapVolumes(), builder.maxR(), builder.maxZ(), paramField.product(), false)); return s; }
Definition at line 36 of file VolumeBasedMagneticFieldESProducer.h.
Referenced by produce(), and VolumeBasedMagneticFieldESProducer().