Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:23

0001 #ifndef DETECTOR_DESCRIPTION_CORE_DD_COMPARATOR_H
0002 #define DETECTOR_DESCRIPTION_CORE_DD_COMPARATOR_H
0003 
0004 #include <vector>
0005 
0006 #include "DetectorDescription/Core/interface/DDExpandedNode.h"
0007 #include "DetectorDescription/Core/interface/DDExpandedView.h"
0008 #include "DetectorDescription/Core/interface/DDLogicalPart.h"
0009 #include "DetectorDescription/Core/interface/DDPartSelection.h"
0010 
0011 //! compares a given geometrical-history whether it corresponds to the given part-selector
0012 /**
0013   This is a function-object.
0014 */
0015 class DDCompareEqual {
0016 public:
0017   DDCompareEqual(const DDGeoHistory &h, const DDPartSelection &s)
0018       : hist_(h),
0019         partsel_(s),
0020         hMax_(h.size()),
0021         hIndex_(0),
0022         sMax_(s.size()),
0023         sIndex_(0),
0024         sLp_(),
0025         sCopyno_(0),
0026         absResult_(hMax_ > 0 && sMax_ > 0) {
0027     // it makes only sense to compare if both std::vectors have at least one entry each.
0028   }
0029 
0030   DDCompareEqual() = delete;
0031 
0032   bool operator()(const DDGeoHistory &, const DDPartSelection &);
0033   bool operator()();
0034 
0035 protected:
0036   inline bool nextAnylogp();
0037   inline bool nextAnyposp();
0038   inline bool nextChildlogp();
0039   inline bool nextChildposp();
0040 
0041 private:
0042   const DDGeoHistory &hist_;
0043   const DDPartSelection &partsel_;
0044   DDGeoHistory::size_type const hMax_;
0045   DDGeoHistory::size_type hIndex_;
0046   DDPartSelection::size_type const sMax_;
0047   DDPartSelection::size_type sIndex_;
0048   DDLogicalPart sLp_;
0049   int sCopyno_;
0050   bool absResult_;
0051 };
0052 
0053 #endif