#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) |
bool DDCheck | ( | std::ostream & | os | ) |
Definition at line 162 of file DDCheck.cc.
References DDCheckAll(), and query::result.
{ bool result = false; os << "DDCore: start comprehensive checking" << std::endl; DDCompactView cpv; // THE one and only (prototype restriction) CompactView DDExpandedView exv(cpv); // result |= DDCheckMaterials(os); //DDCheckLP(exv.logicalPart(),os); result |= DDCheckAll(cpv,os); // done os << "DDCore: end of comprehensive checking" << std::endl; if (result) { // at least one error found edm::LogError("DDCheck") << std::endl << "DDD:DDCore:DDCheck: found inconsistency problems!" << std::endl; // edm::LogError("DDCheck") << "To continue press 'y' ... " << std::endl; // char c; // cin >> c; // if (c != 'y') { // edm::LogError("DDCheck") << " terminating ..." << std::endl; exit(1); // (Mike Case) should we throw instead? OR is an if (DDCheck) the best way? // throw(DDException(std::string("DDD:DDCore:DDCheck: found inconsistency problems!")); } return result; }
bool DDCheck | ( | const DDCompactView & | cpv, |
std::ostream & | os | ||
) |
Definition at line 190 of file DDCheck.cc.
References DDCheckAll(), and query::result.
{ bool result = false; os << "DDCore: start comprehensive checking" << std::endl; // DDCompactView cpv; // THE one and only (prototype restriction) CompactView DDExpandedView exv(cpv); // result |= DDCheckMaterials(os); //DDCheckLP(exv.logicalPart(),os); result |= DDCheckAll(cpv,os); // done os << "DDCore: end of comprehensive checking" << std::endl; if (result) { // at least one error found edm::LogError("DDCheck") << std::endl << "DDD:DDCore:DDCheck: found inconsistency problems!" << std::endl; // edm::LogError("DDCheck") << "To continue press 'y' ... " << std::endl; // char c; // cin >> c; // if (c != 'y') { // edm::LogError("DDCheck") << " terminating ..." << std::endl; exit(1); // (Mike Case) should we throw instead? OR is an if (DDCheck) the best way? // throw(DDException(std::string("DDD:DDCore:DDCheck: found inconsistency problems!")); } return result; }
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().
{ bool result = false; // const_cast because graph_type does not provide const_iterators! DDCompactView::graph_type & g = const_cast<DDCompactView::graph_type&>(cpv.graph()); // basic debuggger std::map< std::pair<std::string,std::string>, int > lp_names; DDCompactView::graph_type::adj_list::size_type it = 0; for(; it < g.size(); ++it) { const DDLogicalPart & lp = g.nodeData(it); lp_names[std::make_pair(lp.name().ns(),lp.name().name())]++; } std::map< std::pair<std::string,std::string>, int >::iterator mit = lp_names.begin(); for (; mit != lp_names.end(); ++ mit) { if (mit->second >1) { os << "interesting: " << mit->first.first << ":" << mit->first.second << " counted " << mit->second << " times!" << std::endl; os << " Names of LogicalParts seem not to be unique!" << std::endl << std::endl; result = true; } //os << "registered: " << mit->first.first << ":" << mit->first.second << std::endl; } // iterate over all nodes in the graph (nodes are logicalparts, // edges are posdata* for(it=0; it < g.size(); ++it) { const DDLogicalPart & lp = g.nodeData(it); result |= DDCheckLP(lp,os); result |= DDCheckPD(lp ,g.edges(it), g, os); } // Check the connectivity of the graph..., takes quite some time & memory result |= DDCheckConnect(cpv, os); return result; }
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(), and DDCompactView::walker().
Referenced by DDCheckAll().
{ bool result = false; os << std::endl << "Checking connectivity of CompactView:" << std::endl; // Algorithm: // Pass 1: walk the whole graph, mark every visited LogicalPart-node // Pass 2: iterate over all nodes, check with marked nodes from Pass 1 // Pass 1: std::map<DDLogicalPart,bool> visited; // walker_type wkr = DDCompactView().walker(); walker_type wkr = cpv.walker(); visited[wkr.current().first]=true; while(wkr.next()) { // std::cout << "DDCheck" << " " << wkr.current().first << std::endl; visited[wkr.current().first]=true; } os << " CompactView has " << visited.size() << " (multiple-)connected LogicalParts with root=" << cpv.root().ddname() << std::endl; // Pass 2: DDCompactView::graph_type & g = const_cast<DDCompactView::graph_type&>(cpv.graph()); int uc = 0; DDCompactView::graph_type::adj_list::size_type it = 0; for(; it < g.size(); ++it) { if (! visited[g.nodeData(it)] ) { ++uc; os << " " << g.nodeData(it).ddname(); } } os << std::endl; os << " There were " << uc << " unconnected nodes found." << std::endl << std::endl; if (uc) { os << std::endl; os << " ****************************************************************************" << std::endl; os << " WARNING: The geometrical hierarchy may not be complete. " << std::endl << " Expect unpredicted behaviour using DDCore/interface (i.e. SEGFAULT)" << std::endl; os << " ****************************************************************************" << std::endl; os << std::endl; } return result; }
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().
{ bool result = false; // is it defined or just declared? if (!lp) { os << "LogicalPart: " << lp << " is not defined!" << std::endl; } else { // check solid if (!lp.solid()) { os << "LogicalPart: " << lp << "| no solid defined, solid=" << lp.solid() << std::endl; } else if(lp.solid().shape()==dd_not_init) { os << "LogicalPart: " << lp << "| solid not init, solid=" << lp.solid() << std::endl; } // check material if (!lp.material()) { os << "LogicalPart: " << lp << "| no material defined, material=" << lp.material() << std::endl; } else { // check consituents recursively } } return result; }
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().
{ bool result = false; if (nb.first != nb.second) { for (; nb.first != nb.second; ++(nb.first)) { if (! nb.first->second ) { edm::LogInfo ("DDCheck") << "PosData of LogicalPart " << lp.name() << " missing." << std::endl; edm::LogInfo ("DDCheck") << " the LogicalPart is meant to be a daughter volume, but its position is missing!" << std::endl; } else { // check for the rotation matrix being present const DDRotation & r = g.edgeData(nb.first->second)->rot_; if (! r.isDefined().second ) { //if (! nb.first->second->rot_.rotation() ) { const DDRotation & r = g.edgeData(nb.first->second)->rot_; os << "Rotationmatrix is not defined: " << r << std::endl; } } } } return result; }