CMS 3D CMS Logo

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 44 of file DDCompareTools.h.

Constructor & Destructor Documentation

DDCompareCPV::DDCompareCPV ( )

Definition at line 117 of file DDCompareTools.cc.

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

Definition at line 119 of file DDCompareTools.cc.

119 : ddco_(ddco) { }
DDCompOptions ddco_

Member Function Documentation

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

Definition at line 121 of file DDCompareTools.cc.

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

121  {
122  bool ret(true);
123 
124  const DDCompactView::graph_type & g1 = lhs.graph();
125  const DDCompactView::graph_type & g2 = rhs.graph();
126 
127  typedef DDCompactView::graph_type::const_adj_iterator adjl_iterator;
128  adjl_iterator git1 = g1.begin();
129  adjl_iterator gend1 = g1.end();
130  adjl_iterator git2 = g2.begin();
131  adjl_iterator gend2 = g2.end();
132  /* std::cout << "uniqueness test: " << &(*git1) << " != " << &(*git2) */
133  /* << " and " << &(*gend1) << " != " << &(*gend2) << std::endl; */
134  // DDCompactView::graph_type::const_iterator bit = g1.begin_iter();
136  // for (; git1 != gend1; ++git1) {
137  while ( git1 != gend1 && git2 != gend2 && ret ) {
138  const DDLogicalPart & ddLP1 = g1.nodeData(git1);
139  const DDLogicalPart & ddLP2 = g2.nodeData(git2);
140  std::cout << ++i << " P " << ddLP1.name() << " " << ddLP2.name() << std::endl;
141  if ( ! DDCompareLP(ddco_)(ddLP1, ddLP2) ) {
142  ret = false;
143  break;
144  } else if (!git1->empty() && !git2->empty() ) {
145  DDCompactView::graph_type::edge_list::const_iterator cit1 = git1->begin();
146  DDCompactView::graph_type::edge_list::const_iterator cend1 = git1->end();
147  DDCompactView::graph_type::edge_list::const_iterator cit2 = git2->begin();
148  DDCompactView::graph_type::edge_list::const_iterator cend2 = git2->end();
149  //for (; cit != cend; ++cit) {
150  while ( cit1 != cend1 && cit2 != cend2 ) {
151  const DDLogicalPart & ddcurLP1 = g1.nodeData(cit1->first);
152  const DDLogicalPart & ddcurLP2 = g2.nodeData(cit2->first);
153  std::cout << ++i << " c1--> " << g1.edgeData(cit1->second)->copyno() << " " << ddcurLP1.name().fullname() << std::endl;
154  std::cout << ++i << " c2--> " << g2.edgeData(cit2->second)->copyno() << " " << ddcurLP2.name().fullname() << std::endl;
155  const DDPosData* p1(g1.edgeData(cit1->second));
156  const DDPosData* p2(g2.edgeData(cit2->second));
157  // if ( g1.edgeData(cit1->second)->copyno_ != g2.edgeData(cit2->second)->copyno_
158 // if ( p1->copyno_ != p2->copyno_
159 // || ddcurLP1.name().fullname() != ddcurLP2.name().fullname() ) {
160 // std::cout << "Failed to match node (fullname:copy_no): 1: "
161 // << ddcurLP1.name().fullname() << ":" << p1->copyno_ << " 2: "
162 // << ddcurLP2.name().fullname() << ":" << p2->copyno_ << std::endl;
163 // ret = false;
164 // break;
165  if ( p1->copyno() != p2->copyno() ||
166  ! DDCompareLP(ddco_)(ddcurLP1,ddcurLP2) ) {
167  std::cout << "Failed to match node (fullname:copy_no): 1: "
168  << ddcurLP1.name().fullname() << ":" << p1->copyno() << " 2: "
169  << ddcurLP2.name().fullname() << ":" << p2->copyno() << std::endl;
170  ret = false;
171  break;
172  } else if ( ! DDCompareDDTrans()(p1->trans(), p2->trans()) ) {
173  std::cout << "Failed to match translation " << std::endl;
174 // std::cout << "1: " << std::setw(12) << std::fixed << std::setprecision(4) << p1->trans_.x();
175 // std::cout << "," << std::setw(12) << std::fixed << std::setprecision(4) << p1->trans_.y();
176 // std::cout << "," << std::setw(12) << std::fixed << std::setprecision(4) << p1->trans_.z() << std::endl;
177 // std::cout << "2: " << std::setw(12) << std::fixed << std::setprecision(4) << p2->trans_.x();
178 // std::cout << "," << std::setw(12) << std::fixed << std::setprecision(4) << p2->trans_.y();
179 // std::cout << "," << std::setw(12) << std::fixed << std::setprecision(4) << p2->trans_.z() << std::endl;
180  ret = false;
181  break;
182  } else if ( ! DDCompareDDRot(ddco_)(p1->ddrot(), p2->ddrot()) ) {
183  std::cout << "Failed to match rotation " << std::endl;
184  ret = false;
185  break;
186  }
187  ++cit1;
188  ++cit2;
189  }
190  } else if ( git1->size() != git2->size() ) {
191  ret = false;
192  std::cout << "DDCompactViews are different because number of children do not match" << std::endl;
193  std::cout << "graph1 size of edge_list: " << git1->size() << " and graph2 size of edge_list: " << git2->size() << std::endl;
194  break;
195  }
196  ++git1;
197  ++git2;
198  }
199  return ret;
200 }
Relative position of a child-volume inside a parent-volume.
Definition: DDPosData.h:13
std::vector< double >::size_type index_type
Definition: Graph.h:16
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.
DDCompOptions ddco_
const N & nodeData(const edge_type &) const
Definition: Graph.h:312
const E & edgeData(index_type i) const
Definition: Graph.h:178
const std::string fullname() const
Definition: DDName.h:52
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
double p2[4]
Definition: TauolaWrapper.h:90
adj_iterator end()
Definition: Graph.h:194
int copyno() const
Definition: DDPosData.h:35
Allows to compare name or not. If not, compares only values of the rotation matrix.
adj_iterator begin()
Definition: Graph.h:192
LogicalParts have solids which could be BooleanSolids.
double p1[4]
Definition: TauolaWrapper.h:89
adj_list::const_iterator const_adj_iterator
Definition: Graph.h:125

Member Data Documentation

DDCompOptions DDCompareCPV::ddco_

Definition at line 48 of file DDCompareTools.h.

Referenced by operator()().