CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 13 of file DDComparator.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file DDComparator.h.

17  : hist_(h),
18  partsel_(s),
19  hMax_(h.size()),
20  hIndex_(0),
21  sMax_(s.size()),
22  sIndex_(0),
23  sLp_(),
24  sCopyno_(0),
25  absResult_(hMax_>0 && sMax_>0 )
26  {
27  // it makes only sense to compare if both std::vectors have at least one entry each.
28  //std::cout << std::endl << std::endl << "COMPARATOR CREATED" << std::endl << std::endl;
29  //DCOUT('U', "Comparator():\n hist=" << h << "\n PartSel=" << s);
30  }
DDPartSelection::size_type sIndex_
Definition: DDComparator.h:48
DDPartSelection::size_type const sMax_
Definition: DDComparator.h:47
DDLogicalPart sLp_
Definition: DDComparator.h:49
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
const DDPartSelection & partsel_
Definition: DDComparator.h:44
DDGeoHistory::size_type hIndex_
Definition: DDComparator.h:46
DDGeoHistory::size_type const hMax_
Definition: DDComparator.h:45
const DDGeoHistory & hist_
Definition: DDComparator.h:43
DDCompareEqual::DDCompareEqual ( )
private

Member Function Documentation

bool DDCompareEqual::nextAnylogp ( )
inlineprotected

Definition at line 74 of file DDComparator.cc.

References hIndex_, hist_, hMax_, and sLp_.

Referenced by operator()().

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

Definition at line 89 of file DDComparator.cc.

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

Referenced by operator()().

90 {
91  bool result(false);
92  while (hIndex_ < hMax_) {
93  if (sLp_ == hist_[hIndex_].logicalPart() &&
94  sCopyno_ == hist_[hIndex_].copyno() )
95  { result=true;
96  ++hIndex_;
97  break;
98  }
99  ++hIndex_;
100  }
101  return result;
102 }
tuple result
Definition: query.py:137
DDLogicalPart sLp_
Definition: DDComparator.h:49
DDGeoHistory::size_type hIndex_
Definition: DDComparator.h:46
DDGeoHistory::size_type const hMax_
Definition: DDComparator.h:45
const DDGeoHistory & hist_
Definition: DDComparator.h:43
bool DDCompareEqual::nextChildlogp ( )
inlineprotected

Definition at line 105 of file DDComparator.cc.

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

Referenced by operator()().

106 {
107  bool result(false);
108  if (hIndex_ < hMax_) {
109  if (sLp_ == hist_[hIndex_].logicalPart()) {
110  ++hIndex_;
111  result=true;
112  }
113  }
114  return result;
115 }
tuple result
Definition: query.py:137
DDLogicalPart sLp_
Definition: DDComparator.h:49
DDGeoHistory::size_type hIndex_
Definition: DDComparator.h:46
DDGeoHistory::size_type const hMax_
Definition: DDComparator.h:45
const DDGeoHistory & hist_
Definition: DDComparator.h:43
bool DDCompareEqual::nextChildposp ( )
inlineprotected

Definition at line 118 of file DDComparator.cc.

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

Referenced by operator()().

119 {
120  bool result(false);
121  if (hIndex_ < hMax_) {
122  if (sLp_ == hist_[hIndex_].logicalPart() &&
123  sCopyno_ == hist_[hIndex_].copyno() ) {
124  ++hIndex_;
125  result=true;
126  }
127  }
128  return result;
129 }
tuple result
Definition: query.py:137
DDLogicalPart sLp_
Definition: DDComparator.h:49
DDGeoHistory::size_type hIndex_
Definition: DDComparator.h:46
DDGeoHistory::size_type const hMax_
Definition: DDComparator.h:45
const DDGeoHistory & hist_
Definition: DDComparator.h:43
bool DDCompareEqual::operator() ( const DDGeoHistory ,
const DDPartSelection  
)

Definition at line 9 of file DDComparator.cc.

10 {
11  return (*this)();
12 }
bool DDCompareEqual::operator() ( )

Definition at line 14 of file DDComparator.cc.

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

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

Member Data Documentation

bool DDCompareEqual::absResult_
private

Definition at line 55 of file DDComparator.h.

Referenced by operator()().

DDGeoHistory::size_type DDCompareEqual::hIndex_
private

Definition at line 46 of file DDComparator.h.

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

const DDGeoHistory& DDCompareEqual::hist_
private

Definition at line 43 of file DDComparator.h.

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

DDGeoHistory::size_type const DDCompareEqual::hMax_
private

Definition at line 45 of file DDComparator.h.

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

const DDPartSelection& DDCompareEqual::partsel_
private

Definition at line 44 of file DDComparator.h.

Referenced by operator()().

int DDCompareEqual::sCopyno_
private

Definition at line 54 of file DDComparator.h.

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

DDPartSelection::size_type DDCompareEqual::sIndex_
private

Definition at line 48 of file DDComparator.h.

Referenced by operator()().

DDLogicalPart DDCompareEqual::sLp_
private

Definition at line 49 of file DDComparator.h.

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

DDPartSelection::size_type const DDCompareEqual::sMax_
private

Definition at line 47 of file DDComparator.h.

Referenced by operator()().