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 162 of file DDCheck.cc.

References DDCheckAll(), and query::result.

163 {
164  bool result = false;
165  os << "DDCore: start comprehensive checking" << std::endl;
166  DDCompactView cpv; // THE one and only (prototype restriction) CompactView
167  DDExpandedView exv(cpv);
168 
169  // result |= DDCheckMaterials(os);
170  //DDCheckLP(exv.logicalPart(),os);
171  result |= DDCheckAll(cpv,os);
172 
173  // done
174  os << "DDCore: end of comprehensive checking" << std::endl;
175 
176  if (result) { // at least one error found
177  edm::LogError("DDCheck") << std::endl << "DDD:DDCore:DDCheck: found inconsistency problems!" << std::endl;
178 // edm::LogError("DDCheck") << "To continue press 'y' ... " << std::endl;
179 // char c;
180 // cin >> c;
181 // if (c != 'y') {
182 // edm::LogError("DDCheck") << " terminating ..." << std::endl; exit(1);
183 // (Mike Case) should we throw instead? OR is an if (DDCheck) the best way?
184 // throw(DDException(std::string("DDD:DDCore:DDCheck: found inconsistency problems!"));
185  }
186 
187  return result;
188 }
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 190 of file DDCheck.cc.

References DDCheckAll(), and query::result.

191 {
192  bool result = false;
193  os << "DDCore: start comprehensive checking" << std::endl;
194  // DDCompactView cpv; // THE one and only (prototype restriction) CompactView
195  DDExpandedView exv(cpv);
196 
197  // result |= DDCheckMaterials(os);
198  //DDCheckLP(exv.logicalPart(),os);
199  result |= DDCheckAll(cpv,os);
200 
201  // done
202  os << "DDCore: end of comprehensive checking" << std::endl;
203 
204  if (result) { // at least one error found
205  edm::LogError("DDCheck") << std::endl << "DDD:DDCore:DDCheck: found inconsistency problems!" << std::endl;
206 // edm::LogError("DDCheck") << "To continue press 'y' ... " << std::endl;
207 // char c;
208 // cin >> c;
209 // if (c != 'y') {
210 // edm::LogError("DDCheck") << " terminating ..." << std::endl; exit(1);
211 // (Mike Case) should we throw instead? OR is an if (DDCheck) the best way?
212 // throw(DDException(std::string("DDD:DDCore:DDCheck: found inconsistency problems!"));
213  }
214 
215  return result;
216 }
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 DDBase< N, C >::begin(), 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  std::map< std::pair<std::string,std::string>, int >::iterator mit = lp_names.begin();
130 
131 
132  for (; mit != lp_names.end(); ++ mit) {
133  if (mit->second >1) {
134  os << "interesting: " << mit->first.first << ":" << mit->first.second
135  << " counted " << mit->second << " times!" << std::endl;
136  os << " Names of LogicalParts seem not to be unique!" << std::endl << std::endl;
137  result = true;
138 
139  }
140  //os << "registered: " << mit->first.first << ":" << mit->first.second << std::endl;
141 
142  }
143  // iterate over all nodes in the graph (nodes are logicalparts,
144  // edges are posdata*
145  for(it=0; it < g.size(); ++it) {
146  const DDLogicalPart & lp = g.nodeData(it);
147  result |= DDCheckLP(lp,os);
148  result |= DDCheckPD(lp ,g.edges(it), g, os);
149  }
150 
151  // Check the connectivity of the graph..., takes quite some time & memory
152  result |= DDCheckConnect(cpv, os);
153  return result;
154 
155 }
adj_list::size_type size() const
Definition: adjgraph.h:201
const N & name() const
Definition: DDBase.h:82
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
static DDI::Store< N, C >::iterator begin()
Definition: DDBase.h:70
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:84
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:115
const N & name() const
Definition: DDBase.h:82
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:49