File indexing completed on 2024-04-06 12:05:24
0001 #ifndef DDExpandedView_h
0002 #define DDExpandedView_h
0003
0004 #include <cstddef>
0005 #include <iosfwd>
0006 #include <map>
0007 #include <string>
0008 #include <utility>
0009 #include <vector>
0010
0011 #include "DetectorDescription/Core/interface/DDRotationMatrix.h"
0012 #include "DetectorDescription/Core/interface/DDTranslation.h"
0013 #include "DetectorDescription/Core/interface/DDCompactView.h"
0014 #include "DetectorDescription/Core/interface/DDExpandedNode.h"
0015 #include "DetectorDescription/Core/interface/DDLogicalPart.h"
0016 #include "DetectorDescription/Core/interface/DDPosData.h"
0017 #include "DetectorDescription/Core/interface/DDTransform.h"
0018 #include "DetectorDescription/Core/interface/DDsvalues.h"
0019 #include "DataFormats/Math/interface/GraphWalker.h"
0020
0021 class DDFilteredView;
0022 class DDLogicalPart;
0023 struct DDPosData;
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 class DDExpandedView {
0042 friend class DDFilteredView;
0043
0044 public:
0045 using WalkerType = math::GraphWalker<DDLogicalPart, DDPosData *>;
0046
0047
0048 typedef std::vector<int> nav_type;
0049 typedef std::pair<int const *, size_t> NavRange;
0050
0051
0052 DDExpandedView(const DDCompactView &);
0053
0054 virtual ~DDExpandedView();
0055
0056
0057 const DDLogicalPart &logicalPart() const;
0058
0059
0060 const std::string &name() const;
0061
0062
0063 const DDTranslation &translation() const;
0064
0065
0066 const DDRotationMatrix &rotation() const;
0067
0068
0069 const DDGeoHistory &geoHistory() const;
0070
0071
0072 bool goTo(const nav_type &);
0073 bool goTo(NavRange);
0074 bool goTo(int const *newpos, size_t sz);
0075
0076
0077 nav_type navPos() const;
0078
0079
0080 nav_type copyNumbers() const;
0081
0082
0083 std::vector<const DDsvalues_type *> specifics() const;
0084 void specificsV(std::vector<const DDsvalues_type *> &vc) const;
0085
0086 DDsvalues_type mergedSpecifics() const;
0087 void mergedSpecificsV(DDsvalues_type &res) const;
0088
0089
0090 std::vector<double> const &vector(std::string_view iKey) const { return cpv_->vector(iKey); }
0091
0092
0093 int copyno() const;
0094
0095
0096
0097
0098 const DDGeoHistory &scope() const;
0099
0100
0101 bool setScope(const DDGeoHistory &hist, int depth = 0);
0102
0103
0104 void clearScope();
0105
0106
0107 int depth() const;
0108
0109
0110 bool next();
0111
0112
0113 bool nextB();
0114
0115
0116 bool nextSibling();
0117
0118
0119 bool firstChild();
0120
0121
0122 bool parent();
0123
0124
0125
0126
0127
0128 void reset();
0129
0130
0131 bool goToHistory(const DDGeoHistory &sc);
0132
0133 protected:
0134 bool descend(const DDGeoHistory &sc);
0135
0136 protected:
0137 WalkerType *walker_;
0138 WalkerType w2_;
0139 const DDTranslation trans_;
0140 const DDRotationMatrix rot_;
0141 DDGeoHistory history_;
0142 DDGeoHistory scope_;
0143 unsigned int depth_;
0144 const DDPosData *worldpos_;
0145 std::vector<nav_type> nextBStack_;
0146 const DDCompactView *cpv_;
0147 };
0148
0149 std::string printNavType(int const *n, size_t sz);
0150 inline std::ostream &operator<<(std::ostream &os, const DDExpandedView::nav_type &n) {
0151 os << printNavType(&n.front(), n.size());
0152 return os;
0153 }
0154 inline std::ostream &operator<<(std::ostream &os, const DDExpandedView::NavRange &n) {
0155 os << printNavType(n.first, n.second);
0156 return os;
0157 }
0158 #endif