CMS 3D CMS Logo

GoldenPattern.h
Go to the documentation of this file.
1 #ifndef OMTF_GoldenPattern_H
2 #define OMTF_GoldenPattern_H
3 
4 #include <vector>
5 #include <ostream>
6 
8 
9 class OMTFConfigMaker;
10 class OMTFProcessor;
11 class OMTFConfiguration;
13 // Key
15 struct Key {
16  Key(int iEta = 99, unsigned int iPt = 0, int iCharge = 0, unsigned int iNumber = 999)
17  : theEtaCode(iEta), thePtCode(iPt), theCharge(iCharge), theNumber(iNumber) {}
18 
19  inline bool operator<(const Key &o) const { return (theNumber < o.theNumber); }
20 
21  bool operator==(const Key &o) const {
22  return theEtaCode == o.theEtaCode && thePtCode == o.thePtCode && theCharge == o.theCharge &&
23  theNumber == o.theNumber;
24  }
25 
26  friend std::ostream &operator<<(std::ostream &out, const Key &o) {
27  out << "Key_" << o.theNumber << ": (eta=" << o.theEtaCode << ", pt=" << o.thePtCode << ", charge=" << o.theCharge
28  << ")";
29  return out;
30  }
31 
32  unsigned int number() const { return theNumber; }
33 
35  unsigned int thePtCode;
36  int theCharge;
37  unsigned int theNumber;
38 };
40 // Golden Pattern
42 class OMTFinput;
43 
45 public:
46  typedef std::vector<int> vector1D;
47  typedef std::vector<vector1D> vector2D;
48  typedef std::vector<vector2D> vector3D;
49  typedef std::pair<int, bool> layerResult;
50 
51  //
52  // GoldenPatterns methods
53  //
54  GoldenPattern(const Key &aKey, const OMTFConfiguration *omtfConfig) : theKey(aKey), myOmtfConfig(omtfConfig) {}
55 
56  Key key() const { return theKey; }
57 
58  void setMeanDistPhi(const vector2D &aMeanDistPhi) { meanDistPhi = aMeanDistPhi; }
59 
60  const vector2D &getMeanDistPhi() const { return meanDistPhi; }
61 
62  const vector3D &getPdf() const { return pdfAllRef; }
63 
64  void setPdf(const vector3D &aPdf) { pdfAllRef = aPdf; }
65 
66  int meanDistPhiValue(unsigned int iLayer, unsigned int iRefLayer) const { return meanDistPhi[iLayer][iRefLayer]; }
67 
68  int pdfValue(unsigned int iLayer, unsigned int iRefLayer, unsigned int iBin) const {
69  return pdfAllRef[iLayer][iRefLayer][iBin];
70  }
71 
75  unsigned int iLayer,
76  const int refPhi,
77  const OMTFinput::vector1D &layerHits);
78 
79  friend std::ostream &operator<<(std::ostream &out, const GoldenPattern &aPattern);
80 
82  void addCount(unsigned int iRefLayer, unsigned int iLayer, const int refPhi, const OMTFinput::vector1D &layerHits);
83 
85  void reset();
86 
91  void normalise(unsigned int nPdfAddrBits);
92 
96  int propagateRefPhi(int phiRef, int etaRef, unsigned int iRefLayer);
97 
99  bool hasCounts();
100 
101 private:
104 
110 
115 
119 
121 };
124 #endif
unsigned int theNumber
Definition: GoldenPattern.h:37
Key(int iEta=99, unsigned int iPt=0, int iCharge=0, unsigned int iNumber=999)
Definition: GoldenPattern.h:16
unsigned int number() const
Definition: GoldenPattern.h:32
friend std::ostream & operator<<(std::ostream &out, const GoldenPattern &aPattern)
vector2D meanDistPhiCounts
std::vector< int > vector1D
Definition: GoldenPattern.h:46
int theCharge
Definition: GoldenPattern.h:36
std::vector< int > vector1D
Definition: OMTFinput.h:13
std::pair< int, bool > layerResult
Definition: GoldenPattern.h:49
const OMTFConfiguration * myOmtfConfig
unsigned int thePtCode
Definition: GoldenPattern.h:35
vector2D meanDistPhi
bool hasCounts()
Check if the GP has any counts in any of referecne layers;.
GoldenPattern::layerResult process1Layer1RefLayer(unsigned int iRefLayer, unsigned int iLayer, const int refPhi, const OMTFinput::vector1D &layerHits)
int pdfValue(unsigned int iLayer, unsigned int iRefLayer, unsigned int iBin) const
Definition: GoldenPattern.h:68
void normalise(unsigned int nPdfAddrBits)
const vector2D & getMeanDistPhi() const
Definition: GoldenPattern.h:60
std::vector< vector1D > vector2D
Definition: GoldenPattern.h:47
std::vector< vector2D > vector3D
Definition: GoldenPattern.h:48
void setPdf(const vector3D &aPdf)
Definition: GoldenPattern.h:64
Key theKey
Pattern kinematical identification (iEta,iPt,iCharge)
Key key() const
Definition: GoldenPattern.h:56
vector3D pdfAllRef
bool operator==(const Key &o) const
Definition: GoldenPattern.h:21
GoldenPattern(const Key &aKey, const OMTFConfiguration *omtfConfig)
Definition: GoldenPattern.h:54
void reset()
Reset contents of all data vectors, keeping the vectors size.
bool operator<(const Key &o) const
Definition: GoldenPattern.h:19
int propagateRefPhi(int phiRef, int etaRef, unsigned int iRefLayer)
const vector3D & getPdf() const
Definition: GoldenPattern.h:62
void setMeanDistPhi(const vector2D &aMeanDistPhi)
Definition: GoldenPattern.h:58
friend std::ostream & operator<<(std::ostream &out, const Key &o)
Definition: GoldenPattern.h:26
int meanDistPhiValue(unsigned int iLayer, unsigned int iRefLayer) const
Definition: GoldenPattern.h:66
void addCount(unsigned int iRefLayer, unsigned int iLayer, const int refPhi, const OMTFinput::vector1D &layerHits)
Add a single count to the relevant pdf bin in three dimensions.
int theEtaCode
Definition: GoldenPattern.h:34