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 122 of file DDComparator.cc.

References hIndex_, hist_, hMax_, and sLp_.

Referenced by operator()().

123 {
124  /* does not help, most of the time is spent when FALSE....
125  static size_t hIndexOld=0;
126  // hope same position that previous
127  {
128  size_t oldH = hIndexOld; // thread safe???
129  if (oldH<hMax_ && sLp_== hist_[oldH].logicalPart()) {
130  hIndex_ = oldH+1;
131  ++counter.old;
132  return true;
133  }
134  }
135  */
136  register size_t hi = hIndex_;
137  while (hi < hMax_) {
138  if (sLp_==hist_[hi].logicalPart()) {
139  // hIndexOld=hIndex_;
140  // ++counter.diff;
141  hIndex_ = hi+1;
142  return true;
143  }
144  ++hi;
145  }
146  hIndex_ = hi;
147  return false;
148 }
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 151 of file DDComparator.cc.

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

Referenced by operator()().

152 {
153  bool result(false);
154  while (hIndex_ < hMax_) {
155  if (sLp_ == hist_[hIndex_].logicalPart() &&
156  sCopyno_ == hist_[hIndex_].copyno() )
157  { result=true;
158  ++hIndex_;
159  break;
160  }
161  ++hIndex_;
162  }
163  return result;
164 }
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 167 of file DDComparator.cc.

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

Referenced by operator()().

168 {
169  bool result(false);
170  if (hIndex_ < hMax_) {
171  if (sLp_ == hist_[hIndex_].logicalPart()) {
172  ++hIndex_;
173  result=true;
174  }
175  }
176  return result;
177 }
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 180 of file DDComparator.cc.

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

Referenced by operator()().

181 {
182  bool result(false);
183  if (hIndex_ < hMax_) {
184  if (sLp_ == hist_[hIndex_].logicalPart() &&
185  sCopyno_ == hist_[hIndex_].copyno() ) {
186  ++hIndex_;
187  result=true;
188  }
189  }
190  return result;
191 }
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 56 of file DDComparator.cc.

57 {
58  return (*this)();
59 }
bool DDCompareEqual::operator() ( )

Definition at line 61 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_.

62 {
63 
64  // don't compare, if history or partsel is empty! (see ctor)
65  bool result(absResult_);
66 
67  /*
68  sIndex_ = running index in the part-selection-std::vector
69  sMax_ = max. value + 1 of sIndex_
70  hIndex_ = runninig index in the geo-history-std::vector
71  hMax_ = max. value + 1 of hIndex_
72  sLp_ = current LogicalPart (the redir-ptr!) in the part-selection-std::vector
73  hLp_ = current LogicalPart (the redir-ptr!) in the geo-history-std::vector
74  sCopyno_ = current copy-no in the part-selection-std::vector
75  */
76  //DCOUT('U', "DDCompareEqual: comparing");
77 
78  while(result && sIndex_ < sMax_) {
79  sLp_ = partsel_[sIndex_].lp_;
80  sCopyno_ = partsel_[sIndex_].copyno_;
81  ddselection_type stype = partsel_[sIndex_].selectionType_;
82  switch (stype) {
83 
84  case ddanylogp:
86  break;
87 
88  case ddanyposp:
90  break;
91 
92  case ddchildlogp:
94  break;
95 
96  case ddchildposp:
98  break;
99 
100  case ddanychild:
101  ++sIndex_;
102  ++hIndex_;
103  result=true;
104  break;
105 
106  // ddanynode IS NOT SUPPORTED IN PROTOTYPE SW !!!!
107  case ddanynode:
108  result=false;
109  break;
110 
111  default:
112  result=false;
113  //throw DDException("DDCompareEqual: undefined state!");
114  }
115  ++sIndex_;
116  }
117  counter().add(result,sIndex_, sMax_);
118  return result;
119 }
DDPartSelection::size_type sIndex_
Definition: DDComparator.h:48
bool nextChildposp()
DDPartSelection::size_type const sMax_
Definition: DDComparator.h:47
ddselection_type
tuple result
Definition: query.py:137
DDLogicalPart sLp_
Definition: DDComparator.h:49
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()().