File indexing completed on 2024-09-07 04:35:55
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef L1_TRACK_TRIGGER_STUB_FORMAT_H
0015 #define L1_TRACK_TRIGGER_STUB_FORMAT_H
0016
0017 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
0018 #include "DataFormats/L1TrackTrigger/interface/TTCluster.h"
0019 #include "DataFormats/Common/interface/DetSetVectorNew.h"
0020
0021 template <typename T>
0022 class TTStub {
0023 public:
0024
0025 TTStub();
0026 TTStub(DetId aDetId);
0027
0028
0029 ~TTStub();
0030
0031
0032
0033
0034
0035
0036
0037
0038 const edm::Ref<edmNew::DetSetVector<TTCluster<T> >, TTCluster<T> >& clusterRef(unsigned int hitStackMember) const;
0039
0040
0041 void addClusterRef(edm::Ref<edmNew::DetSetVector<TTCluster<T> >, TTCluster<T> > aTTCluster);
0042
0043
0044 DetId getDetId() const { return theDetId; }
0045 void setDetId(DetId aDetId) { theDetId = aDetId; }
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057 double rawBend() const;
0058
0059
0060
0061
0062
0063 void setRawBend(int aDisplacement);
0064
0065
0066
0067
0068
0069
0070
0071 double bendOffset() const;
0072
0073
0074
0075 void setBendOffset(int anOffset);
0076
0077
0078 void setModuleTypePS(bool isPSModule);
0079
0080
0081 bool moduleTypePS() const;
0082
0083
0084
0085
0086
0087
0088
0089 double innerClusterPosition() const;
0090
0091
0092 double bendFE() const;
0093
0094
0095 double bendBE() const;
0096
0097
0098 void setBendBE(float aBend);
0099
0100
0101 std::string print(unsigned int i = 0) const;
0102
0103 private:
0104
0105 DetId theDetId;
0106 edm::Ref<edmNew::DetSetVector<TTCluster<T> >, TTCluster<T> > theClusterRef0;
0107 edm::Ref<edmNew::DetSetVector<TTCluster<T> >, TTCluster<T> > theClusterRef1;
0108 int theDisplacement;
0109 int theOffset;
0110 float theBendBE;
0111 bool thePSModule;
0112
0113 static constexpr float dummyBend = 999999;
0114 };
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124 template <typename T>
0125 TTStub<T>::TTStub() {
0126
0127 theDetId = 0;
0128 theDisplacement = dummyBend;
0129 theOffset = 0;
0130 theBendBE = dummyBend;
0131 }
0132
0133
0134 template <typename T>
0135 TTStub<T>::TTStub(DetId aDetId) {
0136
0137 this->setDetId(aDetId);
0138
0139
0140 theDisplacement = dummyBend;
0141 theOffset = 0;
0142 theBendBE = dummyBend;
0143 }
0144
0145
0146 template <typename T>
0147 TTStub<T>::~TTStub() {}
0148
0149 template <typename T>
0150 const edm::Ref<edmNew::DetSetVector<TTCluster<T> >, TTCluster<T> >& TTStub<T>::clusterRef(
0151 unsigned int hitStackMember) const {
0152 return (hitStackMember == 0) ? theClusterRef0 : theClusterRef1;
0153 }
0154
0155 template <typename T>
0156 void TTStub<T>::addClusterRef(edm::Ref<edmNew::DetSetVector<TTCluster<T> >, TTCluster<T> > aTTCluster) {
0157 if (aTTCluster->getStackMember() == 0)
0158 theClusterRef0 = aTTCluster;
0159 else if (aTTCluster->getStackMember() == 1)
0160 theClusterRef1 = aTTCluster;
0161 }
0162
0163
0164 template <typename T>
0165 double TTStub<T>::rawBend() const {
0166 return 0.5 * theDisplacement;
0167 }
0168
0169 template <typename T>
0170 void TTStub<T>::setRawBend(int aDisplacement) {
0171 theDisplacement = aDisplacement;
0172 }
0173
0174 template <typename T>
0175 double TTStub<T>::bendOffset() const {
0176 return 0.5 * theOffset;
0177 }
0178
0179 template <typename T>
0180 void TTStub<T>::setBendOffset(int anOffset) {
0181 theOffset = anOffset;
0182 }
0183
0184 template <typename T>
0185 void TTStub<T>::setBendBE(float aBend) {
0186 theBendBE = aBend;
0187 }
0188
0189 template <typename T>
0190 void TTStub<T>::setModuleTypePS(bool isPSModule) {
0191 thePSModule = isPSModule;
0192 }
0193 template <typename T>
0194 bool TTStub<T>::moduleTypePS() const {
0195 return thePSModule;
0196 }
0197 template <typename T>
0198 double TTStub<T>::innerClusterPosition() const {
0199 return this->clusterRef(0)->findAverageLocalCoordinates().x();
0200 }
0201
0202 template <typename T>
0203 double TTStub<T>::bendFE() const {
0204 if (theDisplacement == dummyBend)
0205 return theDisplacement;
0206
0207 return 0.5 * (theDisplacement - theOffset);
0208 }
0209
0210 template <typename T>
0211 double TTStub<T>::bendBE() const {
0212 if (theBendBE == dummyBend)
0213 return this->bendFE();
0214
0215 return theBendBE;
0216 }
0217
0218
0219 template <typename T>
0220 std::string TTStub<T>::print(unsigned int i) const {
0221 std::string padding("");
0222 for (unsigned int j = 0; j != i; ++j) {
0223 padding += "\t";
0224 }
0225
0226 std::stringstream output;
0227 output << padding << "TTStub:\n";
0228 padding += '\t';
0229 output << padding << "DetId: " << theDetId.rawId() << ", position: " << this->innerClusterPosition();
0230 output << ", bend: " << this->bendFE() << '\n';
0231 output << ", hardware bend: " << this->bendBE() << '\n';
0232 output << padding << "cluster 0: address: " << theClusterRef0.get();
0233 output << ", cluster size: " << theClusterRef0->getHits().size() << '\n';
0234 output << padding << "cluster 1: address: " << theClusterRef1.get();
0235 output << ", cluster size: " << theClusterRef1->getHits().size() << '\n';
0236 return output.str();
0237 }
0238
0239 template <typename T>
0240 std::ostream& operator<<(std::ostream& os, const TTStub<T>& aTTStub) {
0241 return (os << aTTStub.print());
0242 }
0243
0244 #endif