CMS 3D CMS Logo

FastTimeParametersFromDD.cc
Go to the documentation of this file.
6 
8 
9 //#define EDM_ML_DEBUG
10 
12  FastTimeParameters& php,
13  const std::string& name,
14  const int type) {
15 #ifdef EDM_ML_DEBUG
16  edm::LogVerbatim("HGCalGeom") << "FastTimeParametersFromDD::build called with names " << name << " and type " << type;
17 #endif
18 
19  // Special parameters at simulation level
20  std::string attribute = "Volume";
21  const std::string& value = name;
22  DDValue val(attribute, value, 0.0);
24  DDFilteredView fv(*cpv, filter);
25  bool ok = fv.firstChild();
26 
27  if (ok) {
29  std::vector<double> temp;
30  if (type == 1) {
31  php.geomParBarrel_ = getDDDArray("geomParsB", sv);
32  temp = getDDDArray("numberZB", sv);
33  php.nZBarrel_ = (int)(temp[0]);
34  temp = getDDDArray("numberPhiB", sv);
35  php.nPhiBarrel_ = (int)(temp[0]);
36 #ifdef EDM_ML_DEBUG
37  edm::LogVerbatim("HGCalGeom") << "Barrel Parameters: " << php.nZBarrel_ << ":" << php.nPhiBarrel_ << ":"
38  << php.geomParBarrel_[0] << ":" << php.geomParBarrel_[1];
39 #endif
40  } else if (type == 2) {
41  php.geomParEndcap_ = getDDDArray("geomParsE", sv);
42  temp = getDDDArray("numberEtaE", sv);
43  php.nEtaEndcap_ = (int)(temp[0]);
44  temp = getDDDArray("numberPhiE", sv);
45  php.nPhiEndcap_ = (int)(temp[0]);
46 #ifdef EDM_ML_DEBUG
47  edm::LogVerbatim("HGCalGeom") << "Endcap Parameters: " << php.nEtaEndcap_ << ":" << php.nPhiEndcap_ << ":"
48  << php.geomParEndcap_[0] << ":" << php.geomParEndcap_[1] << ":"
49  << php.geomParEndcap_[2];
50 #endif
51  } else {
52  edm::LogWarning("HGCalGeom") << "Unknown Geometry type " << type << " for FastTiming " << name;
53  }
54  } else {
55  edm::LogError("HGCalGeom") << " Attribute " << val << " not found but needed.";
56  throw cms::Exception("DDException") << "Attribute " << val << " not found but needed.";
57  }
58 #ifdef EDM_ML_DEBUG
59  edm::LogVerbatim("HGCalGeom") << "FastTimeParametersFromDD::Returns with flag " << ok << " for " << name
60  << " and type " << type;
61 #endif
62  return ok;
63 }
64 
66  DDValue value(str);
67  if (DDfetch(&sv, value)) {
68  const std::vector<double>& fvec = value.doubles();
69  int nval = fvec.size();
70  if (nval < 1) {
71  edm::LogError("HGCalGeom") << "HGCalGeomParameters : # of " << str << " bins " << nval << " < 1 ==> illegal";
72  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
73  }
74  return fvec;
75  } else {
76  edm::LogError("HGCalGeom") << "HGCalGeomParameters: cannot get array " << str;
77  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
78  }
79 }
Log< level::Info, true > LogVerbatim
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &)
Log< level::Error, false > LogError
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
std::vector< double > geomParEndcap_
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
Definition: value.py:1
DDsvalues_type mergedSpecifics() const
std::vector< double > geomParBarrel_
bool build(const DDCompactView *, FastTimeParameters &, const std::string &, const int)
bool firstChild()
set the current node to the first child ...
Log< level::Warning, false > LogWarning
#define str(s)