CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions
FastTimeParametersFromDD Class Reference

#include <FastTimeParametersFromDD.h>

Public Member Functions

bool build (const DDCompactView *, FastTimeParameters &, const std::string &, const int)
 
 FastTimeParametersFromDD ()
 
virtual ~FastTimeParametersFromDD ()
 

Private Member Functions

std::vector< double > getDDDArray (const std::string &, const DDsvalues_type &)
 

Detailed Description

Definition at line 10 of file FastTimeParametersFromDD.h.

Constructor & Destructor Documentation

FastTimeParametersFromDD::FastTimeParametersFromDD ( )
inline

Definition at line 12 of file FastTimeParametersFromDD.h.

12 {}
virtual FastTimeParametersFromDD::~FastTimeParametersFromDD ( )
inlinevirtual

Definition at line 13 of file FastTimeParametersFromDD.h.

13 {}

Member Function Documentation

bool FastTimeParametersFromDD::build ( const DDCompactView cpv,
FastTimeParameters php,
const std::string &  name,
const int  type 
)

Definition at line 11 of file FastTimeParametersFromDD.cc.

References Exception, alcazmumu_cfi::filter, DDFilteredView::firstChild(), FastTimeParameters::geomParBarrel_, FastTimeParameters::geomParEndcap_, getDDDArray(), DDFilteredView::mergedSpecifics(), mergeVDriftHistosByStation::name, FastTimeParameters::nEtaEndcap_, FastTimeParameters::nPhiBarrel_, FastTimeParameters::nPhiEndcap_, FastTimeParameters::nZBarrel_, convertSQLiteXML::ok, AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, hgcalPerformanceValidation::val, and relativeConstraints::value.

Referenced by FastTimeParametersESModule::produce().

14  {
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) {
28  DDsvalues_type sv(fv.mergedSpecifics());
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 }
Log< level::Info, true > LogVerbatim
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &)
Log< level::Error, false > LogError
std::vector< double > geomParEndcap_
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< double > geomParBarrel_
Log< level::Warning, false > LogWarning
std::vector< double > FastTimeParametersFromDD::getDDDArray ( const std::string &  str,
const DDsvalues_type sv 
)
private

Definition at line 65 of file FastTimeParametersFromDD.cc.

References DDfetch(), DDValue::doubles(), Exception, str, and relativeConstraints::value.

Referenced by build().

65  {
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::Error, false > LogError
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
#define str(s)