File indexing completed on 2024-04-06 12:04:37
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include "DataFormats/L1TrackTrigger/interface/TTCluster.h"
0012
0013
0014 template <>
0015 unsigned int TTCluster<edm::Ref<edm::DetSetVector<Phase2TrackerDigi>, Phase2TrackerDigi> >::findWidth() const {
0016 int rowMin = 99999999;
0017 int rowMax = 0;
0018
0019 for (unsigned int i = 0; i < theHits.size(); i++) {
0020 int row = 0;
0021 if (this->getRows().empty()) {
0022 row = theHits[i]->row();
0023 } else {
0024 row = this->getRows()[i];
0025 }
0026 if (row < rowMin)
0027 rowMin = row;
0028 if (row > rowMax)
0029 rowMax = row;
0030 }
0031 return abs(rowMax - rowMin + 1);
0032 }
0033
0034
0035 template <>
0036 MeasurementPoint TTCluster<edm::Ref<edm::DetSetVector<Phase2TrackerDigi>, Phase2TrackerDigi> >::findHitLocalCoordinates(
0037 unsigned int hitIdx) const {
0038
0039
0040 if (this->getRows().empty() || this->getCols().empty()) {
0041 MeasurementPoint mp(theHits[hitIdx]->row(), theHits[hitIdx]->column());
0042 return mp;
0043 } else {
0044 int row = this->getRows()[hitIdx];
0045 int col = this->getCols()[hitIdx];
0046 MeasurementPoint mp(row, col);
0047 return mp;
0048 }
0049 }
0050
0051
0052 template <>
0053 MeasurementPoint
0054 TTCluster<edm::Ref<edm::DetSetVector<Phase2TrackerDigi>, Phase2TrackerDigi> >::findAverageLocalCoordinates() const {
0055 double averageCol = 0.0;
0056 double averageRow = 0.0;
0057
0058
0059 if (!theHits.empty()) {
0060 if (this->getRows().empty() || this->getCols().empty()) {
0061 typename std::vector<edm::Ref<edm::DetSetVector<Phase2TrackerDigi>, Phase2TrackerDigi> >::const_iterator hitIter;
0062 for (hitIter = theHits.begin(); hitIter != theHits.end(); hitIter++) {
0063 averageCol += (*hitIter)->column();
0064 averageRow += (*hitIter)->row();
0065 }
0066 averageCol /= theHits.size();
0067 averageRow /= theHits.size();
0068 } else {
0069 for (unsigned int j = 0; j < theHits.size(); j++) {
0070 averageCol += theCols[j];
0071 averageRow += theRows[j];
0072 }
0073 averageCol /= theHits.size();
0074 averageRow /= theHits.size();
0075 }
0076 }
0077 return MeasurementPoint(averageRow, averageCol);
0078 }
0079
0080
0081 template <>
0082 MeasurementPoint TTCluster<
0083 edm::Ref<edm::DetSetVector<Phase2TrackerDigi>, Phase2TrackerDigi> >::findAverageLocalCoordinatesCentered() const {
0084 double averageCol = 0.0;
0085 double averageRow = 0.0;
0086
0087
0088 if (!theHits.empty()) {
0089 if (this->getRows().empty() || this->getCols().empty()) {
0090 typename std::vector<edm::Ref<edm::DetSetVector<Phase2TrackerDigi>, Phase2TrackerDigi> >::const_iterator hitIter;
0091 for (hitIter = theHits.begin(); hitIter != theHits.end(); hitIter++) {
0092 averageCol += (*hitIter)->column() + 0.5;
0093 averageRow += (*hitIter)->row() + 0.5;
0094 }
0095 averageCol /= theHits.size();
0096 averageRow /= theHits.size();
0097 } else {
0098 for (unsigned int j = 0; j < theHits.size(); j++) {
0099 averageCol += theCols[j] + 0.5;
0100 averageRow += theRows[j] + 0.5;
0101 }
0102 averageCol /= theHits.size();
0103 averageRow /= theHits.size();
0104 }
0105 }
0106 return MeasurementPoint(averageRow, averageCol);
0107 }
0108
0109
0110 template <>
0111 std::vector<int> TTCluster<edm::Ref<edm::DetSetVector<Phase2TrackerDigi>, Phase2TrackerDigi> >::findRows() const {
0112 std::vector<int> temp;
0113 temp.reserve(theHits.size());
0114 for (unsigned int i = 0; i < theHits.size(); i++) {
0115 temp.push_back(theHits[i]->row());
0116 }
0117 return temp;
0118 }
0119
0120 template <>
0121 std::vector<int> TTCluster<edm::Ref<edm::DetSetVector<Phase2TrackerDigi>, Phase2TrackerDigi> >::findCols() const {
0122 std::vector<int> temp;
0123 temp.reserve(theHits.size());
0124 for (unsigned int i = 0; i < theHits.size(); i++) {
0125 temp.push_back(theHits[i]->column());
0126 }
0127 return temp;
0128 }