CMS 3D CMS Logo

DDComparator.cc
Go to the documentation of this file.
2 
3 #include <cstddef>
4 #include <memory>
5 
7 
8 // reason for the ctor: reference initialization at construction.
9 // FIXME: DDCompareEqual: use pointers instead of references, initialize to 0 and
10 // FIXME: do the check in operator() instead of in the ctor
11 
12 bool DDCompareEqual::operator()(const DDGeoHistory&, const DDPartSelection&) { return (*this)(); }
13 
15  // don't compare, if history or partsel is empty! (see ctor)
16  bool result(absResult_);
17 
18  /*
19  sIndex_ = running index in the part-selection-std::vector
20  sMax_ = max. value + 1 of sIndex_
21  hIndex_ = runninig index in the geo-history-std::vector
22  hMax_ = max. value + 1 of hIndex_
23  sLp_ = current LogicalPart (the redir-ptr!) in the part-selection-std::vector
24  hLp_ = current LogicalPart (the redir-ptr!) in the geo-history-std::vector
25  sCopyno_ = current copy-no in the part-selection-std::vector
26  */
27  //DCOUT('U', "DDCompareEqual: comparing");
28 
29  while (result && sIndex_ < sMax_) {
30  sLp_ = partsel_[sIndex_].lp_;
31  sCopyno_ = partsel_[sIndex_].copyno_;
32  ddselection_type stype = partsel_[sIndex_].selectionType_;
33  switch (stype) {
34  case ddanylogp:
35  result = nextAnylogp();
36  break;
37 
38  case ddanyposp:
39  result = nextAnyposp();
40  break;
41 
42  case ddchildlogp:
44  break;
45 
46  case ddchildposp:
48  break;
49 
50  case ddanychild:
51  ++sIndex_;
52  ++hIndex_;
53  result = true;
54  break;
55 
56  // ddanynode IS NOT SUPPORTED IN PROTOTYPE SW !!!!
57  case ddanynode:
58  result = false;
59  break;
60 
61  default:
62  result = false;
63  //throw DDException("DDCompareEqual: undefined state!");
64  }
65  ++sIndex_;
66  }
67  return result;
68 }
69 
71  size_t hi = hIndex_;
72  while (hi < hMax_) {
73  if (sLp_ == hist_[hi].logicalPart()) {
74  hIndex_ = hi + 1;
75  return true;
76  }
77  ++hi;
78  }
79  hIndex_ = hi;
80  return false;
81 }
82 
84  bool result(false);
85  while (hIndex_ < hMax_) {
86  if (sLp_ == hist_[hIndex_].logicalPart() && sCopyno_ == hist_[hIndex_].copyno()) {
87  result = true;
88  ++hIndex_;
89  break;
90  }
91  ++hIndex_;
92  }
93  return result;
94 }
95 
97  bool result(false);
98  if (hIndex_ < hMax_) {
99  if (sLp_ == hist_[hIndex_].logicalPart()) {
100  ++hIndex_;
101  result = true;
102  }
103  }
104  return result;
105 }
106 
108  bool result(false);
109  if (hIndex_ < hMax_) {
110  if (sLp_ == hist_[hIndex_].logicalPart() && sCopyno_ == hist_[hIndex_].copyno()) {
111  ++hIndex_;
112  result = true;
113  }
114  }
115  return result;
116 }
DDPartSelection::size_type sIndex_
Definition: DDComparator.h:47
bool nextChildposp()
DDPartSelection::size_type const sMax_
Definition: DDComparator.h:46
Definition: EPCuts.h:4
bool nextAnyposp()
Definition: DDComparator.cc:83
ddselection_type
DDLogicalPart sLp_
Definition: DDComparator.h:48
bool nextAnylogp()
Definition: DDComparator.cc:70
std::vector< DDExpandedNode > DDGeoHistory
Geometrical &#39;path&#39; of the current node up to the root-node.
const DDPartSelection & partsel_
Definition: DDComparator.h:43
DDGeoHistory::size_type hIndex_
Definition: DDComparator.h:45
DDGeoHistory::size_type const hMax_
Definition: DDComparator.h:44
bool nextChildlogp()
Definition: DDComparator.cc:96
const DDGeoHistory & hist_
Definition: DDComparator.h:42