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 15 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().

18  {
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) {
34  DDsvalues_type sv(fv.mergedSpecifics());
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 }
type
Definition: HCALResponse.h:21
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &)
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_
std::vector< double > FastTimeParametersFromDD::getDDDArray ( const std::string &  str,
const DDsvalues_type sv 
)
private

Definition at line 76 of file FastTimeParametersFromDD.cc.

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

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

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