File indexing completed on 2023-03-17 11:12:47
0001 #ifndef OMTF_GoldenPattern_H
0002 #define OMTF_GoldenPattern_H
0003
0004 #include <vector>
0005 #include <ostream>
0006
0007 #include "L1Trigger/L1TMuonOverlap/interface/OMTFinput.h"
0008
0009 class OMTFConfigMaker;
0010 class OMTFProcessor;
0011 class OMTFConfiguration;
0012
0013
0014
0015 struct Key {
0016 Key(int iEta = 99, unsigned int iPt = 0, int iCharge = 0, unsigned int iNumber = 999)
0017 : theEtaCode(iEta), thePtCode(iPt), theCharge(iCharge), theNumber(iNumber) {}
0018
0019 inline bool operator<(const Key &o) const { return (theNumber < o.theNumber); }
0020
0021 bool operator==(const Key &o) const {
0022 return theEtaCode == o.theEtaCode && thePtCode == o.thePtCode && theCharge == o.theCharge &&
0023 theNumber == o.theNumber;
0024 }
0025
0026 friend std::ostream &operator<<(std::ostream &out, const Key &o) {
0027 out << "Key_" << o.theNumber << ": (eta=" << o.theEtaCode << ", pt=" << o.thePtCode << ", charge=" << o.theCharge
0028 << ")";
0029 return out;
0030 }
0031
0032 unsigned int number() const { return theNumber; }
0033
0034 int theEtaCode;
0035 unsigned int thePtCode;
0036 int theCharge;
0037 unsigned int theNumber;
0038 };
0039
0040
0041
0042 class OMTFinput;
0043
0044 class GoldenPattern {
0045 public:
0046 typedef std::vector<int> vector1D;
0047 typedef std::vector<vector1D> vector2D;
0048 typedef std::vector<vector2D> vector3D;
0049 typedef std::pair<int, bool> layerResult;
0050
0051
0052
0053
0054 GoldenPattern(const Key &aKey, const OMTFConfiguration *omtfConfig) : theKey(aKey), myOmtfConfig(omtfConfig) {}
0055
0056 Key key() const { return theKey; }
0057
0058 void setMeanDistPhi(const vector2D &aMeanDistPhi) { meanDistPhi = aMeanDistPhi; }
0059
0060 const vector2D &getMeanDistPhi() const { return meanDistPhi; }
0061
0062 const vector3D &getPdf() const { return pdfAllRef; }
0063
0064 void setPdf(const vector3D &aPdf) { pdfAllRef = aPdf; }
0065
0066 int meanDistPhiValue(unsigned int iLayer, unsigned int iRefLayer) const { return meanDistPhi[iLayer][iRefLayer]; }
0067
0068 int pdfValue(unsigned int iLayer, unsigned int iRefLayer, unsigned int iBin) const {
0069 return pdfAllRef[iLayer][iRefLayer][iBin];
0070 }
0071
0072
0073
0074 GoldenPattern::layerResult process1Layer1RefLayer(unsigned int iRefLayer,
0075 unsigned int iLayer,
0076 const int refPhi,
0077 const OMTFinput::vector1D &layerHits);
0078
0079 friend std::ostream &operator<<(std::ostream &out, const GoldenPattern &aPattern);
0080
0081
0082 void addCount(unsigned int iRefLayer, unsigned int iLayer, const int refPhi, const OMTFinput::vector1D &layerHits);
0083
0084
0085 void reset();
0086
0087
0088
0089
0090
0091 void normalise(unsigned int nPdfAddrBits);
0092
0093
0094
0095
0096 int propagateRefPhi(int phiRef, int etaRef, unsigned int iRefLayer);
0097
0098
0099 bool hasCounts();
0100
0101 private:
0102
0103 Key theKey;
0104
0105
0106
0107
0108
0109 vector3D pdfAllRef;
0110
0111
0112
0113
0114 vector2D meanDistPhi;
0115
0116
0117
0118 vector2D meanDistPhiCounts;
0119
0120 const OMTFConfiguration *myOmtfConfig;
0121 };
0122
0123
0124 #endif