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 76 of file DDCompareTools.cc.

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

Definition at line 78 of file DDCompareTools.cc.

78 : ddco_(ddco) { }
DDCompOptions ddco_

Member Function Documentation

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

Definition at line 80 of file DDCompareTools.cc.

References gather_cfg::cout, ddco_, DDName::fullname(), diffTwoXMLs::g1, diffTwoXMLs::g2, DDCompactView::graph(), mps_fire::i, DDBase< N, C >::name(), p1, and p2.

80  {
81  bool ret(true);
82 
83  const auto & g1 = lhs.graph();
84  const auto & g2 = rhs.graph();
85 
88 
89  adjl_iterator git1 = g1.begin();
90  adjl_iterator gend1 = g1.end();
91  adjl_iterator git2 = g2.begin();
92  adjl_iterator gend2 = g2.end();
93 
95 
96  while ( git1 != gend1 && git2 != gend2 && ret ) {
97  const DDLogicalPart & ddLP1 = g1.nodeData(git1);
98  const DDLogicalPart & ddLP2 = g2.nodeData(git2);
99  std::cout << ++i << " P " << ddLP1.name() << " " << ddLP2.name() << std::endl;
100  if ( ! DDCompareLP(ddco_)(ddLP1, ddLP2) ) {
101  ret = false;
102  break;
103  } else if (!git1->empty() && !git2->empty() ) {
104  auto cit1 = git1->begin();
105  auto cend1 = git1->end();
106  auto cit2 = git2->begin();
107  auto cend2 = git2->end();
108 
109  while ( cit1 != cend1 && cit2 != cend2 ) {
110  const DDLogicalPart & ddcurLP1 = g1.nodeData(cit1->first);
111  const DDLogicalPart & ddcurLP2 = g2.nodeData(cit2->first);
112  std::cout << ++i << " c1--> " << g1.edgeData(cit1->second)->copyno() << " " << ddcurLP1.name().fullname() << std::endl;
113  std::cout << ++i << " c2--> " << g2.edgeData(cit2->second)->copyno() << " " << ddcurLP2.name().fullname() << std::endl;
114  const DDPosData* p1(g1.edgeData(cit1->second));
115  const DDPosData* p2(g2.edgeData(cit2->second));
116 
117  if ( p1->copyno() != p2->copyno() ||
118  ! DDCompareLP(ddco_)(ddcurLP1,ddcurLP2) ) {
119  std::cout << "Failed to match node (fullname:copy_no): 1: "
120  << ddcurLP1.name().fullname() << ":" << p1->copyno() << " 2: "
121  << ddcurLP2.name().fullname() << ":" << p2->copyno() << std::endl;
122  ret = false;
123  break;
124  } else if ( ! DDCompareDDTrans()(p1->trans(), p2->trans()) ) {
125  std::cout << "Failed to match translation " << std::endl;
126  ret = false;
127  break;
128  } else if ( ! DDCompareDDRot(ddco_)(p1->ddrot(), p2->ddrot()) ) {
129  std::cout << "Failed to match rotation " << std::endl;
130  ret = false;
131  break;
132  }
133  ++cit1;
134  ++cit2;
135  }
136  } else if ( git1->size() != git2->size() ) {
137  ret = false;
138  std::cout << "DDCompactViews are different because number of children do not match" << std::endl;
139  std::cout << "graph1 size of edge_list: " << git1->size() << " and graph2 size of edge_list: " << git2->size() << std::endl;
140  break;
141  }
142  ++git1;
143  ++git2;
144  }
145  return ret;
146 }
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
DDCompOptions ddco_
const std::string fullname() const
Definition: DDName.h:52
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
Graph::const_adj_iterator adjl_iterator
double p2[4]
Definition: TauolaWrapper.h:90
const Graph & graph() const
Provides read-only access to the data structure of the compact-view.
Allows to compare name or not. If not, compares only values of the rotation matrix.
LogicalParts have solids which could be BooleanSolids.
double p1[4]
Definition: TauolaWrapper.h:89
math::Graph< DDLogicalPart, DDPosData * > Graph
Definition: DDCompactView.h:86
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()().