test
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
 

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 15 of file DDCompactViewImpl.h.

Member Typedef Documentation

Definition at line 19 of file DDCompactViewImpl.h.

Constructor & Destructor Documentation

DDCompactViewImpl::DDCompactViewImpl ( )
explicit

Definition at line 113 of file DDCompactViewImpl.cc.

113 { }
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:16
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 35 of file DDCompactViewImpl.h.

References graph_.

Referenced by cuy.FindIssue::__init__(), DDCompactView::graph(), and DDCompactView::writeableGraph().

35 { 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 97 of file DDCompactViewImpl.cc.

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

Referenced by DDCompactView::position().

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

Definition at line 27 of file DDCompactViewImpl.h.

References root_.

Referenced by DDCompactView::root(), and setRoot().

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

Definition at line 25 of file DDCompactViewImpl.h.

References root(), and root_.

Referenced by DDCompactView::setRoot().

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

Definition at line 109 of file DDCompactViewImpl.cc.

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

Referenced by DDCompactView::swap().

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

returns a walker beginning at the root of the expanded-view FIXME: CompactView::walker: it is assumed, that the root of walker is FIXME: world volume (just 1 copy, unrotated, unpositioned)

Definition at line 34 of file DDCompactViewImpl.cc.

References DCOUT, graph_, and root_.

Referenced by DDCompactView::walker(), and weight().

35 {
36  DCOUT('C',"DDCompactView::walker() root_=" << root_);
38 }
DDLogicalPart root_
#define DCOUT(M_v_Y, M_v_S)
Definition: DDdebug.h:53
double DDCompactViewImpl::weight ( const DDLogicalPart aPart) const

Definition at line 44 of file DDCompactViewImpl.cc.

References 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__(), cuy.graphElement::__init__(), and DDCompactView::weight().

45 {
46  // return 0;
47 
48  if (!aPart)
49  return -1;
50  DDLogicalPart part = aPart;
51  //double result;
52  if (part.weight())
53  return part.weight();
54 
55  // weigth = (parent.vol - children.vol)*parent.density + weight(children)
56  double childrenVols=0;
57  double childrenWeights=0;
59  if(walker.firstChild()) {
60  bool doIt=true;
61  while(doIt) {
62  double a_vol;
64  a_vol=child.solid().volume();
65  if (a_vol <= 0.) {
66  edm::LogError("DDCompactViewImpl") << "DD-WARNING: volume of solid=" << aPart.solid()
67  << "is zero or negative, vol=" << a_vol/m3 << "m3" << std::endl;
68  }
69  DCOUT_V('C', "DC: weightcalc, currently=" << child.ddname().name()
70  << " vol=" << a_vol/cm3 << "cm3");
71  childrenVols += a_vol;
72  childrenWeights += weight(child); // recursive
73  doIt=walker.nextSibling();
74  }
75  }
76 
77  double dens = part.material().density();
78  if (dens <=0) {
79  edm::LogError("DDCompactViewImpl") << "DD-WARNING: density of material=" << part.material().ddname()
80  << " is negative or zero, rho=" << dens/g*cm3 << "g/cm3" << std::endl;
81  }
82  double p_vol = part.solid().volume();
83  double w = (p_vol - childrenVols)*dens + childrenWeights;
84  if ( (fabs(p_vol) - fabs(childrenVols))/fabs(p_vol) > 1.01 ) {
85  edm::LogError("DDCompactViewImpl") << "DD-WARNING: parent-volume smaller than children, parent="
86  << part.ddname() << " difference-vol="
87  << (p_vol - childrenVols)/m3 << "m3, this is "
88  << (childrenVols - p_vol)/p_vol << "% of the parent-vol." << std::endl;
89  }
90 
91  //part.rep().weight_=w;
92  part.weight() = w;
93  return w;
94 
95 }
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:84

Member Data Documentation

GraphNav DDCompactViewImpl::graph_
protected

Definition at line 63 of file DDCompactViewImpl.h.

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

DDLogicalPart DDCompactViewImpl::root_
protected

will return a walker beginning at the node specified by the PartSelector

walker_t walker(const DDPartSelector&) const;

Definition at line 62 of file DDCompactViewImpl.h.

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