00001 #ifndef DDExpandedNode_h 00002 #define DDExpandedNode_h 00003 00004 #include "DetectorDescription/Core/interface/DDTransform.h" 00005 #include "DetectorDescription/Base/interface/DDTranslation.h" 00006 #include "DetectorDescription/Core/interface/DDLogicalPart.h" 00007 #include <vector> 00008 #include <iosfwd> 00009 00010 class DDExpandedView; 00011 class DDPosData; 00012 00014 class DDExpandedNode 00015 { 00016 friend class DDExpandedView; 00017 00018 public: 00019 DDExpandedNode(const DDLogicalPart & lp, 00020 DDPosData * pd, 00021 const DDTranslation & t, 00022 const DDRotationMatrix & r, 00023 int siblingno); 00024 00025 ~DDExpandedNode(); 00026 00027 00028 bool operator==(const DDExpandedNode & n) const; 00029 00031 const DDLogicalPart & logicalPart() const { return logp_; } 00032 00033 00035 const DDTranslation & absTranslation() const { return trans_; } 00036 00037 00039 const DDRotationMatrix & absRotation() const { return rot_; } 00040 00042 int copyno() const; 00043 00045 int siblingno() const { return siblingno_; } 00046 00047 00048 const DDPosData * posdata() const { return posd_; } 00049 00050 private: 00051 DDLogicalPart logp_; // logicalpart to provide access to solid & material information 00052 DDPosData * posd_; 00053 DDTranslation trans_; // absolute translation 00054 DDRotationMatrix rot_; // absolute rotation 00055 int siblingno_; // internal sibling-numbering from 0 to max-sibling 00056 }; 00057 00058 00059 00061 00064 struct DDExpandedNodeLess 00065 { 00066 00067 bool operator()(const DDExpandedNode & n1, const DDExpandedNode & n2) 00068 { 00069 const DDTranslation & t1 = n1.absTranslation(); 00070 const DDTranslation & t2 = n2.absTranslation(); 00071 00072 bool result = false; 00073 00074 // 'alphabetical ordering' according to absolute position 00075 00076 if (t1.z() < t2.z()) 00077 { 00078 result=true; 00079 } 00080 else if ( (t1.z()==t2.z()) && (t1.y() < t2.y())) 00081 { 00082 result=true; 00083 } 00084 else if ( (t1.z()==t2.z()) && (t1.y()==t2.y()) && (t1.x()<t2.x())) 00085 { 00086 result=true; 00087 } 00088 else if (n1.siblingno() < n2.siblingno()) 00089 { 00090 result=true; 00091 } 00092 else if (n1.logicalPart().ddname() < n2.logicalPart().ddname()) 00093 { 00094 result=true; 00095 } 00096 00097 return result; 00098 } 00099 00100 }; 00101 00102 00104 typedef std::vector<DDExpandedNode> DDGeoHistory; 00105 00106 std::ostream & operator<<(std::ostream &, const DDExpandedNode &); 00107 std::ostream & operator<<(std::ostream &, const DDGeoHistory &); 00108 #endif 00109