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::FastTimeParametersFromDD ( )
inline

Definition at line 12 of file FastTimeParametersFromDD.h.

12 {}

◆ ~FastTimeParametersFromDD()

virtual FastTimeParametersFromDD::~FastTimeParametersFromDD ( )
inlinevirtual

Definition at line 13 of file FastTimeParametersFromDD.h.

13 {}

Member Function Documentation

◆ build()

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

Definition at line 11 of file FastTimeParametersFromDD.cc.

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 }

References Exception, ALCARECOTkAlBeamHalo_cff::filter, DDFilteredView::firstChild(), FastTimeParameters::geomParBarrel_, FastTimeParameters::geomParEndcap_, getDDDArray(), createfilelist::int, DDFilteredView::mergedSpecifics(), Skims_PA_cff::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().

◆ getDDDArray()

std::vector< double > FastTimeParametersFromDD::getDDDArray ( const std::string &  str,
const DDsvalues_type sv 
)
private

Definition at line 65 of file FastTimeParametersFromDD.cc.

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 }

References DDfetch(), Exception, str, pfDeepBoostedJetPreprocessParams_cfi::sv, and relativeConstraints::value.

Referenced by build().

FastTimeParameters::geomParBarrel_
std::vector< double > geomParBarrel_
Definition: FastTimeParameters.h:18
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
pfDeepBoostedJetPreprocessParams_cfi.sv
sv
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:352
str
#define str(s)
Definition: TestProcessor.cc:53
DDfetch
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
ALCARECOTkAlBeamHalo_cff.filter
filter
Definition: ALCARECOTkAlBeamHalo_cff.py:27
FastTimeParameters::nPhiBarrel_
int nPhiBarrel_
Definition: FastTimeParameters.h:15
FastTimeParameters::nEtaEndcap_
int nEtaEndcap_
Definition: FastTimeParameters.h:16
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
FastTimeParameters::nZBarrel_
int nZBarrel_
Definition: FastTimeParameters.h:14
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
createfilelist.int
int
Definition: createfilelist.py:10
value
Definition: value.py:1
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
FastTimeParametersFromDD::getDDDArray
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &)
Definition: FastTimeParametersFromDD.cc:65
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
heppy_batch.val
val
Definition: heppy_batch.py:351
DDValue
Definition: DDValue.h:22
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Exception
Definition: hltDiff.cc:245
FastTimeParameters::geomParEndcap_
std::vector< double > geomParEndcap_
Definition: FastTimeParameters.h:19
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
DDSpecificsMatchesValueFilter
Definition: DDFilter.h:70
DDFilteredView
Definition: DDFilteredView.h:20
DDsvalues_type
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
FastTimeParameters::nPhiEndcap_
int nPhiEndcap_
Definition: FastTimeParameters.h:17