CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Attributes
GoldenPatternBase Class Referenceabstract

#include <GoldenPatternBase.h>

Inheritance diagram for GoldenPatternBase:
GoldenPattern GoldenPatternWithThresh GoldenPatternWithStat

Public Types

typedef boost::multi_array< GoldenPatternResult, 2 > resultsArrayType
 
typedef std::vector< int > vector1D
 

Public Member Functions

virtual void finalise (unsigned int procIndx)
 last step of the event processing, before sorting and ghost busting More...
 
const OMTFConfigurationgetConfig () const
 
virtual int getDistPhiBitShift (unsigned int iLayer, unsigned int iRefLayer) const =0
 
resultsArrayTypegetResults ()
 
 GoldenPatternBase (const Key &aKey)
 
 GoldenPatternBase (const Key &aKey, const OMTFConfiguration *omtfConfig)
 
virtual Keykey ()
 
virtual int meanDistPhiValue (unsigned int iLayer, unsigned int iRefLayer, int refLayerPhiB=0) const =0
 
virtual PdfValueType pdfValue (unsigned int iLayer, unsigned int iRefLayer, unsigned int iBin, int refLayerPhiB=0) const =0
 
virtual StubResult process1Layer1RefLayer (unsigned int iRefLayer, unsigned int iLayer, MuonStubPtrs1D layerStubs, const std::vector< int > &extrapolatedPhi, const MuonStubPtr &refStub)
 
virtual int propagateRefPhi (int phiRef, int etaRef, unsigned int iRefLayer)=0
 
virtual void setConfig (const OMTFConfiguration *omtfConfig)
 
virtual void setDistPhiBitShift (int value, unsigned int iLayer, unsigned int iRefLayer)=0
 
virtual void setMeanDistPhiValue (int value, unsigned int iLayer, unsigned int iRefLayer, unsigned int paramIndex=0)=0
 
virtual void setPdfValue (PdfValueType value, unsigned int iLayer, unsigned int iRefLayer, unsigned int iBin, int refLayerPhiB=0)=0
 
virtual ~GoldenPatternBase ()
 

Protected Attributes

const OMTFConfigurationmyOmtfConfig
 
resultsArrayType results
 
Key theKey
 Pattern kinematic identification (iEta,iPt,iCharge) More...
 

Detailed Description

Definition at line 61 of file GoldenPatternBase.h.

Member Typedef Documentation

◆ resultsArrayType

Definition at line 65 of file GoldenPatternBase.h.

◆ vector1D

typedef std::vector<int> GoldenPatternBase::vector1D

Definition at line 63 of file GoldenPatternBase.h.

Constructor & Destructor Documentation

◆ GoldenPatternBase() [1/2]

GoldenPatternBase::GoldenPatternBase ( const Key aKey)

Definition at line 20 of file GoldenPatternBase.cc.

20 : theKey(aKey), myOmtfConfig(nullptr) {}
Key theKey
Pattern kinematic identification (iEta,iPt,iCharge)
const OMTFConfiguration * myOmtfConfig

◆ GoldenPatternBase() [2/2]

GoldenPatternBase::GoldenPatternBase ( const Key aKey,
const OMTFConfiguration omtfConfig 
)

Definition at line 22 of file GoldenPatternBase.cc.

References results.

23  : theKey(aKey),
24  myOmtfConfig(omtfConfig),
26  for (unsigned int iProc = 0; iProc < results.size(); iProc++) {
27  for (unsigned int iTestRefHit = 0; iTestRefHit < results[iProc].size(); iTestRefHit++) {
28  results[iProc][iTestRefHit].init(omtfConfig);
29  }
30  }
31 }
resultsArrayType results
unsigned int processorCnt() const
unsigned int nTestRefHits() const
Key theKey
Pattern kinematic identification (iEta,iPt,iCharge)
const OMTFConfiguration * myOmtfConfig

◆ ~GoldenPatternBase()

virtual GoldenPatternBase::~GoldenPatternBase ( )
inlinevirtual

Definition at line 73 of file GoldenPatternBase.h.

73 {}

Member Function Documentation

◆ finalise()

void GoldenPatternBase::finalise ( unsigned int  procIndx)
virtual

last step of the event processing, before sorting and ghost busting

Definition at line 134 of file GoldenPatternBase.cc.

References getResults(), and mps_fire::result.

134  {
135  for (auto& result : getResults()[procIndx]) {
136  result.finalise();
137  }
138 }
resultsArrayType & getResults()

◆ getConfig()

const OMTFConfiguration* GoldenPatternBase::getConfig ( ) const
inline

Definition at line 77 of file GoldenPatternBase.h.

References myOmtfConfig.

77 { return myOmtfConfig; }
const OMTFConfiguration * myOmtfConfig

◆ getDistPhiBitShift()

virtual int GoldenPatternBase::getDistPhiBitShift ( unsigned int  iLayer,
unsigned int  iRefLayer 
) const
pure virtual

Implemented in GoldenPattern.

Referenced by process1Layer1RefLayer().

◆ getResults()

resultsArrayType& GoldenPatternBase::getResults ( )
inline

Definition at line 113 of file GoldenPatternBase.h.

References results.

Referenced by finalise(), PatternGenerator::updateStat(), and PatternGenerator::updateStatUsingMatcher2().

113 { return results; }
resultsArrayType results

◆ key()

virtual Key& GoldenPatternBase::key ( )
inlinevirtual

◆ meanDistPhiValue()

virtual int GoldenPatternBase::meanDistPhiValue ( unsigned int  iLayer,
unsigned int  iRefLayer,
int  refLayerPhiB = 0 
) const
pure virtual

Implemented in GoldenPattern.

Referenced by process1Layer1RefLayer().

◆ pdfValue()

virtual PdfValueType GoldenPatternBase::pdfValue ( unsigned int  iLayer,
unsigned int  iRefLayer,
unsigned int  iBin,
int  refLayerPhiB = 0 
) const
pure virtual

Implemented in GoldenPattern.

Referenced by process1Layer1RefLayer().

◆ process1Layer1RefLayer()

StubResult GoldenPatternBase::process1Layer1RefLayer ( unsigned int  iRefLayer,
unsigned int  iLayer,
MuonStubPtrs1D  layerStubs,
const std::vector< int > &  extrapolatedPhi,
const MuonStubPtr refStub 
)
virtual

Process single measurement layer with a single ref layer Method should be thread safe

Select hit closest to the mean of probability distribution in given layer

Check if phiDistMin is within pdf range -63 +63 in firmware here the arithmetic "value and sign" is used, therefore the range is -63 +63, and not -64 +63
Shift phidist, so 0 is at the middle of the range

Definition at line 45 of file GoldenPatternBase.cc.

References funct::abs(), ProcConfigurationBase::foldPhi(), getDistPhiBitShift(), OMTFConfiguration::isBendingLayer(), OMTFConfiguration::isNoHitValueInPdf(), meanDistPhiValue(), myOmtfConfig, OMTFConfiguration::nPdfAddrBits(), OMTFConfiguration::nPhiBins(), pdfValue(), and Validation_hcalonly_cfi::sign.

49  {
50  //if (this->getDistPhiBitShift(iLayer, iRefLayer) != 0) LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<key()<<this->getDistPhiBitShift(iLayer, iRefLayer)<<std::endl;
51 
52  int phiMean = this->meanDistPhiValue(iLayer, iRefLayer, refStub->phiBHw);
53  int phiDistMin = myOmtfConfig->nPhiBins();
54 
57  MuonStubPtr selectedStub;
58 
59  int phiRefHit = 0;
60  if (refStub)
61  phiRefHit = refStub->phiHw;
62 
63  if (this->myOmtfConfig->isBendingLayer(iLayer)) {
64  phiRefHit = 0; //phi ref hit for the bending layer set to 0, since it should not be included in the phiDist
65  }
66 
67  for (size_t iStub = 0; iStub < layerStubs.size(); iStub++) {
68  const auto& stub = layerStubs[iStub];
69  if (!stub) //empty pointer
70  continue;
71 
72  int hitPhi = stub->phiHw;
73  if (this->myOmtfConfig->isBendingLayer(iLayer)) {
74  //rejecting phiB of the low quality DT stubs is done in the OMTFInputMaker
75  hitPhi = stub->phiBHw;
76  }
77 
78  if (hitPhi >= (int)myOmtfConfig->nPhiBins()) //TODO is this needed now? the empty hit will be empty stub
79  continue; //empty itHits are marked with nPhiBins() in OMTFProcessor::restrictInput
80 
81  int phiDist = this->myOmtfConfig->foldPhi(hitPhi - extrapolatedPhi[iStub] - phiMean - phiRefHit);
82  /*LogTrace("l1tOmtfEventPrint") <<"\n"<<__FUNCTION__<<":"<<__LINE__<<" "<<theKey<<std::endl;
83  LogTrace("l1tOmtfEventPrint") <<__FUNCTION__<<":"<<__LINE__
84  <<" iRefLayer "<<iRefLayer<<" iLayer "<<iLayer
85  <<" hitPhi "<<hitPhi<<" phiMean "<<phiMean<<" phiRefHit "<<phiRefHit<<" phiDist "<<phiDist<<std::endl;*/
86 
87  //firmware works on the sign-value, shift must be done on std::abs(phiDist)
88  int sign = phiDist < 0 ? -1 : 1;
89  phiDist = std::abs(phiDist) >> this->getDistPhiBitShift(iLayer, iRefLayer);
90  phiDist *= sign;
91  //if the shift is done here, it means that the phiMean in the xml should be the same as without shift
92  //if (this->getDistPhiBitShift(iLayer, iRefLayer) != 0) std::cout<<__FUNCTION__<<":"<<__LINE__<<" phiDist "<<phiDist<<std::endl;
93  if (std::abs(phiDist) < std::abs(phiDistMin)) {
94  phiDistMin = phiDist;
95  selectedStub = stub;
96  }
97  }
98 
99  if (!selectedStub) {
100  PdfValueType pdfVal = 0;
101  if (this->myOmtfConfig->isNoHitValueInPdf())
102  pdfVal = this->pdfValue(iLayer, iRefLayer, 0);
103  return StubResult(pdfVal, false, myOmtfConfig->nPhiBins(), iLayer, selectedStub);
104  }
105 
106  int pdfMiddle = 1 << (myOmtfConfig->nPdfAddrBits() - 1);
107 
108  /* debug
109  if(phiDistMin != 128 && iRefLayer == 0 && iLayer == 1)*/
110  /*LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" iRefLayer "<<iRefLayer<<" iLayer "<<iLayer<<" selectedStub "<<*selectedStub
111  <<" phiDistMin "<<phiDistMin<<" phiMean "<<phiMean<<" shift "<<this->getDistPhiBitShift(iLayer, iRefLayer)<<std::endl;*/
112 
115  if (std::abs(phiDistMin) > ((1 << (myOmtfConfig->nPdfAddrBits() - 1)) - 1)) {
116  return StubResult(0, false, phiDistMin + pdfMiddle, iLayer, selectedStub);
117 
118  //in some algorithms versions with thresholds we use the bin 0 to store the pdf value returned when there was no hit.
119  //in the version without thresholds, the value in the bin 0 should be 0
120  }
121 
123  phiDistMin += pdfMiddle;
124  //if (this->getDistPhiBitShift(iLayer, iRefLayer) != 0) LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" phiDistMin "<<phiDistMin<<std::endl;
125  PdfValueType pdfVal = this->pdfValue(iLayer, iRefLayer, phiDistMin);
126  if (pdfVal <= 0) {
127  return StubResult(0, false, phiDistMin, iLayer, selectedStub);
128  }
129  return StubResult(pdfVal, true, phiDistMin, iLayer, selectedStub);
130 }
virtual PdfValueType pdfValue(unsigned int iLayer, unsigned int iRefLayer, unsigned int iBin, int refLayerPhiB=0) const =0
bool isNoHitValueInPdf() const
virtual int meanDistPhiValue(unsigned int iLayer, unsigned int iRefLayer, int refLayerPhiB=0) const =0
unsigned int nPhiBins() const
unsigned int nPdfAddrBits() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::shared_ptr< MuonStub > MuonStubPtr
Definition: MuonStub.h:67
virtual int getDistPhiBitShift(unsigned int iLayer, unsigned int iRefLayer) const =0
float PdfValueType
virtual int foldPhi(int phi) const
const OMTFConfiguration * myOmtfConfig
bool isBendingLayer(unsigned int iLayer) const override

◆ propagateRefPhi()

virtual int GoldenPatternBase::propagateRefPhi ( int  phiRef,
int  etaRef,
unsigned int  iRefLayer 
)
pure virtual

Propagate phi from given reference layer to MB2 or ME2 ME2 is used if eta of reference hit is larger than 1.1 expressed in integer MicroGMT scale: 1.1/2.61*240 = 101

Implemented in GoldenPattern, and GoldenPattern.

◆ setConfig()

void GoldenPatternBase::setConfig ( const OMTFConfiguration omtfConfig)
virtual

Definition at line 33 of file GoldenPatternBase.cc.

References myOmtfConfig, OMTFConfiguration::nTestRefHits(), OMTFConfiguration::processorCnt(), and results.

33  {
34  myOmtfConfig = omtfConfig;
35  results.resize(boost::extents[myOmtfConfig->processorCnt()][myOmtfConfig->nTestRefHits()]);
36  for (unsigned int iProc = 0; iProc < results.size(); iProc++) {
37  for (unsigned int iTestRefHit = 0; iTestRefHit < results[iProc].size(); iTestRefHit++) {
38  results[iProc][iTestRefHit].init(omtfConfig);
39  }
40  }
41 }
resultsArrayType results
unsigned int processorCnt() const
unsigned int nTestRefHits() const
const OMTFConfiguration * myOmtfConfig

◆ setDistPhiBitShift()

virtual void GoldenPatternBase::setDistPhiBitShift ( int  value,
unsigned int  iLayer,
unsigned int  iRefLayer 
)
pure virtual

Implemented in GoldenPattern.

◆ setMeanDistPhiValue()

virtual void GoldenPatternBase::setMeanDistPhiValue ( int  value,
unsigned int  iLayer,
unsigned int  iRefLayer,
unsigned int  paramIndex = 0 
)
pure virtual

Implemented in GoldenPattern.

◆ setPdfValue()

virtual void GoldenPatternBase::setPdfValue ( PdfValueType  value,
unsigned int  iLayer,
unsigned int  iRefLayer,
unsigned int  iBin,
int  refLayerPhiB = 0 
)
pure virtual

Implemented in GoldenPattern.

Member Data Documentation

◆ myOmtfConfig

const OMTFConfiguration* GoldenPatternBase::myOmtfConfig
protected

Definition at line 122 of file GoldenPatternBase.h.

Referenced by getConfig(), process1Layer1RefLayer(), and setConfig().

◆ results

resultsArrayType GoldenPatternBase::results
protected

Definition at line 124 of file GoldenPatternBase.h.

Referenced by getResults(), GoldenPatternBase(), and setConfig().

◆ theKey

Key GoldenPatternBase::theKey
protected

Pattern kinematic identification (iEta,iPt,iCharge)

Definition at line 120 of file GoldenPatternBase.h.

Referenced by key().