CMS 3D CMS Logo

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

#include <DDCompactViewImpl.h>

Public Types

typedef ::graph< DDLogicalPart,
DDPosData * > 
GraphNav
 
typedef graphwalker
< DDLogicalPart, DDPosData * > 
WalkerType
 

Public Member Functions

DDLogicalPartcurrent () const
 
 DDCompactViewImpl ()
 
 DDCompactViewImpl (const DDLogicalPart &rootnodedata)
 
const GraphNavgraph () const
 
void position (const DDLogicalPart &self, const DDLogicalPart &parent, int copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div)
 
const DDLogicalPartroot () const
 
void setRoot (const DDLogicalPart &root)
 
void swap (DDCompactViewImpl &)
 
graphwalker< DDLogicalPart,
DDPosData * > 
walker () const
 
double weight (const DDLogicalPart &) const
 
 ~DDCompactViewImpl ()
 

Protected Attributes

GraphNav graph_
 
DDLogicalPart root_
 

Detailed Description

Definition at line 10 of file DDCompactViewImpl.h.

Member Typedef Documentation

Definition at line 14 of file DDCompactViewImpl.h.

Definition at line 15 of file DDCompactViewImpl.h.

Constructor & Destructor Documentation

DDCompactViewImpl::DDCompactViewImpl ( )
explicit

Definition at line 112 of file DDCompactViewImpl.cc.

112 { }
DDCompactViewImpl::DDCompactViewImpl ( const DDLogicalPart rootnodedata)

Definition at line 9 of file DDCompactViewImpl.cc.

References LogDebug.

10  : root_(rootnodedata)
11 {
12  LogDebug("DDCompactViewImpl") << "Root node data = " << rootnodedata << std::endl;
13 }
#define LogDebug(id)
DDLogicalPart root_
DDCompactViewImpl::~DDCompactViewImpl ( )

Definition at line 15 of file DDCompactViewImpl.cc.

References graph< N, E >::edgeData(), graph< N, E >::edges(), graph_, LogDebug, root_, and graph< N, E >::size().

16 {
18  if ( graph_.size() == 0 ) {
19  LogDebug("DDCompactViewImpl") << "In destructor, graph is empty. Root:" << root_ << std::endl;
20  } else {
21  LogDebug("DDCompactViewImpl") << "In destructor, graph is NOT empty. Root:" << root_ << " graph_.size() = " << graph_.size() << std::endl;
22  for (; it < graph_.size() ; ++it) {
23  GraphNav::edge_range erange = graph_.edges(it); //it->second.begin();
24  for(; erange.first != erange.second; ++(erange.first)) {
25  DDPosData * pd = graph_.edgeData(erange.first->second);
26  delete pd;
27  pd=0;
28  }
29  }
30  }
31  edm::LogInfo("DDCompactViewImpl") << std::endl << "DDD transient representation has been destructed." << std::endl << std::endl;
32 }
#define LogDebug(id)
adj_list::size_type size() const
Definition: adjgraph.h:201
Relative position of a child-volume inside a parent-volume.
Definition: DDPosData.h:13
std::pair< edge_iterator, edge_iterator > edge_range
Definition: adjgraph.h:138
DDLogicalPart root_
const E & edgeData(index_type i) const
Definition: adjgraph.h:183
uint16_t size_type
edge_range edges(index_type nodeIndex)
Definition: adjgraph.h:277

Member Function Documentation

DDLogicalPart& DDCompactViewImpl::current ( ) const
const GraphNav& DDCompactViewImpl::graph ( ) const
inline

Definition at line 28 of file DDCompactViewImpl.h.

References graph_.

Referenced by cuy.FindIssue::__init__().

28 { return graph_; }
void DDCompactViewImpl::position ( const DDLogicalPart self,
const DDLogicalPart parent,
int  copyno,
const DDTranslation trans,
const DDRotation rot,
const DDDivision div 
)

Definition at line 96 of file DDCompactViewImpl.cc.

References graph< N, E >::addEdge(), and graph_.

102 {
103  DDPosData * pd = new DDPosData(trans,rot,copyno,div);
104  graph_.addEdge(parent,self,pd);
105 }
Relative position of a child-volume inside a parent-volume.
Definition: DDPosData.h:13
void addEdge(const N &from, const N &to, const E &edge)
Definition: adjgraph.h:266
const DDLogicalPart& DDCompactViewImpl::root ( ) const
inline

Definition at line 24 of file DDCompactViewImpl.h.

References root_.

Referenced by setRoot().

24 { return root_; }
DDLogicalPart root_
void DDCompactViewImpl::setRoot ( const DDLogicalPart root)
inline

Definition at line 22 of file DDCompactViewImpl.h.

References root(), and root_.

22 { root_=root; }
DDLogicalPart root_
const DDLogicalPart & root() const
void DDCompactViewImpl::swap ( DDCompactViewImpl implToSwap)

Definition at line 108 of file DDCompactViewImpl.cc.

References graph_, and graph< N, E >::swap().

108  {
109  graph_.swap(implToSwap.graph_);
110 }
void swap(graph< N, E > &)
Definition: adjgraph.h:442
graphwalker< DDLogicalPart, DDPosData * > DDCompactViewImpl::walker ( ) const

Definition at line 34 of file DDCompactViewImpl.cc.

References graph_, and root_.

Referenced by weight().

double DDCompactViewImpl::weight ( const DDLogicalPart aPart) const

Definition at line 43 of file DDCompactViewImpl.cc.

References class-composition::child, graphwalker< N, E >::current(), DCOUT_V, DDBase< N, C >::ddname(), DDMaterial::density(), graphwalker< N, E >::firstChild(), g, graph_, DDLogicalPart::material(), graphwalker< N, E >::nextSibling(), DDLogicalPart::solid(), DDSolid::volume(), w, walker(), and DDLogicalPart::weight().

Referenced by cuy.ValElement::__init__(), cuy.additionElement::__init__(), cuy.superimposeElement::__init__(), and cuy.graphElement::__init__().

44 {
45  // return 0;
46 
47  if (!aPart)
48  return -1;
49  DDLogicalPart part = aPart;
50  //double result;
51  if (part.weight())
52  return part.weight();
53 
54  // weigth = (parent.vol - children.vol)*parent.density + weight(children)
55  double childrenVols=0;
56  double childrenWeights=0;
57  WalkerType walker(graph_,part);
58  if(walker.firstChild()) {
59  bool doIt=true;
60  while(doIt) {
61  double a_vol;
63  a_vol=child.solid().volume();
64  if (a_vol <= 0.) {
65  edm::LogError("DDCompactViewImpl") << "DD-WARNING: volume of solid=" << aPart.solid()
66  << "is zero or negative, vol=" << a_vol/m3 << "m3" << std::endl;
67  }
68  DCOUT_V('C', "DC: weightcalc, currently=" << child.ddname().name()
69  << " vol=" << a_vol/cm3 << "cm3");
70  childrenVols += a_vol;
71  childrenWeights += weight(child); // recursive
72  doIt=walker.nextSibling();
73  }
74  }
75 
76  double dens = part.material().density();
77  if (dens <=0) {
78  edm::LogError("DDCompactViewImpl") << "DD-WARNING: density of material=" << part.material().ddname()
79  << " is negative or zero, rho=" << dens/g*cm3 << "g/cm3" << std::endl;
80  }
81  double p_vol = part.solid().volume();
82  double w = (p_vol - childrenVols)*dens + childrenWeights;
83  if ( (fabs(p_vol) - fabs(childrenVols))/fabs(p_vol) > 1.01 ) {
84  edm::LogError("DDCompactViewImpl") << "DD-WARNING: parent-volume smaller than children, parent="
85  << part.ddname() << " difference-vol="
86  << (p_vol - childrenVols)/m3 << "m3, this is "
87  << (childrenVols - p_vol)/p_vol << "% of the parent-vol." << std::endl;
88  }
89 
90  //part.rep().weight_=w;
91  part.weight() = w;
92  return w;
93 
94 }
graphwalker< DDLogicalPart, DDPosData * > WalkerType
graphwalker< DDLogicalPart, DDPosData * > walker() const
const double w
Definition: UKUtility.cc:23
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
double & weight(void)
Weight of the LogicalPart viewed as a component, if cached, else -1.
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
result_type nextSibling()
Definition: graphwalker.h:157
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
double density() const
returns the density
Definition: DDMaterial.cc:109
result_type firstChild()
Definition: graphwalker.h:143
part
Definition: HCALResponse.h:20
value_type current() const
Definition: graphwalker.h:109
double weight(const DDLogicalPart &) const
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
double volume(void) const
Returns the volume of the given solid (does not work with boolean soids !)
Definition: DDSolid.cc:133
const N & ddname() const
Definition: DDBase.h:80

Member Data Documentation

GraphNav DDCompactViewImpl::graph_
protected

Definition at line 46 of file DDCompactViewImpl.h.

Referenced by graph(), position(), swap(), walker(), weight(), and ~DDCompactViewImpl().

DDLogicalPart DDCompactViewImpl::root_
protected

Definition at line 45 of file DDCompactViewImpl.h.

Referenced by root(), setRoot(), walker(), and ~DDCompactViewImpl().