CMS 3D CMS Logo

DDCheck.h File Reference

#include <iostream>
#include <vector>
#include "DetectorDescription/Core/interface/DDName.h"
#include <map>

Go to the source code of this file.

Functions

bool DDCheck (std::ostream &)
bool DDCheckMaterials (std::ostream &, std::vector< std::pair< std::string, DDName > > *=0)
 Checks all registered materials and sends a report /p os.


Function Documentation

bool DDCheck ( std::ostream &   ) 

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 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(), lat::endl(), error, HLT_VtxMuL3::errors, i, j, res, HLT_VtxMuL3::result, and s.

Referenced by DDCheck(), and DDErrorDetection::ma().

00096 {
00097    bool result = false;
00098    std::vector<std::pair<std::string,DDName> > errors;
00099    
00100    
00101    //DDMaterialReg::instance_t& mr = DDMaterialReg::instance();
00102    //DDMaterialReg::instance_t::iterator i = mr.begin();
00103    typedef DDBase<DDName,DDI::Material*>::StoreT RegT;
00104    RegT::value_type& mr = RegT::instance();
00105    RegT::value_type::iterator i = mr.begin();
00106    //edm::LogError("DDCheckMaterials") << " material checking, registry access, exiting! " << std::endl; exit(1);
00107    for(; i != mr.end(); ++i) {
00108         std::pair<std::string,DDName> error("","");
00109         DDMaterial tmat(i->first); 
00110         //exit(1);
00111         if (DDCheckMaterial(tmat,error)) {
00112            errors.push_back(error);
00113         }             
00114    }
00115 
00116    std::string s(" ");   
00117    os << "[DDCore:Report] Materials " << std::endl;
00118    os << s << mr.size() << " Materials declared" << std::endl;
00119    os << s << "detected errors:" << errors.size() << std::endl;
00120    std::vector<std::pair<std::string,DDName> >::iterator j = errors.begin();
00121    for (;j!=errors.end();++j) {
00122      os << std::endl << s << j->second << "  " << j->first << std::endl;
00123      result = true;
00124    }
00125    if(res) *res = errors;
00126    return result;
00127 }


Generated on Tue Jun 9 17:52:36 2009 for CMSSW by  doxygen 1.5.4