CMS 3D CMS Logo

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.

References build(), getDDDArray(), and AlCaHLTBitMon_QueryRunRegistry::string.

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, ALCARECOTkAlBeamHalo_cff::filter, DDFilteredView::firstChild(), FastTimeParameters::geomParBarrel_, FastTimeParameters::geomParEndcap_, getDDDArray(), createfilelist::int, DDFilteredView::mergedSpecifics(), dataset::name, FastTimeParameters::nEtaEndcap_, FastTimeParameters::nPhiBarrel_, FastTimeParameters::nPhiEndcap_, FastTimeParameters::nZBarrel_, convertSQLiteXML::ok, AlCaHLTBitMon_QueryRunRegistry::string, pfDeepBoostedJetPreprocessParams_cfi::sv, groupFilesInBlocks::temp, and heppy_batch::val.

Referenced by FastTimeParametersESModule::produce(), and ~FastTimeParametersFromDD().

13  {
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) {
29  DDsvalues_type sv(fv.mergedSpecifics());
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 }
type
Definition: HCALResponse.h:21
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &)
std::vector< double > geomParEndcap_
Definition: value.py:1
std::vector< double > geomParBarrel_
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< double > FastTimeParametersFromDD::getDDDArray ( const std::string &  str,
const DDsvalues_type sv 
)
private

Definition at line 72 of file FastTimeParametersFromDD.cc.

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

Referenced by build(), and ~FastTimeParametersFromDD().

73  {
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 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:81
Definition: value.py:1
#define str(s)