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

Constructor & Destructor Documentation

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

Definition at line 17 of file DDComparator.h.

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

18  : hist_(h),
19  partsel_(s),
20  hMax_(h.size()),
21  hIndex_(0),
22  sMax_(s.size()),
23  sIndex_(0),
24  sLp_(),
25  sCopyno_(0),
26  absResult_(hMax_ > 0 && sMax_ > 0) {
27  // it makes only sense to compare if both std::vectors have at least one entry each.
28  }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
DDPartSelection::size_type sIndex_
Definition: DDComparator.h:47
DDPartSelection::size_type const sMax_
Definition: DDComparator.h:46
DDLogicalPart sLp_
Definition: DDComparator.h:48
const DDPartSelection & partsel_
Definition: DDComparator.h:43
DDGeoHistory::size_type hIndex_
Definition: DDComparator.h:45
DDGeoHistory::size_type const hMax_
Definition: DDComparator.h:44
const DDGeoHistory & hist_
Definition: DDComparator.h:42
DDCompareEqual::DDCompareEqual ( )
delete

Referenced by DDCompareEqual().

Member Function Documentation

bool DDCompareEqual::nextAnylogp ( )
inlineprotected

Definition at line 70 of file DDComparator.cc.

References hIndex_, hist_, hMax_, and sLp_.

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

70  {
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 }
DDLogicalPart sLp_
Definition: DDComparator.h:48
DDGeoHistory::size_type hIndex_
Definition: DDComparator.h:45
DDGeoHistory::size_type const hMax_
Definition: DDComparator.h:44
const DDGeoHistory & hist_
Definition: DDComparator.h:42
bool DDCompareEqual::nextAnyposp ( )
inlineprotected

Definition at line 83 of file DDComparator.cc.

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

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

83  {
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 }
DDLogicalPart sLp_
Definition: DDComparator.h:48
DDGeoHistory::size_type hIndex_
Definition: DDComparator.h:45
DDGeoHistory::size_type const hMax_
Definition: DDComparator.h:44
const DDGeoHistory & hist_
Definition: DDComparator.h:42
bool DDCompareEqual::nextChildlogp ( )
inlineprotected

Definition at line 96 of file DDComparator.cc.

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

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

96  {
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 }
DDLogicalPart sLp_
Definition: DDComparator.h:48
DDGeoHistory::size_type hIndex_
Definition: DDComparator.h:45
DDGeoHistory::size_type const hMax_
Definition: DDComparator.h:44
const DDGeoHistory & hist_
Definition: DDComparator.h:42
bool DDCompareEqual::nextChildposp ( )
inlineprotected

Definition at line 107 of file DDComparator.cc.

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

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

107  {
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 }
DDLogicalPart sLp_
Definition: DDComparator.h:48
DDGeoHistory::size_type hIndex_
Definition: DDComparator.h:45
DDGeoHistory::size_type const hMax_
Definition: DDComparator.h:44
const DDGeoHistory & hist_
Definition: DDComparator.h:42
bool DDCompareEqual::operator() ( const DDGeoHistory ,
const DDPartSelection  
)

Definition at line 12 of file DDComparator.cc.

12 { return (*this)(); }
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_, mps_fire::result, sCopyno_, sIndex_, sLp_, and sMax_.

Referenced by DDCompareEqual().

14  {
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 }
DDPartSelection::size_type sIndex_
Definition: DDComparator.h:47
bool nextChildposp()
DDPartSelection::size_type const sMax_
Definition: DDComparator.h:46
bool nextAnyposp()
Definition: DDComparator.cc:83
ddselection_type
DDLogicalPart sLp_
Definition: DDComparator.h:48
bool nextAnylogp()
Definition: DDComparator.cc:70
const DDPartSelection & partsel_
Definition: DDComparator.h:43
DDGeoHistory::size_type hIndex_
Definition: DDComparator.h:45
bool nextChildlogp()
Definition: DDComparator.cc:96

Member Data Documentation

bool DDCompareEqual::absResult_
private

Definition at line 50 of file DDComparator.h.

Referenced by operator()().

DDGeoHistory::size_type DDCompareEqual::hIndex_
private

Definition at line 45 of file DDComparator.h.

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

const DDGeoHistory& DDCompareEqual::hist_
private

Definition at line 42 of file DDComparator.h.

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

DDGeoHistory::size_type const DDCompareEqual::hMax_
private

Definition at line 44 of file DDComparator.h.

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

const DDPartSelection& DDCompareEqual::partsel_
private

Definition at line 43 of file DDComparator.h.

Referenced by operator()().

int DDCompareEqual::sCopyno_
private

Definition at line 49 of file DDComparator.h.

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

DDPartSelection::size_type DDCompareEqual::sIndex_
private

Definition at line 47 of file DDComparator.h.

Referenced by operator()().

DDLogicalPart DDCompareEqual::sLp_
private

Definition at line 48 of file DDComparator.h.

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

DDPartSelection::size_type const DDCompareEqual::sMax_
private

Definition at line 46 of file DDComparator.h.

Referenced by operator()().