CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 15 of file FastTimeParametersFromDD.cc.

References DDFilteredView::addFilter(), gather_cfg::cout, equals, 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, DDSpecificsFilter::setCriteria(), AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, SpecificationBuilder_cfi::val(), and relativeConstraints::value.

Referenced by FastTimeParametersESModule::produce().

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";
28  DDValue val(attribute, value, 0.0);
31  DDFilteredView fv(*cpv);
32  fv.addFilter(filter);
33  bool ok = fv.firstChild();
34 
35  if (ok) {
36  DDsvalues_type sv(fv.mergedSpecifics());
37  std::vector<double> temp;
38  if (type == 1) {
39  php.geomParBarrel_ = getDDDArray("geomParsB", sv);
40  temp = getDDDArray("numberZB", sv);
41  php.nZBarrel_ = (int)(temp[0]);
42  temp = getDDDArray("numberPhiB", sv);
43  php.nPhiBarrel_ = (int)(temp[0]);
44 #ifdef EDM_ML_DEBUG
45  std::cout << "Barrel Parameters: " << php.nZBarrel_ << ":"
46  << php.nPhiBarrel_ << ":" << php.geomParBarrel_[0] << ":"
47  << php.geomParBarrel_[1] << std::endl;
48 #endif
49  } else if (type == 2) {
50  php.geomParEndcap_ = getDDDArray("geomParsE", sv);
51  temp = getDDDArray("numberEtaE", sv);
52  php.nEtaEndcap_ = (int)(temp[0]);
53  temp = getDDDArray("numberPhiE", sv);
54  php.nPhiEndcap_ = (int)(temp[0]);
55 #ifdef EDM_ML_DEBUG
56  std::cout << "Endcap Parameters: " << php.nEtaEndcap_ << ":"
57  << php.nPhiEndcap_ << ":" << php.geomParEndcap_[0] << ":"
58  << php.geomParEndcap_[1] << ":" << php.geomParEndcap_[2]
59  << std::endl;
60 #endif
61  } else {
62  edm::LogWarning("HGCalGeom") << "Unknown Geometry type " << type
63  << " for FastTiming " << name;
64  }
65  } else {
66  edm::LogError("HGCalGeom") << " Attribute " << val
67  << " not found but needed.";
68  throw cms::Exception("DDException") << "Attribute " << val
69  << " not found but needed.";
70  }
71 #ifdef EDM_ML_DEBUG
72  std::cout << "FastTimeParametersFromDD::Returns with flag " << ok
73  << " for " << name << " and type " << type << std::endl;
74 #endif
75  return ok;
76 }
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
std::vector< double > geomParBarrel_
tuple cout
Definition: gather_cfg.py:145
void setCriteria(const DDValue &nameVal, DDCompOp, DDLogOp l=DDLogOp::AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:253
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:33
std::vector< double > FastTimeParametersFromDD::getDDDArray ( const std::string &  str,
const DDsvalues_type sv 
)
private

Definition at line 78 of file FastTimeParametersFromDD.cc.

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

Referenced by build().

79  {
80 
81  DDValue value(str);
82  if (DDfetch(&sv,value)) {
83  const std::vector<double> & fvec = value.doubles();
84  int nval = fvec.size();
85  if (nval < 1) {
86  edm::LogError("HGCalGeom") << "HGCalGeomParameters : # of " << str
87  << " bins " << nval << " < 1 ==> illegal";
88  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
89  }
90  return fvec;
91  } else {
92  edm::LogError("HGCalGeom") << "HGCalGeomParameters: cannot get array "
93  << str;
94  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
95  }
96 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:80