CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
DDCheck.cc File Reference
#include "DetectorDescription/Core/src/DDCheck.h"
#include "DetectorDescription/Core/interface/DDExpandedView.h"
#include "DetectorDescription/Core/interface/DDLogicalPart.h"
#include "DetectorDescription/Core/interface/DDSolid.h"
#include "DetectorDescription/Core/interface/DDMaterial.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

Go to the source code of this file.

Functions

bool DDCheck (std::ostream &os)
 
bool DDCheck (const DDCompactView &cpv, std::ostream &os)
 
bool DDCheckAll (const DDCompactView &cpv, std::ostream &os)
 
bool DDCheckConnect (const DDCompactView &cpv, std::ostream &os)
 
bool DDCheckLP (const DDLogicalPart &lp, std::ostream &os)
 
bool DDCheckPD (const DDLogicalPart &lp, DDCompactView::graph_type::edge_range nb, const DDCompactView::graph_type &g, std::ostream &os)
 

Function Documentation

bool DDCheck ( std::ostream &  os)

Definition at line 156 of file DDCheck.cc.

References DDCheckAll(), and query::result.

157 {
158  bool result = false;
159  os << "DDCore: start comprehensive checking" << std::endl;
160  DDCompactView cpv; // THE one and only (prototype restriction) CompactView
161  DDExpandedView exv(cpv);
162  result |= DDCheckAll(cpv,os);
163 
164  // done
165  os << "DDCore: end of comprehensive checking" << std::endl;
166 
167  if (result) { // at least one error found
168  edm::LogError("DDCheck") << std::endl << "DDD:DDCore:DDCheck: found inconsistency problems!" << std::endl;
169  }
170 
171  return result;
172 }
type of data representation of DDCompactView
Definition: DDCompactView.h:77
tuple result
Definition: query.py:137
bool DDCheckAll(const DDCompactView &cpv, std::ostream &os)
Definition: DDCheck.cc:115
Provides an exploded view of the detector (tree-view)
bool DDCheck ( const DDCompactView cpv,
std::ostream &  os 
)

Definition at line 174 of file DDCheck.cc.

References DDCheckAll(), and query::result.

175 {
176  bool result = false;
177  os << "DDCore: start comprehensive checking" << std::endl;
178  // DDCompactView cpv; // THE one and only (prototype restriction) CompactView
179  DDExpandedView exv(cpv);
180  result |= DDCheckAll(cpv,os);
181 
182  // done
183  os << "DDCore: end of comprehensive checking" << std::endl;
184 
185  if (result) { // at least one error found
186  edm::LogError("DDCheck") << std::endl << "DDD:DDCore:DDCheck: found inconsistency problems!" << std::endl;
187  }
188 
189  return result;
190 }
tuple result
Definition: query.py:137
bool DDCheckAll(const DDCompactView &cpv, std::ostream &os)
Definition: DDCheck.cc:115
Provides an exploded view of the detector (tree-view)
bool DDCheckAll ( const DDCompactView cpv,
std::ostream &  os 
)

Definition at line 115 of file DDCheck.cc.

References DDCheckConnect(), DDCheckLP(), DDCheckPD(), graph< N, E >::edges(), g, DDCompactView::graph(), DDName::name(), DDBase< N, C >::name(), graph< N, E >::nodeData(), DDName::ns(), query::result, and graph< N, E >::size().

Referenced by DDCheck().

116 {
117  bool result = false;
118  // const_cast because graph_type does not provide const_iterators!
120 
121  // basic debuggger
122  std::map< std::pair<std::string,std::string>, int > lp_names;
123 
125  for(; it < g.size(); ++it) {
126  const DDLogicalPart & lp = g.nodeData(it);
127  lp_names[std::make_pair(lp.name().ns(),lp.name().name())]++;
128  }
129 
130  for( const auto& mit : lp_names ) {
131  if (mit.second >1) {
132  os << "interesting: " << mit.first.first << ":" << mit.first.second
133  << " counted " << mit.second << " times!" << std::endl;
134  os << " Names of LogicalParts seem not to be unique!" << std::endl << std::endl;
135  result = true;
136 
137  }
138  }
139  // iterate over all nodes in the graph (nodes are logicalparts,
140  // edges are posdata*
141  for(it=0; it < g.size(); ++it) {
142  const DDLogicalPart & lp = g.nodeData(it);
143  result |= DDCheckLP(lp,os);
144  result |= DDCheckPD(lp ,g.edges(it), g, os);
145  }
146 
147  // Check the connectivity of the graph..., takes quite some time & memory
148  result |= DDCheckConnect(cpv, os);
149  return result;
150 }
adj_list::size_type size() const
Definition: adjgraph.h:201
const N & name() const
Definition: DDBase.h:78
bool DDCheckLP(const DDLogicalPart &lp, std::ostream &os)
Definition: DDCheck.cc:10
const graph_type & graph() const
Provides read-only access to the data structure of the compact-view.
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:101
const N & nodeData(const edge_type &) const
Definition: adjgraph.h:317
uint16_t size_type
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
edge_range edges(index_type nodeIndex)
Definition: adjgraph.h:277
tuple result
Definition: query.py:137
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
bool DDCheckConnect(const DDCompactView &cpv, std::ostream &os)
Definition: DDCheck.cc:65
const std::string & name() const
Returns the name.
Definition: DDName.cc:87
bool DDCheckPD(const DDLogicalPart &lp, DDCompactView::graph_type::edge_range nb, const DDCompactView::graph_type &g, std::ostream &os)
Definition: DDCheck.cc:42
bool DDCheckConnect ( const DDCompactView cpv,
std::ostream &  os 
)

Definition at line 65 of file DDCheck.cc.

References graphwalker< N, E >::current(), DDBase< N, C >::ddname(), g, DDCompactView::graph(), graphwalker< N, E >::next(), graph< N, E >::nodeData(), query::result, DDCompactView::root(), graph< N, E >::size(), class-composition::visited, and DDCompactView::walker().

Referenced by DDCheckAll().

66 {
67  bool result = false;
68  os << std::endl << "Checking connectivity of CompactView:" << std::endl;
69 
70  // Algorithm:
71  // Pass 1: walk the whole graph, mark every visited LogicalPart-node
72  // Pass 2: iterate over all nodes, check with marked nodes from Pass 1
73 
74  // Pass 1:
75  std::map<DDLogicalPart,bool> visited;
76  // walker_type wkr = DDCompactView().walker();
77  walker_type wkr = cpv.walker();
78  visited[wkr.current().first]=true;
79  while(wkr.next()) {
80  // std::cout << "DDCheck" << " " << wkr.current().first << std::endl;
81  visited[wkr.current().first]=true;
82  }
83  os << " CompactView has " << visited.size()
84  << " (multiple-)connected LogicalParts with root=" << cpv.root().ddname() << std::endl;
85 
86  // Pass 2:
88 
89  int uc = 0;
91 
92  for(; it < g.size(); ++it) {
93  if (! visited[g.nodeData(it)] ) {
94  ++uc;
95  os << " " << g.nodeData(it).ddname();
96  }
97  }
98  os << std::endl;
99  os << " There were " << uc << " unconnected nodes found." << std::endl << std::endl;
100  if (uc) {
101  os << std::endl;
102  os << " ****************************************************************************" << std::endl;
103  os << " WARNING: The geometrical hierarchy may not be complete. " << std::endl
104  << " Expect unpredicted behaviour using DDCore/interface (i.e. SEGFAULT)"
105  << std::endl;
106  os << " ****************************************************************************" << std::endl;
107  os << std::endl;
108 
109  }
110  return result;
111 }
adj_list::size_type size() const
Definition: adjgraph.h:201
const graph_type & graph() const
Provides read-only access to the data structure of the compact-view.
const N & nodeData(const edge_type &) const
Definition: adjgraph.h:317
uint16_t size_type
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
tuple result
Definition: query.py:137
result_type next()
Definition: graphwalker.h:185
value_type current() const
Definition: graphwalker.h:109
walker_type walker() const
dont&#39;t use ! Proper implementation missing ...
const DDLogicalPart & root() const
returns the DDLogicalPart representing the root of the geometrical hierarchy
const N & ddname() const
Definition: DDBase.h:80
bool DDCheckLP ( const DDLogicalPart lp,
std::ostream &  os 
)

Definition at line 10 of file DDCheck.cc.

References dd_not_init, DDLogicalPart::material(), query::result, DDSolid::shape(), and DDLogicalPart::solid().

Referenced by DDCheckAll().

11 {
12  bool result = false;
13  // is it defined or just declared?
14  if (!lp) {
15  os << "LogicalPart: " << lp << " is not defined!" << std::endl;
16  }
17  else {
18  // check solid
19  if (!lp.solid()) {
20  os << "LogicalPart: " << lp << "| no solid defined, solid="
21  << lp.solid() << std::endl;
22  }
23  else if(lp.solid().shape()==dd_not_init) {
24  os << "LogicalPart: " << lp << "| solid not init, solid="
25  << lp.solid() << std::endl;
26  }
27  // check material
28  if (!lp.material()) {
29  os << "LogicalPart: " << lp << "| no material defined, material="
30  << lp.material() << std::endl;
31  }
32  else { // check consituents recursively
33 
34  }
35  }
36  return result;
37 }
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
tuple result
Definition: query.py:137
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:144
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
bool DDCheckPD ( const DDLogicalPart lp,
DDCompactView::graph_type::edge_range  nb,
const DDCompactView::graph_type g,
std::ostream &  os 
)

Definition at line 42 of file DDCheck.cc.

References graph< N, E >::edgeData(), DDBase< N, C >::isDefined(), DDBase< N, C >::name(), alignCSCRings::r, query::result, and DDPosData::rot_.

Referenced by DDCheckAll().

43 {
44  bool result = false;
45  if (nb.first != nb.second) {
46  for (; nb.first != nb.second; ++(nb.first)) {
47  if (! nb.first->second ) {
48  edm::LogInfo ("DDCheck") << "PosData of LogicalPart " << lp.name() << " missing." << std::endl;
49  edm::LogInfo ("DDCheck") << " the LogicalPart is meant to be a daughter volume, but its position is missing!" << std::endl;
50  }
51  else { // check for the rotation matrix being present
52  const DDRotation & r = g.edgeData(nb.first->second)->rot_;
53  if (! r.isDefined().second ) {
54  //if (! nb.first->second->rot_.rotation() ) {
55  const DDRotation & r = g.edgeData(nb.first->second)->rot_;
56  os << "Rotationmatrix is not defined: " << r << std::endl;
57  }
58  }
59  }
60  }
61  return result;
62 }
def_type isDefined() const
Definition: DDBase.h:110
const N & name() const
Definition: DDBase.h:78
const E & edgeData(index_type i) const
Definition: adjgraph.h:183
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
tuple result
Definition: query.py:137
DDRotation rot_
Definition: DDPosData.h:37