CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Member Functions | Friends
MagFieldConfig Class Reference

#include <MagFieldConfig.h>

Public Member Functions

std::vector< unsigned > expandList (const std::string &list)
 
 MagFieldConfig ()
 
 MagFieldConfig (const edm::ParameterSet &pset, bool debug=false)
 Constructor. More...
 

Public Attributes

int geometryVersion
 Version of the geometry to be used. More...
 
magneticfield::TableFileMap gridFiles
 Specification of which data table is to be used for each volume. More...
 
std::vector< int > keys
 Scaling factors for the field in specific volumes. More...
 
std::vector< double > slaveFieldParameters
 
std::string slaveFieldVersion
 Label or type of the tracker parametrization. More...
 
std::vector< double > values
 
std::string version
 Version of the data tables to be used. More...
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

No description available.

Author
N. Amapane - Torino

Definition at line 26 of file MagFieldConfig.h.

Constructor & Destructor Documentation

◆ MagFieldConfig() [1/2]

MagFieldConfig::MagFieldConfig ( )
inline

Definition at line 28 of file MagFieldConfig.h.

28 {}

◆ MagFieldConfig() [2/2]

MagFieldConfig::MagFieldConfig ( const edm::ParameterSet pset,
bool  debug = false 
)

Constructor.

Definition at line 19 of file MagFieldConfig.cc.

References filterCSVwithJSON::copy, gather_cfg::cout, debug, Exception, volumeBasedMagneticField_160812_cfi::geometryVersion, volumeBasedMagneticField_160812_cfi::gridFiles, mps_fire::i, dqmiolumiharvest::j, relativeConstraints::keys, volumeBasedMagneticField_160812_cfi::master, EnsembleCalibrationLA_cfg::path, muonDTDigis_cfi::pset, mergeVDriftHistosByStation::sectors, AlCaHLTBitMon_QueryRunRegistry::string, contentValuesCheck::values, relval_steps::version, volumeBasedMagneticField_160812_cfi::volumes, and HistogramManager_cfi::VPSet().

19  {
20  version = pset.getParameter<std::string>("version");
21  geometryVersion = pset.getParameter<int>("geometryVersion");
22 
23  // Get specification for the grid tables to be used.
24  typedef vector<edm::ParameterSet> VPSet;
25 
26  VPSet fileSpec = pset.getParameter<VPSet>("gridFiles");
27  if (!fileSpec.empty()) {
28  for (VPSet::const_iterator rule = fileSpec.begin(); rule != fileSpec.end(); ++rule) {
29  string s_volumes = rule->getParameter<string>("volumes");
30  string s_sectors = rule->getParameter<string>("sectors"); // 0 means all volumes
31  int master = rule->getParameter<int>("master");
32  string path = rule->getParameter<string>("path");
33 
34  vector<unsigned> volumes = expandList(s_volumes);
35  vector<unsigned> sectors = expandList(s_sectors);
36 
37  if (debug) {
38  cout << "Volumes: " << s_volumes << " Sectors: " << s_sectors << " Master: " << master << " Path: " << path
39  << endl;
40  cout << " Expanded volumes: ";
41  copy(volumes.begin(), volumes.end(), ostream_iterator<unsigned>(cout, " "));
42  cout << endl;
43  cout << " Expanded sectors: ";
44  copy(sectors.begin(), sectors.end(), ostream_iterator<unsigned>(cout, " "));
45  cout << endl;
46  }
47 
48  for (vector<unsigned>::iterator i = volumes.begin(); i != volumes.end(); ++i) {
49  for (vector<unsigned>::iterator j = sectors.begin(); j != sectors.end(); ++j) {
50  unsigned vpacked = (*i) * 100 + (*j);
51  if (gridFiles.find(vpacked) == gridFiles.end()) {
52  gridFiles[vpacked] = make_pair(path, master);
53  } else {
54  throw cms::Exception("ConfigurationError")
55  << "VolumeBasedMagneticFieldESProducer: malformed gridFiles config parameter" << endl;
56  }
57  }
58  }
59  }
60  }
61 
62  // Get scaling factors
63  keys = pset.getParameter<vector<int> >("scalingVolumes");
64  values = pset.getParameter<vector<double> >("scalingFactors");
65 
66  // Slave field label. Either a label of an existing map (legacy support), or the
67  // type of parametrization to be constructed with the "paramData" parameters.
68  slaveFieldVersion = pset.getParameter<string>("paramLabel");
69  // Check for compatibility with older configurations
70  if (pset.existsAs<vector<double> >("paramData")) {
71  slaveFieldParameters = pset.getParameter<vector<double> >("paramData");
72  }
73 }
std::vector< double > values
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.
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.
int geometryVersion
Version of the geometry to be used.
std::vector< unsigned > expandList(const std::string &list)
std::vector< double > slaveFieldParameters

Member Function Documentation

◆ expandList()

vector< unsigned > MagFieldConfig::expandList ( const std::string &  list)

Definition at line 75 of file MagFieldConfig.cc.

References Exception, mps_fire::i, isotrackApplyRegressor::k, submitPVValidationJobs::split(), and contentValuesCheck::values.

75  {
76  typedef vector<string> vstring;
77  vector<unsigned> values;
78  vstring v1;
79  boost::split(v1, list, boost::is_any_of(","));
80  for (vstring::const_iterator i = v1.begin(); i != v1.end(); ++i) {
81  vstring v2;
82  boost::split(v2, *i, boost::is_any_of("-"));
83  unsigned start = std::stoul(v2.front());
84  unsigned end = std::stoul(v2.back());
85  if ((v2.size() > 2) || (start > end)) {
86  throw cms::Exception("ConfigurationError")
87  << "VolumeBasedMagneticFieldESProducerFromDB: malformed configuration" << list << endl;
88  }
89  for (unsigned k = start; k <= end; ++k) {
90  values.push_back(k);
91  }
92  }
93  return values;
94 }
Definition: start.py:1
vector< string > vstring
Definition: ExoticaDQM.cc:7
std::vector< double > values

◆ serialize()

template<class Archive >
void MagFieldConfig::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 58 of file MagFieldConfig.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 58 of file MagFieldConfig.h.

Member Data Documentation

◆ geometryVersion

int MagFieldConfig::geometryVersion

◆ gridFiles

magneticfield::TableFileMap MagFieldConfig::gridFiles

Specification of which data table is to be used for each volume.

Definition at line 44 of file MagFieldConfig.h.

Referenced by magneticfield::VolumeBasedMagneticFieldESProducer::produce(), and magneticfield::DD4hep_VolumeBasedMagneticFieldESProducer::produce().

◆ keys

std::vector<int> MagFieldConfig::keys

◆ slaveFieldParameters

std::vector<double> MagFieldConfig::slaveFieldParameters

Parameters for the tracker parametrization (not used in legacy producers where slaveFieldVersion is the label of the parametrization in the EventSetup)

Definition at line 56 of file MagFieldConfig.h.

◆ slaveFieldVersion

std::string MagFieldConfig::slaveFieldVersion

Label or type of the tracker parametrization.

Definition at line 51 of file MagFieldConfig.h.

◆ values

std::vector<double> MagFieldConfig::values

◆ version

std::string MagFieldConfig::version