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