File indexing completed on 2024-04-06 12:21:05
0001 #ifndef L1T_OmtfP1_GoldenPatternBase_H
0002 #define L1T_OmtfP1_GoldenPatternBase_H
0003
0004 #include "boost/multi_array.hpp"
0005 #include "L1Trigger/L1TMuonOverlapPhase1/interface/MuonStub.h"
0006 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/GoldenPatternResult.h"
0007 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/OMTFConfiguration.h"
0008 #include <ostream>
0009 #include <vector>
0010
0011
0012
0013
0014 struct Key {
0015 Key(int iEta = 99, unsigned int iPt = 0, int iCharge = 0, unsigned int iNumber = 999)
0016 : theEtaCode(iEta), thePt(iPt), theCharge(iCharge), theNumber(iNumber) {}
0017
0018 Key(int iEta, unsigned int iPt, int iCharge, unsigned int iNumber, unsigned int group, unsigned int indexInGroup)
0019 : theEtaCode(iEta),
0020 thePt(iPt),
0021 theCharge(iCharge),
0022 theNumber(iNumber),
0023 theGroup(group),
0024 theIndexInGroup(indexInGroup) {}
0025
0026 inline bool operator<(const Key& o) const { return (theNumber < o.theNumber); }
0027
0028 bool operator==(const Key& o) const {
0029 return theEtaCode == o.theEtaCode && thePt == o.thePt && theCharge == o.theCharge && theNumber == o.theNumber;
0030 }
0031
0032 friend std::ostream& operator<<(std::ostream& out, const Key& o);
0033
0034 unsigned int number() const { return theNumber; }
0035
0036 int theEtaCode;
0037
0038
0039 unsigned int thePt;
0040
0041 int theCharge;
0042 unsigned int theNumber;
0043
0044
0045 unsigned int theGroup = 0;
0046
0047 unsigned int theIndexInGroup = 1;
0048
0049 void setPt(int pt) { thePt = pt; }
0050
0051 void setGroup(int group) { theGroup = group; }
0052
0053 void setIndexInGroup(unsigned int indexInGroup) { theIndexInGroup = indexInGroup; }
0054
0055 unsigned int getHwPatternNumber() const { return theGroup * 4 + theIndexInGroup - 1; }
0056 };
0057
0058
0059
0060
0061 class GoldenPatternBase {
0062 public:
0063 typedef std::vector<int> vector1D;
0064
0065 typedef boost::multi_array<GoldenPatternResult, 2> resultsArrayType;
0066
0067
0068
0069 GoldenPatternBase(const Key& aKey);
0070
0071 GoldenPatternBase(const Key& aKey, const OMTFConfiguration* omtfConfig);
0072
0073 virtual ~GoldenPatternBase() {}
0074
0075 virtual void setConfig(const OMTFConfiguration* omtfConfig);
0076
0077 const OMTFConfiguration* getConfig() const { return myOmtfConfig; }
0078
0079 virtual Key& key() { return theKey; }
0080
0081 virtual int meanDistPhiValue(unsigned int iLayer, unsigned int iRefLayer, int refLayerPhiB = 0) const = 0;
0082
0083 virtual PdfValueType pdfValue(unsigned int iLayer,
0084 unsigned int iRefLayer,
0085 unsigned int iBin,
0086 int refLayerPhiB = 0) const = 0;
0087
0088 virtual void setMeanDistPhiValue(int value,
0089 unsigned int iLayer,
0090 unsigned int iRefLayer,
0091 unsigned int paramIndex = 0) = 0;
0092
0093 virtual void setPdfValue(
0094 PdfValueType value, unsigned int iLayer, unsigned int iRefLayer, unsigned int iBin, int refLayerPhiB = 0) = 0;
0095
0096 virtual int getDistPhiBitShift(unsigned int iLayer, unsigned int iRefLayer) const = 0;
0097
0098 virtual void setDistPhiBitShift(int value, unsigned int iLayer, unsigned int iRefLayer) = 0;
0099
0100
0101
0102 virtual StubResult process1Layer1RefLayer(unsigned int iRefLayer,
0103 unsigned int iLayer,
0104 MuonStubPtrs1D layerStubs,
0105 const std::vector<int>& extrapolatedPhi,
0106 const MuonStubPtr& refStub);
0107
0108
0109
0110
0111 virtual int propagateRefPhi(int phiRef, int etaRef, unsigned int iRefLayer) = 0;
0112
0113 resultsArrayType& getResults() { return results; }
0114
0115
0116 virtual void finalise(unsigned int procIndx);
0117
0118 protected:
0119
0120 Key theKey;
0121
0122 const OMTFConfiguration* myOmtfConfig;
0123
0124 resultsArrayType results;
0125 };
0126
0127 template <class GoldenPatternType>
0128 using GoldenPatternVec = std::vector<std::unique_ptr<GoldenPatternType> >;
0129
0130
0131 #endif