CMS 3D CMS Logo

HcalTB02ParametersFromDD.cc
Go to the documentation of this file.
9 
10 #define EDM_ML_DEBUG
11 
14  DDFilteredView fv(*cpv, filter);
15  bool dodet = fv.firstChild();
16  while (dodet) {
17  const DDSolid& sol = fv.logicalPart().solid();
18  const std::vector<double>& paras = sol.parameters();
19  std::string namx = static_cast<std::string>(sol.name().name());
20  edm::LogVerbatim("HcalTBSim") << "HcalTB02ParametersFromDD (for " << name << "): Solid " << namx << " Shape "
21  << sol.shape() << " Parameter 0 = " << paras[0];
22  if (sol.shape() == DDSolidShape::ddtrap) {
23  double dz = 2 * k_ScaleFromDDDToG4 * paras[0];
24  php.lengthMap_.insert(std::pair<std::string, double>(namx, dz));
25  }
26  dodet = fv.next();
27  }
28  edm::LogVerbatim("HcalTBSim") << "HcalTB02ParametersFromDD: Length Table for ReadOutName = " << name << ":";
29  std::map<std::string, double>::const_iterator it = php.lengthMap_.begin();
30  int i = 0;
31  for (; it != php.lengthMap_.end(); it++, i++) {
32  edm::LogVerbatim("HcalTBSim") << " " << i << " " << it->first << " L = " << it->second;
33  }
34  return true;
35 }
36 
38  const cms::DDFilter filter("ReadOutName", name);
39  cms::DDFilteredView fv(*cpv, filter);
40  while (fv.firstChild()) {
41  std::string namx = static_cast<std::string>(dd4hep::dd::noNamespace(fv.name()));
42  const std::vector<double>& paras = fv.parameters();
43  edm::LogVerbatim("HcalTBSim") << "HcalTB02ParametersFromDD (for " << name << "): Solid " << namx << " Shape "
44  << cms::dd::name(cms::DDSolidShapeMap, fv.shape()) << " Parameter 0 = " << paras[0];
45  if (dd4hep::isA<dd4hep::Trap>(fv.solid())) {
46  double dz = 2 * k_ScaleFromDD4HepToG4 * paras[0];
47  php.lengthMap_.insert(std::pair<std::string, double>(namx, dz));
48  }
49  }
50  edm::LogVerbatim("HcalTBSim") << "HcalTB02ParametersFromDD: Length Table for ReadOutName = " << name << ":";
51  std::map<std::string, double>::const_iterator it = php.lengthMap_.begin();
52  int i = 0;
53  for (; it != php.lengthMap_.end(); it++, i++) {
54  edm::LogVerbatim("HcalTBSim") << " " << i << " " << it->first << " L = " << it->second;
55  }
56  return true;
57 }
mps_fire.i
i
Definition: mps_fire.py:428
cms::DDFilteredView::parameters
const std::vector< double > parameters() const
extract shape parameters
Definition: DDFilteredView.cc:536
MessageLogger.h
DDSolidShape::ddtrap
DDFilteredView::logicalPart
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
Definition: DDFilteredView.cc:16
DDSplit.h
cms::DDFilteredView
Definition: DDFilteredView.h:70
cms::DDFilteredView::name
std::string_view name() const
Definition: DDFilteredView.cc:854
cms::DDFilteredView::solid
dd4hep::Solid solid() const
Definition: DDFilteredView.cc:862
DDSolid::shape
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:119
HcalTB02Parameters
Definition: HcalTB02Parameters.h:9
HcalTB02ParametersFromDD::k_ScaleFromDD4HepToG4
static constexpr double k_ScaleFromDD4HepToG4
Definition: HcalTB02ParametersFromDD.h:21
DDFilteredView::firstChild
bool firstChild()
set the current node to the first child ...
Definition: DDFilteredView.cc:86
cms::DDFilter
Definition: DDFilteredView.h:59
cms::dd::name
std::string name(Mapping a, V value)
Definition: DDSolidShapes.h:31
DDFilteredView::next
bool next()
set current node to the next node in the filtered tree
Definition: DDFilteredView.cc:67
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
DDBase::name
const N & name() const
Definition: DDBase.h:59
cms::DDFilteredView::firstChild
bool firstChild()
set the current node to the first child
Definition: DDFilteredView.cc:268
cms::DDFilteredView::shape
const cms::DDSolidShape shape() const
Definition: DDFilteredView.cc:553
HcalTB02ParametersFromDD.h
ALCARECOTkAlBeamHalo_cff.filter
filter
Definition: ALCARECOTkAlBeamHalo_cff.py:27
DDValue.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalTB02ParametersFromDD::build
bool build(const DDCompactView *cpv, HcalTB02Parameters &php, const std::string &name)
Definition: HcalTB02ParametersFromDD.cc:12
cms::DDSolidShapeMap
const std::array< const cms::dd::NameValuePair< DDSolidShape >, 19 > DDSolidShapeMap
Definition: DDSolidShapes.h:97
DDMaterial.h
DDFilter.h
DDName::name
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
DDLogicalPart.h
HcalTB02Parameters::lengthMap_
std::map< std::string, double > lengthMap_
Definition: HcalTB02Parameters.h:14
PVValHelper::dz
Definition: PVValidationHelpers.h:51
DDValue
Definition: DDValue.h:21
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
cms::DDCompactView
Definition: DDCompactView.h:31
DDSolid::parameters
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:121
HcalTB02ParametersFromDD::k_ScaleFromDDDToG4
static constexpr double k_ScaleFromDDDToG4
Definition: HcalTB02ParametersFromDD.h:20
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
DDSolid
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
DDSpecificsMatchesValueFilter
Definition: DDFilter.h:70
Exception.h
DDFilteredView
Definition: DDFilteredView.h:20
DDLogicalPart::solid
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
Definition: DDLogicalPart.cc:120