CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
DDCheck.h File Reference
#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. More...
 

Function Documentation

bool DDCheck ( std::ostream &  )

Definition at line 167 of file DDCheck.cc.

References DDCheckAll(), and query::result.

168 {
169  bool result = false;
170  os << "DDCore: start comprehensive checking" << std::endl;
171  DDCompactView cpv; // THE one and only (prototype restriction) CompactView
172  DDExpandedView exv(cpv);
173 
174  // result |= DDCheckMaterials(os);
175  //DDCheckLP(exv.logicalPart(),os);
176  result |= DDCheckAll(cpv,os);
177 
178  // done
179  os << "DDCore: end of comprehensive checking" << std::endl;
180 
181  if (result) { // at least one error found
182  edm::LogError("DDCheck") << std::endl << "DDD:DDCore:DDCheck: found inconsistency problems!" << std::endl;
183 // edm::LogError("DDCheck") << "To continue press 'y' ... " << std::endl;
184 // char c;
185 // cin >> c;
186 // if (c != 'y') {
187 // edm::LogError("DDCheck") << " terminating ..." << std::endl; exit(1);
188 // (Mike Case) should we throw instead? OR is an if (DDCheck) the best way?
189 // throw(DDException(std::string("DDD:DDCore:DDCheck: found inconsistency problems!"));
190  }
191 
192  return result;
193 }
type of data representation of DDCompactView
Definition: DDCompactView.h:81
tuple result
Definition: query.py:137
bool DDCheckAll(const DDCompactView &cpv, std::ostream &os)
Definition: DDCheck.cc:120
Provides an exploded view of the detector (tree-view)
bool DDCheck ( const DDCompactView cpv,
std::ostream &   
)

Definition at line 195 of file DDCheck.cc.

References DDCheckAll(), and query::result.

196 {
197  bool result = false;
198  os << "DDCore: start comprehensive checking" << std::endl;
199  // DDCompactView cpv; // THE one and only (prototype restriction) CompactView
200  DDExpandedView exv(cpv);
201 
202  // result |= DDCheckMaterials(os);
203  //DDCheckLP(exv.logicalPart(),os);
204  result |= DDCheckAll(cpv,os);
205 
206  // done
207  os << "DDCore: end of comprehensive checking" << std::endl;
208 
209  if (result) { // at least one error found
210  edm::LogError("DDCheck") << std::endl << "DDD:DDCore:DDCheck: found inconsistency problems!" << std::endl;
211 // edm::LogError("DDCheck") << "To continue press 'y' ... " << std::endl;
212 // char c;
213 // cin >> c;
214 // if (c != 'y') {
215 // edm::LogError("DDCheck") << " terminating ..." << std::endl; exit(1);
216 // (Mike Case) should we throw instead? OR is an if (DDCheck) the best way?
217 // throw(DDException(std::string("DDD:DDCore:DDCheck: found inconsistency problems!"));
218  }
219 
220  return result;
221 }
tuple result
Definition: query.py:137
bool DDCheckAll(const DDCompactView &cpv, std::ostream &os)
Definition: DDCheck.cc:120
Provides an exploded view of the detector (tree-view)
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().

96 {
97  bool result = false;
98  std::vector<std::pair<std::string,DDName> > errors;
99 
100 
101  //DDMaterialReg::instance_t& mr = DDMaterialReg::instance();
102  //DDMaterialReg::instance_t::iterator i = mr.begin();
104  RegT::value_type& mr = RegT::instance();
105  RegT::value_type::iterator i = mr.begin();
106  //edm::LogError("DDCheckMaterials") << " material checking, registry access, exiting! " << std::endl; exit(1);
107  for(; i != mr.end(); ++i) {
108  std::pair<std::string,DDName> error("","");
109  DDMaterial tmat(i->first);
110  //exit(1);
111  if (DDCheckMaterial(tmat,error)) {
112  errors.push_back(error);
113  }
114  }
115 
116  std::string s(" ");
117  os << "[DDCore:Report] Materials " << std::endl;
118  os << s << mr.size() << " Materials declared" << std::endl;
119  os << s << "detected errors:" << errors.size() << std::endl;
120  std::vector<std::pair<std::string,DDName> >::iterator j = errors.begin();
121  for (;j!=errors.end();++j) {
122  os << std::endl << s << j->second << " " << j->first << std::endl;
123  result = true;
124  }
125  if(res) *res = errors;
126  return result;
127 }
Definition: DDBase.h:18
int i
Definition: DBlmapReader.cc:9
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:45
bool DDCheckMaterial(DDMaterial &mip, std::pair< std::string, DDName > &result)
tuple result
Definition: query.py:137
int j
Definition: DBlmapReader.cc:9
Container::value_type value_type
string s
Definition: asciidump.py:422