CMS 3D CMS Logo

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