CMS 3D CMS Logo

Functions
DDVectorGetter Namespace Reference

Functions

void beginWith (const std::string &, std::vector< std::string > &)
 
bool check (const std::string &)
 
std::vector< double > get (const std::string &)
 

Function Documentation

◆ beginWith()

void DDVectorGetter::beginWith ( const std::string &  str,
std::vector< std::string > &  vstring 
)

Definition at line 47 of file DDVectorGetter.h.

47  {
48  DDVector::iterator<DDVector> vit;
49  DDVector::iterator<DDVector> ved(DDVector::end());
50 
51  for (; vit != ved; ++vit) {
52  if (vit->isDefined().second) {
53  DDName vname(vit->name());
54  if (vname.name().compare(0, str.size(), str) == 0)
55  vstring.emplace_back(vname.name());
56  }
57  }
58  }

References DDBase< DDName, std::unique_ptr< std::vector< double > > >::end(), and str.

◆ check()

bool DDVectorGetter::check ( const std::string &  str)
inline

Definition at line 13 of file DDVectorGetter.h.

13  {
14  DDVector::iterator<DDVector> vit;
15  DDVector::iterator<DDVector> ved(DDVector::end());
16 
17  for (; vit != ved; ++vit) {
18  if (vit->isDefined().second) {
19  DDName vname(vit->name());
20  if (vname.name() == str)
21  return true;
22  }
23  }
24 
25  return false;
26  }

References DDBase< DDName, std::unique_ptr< std::vector< double > > >::end(), and str.

Referenced by HcalParametersFromDD::build(), TrackerParametersFromDD::build(), and MTDParametersFromDD::build().

◆ get()

std::vector< double > DDVectorGetter::get ( const std::string &  str)
inline

Definition at line 28 of file DDVectorGetter.h.

28  {
29  DDVector::iterator<DDVector> vit;
30  DDVector::iterator<DDVector> ved(DDVector::end());
31  if (vit == ved)
32  throw cms::Exception("DDException") << "DDVectorGetter: vectors are empty, cannot get array " << str;
33 
34  for (; vit != ved; ++vit) {
35  if (vit->isDefined().second) {
36  DDName vname(vit->name());
37  if (vname.name() == str) {
38  const std::vector<double>& fvec = vit->values();
39  return fvec;
40  }
41  }
42  }
43 
44  throw cms::Exception("DDException") << "DDVectorGetter: cannot get array " << str;
45  }

References DDBase< DDName, std::unique_ptr< std::vector< double > > >::end(), Exception, and str.

Referenced by HcalParametersFromDD::build(), MTDParametersFromDD::build(), TrackerParametersFromDD::build(), HGCalGeomParameters::loadCellParsHexagon(), HGCalGeomParameters::loadSpecParsHexagon8(), HGCalGeomParameters::loadSpecParsTrapezoid(), and TrackerGeometricDetESModule::produce().

DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
str
#define str(s)
Definition: TestProcessor.cc:48
DDBase< DDName, std::unique_ptr< std::vector< double > > >::end
static auto end()
Definition: DDBase.h:52
Exception
Definition: hltDiff.cc:246
vstring
vector< string > vstring
Definition: ExoticaDQM.cc:8