CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
DDCompareDBLVEC Struct Reference

#include <DDCompareTools.h>

Inheritance diagram for DDCompareDBLVEC:

Public Member Functions

 DDCompareDBLVEC ()
 
 DDCompareDBLVEC (double tol)
 
bool operator() (const std::vector< double > &lhs, const std::vector< double > &rhs) const
 

Public Attributes

double tol_
 

Detailed Description

Definition at line 60 of file DDCompareTools.h.

Constructor & Destructor Documentation

DDCompareDBLVEC::DDCompareDBLVEC ( )

Definition at line 277 of file DDCompareTools.cc.

277 : tol_(0.0004) { }
DDCompareDBLVEC::DDCompareDBLVEC ( double  tol)

Definition at line 279 of file DDCompareTools.cc.

279 : tol_(tol) { }

Member Function Documentation

bool DDCompareDBLVEC::operator() ( const std::vector< double > &  lhs,
const std::vector< double > &  rhs 
) const

Definition at line 282 of file DDCompareTools.cc.

References gather_cfg::cout, i, run_regression::ret, and tol_.

283 {
284  bool ret(true);
285  std::ios_base::fmtflags originalFlags = std::cout.flags();
286  int originalPrecision = std::cout.precision();
287  if( lhs.size() != rhs.size())
288  {
289  ret = false;
290  std::cout << "Size of vectors do not match." << std::endl;
291  }
292  else
293  {
294  for( size_t i = 0; i < lhs.size() ; ++i )
295  {
296  if( std::fabs( lhs[i] - rhs[i] ) > tol_ )
297  {
298  ret = false;
299  std::cout << "Vector content at index " << i << " does not match " ;
300  std::cout << std::setw(12) << std::fixed << std::setprecision(4) << lhs[i] << " != " << rhs[i] << std::endl;
301  break;
302  }
303  }
304  }
305  // Now set everything back to defaults
306  std::cout.flags( originalFlags );
307  std::cout.precision( originalPrecision );
308  return ret;
309 }
int i
Definition: DBlmapReader.cc:9
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

double DDCompareDBLVEC::tol_

Definition at line 64 of file DDCompareTools.h.

Referenced by operator()().