CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions
DDErrorDetection Class Reference

#include <DDErrorDetection.h>

Public Member Functions

 DDErrorDetection (const DDCompactView &cpv)
 
void errors ()
 
const std::map< std::string,
std::set< DDLogicalPart > > & 
lp_cpv (const DDCompactView &cpv)
 
const std::vector< std::pair
< std::string, DDName > > & 
ma ()
 
const std::map< DDMaterial,
std::set< DDLogicalPart > > & 
ma_lp ()
 
void nix ()
 
bool noErrorsInTheReport (const DDCompactView &cpv)
 
void report (const DDCompactView &cpv, std::ostream &o)
 
void scan (const DDCompactView &cpv)
 
const std::map< DDSolid,
std::set< DDSolid > > & 
so ()
 
const std::map< DDSolid,
std::set< DDLogicalPart > > & 
so_lp ()
 
void warnings ()
 
 ~DDErrorDetection ()
 

Private Member Functions

 DDErrorDetection ()
 

Detailed Description

Definition at line 118 of file DDErrorDetection.h.

Constructor & Destructor Documentation

DDErrorDetection::DDErrorDetection ( const DDCompactView cpv)

Definition at line 25 of file DDErrorDetection.cc.

References DDI::Singleton< I >::instance().

26 {
27  DDMaterial::StoreT::instance().setReadOnly(false);
28  DDSolid::StoreT::instance().setReadOnly(false);
29  DDLogicalPart::StoreT::instance().setReadOnly(false);
30  DDSpecifics::StoreT::instance().setReadOnly(false);
31  DDRotation::StoreT::instance().setReadOnly(false);
32 
33  scan(cpv);
34 }
void scan(const DDCompactView &cpv)
static value_type & instance()
DDErrorDetection::~DDErrorDetection ( )

Definition at line 36 of file DDErrorDetection.cc.

References DDI::Singleton< I >::instance().

36  {
37  DDMaterial::StoreT::instance().setReadOnly(true);
38  DDSolid::StoreT::instance().setReadOnly(true);
39  DDLogicalPart::StoreT::instance().setReadOnly(true);
40  DDSpecifics::StoreT::instance().setReadOnly(true);
41  DDRotation::StoreT::instance().setReadOnly(true);
42 }
static value_type & instance()
DDErrorDetection::DDErrorDetection ( )
inlineprivate

Definition at line 144 of file DDErrorDetection.h.

144 { };

Member Function Documentation

void DDErrorDetection::errors ( )

Definition at line 64 of file DDErrorDetection.cc.

References gather_cfg::cout.

65 {
66  std::cout << "What does DDErrorDetection::errors() do? nothing." << std::endl;
67 }
tuple cout
Definition: gather_cfg.py:121
const std::map< std::string, std::set< DDLogicalPart > > & DDErrorDetection::lp_cpv ( const DDCompactView cpv)

Definition at line 75 of file DDErrorDetection.cc.

References begin, DDBase< N, C >::ddname(), graph< N, E >::edges(), end, DDName::fullname(), g, DDCompactView::graph(), DDI::Singleton< I >::instance(), graph< N, E >::nodeData(), and graph< N, E >::nodeIndex().

76 {
77  static std::map<std::string, std::set<DDLogicalPart> > result_;
78  if (result_.size()) return result_;
79 
80  // DDCompactView cpv;
81  const DDCompactView::graph_type & g = cpv.graph();
82 
83  std::map<std::string, std::set<DDLogicalPart> >::const_iterator it(lp_err::instance().begin()),
84  ed(lp_err::instance().end());
85  for (; it != ed; ++it) {
86  std::set<DDLogicalPart>::const_iterator sit(it->second.begin()), sed(it->second.end());
87  for( ; sit != sed; ++sit) {
88  const DDLogicalPart & lp = *sit;
90  if (g.nodeIndex(lp).second) {
91  result_.insert(make_pair(lp.ddname().fullname(), std::set<DDLogicalPart>()));
92  }
93  for (; er.first != er.second; ++er.first) {
94  result_[lp.ddname().fullname()].insert(g.nodeData(er.first->first));
95  }
96  }
97  }
98  return result_;
99 }
std::pair< const_edge_iterator, const_edge_iterator > const_edge_range
Definition: adjgraph.h:140
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
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
static value_type & instance()
edge_range edges(index_type nodeIndex)
Definition: adjgraph.h:277
const std::string fullname() const
Definition: DDName.h:56
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
index_result nodeIndex(const N &) const
Definition: adjgraph.h:252
const N & ddname() const
Definition: DDBase.h:84
const std::vector< pair< std::string, DDName > > & DDErrorDetection::ma ( )

Definition at line 169 of file DDErrorDetection.cc.

References DDCheckMaterials(), and python.connectstrParser::o.

170 {
171  static std::vector<pair<std::string,DDName> > result_;
172  ofstream o("/dev/null");
173 
174  if (result_.size()) return result_;
175 
176  DDCheckMaterials(o,&result_);
177  return result_;
178 
179 /*
180  */
181 }
bool DDCheckMaterials(std::ostream &, std::vector< std::pair< std::string, DDName > > *=0)
Checks all registered materials and sends a report /p os.
const std::map< DDMaterial, std::set< DDLogicalPart > > & DDErrorDetection::ma_lp ( )

Definition at line 141 of file DDErrorDetection.cc.

References i, visualization-live-secondInstance_cfg::m, and alignCSCRings::s.

142 {
143  static std::map<DDMaterial, std::set<DDLogicalPart> > result_;
144  if (result_.size()) return result_;
145 
146  const std::vector<pair<std::string,DDName> > & err_mat = ma();
147  std::vector<pair<std::string,DDName> >::const_iterator it(err_mat.begin()), ed(err_mat.end());
148  for (; it != ed; ++it) {
149  std::set<DDLogicalPart> s;
150  DDMaterial m(it->second);
151  result_[m]=s;
152  //std::cout << "insert: " << m.name() << std::endl;
153  }
154  DDLogicalPart::iterator<DDLogicalPart> lpit,lped; lped.end();
155  for (; lpit != lped; ++lpit) {
156  if (lpit->isDefined().second) {
157  std::map<DDMaterial, std::set<DDLogicalPart> >::iterator i = result_.find(lpit->material());
158  //std::cout << "searching: " << lpit->name() << std::endl;
159  if ( i != result_.end() ) {
160  //std::cout << std::endl << "FOUND: " << lpit->name() << std::endl << std::endl;
161  i->second.insert(*lpit);
162  }
163  }
164  }
165  return result_;
166 }
int i
Definition: DBlmapReader.cc:9
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
const std::vector< std::pair< std::string, DDName > > & ma()
void DDErrorDetection::nix ( )
bool DDErrorDetection::noErrorsInTheReport ( const DDCompactView cpv)

Definition at line 280 of file DDErrorDetection.cc.

References DDI::Singleton< I >::instance().

281 {
282  return lp_err::instance().empty() &&
283  ma_err::instance().empty() &&
284  so_err::instance().empty() &&
285  ro_err::instance().empty() &&
286  sp_err::instance().empty() &&
287  lp_cpv(cpv).empty() &&
288  ma().empty() &&
289  so().empty() &&
290  ma_lp().empty() &&
291  so_lp().empty();
292 }
const std::map< DDSolid, std::set< DDSolid > > & so()
const std::map< DDMaterial, std::set< DDLogicalPart > > & ma_lp()
static value_type & instance()
const std::map< std::string, std::set< DDLogicalPart > > & lp_cpv(const DDCompactView &cpv)
const std::vector< std::pair< std::string, DDName > > & ma()
const std::map< DDSolid, std::set< DDLogicalPart > > & so_lp()
void DDErrorDetection::report ( const DDCompactView cpv,
std::ostream &  o 
)

Definition at line 235 of file DDErrorDetection.cc.

References gather_cfg::cout, and DDI::Singleton< I >::instance().

236 {
237 
238  o << std::endl << std::endl << "---> DDD ERROR REPORT <---" << std::endl << std::endl;
239  o << "MISSING DEFINITIONS:" << std::endl << std::endl;
240  o << "LogicalParts:" << std::endl
241  << lp_err::instance() << std::endl;
242  o << "Materials:" << std::endl
243  << ma_err::instance() << std::endl;
244  o << "Solids:" << std::endl
245  << so_err::instance() << std::endl;
246  o << "Rotations:" << std::endl
247  << ro_err::instance() << std::endl;
248  o << "Specifics:" << std::endl
249  << sp_err::instance() << std::endl;
250  o << std::endl << "IMPLICATIONS OF MISSING DEFINITIONS:" << std::endl << std::endl;
251 
252  o << "A) LogicalParts that have missing definitions but are used in the geometr. hierarchy (PosParts):" << std::endl
253  << " Format: namespace:name: [name of child]*" << std::endl;
254  o << lp_cpv(cpv) << std::endl;
255 
256  o << "B) Detailed report on Materials:" << std::endl;
257  const std::vector<pair<std::string,DDName> > & res = ma();
258  std::vector<pair<std::string,DDName> >::const_iterator it(res.begin()), ed(res.end());
259  for (; it != ed; ++it) {
260  std::cout << it->second << ": " << it->first << std::endl;
261  }
262  std::cout << std::endl;
263 
264 
265  o << "C) Solids affected by Solids that have missing definitions:" << std::endl;
266  o << so() << std::endl;
267 
268  o << "D) LogicalParts affected by Materials of B):" << std::endl;
269  o << ma_lp() << std::endl;
270 
271  o << "E) LogicalParts affected by Solids of C):" << std::endl;
272  o << so_lp() << std::endl;
273 
274  // Did this ever exist?
275  // o << "F) Parent-Child positionings affected by Rotations that have missing definitions:" << std::endl;
276  o << std::endl;
277  //nix();
278 }
const std::map< DDSolid, std::set< DDSolid > > & so()
const std::map< DDMaterial, std::set< DDLogicalPart > > & ma_lp()
static value_type & instance()
const std::map< std::string, std::set< DDLogicalPart > > & lp_cpv(const DDCompactView &cpv)
const std::vector< std::pair< std::string, DDName > > & ma()
const std::map< DDSolid, std::set< DDLogicalPart > > & so_lp()
tuple cout
Definition: gather_cfg.py:121
void DDErrorDetection::scan ( const DDCompactView cpv)

Definition at line 45 of file DDErrorDetection.cc.

References gather_cfg::cout, dd_error_scan(), and DDI::Singleton< I >::instance().

46 {
47  std::cout << "DDErrorDetection::scan(): Scanning for DDD errors ..." << std::flush;
48 
49  DDLogicalPart lp_dummy;
50  DDMaterial ma_dummy;
51  DDRotation ro_dummy;
52  DDSpecifics sp_dummy;
53  DDSolid so_dummy;
54 
55  lp_err::instance() = dd_error_scan(lp_dummy);
56  ma_err::instance() = dd_error_scan(ma_dummy);
57  ro_err::instance() = dd_error_scan(ro_dummy);
58  sp_err::instance() = dd_error_scan(sp_dummy);
59  so_err::instance() = dd_error_scan(so_dummy);
60 
61  std::cout << " ... finished." << std::endl;
62 }
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
A DDSolid represents the shape of a part.
Definition: DDSolid.h:35
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
static value_type & instance()
const std::map< std::string, std::set< C > > & dd_error_scan(const C &)
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
tuple cout
Definition: gather_cfg.py:121
Interface to attach user specific data to nodes in the expanded-view.
Definition: DDSpecifics.h:40
const std::map< DDSolid, std::set< DDSolid > > & DDErrorDetection::so ( )

Definition at line 184 of file DDErrorDetection.cc.

References a, b, gather_cfg::cout, ddintersection, ddsubtraction, ddunion, DDBase< N, C >::isDefined(), visualization-live-secondInstance_cfg::m, mag(), DDSolid::shape(), DDBooleanSolid::solidA(), DDBooleanSolid::solidB(), and w.

185 {
186  static std::map<DDSolid, std::set<DDSolid> > result_;
187  if (result_.size()) return result_;
188 
189  // build the material dependency graph
190  typedef graph<DDSolid,double> ma_graph_t;
191  typedef graphwalker<DDSolid,double> ma_walker_t;
192 
193  ma_graph_t mag;
194  std::vector<DDSolid> errs;
195  DDSolid::iterator<DDSolid> it, ed; ed.end();
196  for (; it != ed; ++it) {
197  DDSolid ma = *it;
198  if (ma.isDefined().second) {
199  DDSolidShape sh = ma.shape();
200  if ( (sh == ddunion) || (sh == ddintersection) || (sh == ddsubtraction) ) {
201  DDBooleanSolid bs(ma);
202  DDSolid a(bs.solidA()),b(bs.solidB());
203  //DDRotation r(bs.rotation());
204  //DDTranslation t(bs.translation);
205  mag.addEdge(a, ma, 0);
206  mag.addEdge(b, ma, 0);
207  }
208  }
209  else {
210  errs.push_back(ma);
211  }
212  }
213 
214  std::vector<DDSolid>::const_iterator mit(errs.begin()),
215  med(errs.end());
216  for (; mit != med; ++mit) {
217 
218  try {
219  // loop over erroreous materials
220  ma_walker_t w(mag,*mit);
221  while (w.next()) {
222  result_[*mit].insert(w.current().first);
223  }
224  std::cout << std::endl;
225  }
226  catch(DDSolid m) {
227  ;
228  //std::cout << "no such material: " << m << " for creating a walker." << std::endl;
229  }
230  }
231  return result_;
232 }
def_type isDefined() const
Definition: DDBase.h:115
const double w
Definition: UKUtility.cc:23
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
DDSolidShape
Definition: DDSolidShapes.h:6
A DDSolid represents the shape of a part.
Definition: DDSolid.h:35
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:144
const std::vector< std::pair< std::string, DDName > > & ma()
Definition: adjgraph.h:12
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
tuple cout
Definition: gather_cfg.py:121
const std::map< DDSolid, std::set< DDLogicalPart > > & DDErrorDetection::so_lp ( )

Definition at line 102 of file DDErrorDetection.cc.

References i, visualization-live-secondInstance_cfg::m, and alignCSCRings::s.

103 {
104  static std::map<DDSolid, std::set<DDLogicalPart> > result_;
105  if (result_.size()) return result_;
106 
107  const std::map<DDSolid, std::set<DDSolid> > & err_mat = so();
108  std::map<DDSolid, std::set<DDSolid> >::const_iterator it(err_mat.begin()), ed(err_mat.end());
109  for (; it != ed; ++it) {
110  std::set<DDLogicalPart> s;
111  DDSolid m(it->first);
112  result_[m]=s;
113  std::set<DDSolid>::const_iterator sit(it->second.begin()), sed(it->second.end());
114  for(; sit != sed; ++sit) {
115  result_[*sit] = s;
116  }
117  //std::cout << "insert: " << m.name() << std::endl;
118  }
119  DDLogicalPart::iterator<DDLogicalPart> lpit,lped; lped.end();
120  for (; lpit != lped; ++lpit) {
121  if (lpit->isDefined().second) {
122  std::map<DDSolid, std::set<DDLogicalPart> >::iterator i = result_.find(lpit->solid());
123  //std::cout << "searching: " << lpit->name() << std::endl;
124  if ( i != result_.end() ) {
125  //std::cout << std::endl << "FOUND: " << lpit->name() << std::endl << std::endl;
126  i->second.insert(*lpit);
127  }
128  }
129  }
130  return result_;
131 }
int i
Definition: DBlmapReader.cc:9
const std::map< DDSolid, std::set< DDSolid > > & so()
A DDSolid represents the shape of a part.
Definition: DDSolid.h:35
void DDErrorDetection::warnings ( )

Definition at line 69 of file DDErrorDetection.cc.

References gather_cfg::cout.

70 {
71  std::cout << "What does DDErrorDetection::warnings() do? nothing." << std::endl;
72 }
tuple cout
Definition: gather_cfg.py:121