File indexing completed on 2024-09-07 04:37:00
0001 #ifndef L1T_OmtfP1_GoldenPattern_H
0002 #define L1T_OmtfP1_GoldenPattern_H
0003
0004 #include "boost/multi_array/base.hpp"
0005 #include "boost/multi_array.hpp"
0006 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/GoldenPatternBase.h"
0007 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OMTFConfiguration.h"
0008 #include <ostream>
0009 #include <vector>
0010
0011
0012
0013
0014
0015 class GoldenPattern : public GoldenPatternBase {
0016 public:
0017 typedef boost::multi_array<PdfValueType, 3> pdfArrayType;
0018 typedef boost::multi_array<short, 3> meanDistPhiArrayType;
0019
0020
0021
0022 GoldenPattern(const Key& aKey, unsigned int nLayers, unsigned int nRefLayers, unsigned int nPdfAddrBits)
0023 : GoldenPatternBase(aKey),
0024 pdfAllRef(boost::extents[nLayers][nRefLayers][1 << nPdfAddrBits]),
0025 meanDistPhi(boost::extents[nLayers][nRefLayers][2]),
0026 distPhiBitShift(boost::extents[nLayers][nRefLayers]) {
0027 reset();
0028 }
0029
0030 GoldenPattern(const Key& aKey, const OMTFConfiguration* omtfConfig)
0031 : GoldenPatternBase(aKey, omtfConfig),
0032 pdfAllRef(boost::extents[omtfConfig->nLayers()][omtfConfig->nRefLayers()][omtfConfig->nPdfBins()]),
0033 meanDistPhi(boost::extents[omtfConfig->nLayers()][omtfConfig->nRefLayers()][2]),
0034 distPhiBitShift(boost::extents[omtfConfig->nLayers()][omtfConfig->nRefLayers()]) {
0035 reset();
0036 }
0037
0038 ~GoldenPattern() override {}
0039
0040 virtual void setMeanDistPhi(const meanDistPhiArrayType& aMeanDistPhi) { meanDistPhi = aMeanDistPhi; }
0041
0042 virtual const meanDistPhiArrayType& getMeanDistPhi() const { return meanDistPhi; }
0043
0044 virtual const pdfArrayType& getPdf() const { return pdfAllRef; }
0045
0046 virtual void setPdf(pdfArrayType& aPdf) { pdfAllRef = aPdf; }
0047
0048 int meanDistPhiValue(unsigned int iLayer, unsigned int iRefLayer, int refLayerPhiB = 0) const override;
0049
0050 PdfValueType pdfValue(unsigned int iLayer,
0051 unsigned int iRefLayer,
0052 unsigned int iBin,
0053 int refLayerPhiB = 0) const override {
0054 return pdfAllRef[iLayer][iRefLayer][iBin];
0055 }
0056
0057 void setMeanDistPhiValue(int value,
0058 unsigned int iLayer,
0059 unsigned int iRefLayer,
0060 unsigned int paramIndex = 0) override {
0061 meanDistPhi[iLayer][iRefLayer][paramIndex] = value;
0062 }
0063
0064 void setPdfValue(PdfValueType value,
0065 unsigned int iLayer,
0066 unsigned int iRefLayer,
0067 unsigned int iBin,
0068 int refLayerPhiB = 0) override {
0069 pdfAllRef[iLayer][iRefLayer][iBin] = value;
0070 }
0071
0072 int getDistPhiBitShift(unsigned int iLayer, unsigned int iRefLayer) const override {
0073 return distPhiBitShift[iLayer][iRefLayer];
0074 }
0075
0076 void setDistPhiBitShift(int value, unsigned int iLayer, unsigned int iRefLayer) override {
0077 distPhiBitShift[iLayer][iRefLayer] = value;
0078 }
0079
0080 friend std::ostream& operator<<(std::ostream& out, const GoldenPattern& aPattern);
0081
0082
0083 virtual void reset();
0084
0085
0086
0087 int propagateRefPhi(int phiRef, int etaRef, unsigned int iRefLayer) override;
0088
0089 protected:
0090
0091
0092
0093
0094 pdfArrayType pdfAllRef;
0095
0096
0097
0098
0099
0100 meanDistPhiArrayType meanDistPhi;
0101
0102
0103
0104
0105
0106 boost::multi_array<short, 2> distPhiBitShift;
0107 };
0108
0109 class GoldenPatternWithThresh : public GoldenPattern {
0110 private:
0111 std::vector<PdfValueType> thresholds;
0112
0113 public:
0114
0115
0116
0117 GoldenPatternWithThresh(const Key& aKey, unsigned int nLayers, unsigned int nRefLayers, unsigned int nPdfAddrBits)
0118 : GoldenPattern(aKey, nLayers, nRefLayers, nPdfAddrBits), thresholds(nRefLayers, 0) {}
0119
0120 GoldenPatternWithThresh(const Key& aKey, const OMTFConfiguration* omtfConfig)
0121 : GoldenPattern(aKey, omtfConfig), thresholds(myOmtfConfig->nRefLayers(), 0) {}
0122
0123 ~GoldenPatternWithThresh() override {}
0124
0125 PdfValueType getThreshold(unsigned int iRefLayer) const { return thresholds.at(iRefLayer); }
0126
0127 void setThresholds(std::vector<PdfValueType>& tresholds) { this->thresholds = tresholds; }
0128
0129 void setThreshold(unsigned int iRefLayer, PdfValueType treshold) { this->thresholds[iRefLayer] = treshold; }
0130 };
0131
0132
0133 #endif