CMS 3D CMS Logo

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

Compact representation of the geometrical detector hierarchy. More...

#include <DDCompactView.h>

Public Types

using Graph = math::Graph< DDLogicalPart, DDPosData * >
 
using GraphWalker = math::GraphWalker< DDLogicalPart, DDPosData * >
 
using Vectors = std::unordered_map< std::string, std::vector< double >>
 

Public Member Functions

 DDCompactView ()
 Creates a compact-view. More...
 
 DDCompactView (const DDName &)
 Creates a compact-view using a different root of the geometry hierarchy. More...
 
 DDCompactView (const DDLogicalPart &rootnodedata)
 Creates a compact-view using a different root of the geometry hierarchy. More...
 
const Graphgraph () const
 Provides read-only access to the data structure of the compact-view. More...
 
void lockdown ()
 
void position (const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
 
void position (const DDLogicalPart &self, const DDLogicalPart &parent, int copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
 
const DDLogicalPartroot () const
 returns the DDLogicalPart representing the root of the geometrical hierarchy More...
 
void setRoot (const DDLogicalPart &root)
 
std::vector< double > const & vector (std::string_view iKey) const
 returns an empty container if not found More...
 
GraphWalker walker () const
 
const DDPosDataworldPosition () const
 The absolute position of the world. More...
 
 ~DDCompactView ()
 

Private Member Functions

void swap (DDCompactView &)
 

Private Attributes

DDI::Store< DDName,
std::unique_ptr
< DDI::LogicalPart > > 
lpStore_
 
DDI::Store< DDName,
std::unique_ptr< DDI::Material > > 
matStore_
 
std::unique_ptr
< DDCompactViewImpl
rep_
 
DDI::Store< DDName,
std::unique_ptr
< DDRotationMatrix > > 
rotStore_
 
DDI::Store< DDName,
std::unique_ptr< DDI::Solid > > 
solidStore_
 
DDI::Store< DDName,
std::unique_ptr< DDI::Specific > > 
specStore_
 
Vectors vectors_
 
std::unique_ptr< DDPosDataworldpos_
 

Detailed Description

Compact representation of the geometrical detector hierarchy.

Navigation through the compact view of the detector ... A DDCompactView represents the detector as an acyclic directed multigraph. The nodes are instances of DDLogicalPart while the edges are pointers to DDPosData. Edges are directed from parent-node to child-node. Edges represented by DDPosData are the relative translation and rotation accompanied by a copy-number of the child-node towards the parent-node.

One node is explicitly marked as the root node. It is the DDLogicalPart which defines the base coordinate system for the detector. All subdetectors are directly or inderectly positioned inside the root-node.

Example:

The figureshows a compact-view graph consisting of 16 DDLogicalParts interconnected by 20 edges represented by pointers to DDPosData.

compact-view.gif

The compact-view also serves as base for calculating nodes in the expanded view. Paths through the compact-view can be viewed as nodes in the expanded-view (expansion of an acyclic directed multigraph into a tree). In the figure there are 5 different paths from CMS to Module2 (e.g. CMS-Pos1->Ecal-Pos4->EEndcap-Pos21->Module2) thus there will be 5 nodes of Module2 in the expanded view.

MEC: There has been a re-purposing of the DDCompactView to not only hold the representation described above (in detail this is the DDCompactViewImpl) but also own the memory of the stores refered to by the graph.

DDCompactView now owns the DDMaterial, DDSpecific, DDLogicalPart, DDRotation, DDSolid and etc. Removal of the global one-and-only stores, methods and details such as DDRoot will mean that all of these will be accessed via the DDCompactView.

Description: DD Compact View Facade

Implementation: The DDCompactView facade serves as a launching point for a broader refactor of monolithic or tightly-coupled systems in favor of more loosely-coupled code.

Definition at line 81 of file DDCompactView.h.

Member Typedef Documentation

Definition at line 83 of file DDCompactView.h.

Definition at line 84 of file DDCompactView.h.

using DDCompactView::Vectors = std::unordered_map<std::string, std::vector<double>>

Definition at line 85 of file DDCompactView.h.

Constructor & Destructor Documentation

DDCompactView::DDCompactView ( )
explicit

Creates a compact-view.

Definition at line 100 of file DDCompactView.cc.

101  : rep_(std::make_unique<DDCompactViewImpl>()),
102  worldpos_(std::make_unique<DDPosData>(DDTranslation(), DDRotation(), 0)) {}
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
std::unique_ptr< DDPosData > worldpos_
std::unique_ptr< DDCompactViewImpl > rep_
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDCompactView::DDCompactView ( const DDName name)
explicit

Creates a compact-view using a different root of the geometry hierarchy.

Definition at line 42 of file DDCompactView.cc.

References DDI::Singleton< I >::instance(), rep_, and worldpos_.

42  {
43  DDMaterial::StoreT::instance().setReadOnly(false);
44  DDSolid::StoreT::instance().setReadOnly(false);
45  DDLogicalPart::StoreT::instance().setReadOnly(false);
46  DDSpecifics::StoreT::instance().setReadOnly(false);
47  DDRotation::StoreT::instance().setReadOnly(false);
48  rep_ = std::make_unique<DDCompactViewImpl>(DDLogicalPart(name));
49  worldpos_ = std::make_unique<DDPosData>(DDTranslation(), DDRotation(), 0);
50 }
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
static value_type & instance()
std::unique_ptr< DDPosData > worldpos_
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
std::unique_ptr< DDCompactViewImpl > rep_
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDCompactView::~DDCompactView ( )
default
DDCompactView::DDCompactView ( const DDLogicalPart rootnodedata)
explicit

Creates a compact-view using a different root of the geometry hierarchy.

Compact-views can be created only after an appropriate geometrical hierarchy has been defined using DDpos().

Further it is assumed that the DDLogicalPart defining the root of the geometrical hierarchy has been defined using DDRootDef - singleton. It will be extracted from this singleton using DDRootDef::instance().root()!

The first time this constructor gets called, the internal graph representation is build up. Subsequent calls will return immidiately providing access to the already built up compact-view representation.

Currently the only usefull methods are DDCompactView::graph(), DDCompactView::root() !

Definition at line 38 of file DDCompactView.cc.

39  : rep_(std::make_unique<DDCompactViewImpl>(rootnodedata)),
40  worldpos_(std::make_unique<DDPosData>(DDTranslation(), DDRotation(), 0)) {}
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
std::unique_ptr< DDPosData > worldpos_
std::unique_ptr< DDCompactViewImpl > rep_
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7

Member Function Documentation

const DDCompactView::Graph & DDCompactView::graph ( ) const

Provides read-only access to the data structure of the compact-view.

The compact-view is kept in an acyclic directed multigraph represented by an instance of class Graph<DDLogicalPart, DDPosData*). Graph provides methods for navigating its content.

Definition at line 59 of file DDCompactView.cc.

References rep_.

Referenced by PrintGeomSolids::analyze(), PrintGeomSummary::beginRun(), DDG4Builder::BuildGeometry(), DDCheckAll(), DDCheckConnect(), DDCompareCPV(), ddstats(), GeometryInfoDump::dumpInfo(), and DDErrorDetection::lp_cpv().

59 { return rep_->graph(); }
std::unique_ptr< DDCompactViewImpl > rep_
void DDCompactView::lockdown ( )

Definition at line 104 of file DDCompactView.cc.

References DDBase< DDName, std::unique_ptr< std::vector< double > > >::end(), DDI::Singleton< I >::instance(), lpStore_, matStore_, rotStore_, solidStore_, specStore_, and vectors_.

Referenced by CompareDDCompactViews::beginRun().

104  {
105  // at this point we should have a valid store of DDObjects and we will move these
106  // to the local storage area using swaps with the existing Singleton<Store...>'s
112 
113  //Deal with DDVectors
114  DDVector::iterator<DDVector> vit;
115  DDVector::iterator<DDVector> ved(DDVector::end());
116 
117  for (; vit != ved; ++vit) {
118  if (vit->isDefined().second) {
119  DDName vname(vit->name());
120  vectors_.emplace(vname.name(), vit->values());
121  }
122  }
123  // NOTE: would be good to clear DDVector's container at this time
124  // to avoid mixing with other DDCompactViews. Unclear if that is
125  // safe to do.
126 
127  // FIXME: lock the global stores.
128  DDMaterial::StoreT::instance().setReadOnly(false);
129  DDSolid::StoreT::instance().setReadOnly(false);
130  DDLogicalPart::StoreT::instance().setReadOnly(false);
131  DDSpecifics::StoreT::instance().setReadOnly(false);
132  DDRotation::StoreT::instance().setReadOnly(false);
133 }
Vectors vectors_
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
static value_type & instance()
DDI::Store< DDName, std::unique_ptr< DDI::Solid > > solidStore_
DDI::Store< DDName, std::unique_ptr< DDI::Specific > > specStore_
DDI::Store< DDName, std::unique_ptr< DDI::LogicalPart > > lpStore_
DDI::Store< DDName, std::unique_ptr< DDI::Material > > matStore_
DDI::Store< DDName, std::unique_ptr< DDRotationMatrix > > rotStore_
void DDCompactView::position ( const DDLogicalPart self,
const DDLogicalPart parent,
const std::string &  copyno,
const DDTranslation trans,
const DDRotation rot,
const DDDivision div = nullptr 
)

Definition at line 76 of file DDCompactView.cc.

Referenced by DDHGCalTBModuleX::constructBlocks(), DDHCalBarrelAlgo::constructGeneralVolume(), DDHCalEndcapAlgo::constructGeneralVolume(), DDHCalBarrelAlgo::constructInsideDetectors(), DDHCalBarrelAlgo::constructInsideLayers(), DDHCalEndcapModuleAlgo::constructInsideModule(), DDHCalEndcapAlgo::constructInsideModule(), DDHCalEndcapModuleAlgo::constructInsideModule0(), DDHCalEndcapAlgo::constructInsideModule0(), DDHCalBarrelAlgo::constructInsideSector(), DDHCalEndcapAlgo::constructInsideSector(), DDHGCalTBModule::constructLayers(), DDHGCalTBModuleX::constructLayers(), DDAHcalModuleAlgo::constructLayers(), DDHGCalModule::constructLayers(), DDHGCalModuleAlgo::constructLayers(), DDHGCalEEAlgo::constructLayers(), DDHGCalHEAlgo::constructLayers(), DDHGCalHEFileAlgo::constructLayers(), DDHGCalEEFileAlgo::constructLayers(), DDHGCalMixLayer::constructLayers(), DDHGCalSiliconModule::constructLayers(), DDHCalBarrelAlgo::constructMidLayer(), DDHCalEndcapModuleAlgo::constructScintLayer(), DDHCalEndcapAlgo::constructScintLayer(), DDHCalBarrelAlgo::constructSideLayer(), DDHGCalNoTaperEndcap::createQuarter(), DDEcalPreshowerAlgo::doLadders(), DDEcalPreshowerAlgoTB::doLayers(), DDEcalPreshowerAlgo::doLayers(), DDTECModuleAlgo::doPos(), DDEcalPreshowerAlgoTB::doSens(), DDEcalPreshowerAlgo::doSens(), DDEcalPreshowerAlgoTB::doWedges(), DDEcalEndcapAlgo::EECreateSC(), DDEcalEndcapAlgo::EEPositionCRs(), DDTBH4Algo::execute(), DDHGCalCell::execute(), DDHGCalWafer8::execute(), DDTOBRodAlgo::execute(), DDTrackerZPosAlgo::execute(), DDTrackerXYZPosAlgo::execute(), DDEcalAPDAlgo::execute(), DDLinear::execute(), DDTIDModulePosAlgo::execute(), DDTrackerAngular::execute(), DDAngular::execute(), DDTotemAngular::execute(), DDHGCalWaferP::execute(), DDTrackerLinear::execute(), DDTrackerPhiAltAlgo::execute(), DDTrackerPhiAlgo::execute(), DDHGCalWafer::execute(), DDMTDLinear::execute(), DDHCalLinearXY::execute(), DDTIDRingAlgo::execute(), DDHCalTestBeamAlgo::execute(), DDPixFwdDiskAlgo::execute(), DDTOBAxCableAlgo::execute(), DDTECPhiAlgo::execute(), DDTIDAxialCableAlgo::execute(), DDTECOptoHybAlgo::execute(), DDTECPhiAltAlgo::execute(), DDTIDModuleAlgo::execute(), DDTOBRadCableAlgo::execute(), DDDividedGeometryObject::execute(), DDHGCalWaferAlgo::execute(), DDHCalXtalAlgo::execute(), DDHCalAngular::execute(), DDPixPhase1FwdDiskAlgo::execute(), DDHCalTBZposAlgo::execute(), DDMuonAngular::execute(), DDGEMAngular::execute(), DDHGCalWaferF::execute(), DDCutTubsFromPoints::execute(), DDHGCalWaferFullRotated::execute(), DDPixBarLayerUpgradeAlgo::execute(), DDPixBarLayerAlgo::execute(), DDHCalForwardAlgo::execute(), DDTIBLayerAlgo::execute(), DDBHMAngular::execute(), DDTECCoolAlgo::execute(), DDHCalTBCableAlgo::execute(), DDHCalFibreBundle::execute(), DDTECModuleAlgo::execute(), DDEcalBarrelNewAlgo::execute(), DDEcalBarrelAlgo::execute(), DDEcalEndcapAlgo::execute(), DDTrackerIrregularRingAlgo::execute(), DDTrackerRingAlgo::execute(), DDPixFwdBlades::execute(), DDHGCalHEFileAlgo::positionMix(), DDHGCalHEAlgo::positionMix(), DDHGCalMixLayer::positionMix(), DDAHcalModuleAlgo::positionSensitive(), DDHGCalTBModule::positionSensitive(), DDHGCalModuleAlgo::positionSensitive(), DDHGCalEEAlgo::positionSensitive(), DDHGCalModule::positionSensitive(), DDHGCalTBModuleX::positionSensitive(), DDHGCalEEFileAlgo::positionSensitive(), DDHGCalSiliconModule::positionSensitive(), DDHGCalHEAlgo::positionSensitive(), DDHGCalHEFileAlgo::positionSensitive(), DDLPosPart::processElement(), regressionTest_first(), DDEcalBarrelAlgo::web(), and DDEcalBarrelNewAlgo::web().

81  {
82  int cpno = atoi(copyno.c_str());
83  position(self, parent, cpno, trans, rot, div);
84 }
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
void DDCompactView::position ( const DDLogicalPart self,
const DDLogicalPart parent,
int  copyno,
const DDTranslation trans,
const DDRotation rot,
const DDDivision div = nullptr 
)

Definition at line 86 of file DDCompactView.cc.

References rep_.

91  {
92  rep_->position(self, parent, copyno, trans, rot, div);
93 }
std::unique_ptr< DDCompactViewImpl > rep_
const DDLogicalPart & DDCompactView::root ( ) const

returns the DDLogicalPart representing the root of the geometrical hierarchy

Definition at line 63 of file DDCompactView.cc.

References rep_.

Referenced by DDG4Builder::BuildGeometry(), and DDCheckConnect().

63 { return rep_->root(); }
std::unique_ptr< DDCompactViewImpl > rep_
void DDCompactView::setRoot ( const DDLogicalPart root)

Definition at line 96 of file DDCompactView.cc.

References rep_.

Referenced by DDLSAX2ConfigHandler::startElement().

96 { rep_->setRoot(root); }
std::unique_ptr< DDCompactViewImpl > rep_
void DDCompactView::swap ( DDCompactView repToSwap)
private

Definition at line 98 of file DDCompactView.cc.

References rep_.

98 { rep_->swap(*(repToSwap.rep_)); }
std::unique_ptr< DDCompactViewImpl > rep_
const std::vector< double > & DDCompactView::vector ( std::string_view  iKey) const

returns an empty container if not found

Definition at line 67 of file DDCompactView.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, and vectors_.

Referenced by HcalParametersFromDD::build(), TrackerParametersFromDD::build(), MTDParametersFromDD::build(), HGCalGeomParameters::loadCellParsHexagon(), and DDExpandedView::vector().

67  {
68  auto itFind = vectors_.find(std::string(iKey));
69  if (itFind != vectors_.end()) {
70  return itFind->second;
71  }
72  static const std::vector<double> s_empty;
73  return s_empty;
74 }
Vectors vectors_
DDCompactView::GraphWalker DDCompactView::walker ( ) const

Definition at line 61 of file DDCompactView.cc.

References rep_.

61 { return rep_->walker(); }
std::unique_ptr< DDCompactViewImpl > rep_
const DDPosData * DDCompactView::worldPosition ( ) const

The absolute position of the world.

Definition at line 65 of file DDCompactView.cc.

References worldpos_.

65 { return worldpos_.get(); }
std::unique_ptr< DDPosData > worldpos_

Member Data Documentation

DDI::Store<DDName, std::unique_ptr<DDI::LogicalPart> > DDCompactView::lpStore_
private

Definition at line 138 of file DDCompactView.h.

Referenced by lockdown().

DDI::Store<DDName, std::unique_ptr<DDI::Material> > DDCompactView::matStore_
private

Definition at line 136 of file DDCompactView.h.

Referenced by lockdown().

std::unique_ptr<DDCompactViewImpl> DDCompactView::rep_
private

Definition at line 133 of file DDCompactView.h.

Referenced by DDCompactView(), graph(), position(), root(), setRoot(), swap(), and walker().

DDI::Store<DDName, std::unique_ptr<DDRotationMatrix> > DDCompactView::rotStore_
private

Definition at line 140 of file DDCompactView.h.

Referenced by lockdown().

DDI::Store<DDName, std::unique_ptr<DDI::Solid> > DDCompactView::solidStore_
private

Definition at line 137 of file DDCompactView.h.

Referenced by lockdown().

DDI::Store<DDName, std::unique_ptr<DDI::Specific> > DDCompactView::specStore_
private

Definition at line 139 of file DDCompactView.h.

Referenced by lockdown().

Vectors DDCompactView::vectors_
private

Definition at line 142 of file DDCompactView.h.

Referenced by lockdown(), and vector().

std::unique_ptr<DDPosData> DDCompactView::worldpos_
private

Definition at line 134 of file DDCompactView.h.

Referenced by DDCompactView(), and worldPosition().