CMS 3D CMS Logo

FastTimeParametersFromDD.cc
Go to the documentation of this file.
6 
8 #include "CLHEP/Units/GlobalSystemOfUnits.h"
9 #include <iostream>
10 #include <iomanip>
11 
12 //#define EDM_ML_DEBUG
13 
15  FastTimeParameters& php,
16  const std::string& name,
17  const int type) {
18 
19 #ifdef EDM_ML_DEBUG
20  std::cout << "FastTimeParametersFromDD::build called with names " << name
21  << " and type " << type << std::endl;
22 #endif
23 
24  //Special parameters at simulation level
25  std::string attribute = "Volume";
26  const std::string& value = name;
27  DDValue val(attribute, value, 0.0);
29  DDFilteredView fv(*cpv,filter);
30  bool ok = fv.firstChild();
31 
32  if (ok) {
34  std::vector<double> temp;
35  if (type == 1) {
36  php.geomParBarrel_ = getDDDArray("geomParsB", sv);
37  temp = getDDDArray("numberZB", sv);
38  php.nZBarrel_ = (int)(temp[0]);
39  temp = getDDDArray("numberPhiB", sv);
40  php.nPhiBarrel_ = (int)(temp[0]);
41 #ifdef EDM_ML_DEBUG
42  std::cout << "Barrel Parameters: " << php.nZBarrel_ << ":"
43  << php.nPhiBarrel_ << ":" << php.geomParBarrel_[0] << ":"
44  << php.geomParBarrel_[1] << std::endl;
45 #endif
46  } else if (type == 2) {
47  php.geomParEndcap_ = getDDDArray("geomParsE", sv);
48  temp = getDDDArray("numberEtaE", sv);
49  php.nEtaEndcap_ = (int)(temp[0]);
50  temp = getDDDArray("numberPhiE", sv);
51  php.nPhiEndcap_ = (int)(temp[0]);
52 #ifdef EDM_ML_DEBUG
53  std::cout << "Endcap Parameters: " << php.nEtaEndcap_ << ":"
54  << php.nPhiEndcap_ << ":" << php.geomParEndcap_[0] << ":"
55  << php.geomParEndcap_[1] << ":" << php.geomParEndcap_[2]
56  << std::endl;
57 #endif
58  } else {
59  edm::LogWarning("HGCalGeom") << "Unknown Geometry type " << type
60  << " for FastTiming " << name;
61  }
62  } else {
63  edm::LogError("HGCalGeom") << " Attribute " << val
64  << " not found but needed.";
65  throw cms::Exception("DDException") << "Attribute " << val
66  << " not found but needed.";
67  }
68 #ifdef EDM_ML_DEBUG
69  std::cout << "FastTimeParametersFromDD::Returns with flag " << ok
70  << " for " << name << " and type " << type << std::endl;
71 #endif
72  return ok;
73 }
74 
76  const DDsvalues_type & sv) {
77 
78  DDValue value(str);
79  if (DDfetch(&sv,value)) {
80  const std::vector<double> & fvec = value.doubles();
81  int nval = fvec.size();
82  if (nval < 1) {
83  edm::LogError("HGCalGeom") << "HGCalGeomParameters : # of " << str
84  << " bins " << nval << " < 1 ==> illegal";
85  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
86  }
87  return fvec;
88  } else {
89  edm::LogError("HGCalGeom") << "HGCalGeomParameters: cannot get array "
90  << str;
91  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
92  }
93 }
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)