CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 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

Definition at line 65 of file GoldenPatternBase.h.

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

Definition at line 63 of file GoldenPatternBase.h.

Constructor & Destructor Documentation

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::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 }
unsigned int processorCnt() const
resultsArrayType results
Key theKey
Pattern kinematic identification (iEta,iPt,iCharge)
const OMTFConfiguration * myOmtfConfig
unsigned int nTestRefHits() const
virtual GoldenPatternBase::~GoldenPatternBase ( )
inlinevirtual

Definition at line 73 of file GoldenPatternBase.h.

73 {}

Member Function Documentation

void GoldenPatternBase::finalise ( unsigned int  procIndx)
virtual

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

Definition at line 137 of file GoldenPatternBase.cc.

References getResults(), and mps_fire::result.

137  {
138  for (auto& result : getResults()[procIndx]) {
139  result.finalise();
140  }
141 }
tuple result
Definition: mps_fire.py:311
resultsArrayType & getResults()
const OMTFConfiguration* GoldenPatternBase::getConfig ( ) const
inline

Definition at line 77 of file GoldenPatternBase.h.

References myOmtfConfig.

77 { return myOmtfConfig; }
const OMTFConfiguration * myOmtfConfig
virtual int GoldenPatternBase::getDistPhiBitShift ( unsigned int  iLayer,
unsigned int  iRefLayer 
) const
pure virtual

Implemented in GoldenPattern.

Referenced by process1Layer1RefLayer().

resultsArrayType& GoldenPatternBase::getResults ( )
inline

Definition at line 112 of file GoldenPatternBase.h.

References results.

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

112 { return results; }
resultsArrayType results
virtual Key& GoldenPatternBase::key ( )
inlinevirtual

Definition at line 79 of file GoldenPatternBase.h.

References theKey.

Referenced by AlgoMuon::getCharge(), AlgoMuon::getHwPatternNumber(), AlgoMuon::getPatternNumber(), and AlgoMuon::getPt().

79 { return theKey; }
Key theKey
Pattern kinematic identification (iEta,iPt,iCharge)
virtual int GoldenPatternBase::meanDistPhiValue ( unsigned int  iLayer,
unsigned int  iRefLayer,
int  refLayerPhiB = 0 
) const
pure virtual

Implemented in GoldenPattern.

Referenced by process1Layer1RefLayer().

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().

StubResult GoldenPatternBase::process1Layer1RefLayer ( unsigned int  iRefLayer,
unsigned int  iLayer,
MuonStubPtrs1D  layerStubs,
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 jetcorrextractor::sign().

48  {
49  //if (this->getDistPhiBitShift(iLayer, iRefLayer) != 0) LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<key()<<this->getDistPhiBitShift(iLayer, iRefLayer)<<std::endl;
50 
51  int phiMean = this->meanDistPhiValue(iLayer, iRefLayer, refStub->phiBHw);
52  int phiDistMin = myOmtfConfig->nPhiBins(); //1<<(myOmtfConfig->nPdfAddrBits()); //"infinite" value for the beginning
53 
56  MuonStubPtr selectedStub;
57 
58  int phiRefHit = 0;
59  if (refStub)
60  phiRefHit = refStub->phiHw;
61 
62  if (this->myOmtfConfig->isBendingLayer(iLayer)) {
63  phiRefHit = 0; //phi ref hit for the bending layer set to 0, since it should not be included in the phiDist
64  }
65 
66  for (auto& stub : layerStubs) {
67  if (!stub) //empty pointer
68  continue;
69 
70  int hitPhi = stub->phiHw;
71  if (this->myOmtfConfig->isBendingLayer(iLayer)) {
72  //rejecting phiB of the low quality DT stubs is done in the OMTFInputMaker
73  hitPhi = stub->phiBHw;
74  }
75 
76  if (hitPhi >= (int)myOmtfConfig->nPhiBins()) //TODO is this needed now? the empty hit will be empty stub
77  continue; //empty itHits are marked with nPhiBins() in OMTFProcessor::restrictInput
78 
79  int phiDist = this->myOmtfConfig->foldPhi(hitPhi - phiMean - phiRefHit);
80  //for standard omtf foldPhi is not needed, but if one processor works for full phi then it is
81  //if (this->getDistPhiBitShift(iLayer, iRefLayer) != 0)
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 abs(phiDist)
88  int sign = phiDist < 0 ? -1 : 1;
89  phiDist = 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 (abs(phiDist) < abs(phiDistMin)) {
94  phiDistMin = phiDist;
95  selectedStub = stub;
96  }
97  }
98 
99  if (!selectedStub) {
100  if (this->myOmtfConfig->isNoHitValueInPdf()) {
101  PdfValueType pdfVal = this->pdfValue(iLayer, iRefLayer, 0);
102  return StubResult(pdfVal, false, myOmtfConfig->nPhiBins(), iLayer, selectedStub);
103  } else {
104  return StubResult(0, false, myOmtfConfig->nPhiBins(), iLayer, selectedStub); //2018 version
105  }
106  }
107 
108  int pdfMiddle = 1 << (myOmtfConfig->nPdfAddrBits() - 1);
109 
110  /* debug
111  if(phiDistMin != 128 && iRefLayer == 0 && iLayer == 1)*/
112  /*LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" iRefLayer "<<iRefLayer<<" iLayer "<<iLayer<<" selectedStub "<<*selectedStub
113  <<" phiDistMin "<<phiDistMin<<" phiMean "<<phiMean<<" shift "<<this->getDistPhiBitShift(iLayer, iRefLayer)<<std::endl;*/
114 
117  if (abs(phiDistMin) > ((1 << (myOmtfConfig->nPdfAddrBits() - 1)) - 1)) {
118  return StubResult(0, false, phiDistMin + pdfMiddle, iLayer, selectedStub);
119 
120  //return GoldenPatternResult::LayerResult(this->pdfValue(iLayer, iRefLayer, 0), false, phiDistMin + pdfMiddle, selHit);
121  //in some algorithms versions with thresholds we use the bin 0 to store the pdf value returned when there was no hit.
122  //in the version without thresholds, the value in the bin 0 should be 0
123  }
124 
126  phiDistMin += pdfMiddle;
127  //if (this->getDistPhiBitShift(iLayer, iRefLayer) != 0) LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" phiDistMin "<<phiDistMin<<std::endl;
128  PdfValueType pdfVal = this->pdfValue(iLayer, iRefLayer, phiDistMin);
129  if (pdfVal <= 0) {
130  return StubResult(0, false, phiDistMin, iLayer, selectedStub);
131  }
132  return StubResult(pdfVal, true, phiDistMin, iLayer, selectedStub);
133 }
virtual PdfValueType pdfValue(unsigned int iLayer, unsigned int iRefLayer, unsigned int iBin, int refLayerPhiB=0) const =0
bool isNoHitValueInPdf() const
double sign(double x)
unsigned int nPhiBins() const
virtual int meanDistPhiValue(unsigned int iLayer, unsigned int iRefLayer, int refLayerPhiB=0) const =0
unsigned int nPdfAddrBits() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual int getDistPhiBitShift(unsigned int iLayer, unsigned int iRefLayer) const =0
float PdfValueType
std::shared_ptr< MuonStub > MuonStubPtr
Definition: MuonStub.h:65
virtual int foldPhi(int phi) const
const OMTFConfiguration * myOmtfConfig
bool isBendingLayer(unsigned int iLayer) const override
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.

void GoldenPatternBase::setConfig ( const OMTFConfiguration omtfConfig)
virtual

Definition at line 33 of file GoldenPatternBase.cc.

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

33  {
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 }
unsigned int processorCnt() const
omtfConfig(omtfConfig)
resultsArrayType results
const OMTFConfiguration * myOmtfConfig
unsigned int nTestRefHits() const
virtual void GoldenPatternBase::setDistPhiBitShift ( int  value,
unsigned int  iLayer,
unsigned int  iRefLayer 
)
pure virtual

Implemented in GoldenPattern.

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

Implemented in GoldenPattern.

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

const OMTFConfiguration* GoldenPatternBase::myOmtfConfig
protected

Definition at line 121 of file GoldenPatternBase.h.

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

resultsArrayType GoldenPatternBase::results
protected

Definition at line 123 of file GoldenPatternBase.h.

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

Key GoldenPatternBase::theKey
protected

Pattern kinematic identification (iEta,iPt,iCharge)

Definition at line 119 of file GoldenPatternBase.h.

Referenced by key().