File indexing completed on 2024-04-06 12:04:37
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef L1_TRACK_TRIGGER_CLUSTER_FORMAT_H
0015 #define L1_TRACK_TRIGGER_CLUSTER_FORMAT_H
0016
0017 #include "DataFormats/Common/interface/Ref.h"
0018 #include "DataFormats/Common/interface/Ptr.h"
0019 #include "DataFormats/Common/interface/DetSet.h"
0020 #include "DataFormats/Common/interface/DetSetVector.h"
0021 #include "DataFormats/DetId/interface/DetId.h"
0022 #include "DataFormats/Phase2TrackerDigi/interface/Phase2TrackerDigi.h"
0023 #include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementPoint.h"
0024 #include "DataFormats/GeometryVector/interface/GlobalPoint.h" /// NOTE: this is needed even if it seems not
0025
0026 template <typename T>
0027 class TTCluster {
0028 public:
0029
0030 TTCluster();
0031 TTCluster(std::vector<T> aHits, DetId aDetId, unsigned int aStackMember, bool storeLocal);
0032
0033
0034 ~TTCluster();
0035
0036
0037
0038
0039
0040 std::vector<T> getHits() const { return theHits; }
0041 void setHits(std::vector<T> aHits) { theHits = aHits; }
0042
0043
0044 DetId getDetId() const { return theDetId; }
0045 void setDetId(DetId aDetId) { theDetId = aDetId; }
0046 unsigned int getStackMember() const { return theStackMember; }
0047 void setStackMember(unsigned int aStackMember) { theStackMember = aStackMember; }
0048
0049
0050 std::vector<int> findRows() const;
0051 std::vector<int> findCols() const;
0052 void setCoordinates(std::vector<int> a, std::vector<int> b) {
0053 theRows = a;
0054 theCols = b;
0055 }
0056 std::vector<int> getRows() const { return theRows; }
0057 std::vector<int> getCols() const { return theCols; }
0058
0059
0060 unsigned int findWidth() const;
0061
0062
0063
0064 MeasurementPoint findHitLocalCoordinates(unsigned int hitIdx) const;
0065 MeasurementPoint findAverageLocalCoordinates() const;
0066 MeasurementPoint findAverageLocalCoordinatesCentered() const;
0067
0068
0069 std::string print(unsigned int i = 0) const;
0070
0071 private:
0072
0073 std::vector<T> theHits;
0074 DetId theDetId;
0075 unsigned int theStackMember;
0076
0077 std::vector<int> theRows;
0078 std::vector<int> theCols;
0079
0080 };
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091 template <typename T>
0092 TTCluster<T>::TTCluster() {
0093
0094 theHits.clear();
0095 theDetId = 0;
0096 theStackMember = 0;
0097
0098 theRows.clear();
0099 theCols.clear();
0100 }
0101
0102
0103 template <typename T>
0104 TTCluster<T>::TTCluster(std::vector<T> aHits, DetId aDetId, unsigned int aStackMember, bool storeLocal) {
0105
0106 this->setHits(aHits);
0107 this->setDetId(aDetId);
0108 this->setStackMember(aStackMember);
0109
0110 theRows.clear();
0111 theCols.clear();
0112 if (storeLocal) {
0113 this->setCoordinates(this->findRows(), this->findCols());
0114 }
0115 }
0116
0117
0118 template <typename T>
0119 TTCluster<T>::~TTCluster() {}
0120
0121
0122 template <>
0123 unsigned int TTCluster<edm::Ref<edm::DetSetVector<Phase2TrackerDigi>, Phase2TrackerDigi> >::findWidth() const;
0124
0125
0126
0127 template <>
0128 MeasurementPoint TTCluster<edm::Ref<edm::DetSetVector<Phase2TrackerDigi>, Phase2TrackerDigi> >::findHitLocalCoordinates(
0129 unsigned int hitIdx) const;
0130
0131 template <>
0132 MeasurementPoint
0133 TTCluster<edm::Ref<edm::DetSetVector<Phase2TrackerDigi>, Phase2TrackerDigi> >::findAverageLocalCoordinates() const;
0134
0135
0136 template <typename T>
0137 std::vector<int> TTCluster<T>::findRows() const {
0138 std::vector<int> temp;
0139 return temp;
0140 }
0141
0142 template <typename T>
0143 std::vector<int> TTCluster<T>::findCols() const {
0144 std::vector<int> temp;
0145 return temp;
0146 }
0147
0148 template <>
0149 std::vector<int> TTCluster<edm::Ref<edm::DetSetVector<Phase2TrackerDigi>, Phase2TrackerDigi> >::findRows() const;
0150
0151 template <>
0152 std::vector<int> TTCluster<edm::Ref<edm::DetSetVector<Phase2TrackerDigi>, Phase2TrackerDigi> >::findCols() const;
0153
0154
0155 template <typename T>
0156 std::string TTCluster<T>::print(unsigned int i) const {
0157 std::string padding("");
0158 for (unsigned int j = 0; j != i; ++j) {
0159 padding += "\t";
0160 }
0161
0162 std::stringstream output;
0163 output << padding << "TTCluster:\n";
0164 padding += '\t';
0165 output << padding << "DetId: " << theDetId.rawId() << '\n';
0166 output << padding << "member: " << theStackMember << ", cluster size: " << theHits.size() << '\n';
0167 return output.str();
0168 }
0169
0170 template <typename T>
0171 std::ostream& operator<<(std::ostream& os, const TTCluster<T>& aTTCluster) {
0172 return (os << aTTCluster.print());
0173 }
0174
0175 #endif