CMS 3D CMS Logo

Functions
detgeomdescbuilder Namespace Reference

Functions

void buildDetGeomDescDescendants (DDFilteredView &fv, DetGeomDesc *geoInfoParent, const bool isRun2)
 
std::unique_ptr< DetGeomDescbuildDetGeomDescFromCompactView (const DDCompactView &myCompactView, const bool isRun2)
 
std::unique_ptr< DetGeomDescbuildDetGeomDescFromCompactView (const cms::DDCompactView &myCompactView, const bool isRun2)
 

Function Documentation

◆ buildDetGeomDescDescendants()

void detgeomdescbuilder::buildDetGeomDescDescendants ( DDFilteredView fv,
DetGeomDesc geoInfoParent,
const bool  isRun2 
)

Definition at line 31 of file DetGeomDescBuilder.cc.

References DetGeomDesc::addComponent(), DDFilteredView::firstChild(), geometryPPS_CMSxz_fromDD_2016_cfi::isRun2, DDFilteredView::nextSibling(), DDFilteredView::parent(), and CTPPSDetId::sdTimingDiamond.

Referenced by buildDetGeomDescFromCompactView().

31  {
32  // Leaf
33  if (!fv.firstChild())
34  return;
35 
36  do {
37  // Create node
38  DetGeomDesc* child = new DetGeomDesc(fv, isRun2);
39 
40  // legacy Run2 z sign fix for diamond detectors
41  const auto& detId = child->geographicalID();
42  if (isRun2 && detId.subdetId() == CTPPSDetId::sdTimingDiamond)
43  child->invertZSign();
44 
45  // add the to the geoInfoParent's list.
46  geoInfo->addComponent(child);
47 
48  // Recursion
50  } while (fv.nextSibling());
51 
52  fv.parent();
53 }
bool parent()
set the current node to the parent node ...
bool nextSibling()
set the current node to the next sibling ...
void buildDetGeomDescDescendants(DDFilteredView &fv, DetGeomDesc *geoInfoParent, const bool isRun2)
bool firstChild()
set the current node to the first child ...

◆ buildDetGeomDescFromCompactView() [1/2]

std::unique_ptr< DetGeomDesc > detgeomdescbuilder::buildDetGeomDescFromCompactView ( const DDCompactView myCompactView,
const bool  isRun2 
)

Definition at line 10 of file DetGeomDescBuilder.cc.

References buildDetGeomDescDescendants(), ALCARECOTkAlBeamHalo_cff::filter, and geometryPPS_CMSxz_fromDD_2016_cfi::isRun2.

Referenced by PPSGeometryBuilder::analyze(), CTPPSCompositeESSource::buildGeometry(), TotemGeometryESModule::produce(), and CTPPSGeometryESModule::produceIdealGD().

11  {
12  // Create DDFilteredView (no filter!!)
14  DDFilteredView fv(myCompactView, filter);
15 
16  // Geo info: root node.
17  auto geoInfoRoot = std::make_unique<DetGeomDesc>(fv, isRun2);
18 
19  // Construct the tree of children geo info (DetGeomDesc).
21 
22  edm::LogInfo("PPSGeometryESProducer") << "Successfully built geometry.";
23 
24  return geoInfoRoot;
25 }
void buildDetGeomDescDescendants(DDFilteredView &fv, DetGeomDesc *geoInfoParent, const bool isRun2)
A DDFilter that always returns true.
Definition: DDFilter.h:26
Log< level::Info, false > LogInfo

◆ buildDetGeomDescFromCompactView() [2/2]

std::unique_ptr< DetGeomDesc > detgeomdescbuilder::buildDetGeomDescFromCompactView ( const cms::DDCompactView myCompactView,
const bool  isRun2 
)

Definition at line 58 of file DetGeomDescBuilder.cc.

References cms::DDCompactView::detector(), geometryPPS_CMSxz_fromDD_2016_cfi::isRun2, cms::DDFilteredView::next(), CTPPSDetId::sdTimingDiamond, findQualityFiles::size, and cms::DDDetector::worldVolume().

59  {
60  // create DDFilteredView (no filter!!)
61  const cms::DDDetector* mySystem = myCompactView.detector();
62  const dd4hep::Volume& worldVolume = mySystem->worldVolume();
63  cms::DDFilteredView fv(mySystem, worldVolume);
64  if (fv.next(0) == false) {
65  edm::LogError("PPSGeometryESProducer") << "Filtered view is empty. Cannot build.";
66  }
67 
68  // Geo info: root node.
69  auto geoInfoRoot = std::make_unique<DetGeomDesc>(fv, isRun2);
70 
71  // Construct the tree of children geo info (DetGeomDesc).
72  do {
73  // Create node
74  DetGeomDesc* child = new DetGeomDesc(fv, isRun2);
75 
76  // legacy Run2 z sign fix for diamond detectors
77  const auto& detId = child->geographicalID();
78  if (isRun2 && detId.subdetId() == CTPPSDetId::sdTimingDiamond)
79  child->invertZSign();
80 
81  // add the node to the geoInfoRoot's list.
82  geoInfoRoot->addComponent(child);
83  } while (fv.next(0));
84 
85  edm::LogInfo("PPSGeometryESProducer") << "Successfully built geometry, it has " << (geoInfoRoot->components()).size()
86  << " DetGeomDesc nodes.";
87 
88  return geoInfoRoot;
89 }
size
Write out results.
const cms::DDDetector * detector() const
Definition: DDCompactView.h:34
Log< level::Error, false > LogError
dd4hep::Volume Volume
Log< level::Info, false > LogInfo
dd4hep::Volume worldVolume() const
Handle to the world volume containing everything.
Definition: DDDetector.cc:67