CMS 3D CMS Logo

GoldenPatternBase.h
Go to the documentation of this file.
1 #ifndef L1T_OmtfP1_GoldenPatternBase_H
2 #define L1T_OmtfP1_GoldenPatternBase_H
3 
4 #include "boost/multi_array.hpp"
8 #include <ostream>
9 #include <vector>
10 
12 // Key
14 struct Key {
15  Key(int iEta = 99, unsigned int iPt = 0, int iCharge = 0, unsigned int iNumber = 999)
16  : theEtaCode(iEta), thePt(iPt), theCharge(iCharge), theNumber(iNumber) {}
17 
18  Key(int iEta, unsigned int iPt, int iCharge, unsigned int iNumber, unsigned int group, unsigned int indexInGroup)
19  : theEtaCode(iEta),
20  thePt(iPt),
21  theCharge(iCharge),
22  theNumber(iNumber),
23  theGroup(group),
24  theIndexInGroup(indexInGroup) {}
25 
26  inline bool operator<(const Key& o) const { return (theNumber < o.theNumber); }
27 
28  bool operator==(const Key& o) const {
29  return theEtaCode == o.theEtaCode && thePt == o.thePt && theCharge == o.theCharge && theNumber == o.theNumber;
30  }
31 
32  friend std::ostream& operator<<(std::ostream& out, const Key& o);
33 
34  unsigned int number() const { return theNumber; }
35 
36  int theEtaCode;
37 
38  //hardware pt, ptInGeV = (thePt-1) * 0.5GeV, where ptInGeV denotes the lover edge of the pt range cover by this pattern
39  unsigned int thePt;
40 
41  int theCharge;
42  unsigned int theNumber;
43 
44  //the index of the patterns group, up to 4 patterns can be grouped together, they have then the same MeanDistPhi and DistPhiBitShift
45  unsigned int theGroup = 0;
46 
47  unsigned int theIndexInGroup = 1; //starts from 1, as in xml
48 
49  void setPt(int pt) { thePt = pt; }
50 
51  void setGroup(int group) { theGroup = group; }
52 
53  void setIndexInGroup(unsigned int indexInGroup) { theIndexInGroup = indexInGroup; }
54 
55  unsigned int getHwPatternNumber() const { return theGroup * 4 + theIndexInGroup - 1; }
56 };
58 // Golden Pattern
60 
62 public:
63  typedef std::vector<int> vector1D;
64 
65  typedef boost::multi_array<GoldenPatternResult, 2> resultsArrayType;
66  //
67  // IGoldenPatterns methods
68  //
69  GoldenPatternBase(const Key& aKey);
70 
71  GoldenPatternBase(const Key& aKey, const OMTFConfiguration* omtfConfig);
72 
73  virtual ~GoldenPatternBase() {}
74 
75  virtual void setConfig(const OMTFConfiguration* omtfConfig);
76 
77  const OMTFConfiguration* getConfig() const { return myOmtfConfig; }
78 
79  virtual Key& key() { return theKey; }
80 
81  virtual int meanDistPhiValue(unsigned int iLayer, unsigned int iRefLayer, int refLayerPhiB = 0) const = 0;
82 
83  virtual PdfValueType pdfValue(unsigned int iLayer,
84  unsigned int iRefLayer,
85  unsigned int iBin,
86  int refLayerPhiB = 0) const = 0;
87 
88  virtual void setMeanDistPhiValue(int value,
89  unsigned int iLayer,
90  unsigned int iRefLayer,
91  unsigned int paramIndex = 0) = 0;
92 
93  virtual void setPdfValue(
94  PdfValueType value, unsigned int iLayer, unsigned int iRefLayer, unsigned int iBin, int refLayerPhiB = 0) = 0;
95 
96  virtual int getDistPhiBitShift(unsigned int iLayer, unsigned int iRefLayer) const = 0;
97 
98  virtual void setDistPhiBitShift(int value, unsigned int iLayer, unsigned int iRefLayer) = 0;
99 
102  virtual StubResult process1Layer1RefLayer(unsigned int iRefLayer,
103  unsigned int iLayer,
104  MuonStubPtrs1D layerStubs,
105  const MuonStubPtr refStub);
106 
110  virtual int propagateRefPhi(int phiRef, int etaRef, unsigned int iRefLayer) = 0;
111 
113 
115  virtual void finalise(unsigned int procIndx);
116 
117 protected:
120 
122 
124 };
125 
126 template <class GoldenPatternType>
127 using GoldenPatternVec = std::vector<std::unique_ptr<GoldenPatternType> >;
130 #endif
virtual void setDistPhiBitShift(int value, unsigned int iLayer, unsigned int iRefLayer)=0
unsigned int theNumber
Definition: GoldenPattern.h:37
virtual PdfValueType pdfValue(unsigned int iLayer, unsigned int iRefLayer, unsigned int iBin, int refLayerPhiB=0) const =0
Key(int iEta=99, unsigned int iPt=0, int iCharge=0, unsigned int iNumber=999)
unsigned int number() const
unsigned int getHwPatternNumber() const
virtual Key & key()
int theCharge
Definition: GoldenPattern.h:36
virtual ~GoldenPatternBase()
virtual int meanDistPhiValue(unsigned int iLayer, unsigned int iRefLayer, int refLayerPhiB=0) const =0
void setIndexInGroup(unsigned int indexInGroup)
unsigned int theGroup
resultsArrayType results
resultsArrayType & getResults()
Key(int iEta, unsigned int iPt, int iCharge, unsigned int iNumber, unsigned int group, unsigned int indexInGroup)
virtual void setConfig(const OMTFConfiguration *omtfConfig)
bool operator==(const Key &o) const
std::vector< MuonStubPtr > MuonStubPtrs1D
Definition: MuonStub.h:66
virtual void setMeanDistPhiValue(int value, unsigned int iLayer, unsigned int iRefLayer, unsigned int paramIndex=0)=0
virtual void finalise(unsigned int procIndx)
last step of the event processing, before sorting and ghost busting
std::shared_ptr< MuonStub > MuonStubPtr
Definition: MuonStub.h:65
Definition: value.py:1
const OMTFConfiguration * getConfig() const
GoldenPatternBase(const Key &aKey)
virtual int getDistPhiBitShift(unsigned int iLayer, unsigned int iRefLayer) const =0
float PdfValueType
bool operator<(const Key &o) const
unsigned int thePt
std::vector< std::unique_ptr< GoldenPatternType > > GoldenPatternVec
void setPt(int pt)
virtual int propagateRefPhi(int phiRef, int etaRef, unsigned int iRefLayer)=0
Key theKey
Pattern kinematic identification (iEta,iPt,iCharge)
std::vector< int > vector1D
virtual StubResult process1Layer1RefLayer(unsigned int iRefLayer, unsigned int iLayer, MuonStubPtrs1D layerStubs, const MuonStubPtr refStub)
unsigned int theIndexInGroup
friend std::ostream & operator<<(std::ostream &out, const Key &o)
Definition: GoldenPattern.h:26
virtual void setPdfValue(PdfValueType value, unsigned int iLayer, unsigned int iRefLayer, unsigned int iBin, int refLayerPhiB=0)=0
const OMTFConfiguration * myOmtfConfig
void setGroup(int group)
int theEtaCode
Definition: GoldenPattern.h:34
boost::multi_array< GoldenPatternResult, 2 > resultsArrayType