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
DDCompareCPV Struct Reference

#include <DDCompareTools.h>

Inheritance diagram for DDCompareCPV:

Public Member Functions

 DDCompareCPV ()
 
 DDCompareCPV (const DDCompOptions &ddco)
 
bool operator() (const DDCompactView &lhs, const DDCompactView &rhs) const
 

Public Attributes

DDCompOptions ddco_
 

Detailed Description

Definition at line 34 of file DDCompareTools.h.

Constructor & Destructor Documentation

DDCompareCPV::DDCompareCPV ( )

Definition at line 104 of file DDCompareTools.cc.

104 : ddco_() { }
DDCompOptions ddco_
DDCompareCPV::DDCompareCPV ( const DDCompOptions ddco)

Definition at line 106 of file DDCompareTools.cc.

106 : ddco_(ddco) { }
DDCompOptions ddco_

Member Function Documentation

bool DDCompareCPV::operator() ( const DDCompactView lhs,
const DDCompactView rhs 
) const

Definition at line 108 of file DDCompareTools.cc.

References graph< N, E >::begin(), DDPosData::copyno_, gather_cfg::cout, ddco_, graph< N, E >::edgeData(), graph< N, E >::end(), DDName::fullname(), diffTwoXMLs::g1, diffTwoXMLs::g2, DDCompactView::graph(), i, DDBase< N, C >::name(), graph< N, E >::nodeData(), p1, p2, and runTheMatrix::ret.

108  {
109  bool ret(true);
110 
111  const DDCompactView::graph_type & g1 = lhs.graph();
112  const DDCompactView::graph_type & g2 = rhs.graph();
113 
114  typedef DDCompactView::graph_type::const_adj_iterator adjl_iterator;
115  adjl_iterator git1 = g1.begin();
116  adjl_iterator gend1 = g1.end();
117  adjl_iterator git2 = g2.begin();
118  adjl_iterator gend2 = g2.end();
119  /* std::cout << "uniqueness test: " << &(*git1) << " != " << &(*git2) */
120  /* << " and " << &(*gend1) << " != " << &(*gend2) << std::endl; */
121  // DDCompactView::graph_type::const_iterator bit = g1.begin_iter();
123  // for (; git1 != gend1; ++git1) {
124  while ( git1 != gend1 && git2 != gend2 && ret ) {
125  const DDLogicalPart & ddLP1 = g1.nodeData(git1);
126  const DDLogicalPart & ddLP2 = g2.nodeData(git2);
127  std::cout << ++i << " P " << ddLP1.name() << " " << ddLP2.name() << std::endl;
128  if ( ! DDCompareLP(ddco_)(ddLP1, ddLP2) ) {
129  ret = false;
130  break;
131  } else if (git1->size() && git2->size() ) {
132  DDCompactView::graph_type::edge_list::const_iterator cit1 = git1->begin();
133  DDCompactView::graph_type::edge_list::const_iterator cend1 = git1->end();
134  DDCompactView::graph_type::edge_list::const_iterator cit2 = git2->begin();
135  DDCompactView::graph_type::edge_list::const_iterator cend2 = git2->end();
136  //for (; cit != cend; ++cit) {
137  while ( cit1 != cend1 && cit2 != cend2 ) {
138  const DDLogicalPart & ddcurLP1 = g1.nodeData(cit1->first);
139  const DDLogicalPart & ddcurLP2 = g2.nodeData(cit2->first);
140  std::cout << ++i << " c1--> " << g1.edgeData(cit1->second)->copyno_ << " " << ddcurLP1.name().fullname() << std::endl;
141  std::cout << ++i << " c2--> " << g2.edgeData(cit2->second)->copyno_ << " " << ddcurLP2.name().fullname() << std::endl;
142  const DDPosData* p1(g1.edgeData(cit1->second));
143  const DDPosData* p2(g2.edgeData(cit2->second));
144  // if ( g1.edgeData(cit1->second)->copyno_ != g2.edgeData(cit2->second)->copyno_
145 // if ( p1->copyno_ != p2->copyno_
146 // || ddcurLP1.name().fullname() != ddcurLP2.name().fullname() ) {
147 // std::cout << "Failed to match node (fullname:copy_no): 1: "
148 // << ddcurLP1.name().fullname() << ":" << p1->copyno_ << " 2: "
149 // << ddcurLP2.name().fullname() << ":" << p2->copyno_ << std::endl;
150 // ret = false;
151 // break;
152  if ( p1->copyno_ != p2->copyno_ ||
153  ! DDCompareLP(ddco_)(ddcurLP1,ddcurLP2) ) {
154  std::cout << "Failed to match node (fullname:copy_no): 1: "
155  << ddcurLP1.name().fullname() << ":" << p1->copyno_ << " 2: "
156  << ddcurLP2.name().fullname() << ":" << p2->copyno_ << std::endl;
157  ret = false;
158  break;
159  } else if ( ! DDCompareDDTrans()(p1->trans_, p2->trans_) ) {
160  std::cout << "Failed to match translation " << std::endl;
161 // std::cout << "1: " << std::setw(12) << std::fixed << std::setprecision(4) << p1->trans_.x();
162 // std::cout << "," << std::setw(12) << std::fixed << std::setprecision(4) << p1->trans_.y();
163 // std::cout << "," << std::setw(12) << std::fixed << std::setprecision(4) << p1->trans_.z() << std::endl;
164 // std::cout << "2: " << std::setw(12) << std::fixed << std::setprecision(4) << p2->trans_.x();
165 // std::cout << "," << std::setw(12) << std::fixed << std::setprecision(4) << p2->trans_.y();
166 // std::cout << "," << std::setw(12) << std::fixed << std::setprecision(4) << p2->trans_.z() << std::endl;
167  ret = false;
168  break;
169  } else if ( ! DDCompareDDRot(ddco_)(p1->rot_, p2->rot_) ) {
170  std::cout << "Failed to match rotation " << std::endl;
171  ret = false;
172  break;
173  }
174  ++cit1;
175  ++cit2;
176  }
177  } else if ( git1->size() != git2->size() ) {
178  ret = false;
179  std::cout << "DDCompactViews are different because number of children do not match" << std::endl;
180  std::cout << "graph1 size of edge_list: " << git1->size() << " and graph2 size of edge_list: " << git2->size() << std::endl;
181  break;
182  }
183  ++git1;
184  ++git2;
185  }
186  return ret;
187 }
int i
Definition: DBlmapReader.cc:9
tuple ret
prodAgent to be discontinued
Relative position of a child-volume inside a parent-volume.
Definition: DDPosData.h:13
const N & name() const
Definition: DDBase.h:78
const graph_type & graph() const
Provides read-only access to the data structure of the compact-view.
const N & nodeData(const edge_type &) const
Definition: adjgraph.h:317
const E & edgeData(index_type i) const
Definition: adjgraph.h:183
std::vector< double >::size_type index_type
Definition: adjgraph.h:15
DDCompOptions ddco_
const std::string fullname() const
Definition: DDName.h:51
int copyno_
Definition: DDPosData.h:38
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
double p2[4]
Definition: TauolaWrapper.h:90
Allows to compare name or not. If not, compares only values of the rotation matrix.
adj_list::const_iterator const_adj_iterator
Definition: adjgraph.h:125
LogicalParts have solids which could be BooleanSolids.
double p1[4]
Definition: TauolaWrapper.h:89
tuple cout
Definition: gather_cfg.py:145
adj_iterator begin()
Definition: adjgraph.h:197
adj_iterator end()
Definition: adjgraph.h:199

Member Data Documentation

DDCompOptions DDCompareCPV::ddco_

Definition at line 38 of file DDCompareTools.h.

Referenced by operator()().