CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Private Attributes
HcalTB02ParametersFromDD Class Reference

#include <HcalTB02ParametersFromDD.h>

Public Member Functions

bool build (const DDCompactView *cpv, HcalTB02Parameters &php, const std::string &name)
 
bool build (const cms::DDCompactView *cpv, HcalTB02Parameters &php, const std::string &name)
 
 HcalTB02ParametersFromDD ()=default
 

Static Private Attributes

static constexpr double k_ScaleFromDD4hepToG4 = (1.0 / dd4hep::mm)
 
static constexpr double k_ScaleFromDDDToG4 = 1.0
 

Detailed Description

Definition at line 13 of file HcalTB02ParametersFromDD.h.

Constructor & Destructor Documentation

HcalTB02ParametersFromDD::HcalTB02ParametersFromDD ( )
default

Member Function Documentation

bool HcalTB02ParametersFromDD::build ( const DDCompactView cpv,
HcalTB02Parameters php,
const std::string &  name 
)

Definition at line 10 of file HcalTB02ParametersFromDD.cc.

References ddtrap, PVValHelper::dz, alcazmumu_cfi::filter, DDFilteredView::firstChild(), mps_fire::i, k_ScaleFromDDDToG4, HcalTB02Parameters::lengthMap_, DDFilteredView::logicalPart(), DDName::name(), DDBase< N, C >::name(), DDFilteredView::next(), DDSolid::parameters(), DDSolid::shape(), DDLogicalPart::solid(), and AlCaHLTBitMon_QueryRunRegistry::string.

10  {
12  DDFilteredView fv(*cpv, filter);
13  bool dodet = fv.firstChild();
14  while (dodet) {
15  const DDSolid& sol = fv.logicalPart().solid();
16  const std::vector<double>& paras = sol.parameters();
17  std::string namx = static_cast<std::string>(sol.name().name());
18  edm::LogVerbatim("HcalTBSim") << "HcalTB02ParametersFromDD (for " << name << "): Solid " << namx << " Shape "
19  << sol.shape() << " Parameter 0 = " << paras[0];
20  if (sol.shape() == DDSolidShape::ddtrap) {
21  double dz = 2 * k_ScaleFromDDDToG4 * paras[0];
22  php.lengthMap_.insert(std::pair<std::string, double>(namx, dz));
23  }
24  dodet = fv.next();
25  }
26  edm::LogVerbatim("HcalTBSim") << "HcalTB02ParametersFromDD: Length Table for ReadOutName = " << name << ":";
27  std::map<std::string, double>::const_iterator it = php.lengthMap_.begin();
28  int i = 0;
29  for (; it != php.lengthMap_.end(); it++, i++) {
30  edm::LogVerbatim("HcalTBSim") << " " << i << " " << it->first << " L = " << it->second;
31  }
32  return true;
33 }
Log< level::Info, true > LogVerbatim
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
const N & name() const
Definition: DDBase.h:59
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
std::map< std::string, double > lengthMap_
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:123
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
static constexpr double k_ScaleFromDDDToG4
bool HcalTB02ParametersFromDD::build ( const cms::DDCompactView cpv,
HcalTB02Parameters php,
const std::string &  name 
)

Definition at line 35 of file HcalTB02ParametersFromDD.cc.

References cms::DDSolidShapeMap, PVValHelper::dz, alcazmumu_cfi::filter, cms::DDFilteredView::firstChild(), mps_fire::i, k_ScaleFromDD4hepToG4, HcalTB02Parameters::lengthMap_, cms::dd::name(), cms::DDFilteredView::name(), cms::DDFilteredView::parameters(), cms::DDFilteredView::shape(), cms::DDFilteredView::solid(), and AlCaHLTBitMon_QueryRunRegistry::string.

35  {
36  const cms::DDFilter filter("ReadOutName", name);
37  cms::DDFilteredView fv(*cpv, filter);
38  while (fv.firstChild()) {
39  std::string namx = static_cast<std::string>(dd4hep::dd::noNamespace(fv.name()));
40  const std::vector<double>& paras = fv.parameters();
41  edm::LogVerbatim("HcalTBSim") << "HcalTB02ParametersFromDD (for " << name << "): Solid " << namx << " Shape "
42  << cms::dd::name(cms::DDSolidShapeMap, fv.shape()) << " Parameter 0 = " << paras[0];
43  if (dd4hep::isA<dd4hep::Trap>(fv.solid())) {
44  double dz = 2 * k_ScaleFromDD4hepToG4 * paras[0];
45  php.lengthMap_.insert(std::pair<std::string, double>(namx, dz));
46  }
47  }
48  edm::LogVerbatim("HcalTBSim") << "HcalTB02ParametersFromDD: Length Table for ReadOutName = " << name << ":";
49  std::map<std::string, double>::const_iterator it = php.lengthMap_.begin();
50  int i = 0;
51  for (; it != php.lengthMap_.end(); it++, i++) {
52  edm::LogVerbatim("HcalTBSim") << " " << i << " " << it->first << " L = " << it->second;
53  }
54  return true;
55 }
Log< level::Info, true > LogVerbatim
static constexpr double k_ScaleFromDD4hepToG4
std::string name(Mapping a, V value)
Definition: DDSolidShapes.h:31
std::map< std::string, double > lengthMap_
const std::array< const cms::dd::NameValuePair< DDSolidShape >, 21 > DDSolidShapeMap
Definition: DDSolidShapes.h:99

Member Data Documentation

constexpr double HcalTB02ParametersFromDD::k_ScaleFromDD4hepToG4 = (1.0 / dd4hep::mm)
staticprivate

Definition at line 22 of file HcalTB02ParametersFromDD.h.

Referenced by build().

constexpr double HcalTB02ParametersFromDD::k_ScaleFromDDDToG4 = 1.0
staticprivate

Definition at line 21 of file HcalTB02ParametersFromDD.h.

Referenced by build().