#include "DetectorDescription/Core/src/DDCheck.h"
#include "DetectorDescription/Core/interface/DDCompactView.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 | 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, graph_type::edge_range nb, const graph_type &g, std::ostream &os) |
bool DDCheck | ( | std::ostream & | os | ) |
Definition at line 166 of file DDCheck.cc.
References DDCheckAll(), DDCheckMaterials(), lat::endl(), and HLT_VtxMuL3::result.
00167 { 00168 bool result = false; 00169 os << "DDCore: start comprehensive checking" << std::endl; 00170 DDCompactView cpv; // THE one and only (prototype restriction) CompactView 00171 DDExpandedView exv(cpv); 00172 00173 result |= DDCheckMaterials(os); 00174 //DDCheckLP(exv.logicalPart(),os); 00175 result |= DDCheckAll(cpv,os); 00176 00177 // done 00178 os << "DDCore: end of comprehensive checking" << std::endl; 00179 00180 if (result) { // at least one error found 00181 edm::LogError("DDCheck") << std::endl << "DDD:DDCore:DDCheck: found inconsistency problems!" << std::endl; 00182 // edm::LogError("DDCheck") << "To continue press 'y' ... " << std::endl; 00183 // char c; 00184 // cin >> c; 00185 // if (c != 'y') { 00186 // edm::LogError("DDCheck") << " terminating ..." << std::endl; exit(1); 00187 // (Mike Case) should we throw instead? OR is an if (DDCheck) the best way? 00188 // throw(DDException(std::string("DDD:DDCore:DDCheck: found inconsistency problems!")); 00189 } 00190 00191 return result; 00192 }
bool DDCheckAll | ( | const DDCompactView & | cpv, | |
std::ostream & | os | |||
) |
Definition at line 119 of file DDCheck.cc.
References DDCheckConnect(), DDCheckLP(), DDCheckPD(), graph< N, E >::edges(), lat::endl(), g, DDCompactView::graph(), it, lp, DDName::name(), DDBase< N, C >::name(), graph< N, E >::nodeData(), DDName::ns(), HLT_VtxMuL3::result, and graph< N, E >::size().
Referenced by DDCheck().
00120 { 00121 bool result = false; 00122 // const_cast because graph_type does not provide const_iterators! 00123 graph_type & g = const_cast<graph_type&>(cpv.graph()); 00124 00125 // basic debuggger 00126 std::map< std::pair<std::string,std::string>, int > lp_names; 00127 00128 graph_type::adj_list::size_type it = 0; 00129 for(; it < g.size(); ++it) { 00130 const DDLogicalPart & lp = g.nodeData(it); 00131 lp_names[std::make_pair(lp.name().ns(),lp.name().name())]++; 00132 } 00133 std::map< std::pair<std::string,std::string>, int >::iterator mit = lp_names.begin(); 00134 00135 00136 for (; mit != lp_names.end(); ++ mit) { 00137 if (mit->second >1) { 00138 os << "interesting: " << mit->first.first << ":" << mit->first.second 00139 << " counted " << mit->second << " times!" << std::endl; 00140 os << " Names of LogicalParts seem not to be unique!" << std::endl << std::endl; 00141 result = true; 00142 00143 } 00144 //os << "registered: " << mit->first.first << ":" << mit->first.second << std::endl; 00145 00146 } 00147 // iterate over all nodes in the graph (nodes are logicalparts, 00148 // edges are posdata* 00149 for(it=0; it < g.size(); ++it) { 00150 const DDLogicalPart & lp = g.nodeData(it); 00151 result |= DDCheckLP(lp,os); 00152 result |= DDCheckPD(lp ,g.edges(it), g, os); 00153 } 00154 00155 // Check the connectivity of the graph..., takes quite some time & memory 00156 result |= DDCheckConnect(cpv, os); 00157 return result; 00158 00159 }
bool DDCheckConnect | ( | const DDCompactView & | cpv, | |
std::ostream & | os | |||
) |
Definition at line 70 of file DDCheck.cc.
References graphwalker< N, E >::current(), DDBase< N, C >::ddname(), lat::endl(), g, DDCompactView::graph(), it, graphwalker< N, E >::next(), graph< N, E >::nodeData(), HLT_VtxMuL3::result, DDCompactView::root(), and graph< N, E >::size().
Referenced by DDCheckAll().
00071 { 00072 bool result = false; 00073 os << std::endl << "Checking connectivity of CompactView:" << std::endl; 00074 00075 // Algorithm: 00076 // Pass 1: walk the whole graph, mark every visited LogicalPart-node 00077 // Pass 2: iterate over all nodes, check with marked nodes from Pass 1 00078 00079 // Pass 1: 00080 std::map<DDLogicalPart,bool> visited; 00081 walker_type wkr = DDCompactView().walker(); 00082 visited[wkr.current().first]=true; 00083 while(wkr.next()) { 00084 //LogDebug ("DDCheck") << " " << wkr.current().first; 00085 visited[wkr.current().first]=true; 00086 } 00087 os << " CompactView has " << visited.size() 00088 << " (multiple-)connected LogicalParts with root=" << cpv.root().ddname() << std::endl; 00089 00090 // Pass 2: 00091 graph_type & g = const_cast<graph_type&>(cpv.graph()); 00092 00093 int uc = 0; 00094 graph_type::adj_list::size_type it = 0; 00095 00096 for(; it < g.size(); ++it) { 00097 if (! visited[g.nodeData(it)] ) { 00098 ++uc; 00099 os << " " << g.nodeData(it).ddname(); 00100 } 00101 } 00102 os << std::endl; 00103 os << " There were " << uc << " unconnected nodes found." << std::endl << std::endl; 00104 if (uc) { 00105 os << std::endl; 00106 os << " ****************************************************************************" << std::endl; 00107 os << " WARNING: The geometrical hierarchy may not be complete. " << std::endl 00108 << " Expect unpredicted behaviour using DDCore/interface (i.e. SEGFAULT)" 00109 << std::endl; 00110 os << " ****************************************************************************" << std::endl; 00111 os << std::endl; 00112 00113 } 00114 return result; 00115 }
bool DDCheckLP | ( | const DDLogicalPart & | lp, | |
std::ostream & | os | |||
) |
Definition at line 15 of file DDCheck.cc.
References dd_not_init, lat::endl(), DDLogicalPart::material(), HLT_VtxMuL3::result, DDSolid::shape(), and DDLogicalPart::solid().
Referenced by DDCheckAll().
00016 { 00017 bool result = false; 00018 // is it defined or just declared? 00019 if (!lp) { 00020 os << "LogicalPart: " << lp << " is not defined!" << std::endl; 00021 } 00022 else { 00023 // check solid 00024 if (!lp.solid()) { 00025 os << "LogicalPart: " << lp << "| no solid defined, solid=" 00026 << lp.solid() << std::endl; 00027 } 00028 else if(lp.solid().shape()==dd_not_init) { 00029 os << "LogicalPart: " << lp << "| solid not init, solid=" 00030 << lp.solid() << std::endl; 00031 } 00032 // check material 00033 if (!lp.material()) { 00034 os << "LogicalPart: " << lp << "| no material defined, material=" 00035 << lp.material() << std::endl; 00036 } 00037 else { // check consituents recursively 00038 00039 } 00040 } 00041 return result; 00042 }
bool DDCheckPD | ( | const DDLogicalPart & | lp, | |
graph_type::edge_range | nb, | |||
const graph_type & | g, | |||
std::ostream & | os | |||
) |
Definition at line 47 of file DDCheck.cc.
References graph< N, E >::edgeData(), lat::endl(), DDBase< N, C >::isDefined(), DDBase< N, C >::name(), r, and HLT_VtxMuL3::result.
Referenced by DDCheckAll().
00048 { 00049 bool result = false; 00050 if (nb.first != nb.second) { 00051 for (; nb.first != nb.second; ++(nb.first)) { 00052 if (! nb.first->second ) { 00053 edm::LogInfo ("DDCheck") << "PosData of LogicalPart " << lp.name() << " missing." << std::endl; 00054 edm::LogInfo ("DDCheck") << " the LogicalPart is meant to be a daughter volume, but its position is missing!" << std::endl; 00055 } 00056 else { // check for the rotation matrix being present 00057 const DDRotation & r = g.edgeData(nb.first->second)->rot_; 00058 if (! r.isDefined().second ) { 00059 //if (! nb.first->second->rot_.rotation() ) { 00060 const DDRotation & r = g.edgeData(nb.first->second)->rot_; 00061 os << "Rotationmatrix is not defined: " << r << std::endl; 00062 } 00063 } 00064 } 00065 } 00066 return result; 00067 }