CMS 3D CMS Logo

List of all members | Public Member Functions | Protected 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)
 
 DDCompareEqual ()=delete
 
bool operator() (const DDGeoHistory &, const DDPartSelection &)
 
bool operator() ()
 

Protected Member Functions

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

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 20 of file DDComparator.h.

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

21  : hist_(h),
22  partsel_(s),
23  hMax_(h.size()),
24  hIndex_(0),
25  sMax_(s.size()),
26  sIndex_(0),
27  sLp_(),
28  sCopyno_(0),
29  absResult_(hMax_>0 && sMax_>0 )
30  {
31  // it makes only sense to compare if both std::vectors have at least one entry each.
32  }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
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 ( )
delete

Referenced by DDCompareEqual().

Member Function Documentation

bool DDCompareEqual::nextAnylogp ( )
inlineprotected

Definition at line 78 of file DDComparator.cc.

References hIndex_, hist_, hMax_, and sLp_.

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

79 {
80  size_t hi = hIndex_;
81  while (hi < hMax_) {
82  if (sLp_==hist_[hi].logicalPart()) {
83  hIndex_ = hi+1;
84  return true;
85  }
86  ++hi;
87  }
88  hIndex_ = hi;
89  return false;
90 }
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 93 of file DDComparator.cc.

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

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

94 {
95  bool result(false);
96  while (hIndex_ < hMax_) {
97  if (sLp_ == hist_[hIndex_].logicalPart() &&
98  sCopyno_ == hist_[hIndex_].copyno() )
99  { result=true;
100  ++hIndex_;
101  break;
102  }
103  ++hIndex_;
104  }
105  return result;
106 }
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 109 of file DDComparator.cc.

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

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

110 {
111  bool result(false);
112  if (hIndex_ < hMax_) {
113  if (sLp_ == hist_[hIndex_].logicalPart()) {
114  ++hIndex_;
115  result=true;
116  }
117  }
118  return result;
119 }
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 122 of file DDComparator.cc.

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

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

123 {
124  bool result(false);
125  if (hIndex_ < hMax_) {
126  if (sLp_ == hist_[hIndex_].logicalPart() &&
127  sCopyno_ == hist_[hIndex_].copyno() ) {
128  ++hIndex_;
129  result=true;
130  }
131  }
132  return result;
133 }
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 13 of file DDComparator.cc.

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

Definition at line 18 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().

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