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 14 of file FastTimeParametersFromDD.cc.

References gather_cfg::cout, 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().

17  {
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) {
33  DDsvalues_type sv(fv.mergedSpecifics());
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 }
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 75 of file FastTimeParametersFromDD.cc.

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

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

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