File indexing completed on 2024-04-06 12:05:24
0001 #ifndef DDExpandedNode_h
0002 #define DDExpandedNode_h
0003
0004 #include <iosfwd>
0005 #include <vector>
0006
0007 #include "DetectorDescription/Core/interface/DDRotationMatrix.h"
0008 #include "DetectorDescription/Core/interface/DDTranslation.h"
0009 #include "DetectorDescription/Core/interface/DDLogicalPart.h"
0010 #include "DetectorDescription/Core/interface/DDTransform.h"
0011
0012 class DDExpandedView;
0013 struct DDPosData;
0014
0015
0016 class DDExpandedNode {
0017 friend class DDExpandedView;
0018
0019 public:
0020 DDExpandedNode(
0021 const DDLogicalPart &lp, const DDPosData *pd, const DDTranslation &t, const DDRotationMatrix &r, int siblingno);
0022
0023 ~DDExpandedNode();
0024
0025 bool operator==(const DDExpandedNode &n) const;
0026
0027
0028 const DDLogicalPart &logicalPart() const { return logp_; }
0029
0030
0031 const DDTranslation &absTranslation() const { return trans_; }
0032
0033
0034 const DDRotationMatrix &absRotation() const { return rot_; }
0035
0036
0037 int copyno() const;
0038
0039
0040 int siblingno() const { return siblingno_; }
0041
0042 const DDPosData *posdata() const { return posd_; }
0043
0044 private:
0045 DDLogicalPart logp_;
0046 const DDPosData *posd_;
0047 DDTranslation trans_;
0048 DDRotationMatrix rot_;
0049 int siblingno_;
0050 };
0051
0052
0053
0054
0055
0056 struct DDExpandedNodeLess {
0057 bool operator()(const DDExpandedNode &n1, const DDExpandedNode &n2) {
0058 const DDTranslation &t1 = n1.absTranslation();
0059 const DDTranslation &t2 = n2.absTranslation();
0060
0061 bool result = false;
0062
0063
0064
0065 if (t1.z() < t2.z()) {
0066 result = true;
0067 } else if ((t1.z() == t2.z()) && (t1.y() < t2.y())) {
0068 result = true;
0069 } else if ((t1.z() == t2.z()) && (t1.y() == t2.y()) && (t1.x() < t2.x())) {
0070 result = true;
0071 } else if (n1.siblingno() < n2.siblingno()) {
0072 result = true;
0073 } else if (n1.logicalPart().ddname() < n2.logicalPart().ddname()) {
0074 result = true;
0075 }
0076
0077 return result;
0078 }
0079 };
0080
0081
0082 typedef std::vector<DDExpandedNode> DDGeoHistory;
0083
0084 std::ostream &operator<<(std::ostream &, const DDExpandedNode &);
0085 std::ostream &operator<<(std::ostream &, const DDGeoHistory &);
0086 #endif