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 
9 
11 
14 
18 
19 #include <string>
20 #include <vector>
21 #include <iostream>
22 
23 using namespace std;
24 using namespace magneticfield;
25 
27 {
28  setWhatProduced(this, pset.getUntrackedParameter<std::string>("label",""));
29 }
30 
31 
32 
33 
34 // ------------ method called to produce the data ------------
35 std::auto_ptr<MagneticField> VolumeBasedMagneticFieldESProducer::produce(const IdealMagneticFieldRecord & iRecord)
36 {
37  bool debug = pset.getUntrackedParameter<bool>("debugBuilder", false);
38  if (debug) {
39  cout << "VolumeBasedMagneticFieldESProducer::produce() " << pset.getParameter<std::string>("version") << endl;
40  }
41 
43  iRecord.get("magfield",cpv );
44  MagGeoBuilderFromDDD builder(pset.getParameter<std::string>("version"),
45  debug,
46  pset.getParameter<bool>("overrideMasterSector"));
47 
48  // Get scaling factors
49  vector<int> keys = pset.getParameter<vector<int> >("scalingVolumes");
50  vector<double> values = pset.getParameter<vector<double> >("scalingFactors");
51 
52  if (keys.size() != 0) {
53  builder.setScaling(keys, values);
54  }
55 
56  builder.build(*cpv);
57 
58 
59  // Get slave field
61  if (pset.getParameter<bool>("useParametrizedTrackerField")) {;
62  iRecord.get(pset.getParameter<string>("paramLabel"),paramField);
63  }
64  std::auto_ptr<MagneticField> s(new VolumeBasedMagneticField(pset,builder.barrelLayers(), builder.endcapSectors(), builder.barrelVolumes(), builder.endcapVolumes(), builder.maxR(), builder.maxZ(), paramField.product(), false));
65  return s;
66 }
67 
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< MagBLayer * > barrelLayers() const
Get barrel layers.
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
std::vector< MagVolume6Faces * > barrelVolumes() const
std::auto_ptr< MagneticField > produce(const IdealMagneticFieldRecord &iRecord)
virtual void build(const DDCompactView &cpv)
void get(HolderT &iHolder) const
void setScaling(std::vector< int > keys, std::vector< double > values)
std::vector< MagESector * > endcapSectors() const
Get endcap layers.
tuple pset
Definition: CrabTask.py:85
T const * product() const
Definition: ESHandle.h:62
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:48
std::vector< MagVolume6Faces * > endcapVolumes() const
tuple cout
Definition: gather_cfg.py:41
string s
Definition: asciidump.py:422
#define debug
Definition: MEtoEDMFormat.h:34