CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Member Functions
cms::DDAlgoArguments Class Reference

#include <DDAlgoArguments.h>

Public Member Functions

std::string childName () const
 Access value of child'name from the xml element. More...
 
double dble (const std::string &nam) const
 Shortcut to access double arguments. More...
 
 DDAlgoArguments (cms::DDParsingContext &, xml_h algorithm)
 
 DDAlgoArguments ()=delete
 
 DDAlgoArguments (const DDAlgoArguments &copy)=delete
 
bool find (const std::string &name) const
 Check the existence of an argument by name. More...
 
int integer (const std::string &nam) const
 Shortcut to access integer arguments. More...
 
DDAlgoArgumentsoperator= (const DDAlgoArguments &copy)=delete
 
std::string parentName () const
 Access value of rParent child node. More...
 
std::string resolveValue (const std::string &value) const
 
std::string str (const std::string &nam) const
 Shortcut to access string arguments. More...
 
template<typename T >
T value (const std::string &name) const
 
template<typename T >
T value (const string &nam) const
 Access typed argument by name. More...
 
template<>
vector< int > value (const string &nam) const
 Access typed vector<int> argument by name. More...
 
template<>
vector< string > value (const string &nam) const
 Access typed vector<string> argument by name. More...
 
template<>
vector< float > value (const string &nam) const
 Access typed vector<float> argument by name. More...
 
template<>
vector< double > value (const string &nam) const
 Access typed vector<double> argument by name. More...
 
template<>
vector< long > value (const string &nam) const
 Access typed vector<long> argument by name. More...
 
std::vector< double > vecDble (const std::string &nam) const
 Shortcut to access vector<double> arguments. More...
 
std::vector< float > vecFloat (const std::string &nam) const
 Shortcut to access vector<float> arguments. More...
 
std::vector< int > vecInt (const std::string &nam) const
 Shortcut to access vector<int> arguments. More...
 
std::vector< std::string > vecStr (const std::string &nam) const
 Shortcut to access vector<string> arguments. More...
 
 ~DDAlgoArguments ()=default
 

Public Attributes

cms::DDParsingContextcontext
 
xml_h element
 
std::string name
 

Private Member Functions

xml_h rawArgument (const std::string &name) const
 Access raw argument as a string by name. More...
 
std::string resolved_scalar_arg (const std::string &name) const
 Access namespace resolved argument as a string by name. More...
 

Detailed Description

Definition at line 28 of file DDAlgoArguments.h.

Constructor & Destructor Documentation

◆ DDAlgoArguments() [1/3]

DDAlgoArguments::DDAlgoArguments ( cms::DDParsingContext ctxt,
xml_h  algorithm 
)

Definition at line 99 of file DDAlgoArguments.cc.

References element, and name.

99  : context(ctxt), element(elt) {
100  name = xml_dim_t(element).nameStr();
101 }
cms::DDParsingContext & context

◆ DDAlgoArguments() [2/3]

cms::DDAlgoArguments::DDAlgoArguments ( )
delete

◆ DDAlgoArguments() [3/3]

cms::DDAlgoArguments::DDAlgoArguments ( const DDAlgoArguments copy)
delete

◆ ~DDAlgoArguments()

cms::DDAlgoArguments::~DDAlgoArguments ( )
default

Member Function Documentation

◆ childName()

string DDAlgoArguments::childName ( ) const

Access value of child'name from the xml element.

Definition at line 112 of file DDAlgoArguments.cc.

References context, and dqmiodumpmetadata::n.

112  {
114  return n.realName(value<string>("ChildName"));
115 }
cms::DDParsingContext & context

◆ dble()

double DDAlgoArguments::dble ( const std::string &  nam) const

Shortcut to access double arguments.

Definition at line 336 of file DDAlgoArguments.cc.

References resolveValue().

336 { return this->value<double>(resolveValue(nam)); }
std::string resolveValue(const std::string &value) const

◆ find()

bool DDAlgoArguments::find ( const std::string &  name) const

Check the existence of an argument by name.

Definition at line 118 of file DDAlgoArguments.cc.

References element, dqmiodumpmetadata::n, name, and AlCaHLTBitMon_ParallelJobs::p.

118  {
119  for (xml_coll_t p(element, _U(star)); p; ++p) {
120  string n = p.attr<string>(_U(name));
121  if (n == nam) {
122  return true;
123  }
124  }
125  return false;
126 }

◆ integer()

int DDAlgoArguments::integer ( const std::string &  nam) const

Shortcut to access integer arguments.

Definition at line 339 of file DDAlgoArguments.cc.

339 { return this->value<int>(nam); }

◆ operator=()

DDAlgoArguments& cms::DDAlgoArguments::operator= ( const DDAlgoArguments copy)
delete

◆ parentName()

string DDAlgoArguments::parentName ( ) const

Access value of rParent child node.

Definition at line 104 of file DDAlgoArguments.cc.

References context, DD_CMU, MillePedeFileConverter_cfg::e, element, dqmiodumpmetadata::n, and heppy_batch::val.

104  {
106  xml_dim_t e(element);
107  string val = n.realName(xml_dim_t(e.child(DD_CMU(rParent))).nameStr());
108  return val;
109 }
#define DD_CMU(a)
Definition: DDXMLTags.h:183
cms::DDParsingContext & context

◆ rawArgument()

xml_h DDAlgoArguments::rawArgument ( const std::string &  name) const
private

Access raw argument as a string by name.

Definition at line 129 of file DDAlgoArguments.cc.

References element, eostools::move(), dqmiodumpmetadata::n, name, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by resolved_scalar_arg().

129  {
130  for (xml_coll_t p(element, _U(star)); p; ++p) {
131  string n = p.attr<string>(_U(name));
132  if (n == nam) {
133  return std::move(p);
134  }
135  }
136  except("DD4CMS", "+++ Attempt to access non-existing algorithm option %s[%s]", name.c_str(), nam.c_str());
137  throw runtime_error("DDCMS: Attempt to access non-existing algorithm option.");
138 }
def move(src, dest)
Definition: eostools.py:511

◆ resolved_scalar_arg()

string DDAlgoArguments::resolved_scalar_arg ( const std::string &  name) const
private

Access namespace resolved argument as a string by name.

Definition at line 141 of file DDAlgoArguments.cc.

References context, rawArgument(), cms::DDNamespace::realName(), and heppy_batch::val.

Referenced by value().

141  {
143  xml_h arg = rawArgument(nam);
144  string val = arg.attr<string>(_U(value));
145  return ns.realName(val);
146 }
xml_h rawArgument(const std::string &name) const
Access raw argument as a string by name.
A arg
Definition: Factorize.h:31
Definition: value.py:1
cms::DDParsingContext & context

◆ resolveValue()

string DDAlgoArguments::resolveValue ( const std::string &  value) const

Definition at line 148 of file DDAlgoArguments.cc.

References context, cms::DDNamespace::context(), cms::DDParsingContext::description, heavyIonCSV_trainingSettings::idx, cms::DDNamespace::name(), NAMESPACE_SEP, alignCSCRings::r, cuy::rep, findQualityFiles::v, and value().

Referenced by dble().

148  {
150  string value(aValue);
151  size_t idx = value.find('[');
152  if (idx == string::npos) {
153  return value;
154  }
155 
156  while (idx != string::npos) {
157  ++idx;
158  size_t idp = value.find(':', idx);
159  size_t idq = value.find(']', idx);
160  if (idp == string::npos || idp > idq)
161  value.insert(idx, ns.name());
162  else if (idp != string::npos && idp < idq)
163  value[idp] = NAMESPACE_SEP;
164  idx = value.find('[', idx);
165  }
166 
167  string rep;
168  string& v = value;
169  size_t idq;
170  for (idx = v.find('[', 0); idx != string::npos; idx = v.find('[', idx + 1)) {
171  idq = v.find(']', idx + 1);
172  rep = v.substr(idx + 1, idq - idx - 1);
173  auto r = ns.context()->description.constants().find(rep);
174  if (r != ns.context()->description.constants().end()) {
175  rep = "(" + r->second->type + ")";
176  v.replace(idx, idq - idx + 1, rep);
177  }
178  }
179  return value;
180 }
T value(const std::string &name) const
Definition: value.py:1
rep
Definition: cuy.py:1189
cms::DDParsingContext & context
#define NAMESPACE_SEP
Definition: DDNamespace.h:92

◆ str()

string DDAlgoArguments::str ( const std::string &  nam) const

Shortcut to access string arguments.

Definition at line 333 of file DDAlgoArguments.cc.

333 { return this->value<string>(nam); }

◆ value() [1/7]

template<typename T >
T cms::DDAlgoArguments::value ( const std::string &  name) const

◆ value() [2/7]

template<typename T >
template string cms::DDAlgoArguments::value< string > ( const string &  nam) const

Access typed argument by name.

Definition at line 291 of file DDAlgoArguments.cc.

References resolved_scalar_arg().

291  {
292  return __cnv<T>(resolved_scalar_arg(nam));
293  }
std::string resolved_scalar_arg(const std::string &name) const
Access namespace resolved argument as a string by name.

◆ value() [3/7]

template<>
vector<long> cms::DDAlgoArguments::value ( const string &  nam) const

Access typed vector<long> argument by name.

Definition at line 321 of file DDAlgoArguments.cc.

321  {
322  return __cnvVect<long>(this, "numeric", rawArgument(nam));
323  }
xml_h rawArgument(const std::string &name) const
Access raw argument as a string by name.

◆ value() [4/7]

template<>
vector<float> cms::DDAlgoArguments::value ( const string &  nam) const

Access typed vector<float> argument by name.

Definition at line 315 of file DDAlgoArguments.cc.

315  {
316  return __cnvVect<float>(this, "numeric", rawArgument(nam));
317  }
xml_h rawArgument(const std::string &name) const
Access raw argument as a string by name.

◆ value() [5/7]

template<>
vector<double> cms::DDAlgoArguments::value ( const string &  nam) const

Access typed vector<double> argument by name.

Definition at line 309 of file DDAlgoArguments.cc.

309  {
310  return __cnvVect<double>(this, "numeric", rawArgument(nam));
311  }
xml_h rawArgument(const std::string &name) const
Access raw argument as a string by name.

◆ value() [6/7]

template<>
vector<string> cms::DDAlgoArguments::value ( const string &  nam) const

Access typed vector<string> argument by name.

Definition at line 303 of file DDAlgoArguments.cc.

303  {
304  return raw_vector(this, rawArgument(nam));
305  }
xml_h rawArgument(const std::string &name) const
Access raw argument as a string by name.

◆ value() [7/7]

template<>
vector<int> cms::DDAlgoArguments::value ( const string &  nam) const

Access typed vector<int> argument by name.

Definition at line 327 of file DDAlgoArguments.cc.

327  {
328  return __cnvVect<int>(this, "numeric", rawArgument(nam));
329  }
xml_h rawArgument(const std::string &name) const
Access raw argument as a string by name.

◆ vecDble()

vector< double > DDAlgoArguments::vecDble ( const std::string &  nam) const

Shortcut to access vector<double> arguments.

Definition at line 342 of file DDAlgoArguments.cc.

342 { return this->value<vector<double> >(nam); }

◆ vecFloat()

vector< float > DDAlgoArguments::vecFloat ( const std::string &  nam) const

Shortcut to access vector<float> arguments.

Definition at line 345 of file DDAlgoArguments.cc.

345 { return this->value<vector<float> >(nam); }

◆ vecInt()

vector< int > DDAlgoArguments::vecInt ( const std::string &  nam) const

Shortcut to access vector<int> arguments.

Definition at line 348 of file DDAlgoArguments.cc.

348 { return this->value<vector<int> >(nam); }

◆ vecStr()

vector< string > DDAlgoArguments::vecStr ( const std::string &  nam) const

Shortcut to access vector<string> arguments.

Definition at line 351 of file DDAlgoArguments.cc.

351 { return this->value<vector<string> >(nam); }

Member Data Documentation

◆ context

cms::DDParsingContext& cms::DDAlgoArguments::context

Definition at line 38 of file DDAlgoArguments.h.

Referenced by childName(), parentName(), resolved_scalar_arg(), and resolveValue().

◆ element

xml_h cms::DDAlgoArguments::element

Definition at line 39 of file DDAlgoArguments.h.

Referenced by DDAlgoArguments(), find(), parentName(), and rawArgument().

◆ name

std::string cms::DDAlgoArguments::name

Definition at line 37 of file DDAlgoArguments.h.

Referenced by ElectronMVAID.ElectronMVAID::__call__(), FWLite.ElectronMVAID::__call__(), dirstructure.Directory::__create_pie_image(), DisplayManager.DisplayManager::__del__(), dqm_interfaces.DirID::__eq__(), dirstructure.Directory::__get_full_path(), dirstructure.Comparison::__get_img_name(), dataset.Dataset::__getDataType(), dataset.Dataset::__getFileInfoList(), dirstructure.Comparison::__make_image(), core.autovars.NTupleVariable::__repr__(), core.autovars.NTupleObjectType::__repr__(), core.autovars.NTupleObject::__repr__(), core.autovars.NTupleCollection::__repr__(), dirstructure.Directory::__repr__(), dqm_interfaces.DirID::__repr__(), dirstructure.Comparison::__repr__(), config.Service::__setattr__(), config.CFG::__str__(), counter.Counter::__str__(), average.Average::__str__(), FWLite.WorkingPoints::_reformat_cut_definitions(), core.autovars.NTupleObjectType::addSubObjects(), core.autovars.NTupleObjectType::addVariables(), core.autovars.NTupleObjectType::allVars(), dataset.CMSDataset::buildListOfFiles(), dataset.LocalDataset::buildListOfFiles(), dataset.CMSDataset::buildListOfFilesDBS(), dirstructure.Directory::calcStats(), DDAlgoArguments(), validation.Sample::digest(), python.rootplot.utilities.Hist::divide(), python.rootplot.utilities.Hist::divide_wilson(), DisplayManager.DisplayManager::Draw(), TreeCrawler.Package::dump(), core.autovars.NTupleVariable::fillBranch(), core.autovars.NTupleObject::fillBranches(), core.autovars.NTupleCollection::fillBranchesScalar(), core.autovars.NTupleCollection::fillBranchesVector(), find(), core.autovars.NTupleCollection::get_cpp_declaration(), core.autovars.NTupleCollection::get_cpp_wrapper_class(), core.autovars.NTupleCollection::get_py_wrapper_class(), utils.StatisticalTest::get_status(), production_tasks.Task::getname(), dataset.CMSDataset::getPrimaryDatasetEntries(), dataset.PrivateDataset::getPrimaryDatasetEntries(), VIDSelectorBase.VIDSelectorBase::initialize(), personalPlayback.Applet::log(), core.autovars.NTupleVariable::makeBranch(), core.autovars.NTupleObject::makeBranches(), core.autovars.NTupleCollection::makeBranchesScalar(), core.autovars.NTupleCollection::makeBranchesVector(), dirstructure.Directory::print_report(), dataset.BaseDataset::printInfo(), dataset.Dataset::printInfo(), rawArgument(), production_tasks.MonitorJobs::run(), python.rootplot.utilities.Hist::TGraph(), python.rootplot.utilities.Hist::TH1F(), counter.Counter::write(), and average.Average::write().