CMS 3D CMS Logo

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 * >
 

Public Member Functions

 DDCompactView ()
 Creates a compact-view. More...
 
 DDCompactView (const DDLogicalPart &rootnodedata)
 Creates a compact-view using a different root of the geometry hierarchy. More...
 
 DDCompactView (const DDName &)
 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)
 
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< DDCompactViewImplrep_
 
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_
 
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.

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 80 of file DDCompactView.h.

Member Typedef Documentation

◆ Graph

Definition at line 82 of file DDCompactView.h.

◆ GraphWalker

Definition at line 83 of file DDCompactView.h.

Constructor & Destructor Documentation

◆ DDCompactView() [1/3]

DDCompactView::DDCompactView ( )
explicit

Creates a compact-view.

Definition at line 90 of file DDCompactView.cc.

91  : rep_(std::make_unique<DDCompactViewImpl>()),
92  worldpos_(std::make_unique<DDPosData>(DDTranslation(), DDRotation(), 0)) {}

◆ DDCompactView() [2/3]

DDCompactView::DDCompactView ( const DDName name)
explicit

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

Definition at line 41 of file DDCompactView.cc.

41  {
42  DDMaterial::StoreT::instance().setReadOnly(false);
43  DDSolid::StoreT::instance().setReadOnly(false);
44  DDLogicalPart::StoreT::instance().setReadOnly(false);
45  DDSpecifics::StoreT::instance().setReadOnly(false);
46  DDRotation::StoreT::instance().setReadOnly(false);
47  rep_ = std::make_unique<DDCompactViewImpl>(DDLogicalPart(name));
48  worldpos_ = std::make_unique<DDPosData>(DDTranslation(), DDRotation(), 0);
49 }

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

◆ ~DDCompactView()

DDCompactView::~DDCompactView ( )
default

◆ DDCompactView() [3/3]

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 37 of file DDCompactView.cc.

38  : rep_(std::make_unique<DDCompactViewImpl>(rootnodedata)),
39  worldpos_(std::make_unique<DDPosData>(DDTranslation(), DDRotation(), 0)) {}

Member Function Documentation

◆ graph()

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 58 of file DDCompactView.cc.

58 { return rep_->graph(); }

References rep_.

Referenced by OutputMagneticFieldDDToDDL::beginRun(), OutputDDToDDL::beginRun(), DDG4Builder::BuildGeometry(), TGeoFromDddService::createManager(), DDCheckAll(), DDCheckConnect(), DDCompareCPV(), ddstats(), GeometryInfoDump::dumpInfo(), DDErrorDetection::lp_cpv(), and PrintGeomSummary::update().

◆ lockdown()

void DDCompactView::lockdown ( )

Definition at line 94 of file DDCompactView.cc.

94  {
95  // at this point we should have a valid store of DDObjects and we will move these
96  // to the local storage area using swaps with the existing Singleton<Store...>'s
102 
103  // FIXME: lock the global stores.
104  DDMaterial::StoreT::instance().setReadOnly(false);
105  DDSolid::StoreT::instance().setReadOnly(false);
106  DDLogicalPart::StoreT::instance().setReadOnly(false);
107  DDSpecifics::StoreT::instance().setReadOnly(false);
108  DDRotation::StoreT::instance().setReadOnly(false);
109 }

References DDI::Singleton< I >::instance(), instance, lpStore_, matStore_, rotStore_, solidStore_, and specStore_.

Referenced by CompareDDCompactViews::beginRun().

◆ position() [1/2]

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 66 of file DDCompactView.cc.

71  {
72  int cpno = atoi(copyno.c_str());
73  position(self, parent, cpno, trans, rot, div);
74 }

References class-composition::parent, and makeMuonMisalignmentScenario::rot.

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(), DDHGCalEEAlgo::constructLayers(), DDHGCalHEAlgo::constructLayers(), DDHGCalModule::constructLayers(), DDHGCalModuleAlgo::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(), DDTIBLayerAlgo_MTCC::execute(), DDTIBRadCableAlgo_MTCC::execute(), DDTBH4Algo::execute(), DDHGCalWafer8::execute(), DDHGCalCell::execute(), DDTOBRodAlgo::execute(), DDTrackerZPosAlgo::execute(), DDEcalAPDAlgo::execute(), DDTrackerXYZPosAlgo::execute(), DDTIDModulePosAlgo::execute(), DDLinear::execute(), DDTrackerPhiAltAlgo::execute(), DDAngular::execute(), DDTotemAngular::execute(), DDTrackerLinear::execute(), DDTrackerPhiAlgo::execute(), DDTrackerAngular::execute(), DDHGCalWafer::execute(), DDMTDLinear::execute(), DDMuonAngular::execute(), DDHCalLinearXY::execute(), DDTIDRingAlgo::execute(), DDGEMAngular::execute(), DDPixFwdDiskAlgo::execute(), DDTIDModuleAlgo::execute(), DDTECOptoHybAlgo::execute(), DDTECPhiAlgo::execute(), DDTECPhiAltAlgo::execute(), DDTIDAxialCableAlgo::execute(), DDTOBRadCableAlgo::execute(), DDTOBAxCableAlgo::execute(), DDHGCalWaferAlgo::execute(), DDDividedGeometryObject::execute(), DDPixPhase1FwdDiskAlgo::execute(), DDHCalTestBeamAlgo::execute(), DDHCalXtalAlgo::execute(), DDHCalAngular::execute(), DDHCalTBZposAlgo::execute(), DDCutTubsFromPoints::execute(), DDHCalForwardAlgo::execute(), DDPixBarLayerAlgo::execute(), DDTIBLayerAlgo::execute(), DDBHMAngular::execute(), DDPixBarLayerUpgradeAlgo::execute(), DDTECCoolAlgo::execute(), DDHCalTBCableAlgo::execute(), DDHCalFibreBundle::execute(), DDTECModuleAlgo::execute(), DDEcalBarrelAlgo::execute(), DDEcalBarrelNewAlgo::execute(), DDEcalEndcapAlgo::execute(), DDTrackerRingAlgo::execute(), DDPixFwdBlades::execute(), DDHGCalHEAlgo::positionMix(), DDHGCalTBModule::positionSensitive(), DDAHcalModuleAlgo::positionSensitive(), DDHGCalTBModuleX::positionSensitive(), DDHGCalEEAlgo::positionSensitive(), DDHGCalModuleAlgo::positionSensitive(), DDHGCalModule::positionSensitive(), DDHGCalHEAlgo::positionSensitive(), DDLPosPart::processElement(), regressionTest_first(), DDEcalBarrelAlgo::web(), and DDEcalBarrelNewAlgo::web().

◆ position() [2/2]

void DDCompactView::position ( const DDLogicalPart self,
const DDLogicalPart parent,
int  copyno,
const DDTranslation trans,
const DDRotation rot,
const DDDivision div = nullptr 
)

Definition at line 76 of file DDCompactView.cc.

81  {
82  rep_->position(self, parent, copyno, trans, rot, div);
83 }

References class-composition::parent, rep_, and makeMuonMisalignmentScenario::rot.

◆ root()

const DDLogicalPart & DDCompactView::root ( ) const

returns the DDLogicalPart representing the root of the geometrical hierarchy

Definition at line 62 of file DDCompactView.cc.

62 { return rep_->root(); }

References rep_.

Referenced by DDG4Builder::BuildGeometry(), TGeoFromDddService::createManager(), DDCheckConnect(), and TGeoMgrFromDdd::produce().

◆ setRoot()

void DDCompactView::setRoot ( const DDLogicalPart root)

Definition at line 86 of file DDCompactView.cc.

86 { rep_->setRoot(root); }

References rep_.

Referenced by DDLSAX2ConfigHandler::startElement().

◆ swap()

void DDCompactView::swap ( DDCompactView repToSwap)
private

Definition at line 88 of file DDCompactView.cc.

88 { rep_->swap(*(repToSwap.rep_)); }

References rep_.

◆ walker()

DDCompactView::GraphWalker DDCompactView::walker ( ) const

Definition at line 60 of file DDCompactView.cc.

60 { return rep_->walker(); }

References rep_.

Referenced by TGeoMgrFromDdd::produce().

◆ worldPosition()

const DDPosData * DDCompactView::worldPosition ( ) const

The absolute position of the world.

Definition at line 64 of file DDCompactView.cc.

64 { return worldpos_.get(); }

References worldpos_.

Member Data Documentation

◆ lpStore_

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

Definition at line 133 of file DDCompactView.h.

Referenced by lockdown().

◆ matStore_

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

Definition at line 131 of file DDCompactView.h.

Referenced by lockdown().

◆ rep_

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

Definition at line 128 of file DDCompactView.h.

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

◆ rotStore_

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

Definition at line 135 of file DDCompactView.h.

Referenced by lockdown().

◆ solidStore_

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

Definition at line 132 of file DDCompactView.h.

Referenced by lockdown().

◆ specStore_

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

Definition at line 134 of file DDCompactView.h.

Referenced by lockdown().

◆ worldpos_

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

Definition at line 129 of file DDCompactView.h.

Referenced by DDCompactView(), and worldPosition().

DDCompactView::specStore_
DDI::Store< DDName, std::unique_ptr< DDI::Specific > > specStore_
Definition: DDCompactView.h:134
DDCompactView::rep_
std::unique_ptr< DDCompactViewImpl > rep_
Definition: DDCompactView.h:128
DDCompactView::matStore_
DDI::Store< DDName, std::unique_ptr< DDI::Material > > matStore_
Definition: DDCompactView.h:131
DDCompactView::solidStore_
DDI::Store< DDName, std::unique_ptr< DDI::Solid > > solidStore_
Definition: DDCompactView.h:132
DDCompactView::worldpos_
std::unique_ptr< DDPosData > worldpos_
Definition: DDCompactView.h:129
DDCompactView::rotStore_
DDI::Store< DDName, std::unique_ptr< DDRotationMatrix > > rotStore_
Definition: DDCompactView.h:135
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDI::Singleton::instance
static value_type & instance()
DDLogicalPart
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Definition: DDLogicalPart.h:93
root
Definition: RooFitFunction.h:10
instance
static PFTauRenderPlugin instance
Definition: PFTauRenderPlugin.cc:70
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
DDCompactView::lpStore_
DDI::Store< DDName, std::unique_ptr< DDI::LogicalPart > > lpStore_
Definition: DDCompactView.h:133
class-composition.parent
parent
Definition: class-composition.py:88
DDCompactView::position
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=nullptr)
Definition: DDCompactView.cc:66
DDRotation
ROOT::Math::Rotation3D DDRotation
Definition: DDEcalEndcapAlgo.cc:18