CMS 3D CMS Logo

Functions
DDCheck.cc File Reference
#include "DetectorDescription/Core/src/DDCheck.h"
#include <map>
#include "DetectorDescription/Core/interface/DDCompactView.h"
#include "DetectorDescription/Core/interface/DDExpandedView.h"
#include "DetectorDescription/Core/interface/DDLogicalPart.h"
#include "DetectorDescription/Core/interface/DDMaterial.h"
#include "DetectorDescription/Core/interface/DDName.h"
#include "DetectorDescription/Core/interface/DDPosData.h"
#include "DetectorDescription/Core/interface/DDSolid.h"
#include "DetectorDescription/Core/interface/DDSolidShapes.h"
#include "DetectorDescription/Core/interface/DDTransform.h"
#include "DetectorDescription/Core/interface/adjgraph.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 163 of file DDCheck.cc.

References DDCheckAll(), and mps_fire::result.

164 {
165  bool result = false;
166  os << "DDCore: start comprehensive checking" << std::endl;
167  DDCompactView cpv; // THE one and only (prototype restriction) CompactView
168  DDExpandedView exv(cpv);
169  result |= DDCheckAll(cpv,os);
170 
171  // done
172  os << "DDCore: end of comprehensive checking" << std::endl;
173 
174  if (result) { // at least one error found
175  edm::LogError("DDCheck") << std::endl << "DDD:DDCore:DDCheck: found inconsistency problems!" << std::endl;
176  }
177 
178  return result;
179 }
type of data representation of DDCompactView
Definition: DDCompactView.h:90
bool DDCheckAll(const DDCompactView &cpv, std::ostream &os)
Definition: DDCheck.cc:122
Provides an exploded view of the detector (tree-view)
bool DDCheck ( const DDCompactView cpv,
std::ostream &  os 
)

Definition at line 181 of file DDCheck.cc.

References DDCheckAll(), and mps_fire::result.

182 {
183  bool result = false;
184  os << "DDCore: start comprehensive checking" << std::endl;
185  // DDCompactView cpv; // THE one and only (prototype restriction) CompactView
186  DDExpandedView exv(cpv);
187  result |= DDCheckAll(cpv,os);
188 
189  // done
190  os << "DDCore: end of comprehensive checking" << std::endl;
191 
192  if (result) { // at least one error found
193  edm::LogError("DDCheck") << std::endl << "DDD:DDCore:DDCheck: found inconsistency problems!" << std::endl;
194  }
195 
196  return result;
197 }
bool DDCheckAll(const DDCompactView &cpv, std::ostream &os)
Definition: DDCheck.cc:122
Provides an exploded view of the detector (tree-view)
bool DDCheckAll ( const DDCompactView cpv,
std::ostream &  os 
)

Definition at line 122 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(), mps_fire::result, and graph< N, E >::size().

Referenced by DDCheck().

123 {
124  bool result = false;
125  // const_cast because graph_type does not provide const_iterators!
127 
128  // basic debuggger
129  std::map< std::pair<std::string,std::string>, int > lp_names;
130 
132  for(; it < g.size(); ++it) {
133  const DDLogicalPart & lp = g.nodeData(it);
134  lp_names[std::make_pair(lp.name().ns(),lp.name().name())]++;
135  }
136 
137  for( const auto& mit : lp_names ) {
138  if (mit.second >1) {
139  os << "interesting: " << mit.first.first << ":" << mit.first.second
140  << " counted " << mit.second << " times!" << std::endl;
141  os << " Names of LogicalParts seem not to be unique!" << std::endl << std::endl;
142  result = true;
143 
144  }
145  }
146  // iterate over all nodes in the graph (nodes are logicalparts,
147  // edges are posdata*
148  for(it=0; it < g.size(); ++it) {
149  const DDLogicalPart & lp = g.nodeData(it);
150  result |= DDCheckLP(lp,os);
151  result |= DDCheckPD(lp ,g.edges(it), g, os);
152  }
153 
154  // Check the connectivity of the graph..., takes quite some time & memory
155  result |= DDCheckConnect(cpv, os);
156  return result;
157 }
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:17
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:104
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
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
bool DDCheckConnect(const DDCompactView &cpv, std::ostream &os)
Definition: DDCheck.cc:72
const std::string & name() const
Returns the name.
Definition: DDName.cc:90
bool DDCheckPD(const DDLogicalPart &lp, DDCompactView::graph_type::edge_range nb, const DDCompactView::graph_type &g, std::ostream &os)
Definition: DDCheck.cc:49
bool DDCheckConnect ( const DDCompactView cpv,
std::ostream &  os 
)

Definition at line 72 of file DDCheck.cc.

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

Referenced by DDCheckAll().

73 {
74  bool result = false;
75  os << std::endl << "Checking connectivity of CompactView:" << std::endl;
76 
77  // Algorithm:
78  // Pass 1: walk the whole graph, mark every visited LogicalPart-node
79  // Pass 2: iterate over all nodes, check with marked nodes from Pass 1
80 
81  // Pass 1:
82  std::map<DDLogicalPart,bool> visited;
83  // walker_type wkr = DDCompactView().walker();
84  walker_type wkr = cpv.walker();
85  visited[wkr.current().first]=true;
86  while(wkr.next()) {
87  // std::cout << "DDCheck" << " " << wkr.current().first << std::endl;
88  visited[wkr.current().first]=true;
89  }
90  os << " CompactView has " << visited.size()
91  << " (multiple-)connected LogicalParts with root=" << cpv.root().ddname() << std::endl;
92 
93  // Pass 2:
95 
96  int uc = 0;
98 
99  for(; it < g.size(); ++it) {
100  if (! visited[g.nodeData(it)] ) {
101  ++uc;
102  os << " " << g.nodeData(it).ddname();
103  }
104  }
105  os << std::endl;
106  os << " There were " << uc << " unconnected nodes found." << std::endl << std::endl;
107  if (uc) {
108  os << std::endl;
109  os << " ****************************************************************************" << std::endl;
110  os << " WARNING: The geometrical hierarchy may not be complete. " << std::endl
111  << " Expect unpredicted behaviour using DDCore/interface (i.e. SEGFAULT)"
112  << std::endl;
113  os << " ****************************************************************************" << std::endl;
114  os << std::endl;
115 
116  }
117  return result;
118 }
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
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 17 of file DDCheck.cc.

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

Referenced by DDCheckAll().

18 {
19  bool result = false;
20  // is it defined or just declared?
21  if (!lp) {
22  os << "LogicalPart: " << lp << " is not defined!" << std::endl;
23  }
24  else {
25  // check solid
26  if (!lp.solid()) {
27  os << "LogicalPart: " << lp << "| no solid defined, solid="
28  << lp.solid() << std::endl;
29  }
30  else if(lp.solid().shape()==dd_not_init) {
31  os << "LogicalPart: " << lp << "| solid not init, solid="
32  << lp.solid() << std::endl;
33  }
34  // check material
35  if (!lp.material()) {
36  os << "LogicalPart: " << lp << "| no material defined, material="
37  << lp.material() << std::endl;
38  }
39  else { // check consituents recursively
40 
41  }
42  }
43  return result;
44 }
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:140
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 49 of file DDCheck.cc.

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

Referenced by DDCheckAll().

50 {
51  bool result = false;
52  if (nb.first != nb.second) {
53  for (; nb.first != nb.second; ++(nb.first)) {
54  if (! nb.first->second ) {
55  edm::LogInfo ("DDCheck") << "PosData of LogicalPart " << lp.name() << " missing." << std::endl;
56  edm::LogInfo ("DDCheck") << " the LogicalPart is meant to be a daughter volume, but its position is missing!" << std::endl;
57  }
58  else { // check for the rotation matrix being present
59  const DDRotation & r = g.edgeData(nb.first->second)->rot_;
60  if (! r.isDefined().second ) {
61  //if (! nb.first->second->rot_.rotation() ) {
62  const DDRotation & r = g.edgeData(nb.first->second)->rot_;
63  os << "Rotationmatrix is not defined: " << r << std::endl;
64  }
65  }
66  }
67  }
68  return result;
69 }
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:64
DDRotation rot_
Definition: DDPosData.h:37