CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
DDCompareEqual Class Reference

compares a given geometrical-history whether it corresponds to the given part-selector More...

#include <DDComparator.h>

Public Member Functions

 DDCompareEqual (const DDGeoHistory &h, const DDPartSelection &s)
 
bool operator() (const DDGeoHistory &, const DDPartSelection &)
 
bool operator() ()
 

Protected Member Functions

bool nextAnylogp ()
 
bool nextAnyposp ()
 
bool nextChildlogp ()
 
bool nextChildposp ()
 

Private Member Functions

 DDCompareEqual ()
 

Private Attributes

bool absResult_
 
DDGeoHistory::size_type hIndex_
 
const DDGeoHistoryhist_
 
DDGeoHistory::size_type const hMax_
 
const DDPartSelectionpartsel_
 
int sCopyno_
 
DDPartSelection::size_type sIndex_
 
DDLogicalPart sLp_
 
DDPartSelection::size_type const sMax_
 

Detailed Description

compares a given geometrical-history whether it corresponds to the given part-selector

This is a function-object.

Definition at line 16 of file DDComparator.h.

Constructor & Destructor Documentation

DDCompareEqual::DDCompareEqual ( const DDGeoHistory h,
const DDPartSelection s 
)
inline

Definition at line 19 of file DDComparator.h.

References DDCompareEqual(), nextAnylogp(), nextAnyposp(), nextChildlogp(), nextChildposp(), and operator()().

20  : hist_(h),
21  partsel_(s),
22  hMax_(h.size()),
23  hIndex_(0),
24  sMax_(s.size()),
25  sIndex_(0),
26  sLp_(),
27  sCopyno_(0),
28  absResult_(hMax_>0 && sMax_>0 )
29  {
30  // it makes only sense to compare if both std::vectors have at least one entry each.
31  //std::cout << std::endl << std::endl << "COMPARATOR CREATED" << std::endl << std::endl;
32  //DCOUT('U', "Comparator():\n hist=" << h << "\n PartSel=" << s);
33  }
DDPartSelection::size_type sIndex_
Definition: DDComparator.h:51
DDPartSelection::size_type const sMax_
Definition: DDComparator.h:50
DDLogicalPart sLp_
Definition: DDComparator.h:52
const DDPartSelection & partsel_
Definition: DDComparator.h:47
DDGeoHistory::size_type hIndex_
Definition: DDComparator.h:49
DDGeoHistory::size_type const hMax_
Definition: DDComparator.h:48
const DDGeoHistory & hist_
Definition: DDComparator.h:46
DDCompareEqual::DDCompareEqual ( )
private

Referenced by DDCompareEqual().

Member Function Documentation

bool DDCompareEqual::nextAnylogp ( )
inlineprotected

Definition at line 77 of file DDComparator.cc.

References hIndex_, hist_, hMax_, and sLp_.

Referenced by DDCompareEqual(), and operator()().

78 {
79  size_t hi = hIndex_;
80  while (hi < hMax_) {
81  if (sLp_==hist_[hi].logicalPart()) {
82  hIndex_ = hi+1;
83  return true;
84  }
85  ++hi;
86  }
87  hIndex_ = hi;
88  return false;
89 }
DDLogicalPart sLp_
Definition: DDComparator.h:52
DDGeoHistory::size_type hIndex_
Definition: DDComparator.h:49
DDGeoHistory::size_type const hMax_
Definition: DDComparator.h:48
const DDGeoHistory & hist_
Definition: DDComparator.h:46
bool DDCompareEqual::nextAnyposp ( )
inlineprotected

Definition at line 92 of file DDComparator.cc.

References hIndex_, hist_, hMax_, mps_fire::result, sCopyno_, and sLp_.

Referenced by DDCompareEqual(), and operator()().

93 {
94  bool result(false);
95  while (hIndex_ < hMax_) {
96  if (sLp_ == hist_[hIndex_].logicalPart() &&
97  sCopyno_ == hist_[hIndex_].copyno() )
98  { result=true;
99  ++hIndex_;
100  break;
101  }
102  ++hIndex_;
103  }
104  return result;
105 }
DDLogicalPart sLp_
Definition: DDComparator.h:52
DDGeoHistory::size_type hIndex_
Definition: DDComparator.h:49
DDGeoHistory::size_type const hMax_
Definition: DDComparator.h:48
const DDGeoHistory & hist_
Definition: DDComparator.h:46
bool DDCompareEqual::nextChildlogp ( )
inlineprotected

Definition at line 108 of file DDComparator.cc.

References hIndex_, hist_, hMax_, mps_fire::result, and sLp_.

Referenced by DDCompareEqual(), and operator()().

109 {
110  bool result(false);
111  if (hIndex_ < hMax_) {
112  if (sLp_ == hist_[hIndex_].logicalPart()) {
113  ++hIndex_;
114  result=true;
115  }
116  }
117  return result;
118 }
DDLogicalPart sLp_
Definition: DDComparator.h:52
DDGeoHistory::size_type hIndex_
Definition: DDComparator.h:49
DDGeoHistory::size_type const hMax_
Definition: DDComparator.h:48
const DDGeoHistory & hist_
Definition: DDComparator.h:46
bool DDCompareEqual::nextChildposp ( )
inlineprotected

Definition at line 121 of file DDComparator.cc.

References hIndex_, hist_, hMax_, mps_fire::result, sCopyno_, and sLp_.

Referenced by DDCompareEqual(), and operator()().

122 {
123  bool result(false);
124  if (hIndex_ < hMax_) {
125  if (sLp_ == hist_[hIndex_].logicalPart() &&
126  sCopyno_ == hist_[hIndex_].copyno() ) {
127  ++hIndex_;
128  result=true;
129  }
130  }
131  return result;
132 }
DDLogicalPart sLp_
Definition: DDComparator.h:52
DDGeoHistory::size_type hIndex_
Definition: DDComparator.h:49
DDGeoHistory::size_type const hMax_
Definition: DDComparator.h:48
const DDGeoHistory & hist_
Definition: DDComparator.h:46
bool DDCompareEqual::operator() ( const DDGeoHistory ,
const DDPartSelection  
)

Definition at line 12 of file DDComparator.cc.

13 {
14  return (*this)();
15 }
bool DDCompareEqual::operator() ( )

Definition at line 17 of file DDComparator.cc.

References absResult_, ddanychild, ddanylogp, ddanynode, ddanyposp, ddchildlogp, ddchildposp, hIndex_, nextAnylogp(), nextAnyposp(), nextChildlogp(), nextChildposp(), partsel_, mps_fire::result, sCopyno_, sIndex_, sLp_, and sMax_.

Referenced by DDCompareEqual().

18 {
19 
20  // don't compare, if history or partsel is empty! (see ctor)
21  bool result(absResult_);
22 
23  /*
24  sIndex_ = running index in the part-selection-std::vector
25  sMax_ = max. value + 1 of sIndex_
26  hIndex_ = runninig index in the geo-history-std::vector
27  hMax_ = max. value + 1 of hIndex_
28  sLp_ = current LogicalPart (the redir-ptr!) in the part-selection-std::vector
29  hLp_ = current LogicalPart (the redir-ptr!) in the geo-history-std::vector
30  sCopyno_ = current copy-no in the part-selection-std::vector
31  */
32  //DCOUT('U', "DDCompareEqual: comparing");
33 
34  while(result && sIndex_ < sMax_) {
35  sLp_ = partsel_[sIndex_].lp_;
36  sCopyno_ = partsel_[sIndex_].copyno_;
37  ddselection_type stype = partsel_[sIndex_].selectionType_;
38  switch (stype) {
39 
40  case ddanylogp:
42  break;
43 
44  case ddanyposp:
46  break;
47 
48  case ddchildlogp:
50  break;
51 
52  case ddchildposp:
54  break;
55 
56  case ddanychild:
57  ++sIndex_;
58  ++hIndex_;
59  result=true;
60  break;
61 
62  // ddanynode IS NOT SUPPORTED IN PROTOTYPE SW !!!!
63  case ddanynode:
64  result=false;
65  break;
66 
67  default:
68  result=false;
69  //throw DDException("DDCompareEqual: undefined state!");
70  }
71  ++sIndex_;
72  }
73  return result;
74 }
DDPartSelection::size_type sIndex_
Definition: DDComparator.h:51
bool nextChildposp()
DDPartSelection::size_type const sMax_
Definition: DDComparator.h:50
bool nextAnyposp()
Definition: DDComparator.cc:92
ddselection_type
DDLogicalPart sLp_
Definition: DDComparator.h:52
bool nextAnylogp()
Definition: DDComparator.cc:77
const DDPartSelection & partsel_
Definition: DDComparator.h:47
DDGeoHistory::size_type hIndex_
Definition: DDComparator.h:49
bool nextChildlogp()

Member Data Documentation

bool DDCompareEqual::absResult_
private

Definition at line 58 of file DDComparator.h.

Referenced by operator()().

DDGeoHistory::size_type DDCompareEqual::hIndex_
private

Definition at line 49 of file DDComparator.h.

Referenced by nextAnylogp(), nextAnyposp(), nextChildlogp(), nextChildposp(), and operator()().

const DDGeoHistory& DDCompareEqual::hist_
private

Definition at line 46 of file DDComparator.h.

Referenced by nextAnylogp(), nextAnyposp(), nextChildlogp(), and nextChildposp().

DDGeoHistory::size_type const DDCompareEqual::hMax_
private

Definition at line 48 of file DDComparator.h.

Referenced by nextAnylogp(), nextAnyposp(), nextChildlogp(), and nextChildposp().

const DDPartSelection& DDCompareEqual::partsel_
private

Definition at line 47 of file DDComparator.h.

Referenced by operator()().

int DDCompareEqual::sCopyno_
private

Definition at line 57 of file DDComparator.h.

Referenced by nextAnyposp(), nextChildposp(), and operator()().

DDPartSelection::size_type DDCompareEqual::sIndex_
private

Definition at line 51 of file DDComparator.h.

Referenced by operator()().

DDLogicalPart DDCompareEqual::sLp_
private

Definition at line 52 of file DDComparator.h.

Referenced by nextAnylogp(), nextAnyposp(), nextChildlogp(), nextChildposp(), and operator()().

DDPartSelection::size_type const DDCompareEqual::sMax_
private

Definition at line 50 of file DDComparator.h.

Referenced by operator()().