test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VolumeBasedMagneticFieldESProducer.cc
Go to the documentation of this file.
1 
7 
9 
13 
18 
19 #include <string>
20 #include <vector>
21 #include <iostream>
22 
23 #include <boost/algorithm/string/split.hpp>
24 #include <boost/algorithm/string/classification.hpp>
25 #include <boost/lexical_cast.hpp>
26 
27 using namespace std;
28 using namespace magneticfield;
29 
31 {
33 }
34 
35 // ------------ method called to produce the data ------------
36 std::unique_ptr<MagneticField> VolumeBasedMagneticFieldESProducer::produce(const IdealMagneticFieldRecord & iRecord)
37 {
38  bool debug = pset.getUntrackedParameter<bool>("debugBuilder", false);
39  if (debug) {
40  cout << "VolumeBasedMagneticFieldESProducer::produce() " << pset.getParameter<std::string>("version") << endl;
41  }
42 
43  MagFieldConfig conf(pset, debug);
44 
46  iRecord.get("magfield",cpv );
47  MagGeoBuilderFromDDD builder(conf.version,
48  conf.geometryVersion,
49  debug);
50 
51  // Set scaling factors
52  if (conf.keys.size() != 0) {
53  builder.setScaling(conf.keys, conf.values);
54  }
55 
56  // Set specification for the grid tables to be used.
57  if (conf.gridFiles.size()!=0) {
58  builder.setGridFiles(conf.gridFiles);
59  }
60 
61  builder.build(*cpv);
62 
63  // Get slave field (from ES)
65  if (pset.getParameter<bool>("useParametrizedTrackerField")) {;
66  iRecord.get(pset.getParameter<string>("paramLabel"),paramField);
67  }
68  return std::make_unique<VolumeBasedMagneticField>(conf.geometryVersion,builder.barrelLayers(), builder.endcapSectors(), builder.barrelVolumes(), builder.endcapVolumes(), builder.maxR(), builder.maxZ(), paramField.product(), false);
69 }
70 
71 
72 
73 
74 
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< MagneticField > produce(const IdealMagneticFieldRecord &iRecord)
std::vector< MagBLayer * > barrelLayers() const
Get barrel layers.
std::vector< double > values
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
magneticfield::TableFileMap gridFiles
Specification of which data table is to be used for each volume.
std::vector< MagVolume6Faces * > barrelVolumes() const
virtual void build(const DDCompactView &cpv)
void get(HolderT &iHolder) const
std::vector< MagESector * > endcapSectors() const
Get endcap layers.
std::vector< int > keys
Scaling factors for the field in specific volumes.
#define debug
Definition: HDRShower.cc:19
std::string version
Version of the data tables to be used.
T const * product() const
Definition: ESHandle.h:86
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
void setScaling(const std::vector< int > &keys, const std::vector< double > &values)
std::vector< MagVolume6Faces * > endcapVolumes() const
int geometryVersion
Version of the geometry to be used.
tuple cout
Definition: gather_cfg.py:145
void setGridFiles(const magneticfield::TableFileMap &gridFiles)