DDCompareEqual

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
#ifndef DETECTOR_DESCRIPTION_CORE_DD_COMPARATOR_H
#define DETECTOR_DESCRIPTION_CORE_DD_COMPARATOR_H

#include <vector>

#include "DetectorDescription/Core/interface/DDExpandedNode.h"
#include "DetectorDescription/Core/interface/DDExpandedView.h"
#include "DetectorDescription/Core/interface/DDLogicalPart.h"
#include "DetectorDescription/Core/interface/DDPartSelection.h"

//! compares a given geometrical-history whether it corresponds to the given part-selector
/**
  This is a function-object.
*/
class DDCompareEqual {
public:
  DDCompareEqual(const DDGeoHistory &h, const DDPartSelection &s)
      : hist_(h),
        partsel_(s),
        hMax_(h.size()),
        hIndex_(0),
        sMax_(s.size()),
        sIndex_(0),
        sLp_(),
        sCopyno_(0),
        absResult_(hMax_ > 0 && sMax_ > 0) {
    // it makes only sense to compare if both std::vectors have at least one entry each.
  }

  DDCompareEqual() = delete;

  bool operator()(const DDGeoHistory &, const DDPartSelection &);
  bool operator()();

protected:
  inline bool nextAnylogp();
  inline bool nextAnyposp();
  inline bool nextChildlogp();
  inline bool nextChildposp();

private:
  const DDGeoHistory &hist_;
  const DDPartSelection &partsel_;
  DDGeoHistory::size_type const hMax_;
  DDGeoHistory::size_type hIndex_;
  DDPartSelection::size_type const sMax_;
  DDPartSelection::size_type sIndex_;
  DDLogicalPart sLp_;
  int sCopyno_;
  bool absResult_;
};

#endif