#include <iostream>
#include <vector>
#include "DetectorDescription/Core/interface/DDName.h"
#include "DetectorDescription/Core/interface/DDCompactView.h"
#include <map>
Go to the source code of this file.
Functions | |
bool | DDCheck (std::ostream &) |
bool | DDCheck (const DDCompactView &cpv, std::ostream &) |
bool | DDCheckMaterials (std::ostream &, std::vector< std::pair< std::string, DDName > > *=0) |
Checks all registered materials and sends a report /p os. |
bool DDCheck | ( | std::ostream & | ) |
Definition at line 167 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 & | |||
) |
Definition at line 195 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 DDCheckMaterials | ( | std::ostream & | , |
std::vector< std::pair< std::string, DDName > > * | = 0 |
||
) |
Checks all registered materials and sends a report /p os.
Definition at line 95 of file DDCheckMaterials.cc.
References DDCheckMaterial(), error, benchmark_cfg::errors, i, j, query::result, and asciidump::s.
Referenced by DDErrorDetection::ma().
{ bool result = false; std::vector<std::pair<std::string,DDName> > errors; //DDMaterialReg::instance_t& mr = DDMaterialReg::instance(); //DDMaterialReg::instance_t::iterator i = mr.begin(); typedef DDBase<DDName,DDI::Material*>::StoreT RegT; RegT::value_type& mr = RegT::instance(); RegT::value_type::iterator i = mr.begin(); //edm::LogError("DDCheckMaterials") << " material checking, registry access, exiting! " << std::endl; exit(1); for(; i != mr.end(); ++i) { std::pair<std::string,DDName> error("",""); DDMaterial tmat(i->first); //exit(1); if (DDCheckMaterial(tmat,error)) { errors.push_back(error); } } std::string s(" "); os << "[DDCore:Report] Materials " << std::endl; os << s << mr.size() << " Materials declared" << std::endl; os << s << "detected errors:" << errors.size() << std::endl; std::vector<std::pair<std::string,DDName> >::iterator j = errors.begin(); for (;j!=errors.end();++j) { os << std::endl << s << j->second << " " << j->first << std::endl; result = true; } if(res) *res = errors; return result; }