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 20 of file MagFieldConfig.cc.

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

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, castor_dqm_sourceclient_file_cfg::path, muonDTDigis_cfi::pset, volumeBasedMagneticField_160812_cfi::sectors, AlCaHLTBitMon_QueryRunRegistry::string, contentValuesCheck::values, BeamSplash_cfg::version, volumeBasedMagneticField_160812_cfi::volumes, and HistogramManager_cfi::VPSet().

Member Function Documentation

◆ expandList()

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

Definition at line 76 of file MagFieldConfig.cc.

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

References mps_fire::end, Exception, mps_fire::i, dqmdumpme::k, submitPVValidationJobs::split(), and contentValuesCheck::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
mps_fire.i
i
Definition: mps_fire.py:428
start
Definition: start.py:1
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
MagFieldConfig::gridFiles
magneticfield::TableFileMap gridFiles
Specification of which data table is to be used for each volume.
Definition: MagFieldConfig.h:44
gather_cfg.cout
cout
Definition: gather_cfg.py:144
MagFieldConfig::version
std::string version
Version of the data tables to be used.
Definition: MagFieldConfig.h:41
MagFieldConfig::geometryVersion
int geometryVersion
Version of the geometry to be used.
Definition: MagFieldConfig.h:38
MagFieldConfig::slaveFieldParameters
std::vector< double > slaveFieldParameters
Definition: MagFieldConfig.h:56
debug
#define debug
Definition: HDRShower.cc:19
volumeBasedMagneticField_160812_cfi.volumes
volumes
Definition: volumeBasedMagneticField_160812_cfi.py:57
submitPVValidationJobs.split
def split(sequence, size)
Definition: submitPVValidationJobs.py:352
mps_fire.end
end
Definition: mps_fire.py:242
dqmdumpme.k
k
Definition: dqmdumpme.py:60
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MagFieldConfig::expandList
std::vector< unsigned > expandList(const std::string &list)
Definition: MagFieldConfig.cc:76
HistogramManager_cfi.VPSet
def VPSet(*args)
Definition: HistogramManager_cfi.py:401
MagFieldConfig::keys
std::vector< int > keys
Scaling factors for the field in specific volumes.
Definition: MagFieldConfig.h:47
Exception
Definition: hltDiff.cc:246
MagFieldConfig::values
std::vector< double > values
Definition: MagFieldConfig.h:48
vstring
vector< string > vstring
Definition: ExoticaDQM.cc:8
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
volumeBasedMagneticField_160812_cfi.master
master
Definition: volumeBasedMagneticField_160812_cfi.py:60
volumeBasedMagneticField_160812_cfi.sectors
sectors
Definition: volumeBasedMagneticField_160812_cfi.py:59
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
MagFieldConfig::slaveFieldVersion
std::string slaveFieldVersion
Label or type of the tracker parametrization.
Definition: MagFieldConfig.h:51