CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
OMTFProcessor< GoldenPatternType > Class Template Reference

#include <OMTFProcessor.h>

Inheritance diagram for OMTFProcessor< GoldenPatternType >:
ProcessorBase< GoldenPatternType > IProcessorEmulator

Public Types

typedef std::map< Key, OMTFResultresultsMap
 

Public Member Functions

void averagePatterns (int charge)
 
bool configure (const OMTFConfiguration *omtfParams, const L1TMuonOverlapParams *omtfPatterns)
 Fill GP map with patterns from CondFormats object. More...
 
int extrapolateDtPhiB (const MuonStubPtr &refStub, const MuonStubPtr &targetStub, unsigned int targetLayer, const OMTFConfiguration *omtfConfig)
 
int extrapolateDtPhiBFixedPoint (const int &refLogicLayer, const int &refPhi, const int &refPhiB, unsigned int targetLayer, const int &targetStubPhi, const int &targetStubQuality, const int &targetStubEta, const int &targetStubR, const OMTFConfiguration *omtfConfig)
 
int extrapolateDtPhiBFloatPoint (const int &refLogicLayer, const int &refPhi, const int &refPhiB, unsigned int targetLayer, const int &targetStubPhi, const int &targetStubQuality, const int &targetStubEta, const int &targetStubR, const OMTFConfiguration *omtfConfig)
 Fill GP vec with patterns from CondFormats object. More...
 
void fillCounts (unsigned int iProcessor, const OMTFinput &aInput, const SimTrack *aSimMuon)
 
std::vector< l1t::RegionalMuonCandgetFinalcandidates (unsigned int iProcessor, l1t::tftype mtfType, const AlgoMuons &algoCands) override
 
const std::map< Key, GoldenPattern * > & getPatterns () const
 Return map of GoldenPatterns. More...
 
AlgoMuons ghostBust (AlgoMuons refHitCands, int charge=0) override
 
void loadExtrapolFactors (const std::string &filename)
 
 OMTFProcessor ()
 
 OMTFProcessor (OMTFConfiguration *omtfConfig, const edm::ParameterSet &edmCfg, edm::EventSetup const &evSetup, const L1TMuonOverlapParams *omtfPatterns)
 
 OMTFProcessor (OMTFConfiguration *omtfConfig, const edm::ParameterSet &edmCfg, edm::EventSetup const &evSetup, GoldenPatternVec< GoldenPatternType > &&gps)
 
void printInfo () const override
 
const std::vector< OMTFProcessor::resultsMap > & processInput (unsigned int iProcessor, const OMTFinput &aInput)
 
void processInput (unsigned int iProcessor, l1t::tftype mtfType, const OMTFinput &aInput, std::vector< std::unique_ptr< IOMTFEmulationObserver > > &observers) override
 
std::vector< l1t::RegionalMuonCandrun (unsigned int iProcessor, l1t::tftype mtfType, int bx, OMTFinputMaker *inputMaker, std::vector< std::unique_ptr< IOMTFEmulationObserver > > &observers) override
 
void saveExtrapolFactors ()
 
void setGhostBuster (IGhostBuster *ghostBuster) override
 allows to use other IGhostBuster implementation than the default one More...
 
virtual void setPtAssignment (PtAssignmentBase *ptAssignment)
 
virtual void setSorter (SorterBase< GoldenPatternType > *sorter)
 allows to use other sorter implementation than the default one More...
 
AlgoMuons sortResults (unsigned int iProcessor, l1t::tftype mtfType, int charge=0) override
 
 ~OMTFProcessor ()
 
 ~OMTFProcessor () override
 
- Public Member Functions inherited from ProcessorBase< GoldenPatternType >
virtual void addGP (GoldenPatternType *aGP)
 Add GoldenPattern to pattern vec. More...
 
virtual bool configure (OMTFConfiguration *omtfParams, const L1TMuonOverlapParams *omtfPatterns)
 Fill GP vec with patterns from CondFormats object. More...
 
const std::vector< OMTFConfiguration::PatternPt > & getPatternPtRange () const
 
virtual GoldenPatternVec< GoldenPatternType > & getPatterns ()
 Return vector of GoldenPatterns. More...
 
virtual void initPatternPtRange (bool firstPatFrom0)
 
 ProcessorBase (OMTFConfiguration *omtfConfig, const L1TMuonOverlapParams *omtfPatterns)
 
 ProcessorBase (OMTFConfiguration *omtfConfig, GoldenPatternVec< GoldenPatternType > &&gps)
 
virtual ~ProcessorBase ()
 
- Public Member Functions inherited from IProcessorEmulator
virtual ~IProcessorEmulator ()
 

Private Member Functions

bool addGP (GoldenPattern *aGP)
 
bool checkHitPatternValidity (unsigned int hits) override
 
void fillInputRange (unsigned int iProcessor, unsigned int iCone, const OMTFinput &aInput)
 
void fillInputRange (unsigned int iProcessor, unsigned int iCone, unsigned int iRefLayer, unsigned int iHit)
 
virtual void init (const edm::ParameterSet &edmCfg, edm::EventSetup const &evSetup)
 
void resetConfiguration ()
 Reset all configuration parameters. More...
 
OMTFinput::vector1D restrictInput (unsigned int iProcessor, unsigned int iCone, unsigned int iLayer, const OMTFinput::vector1D &layerHits)
 
void shiftGP (GoldenPattern *aGP, const GoldenPattern::vector2D &meanDistPhiNew, const GoldenPattern::vector2D &meanDistPhiOld)
 

Private Attributes

std::vector< std::vector< std::map< int, double > > > extrapolFactors
 
std::vector< std::vector< std::map< int, int > > > extrapolFactorsNorm
 
int extrapolMultiplier = 128
 
std::unique_ptr< IGhostBusterghostBuster
 
const OMTFConfigurationmyOmtfConfig
 
std::vector< OMTFProcessor::resultsMapmyResults
 
PtAssignmentBaseptAssignment = nullptr
 
std::unique_ptr< SorterBase< GoldenPatternType > > sorter
 
std::map< Key, GoldenPattern * > theGPs
 Map holding Golden Patterns. More...
 
bool useEndcapStubsRInExtr = false
 
bool useFloatingPointExtrapolation = false
 
bool useStubQualInExtr = false
 

Additional Inherited Members

- Protected Member Functions inherited from ProcessorBase< GoldenPatternType >
virtual MuonStubPtrs1D restrictInput (unsigned int iProcessor, unsigned int iCone, unsigned int iLayer, const OMTFinput &input)
 
- Protected Attributes inherited from ProcessorBase< GoldenPatternType >
const OMTFConfigurationmyOmtfConfig
 
std::vector< OMTFConfiguration::PatternPtpatternPts
 
GoldenPatternVec< GoldenPatternType > theGPs
 vector holding Golden Patterns More...
 

Detailed Description

template<class GoldenPatternType>
class OMTFProcessor< GoldenPatternType >

Definition at line 19 of file OMTFProcessor.h.

Member Typedef Documentation

◆ resultsMap

template<class GoldenPatternType >
typedef std::map<Key, OMTFResult> OMTFProcessor< GoldenPatternType >::resultsMap

Definition at line 21 of file OMTFProcessor.h.

Constructor & Destructor Documentation

◆ OMTFProcessor() [1/3]

template<class GoldenPatternType >
OMTFProcessor< GoldenPatternType >::OMTFProcessor ( )
inline

Definition at line 23 of file OMTFProcessor.h.

23 {};

◆ ~OMTFProcessor() [1/2]

template<class GoldenPatternType >
OMTFProcessor< GoldenPatternType >::~OMTFProcessor ( )

Definition at line 21 of file OMTFProcessor.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, and OMTFProcessor< GoldenPatternType >::theGPs.

21  {
22  for (auto it : theGPs)
23  delete it.second;
24 }
std::map< Key, GoldenPattern * > theGPs
Map holding Golden Patterns.
Definition: OMTFProcessor.h:77

◆ OMTFProcessor() [2/3]

template<class GoldenPatternType >
OMTFProcessor< GoldenPatternType >::OMTFProcessor ( OMTFConfiguration omtfConfig,
const edm::ParameterSet edmCfg,
edm::EventSetup const &  evSetup,
const L1TMuonOverlapParams omtfPatterns 
)

Definition at line 35 of file OMTFProcessor.cc.

References OMTFProcessor< GoldenPatternType >::init().

39  : ProcessorBase<GoldenPatternType>(omtfConfig, omtfPatterns) {
40  init(edmCfg, evSetup);
41 };
virtual void init(const edm::ParameterSet &edmCfg, edm::EventSetup const &evSetup)

◆ OMTFProcessor() [3/3]

template<class GoldenPatternType >
OMTFProcessor< GoldenPatternType >::OMTFProcessor ( OMTFConfiguration omtfConfig,
const edm::ParameterSet edmCfg,
edm::EventSetup const &  evSetup,
GoldenPatternVec< GoldenPatternType > &&  gps 
)

Definition at line 44 of file OMTFProcessor.cc.

References OMTFProcessor< GoldenPatternType >::init().

48  : ProcessorBase<GoldenPatternType>(omtfConfig, std::forward<GoldenPatternVec<GoldenPatternType> >(gps)) {
49  init(edmCfg, evSetup);
50 };
virtual void init(const edm::ParameterSet &edmCfg, edm::EventSetup const &evSetup)

◆ ~OMTFProcessor() [2/2]

template<class GoldenPatternType >
OMTFProcessor< GoldenPatternType >::~OMTFProcessor ( )
override

Member Function Documentation

◆ addGP()

template<class GoldenPatternType >
bool OMTFProcessor< GoldenPatternType >::addGP ( GoldenPattern aGP)
private

Add GoldenPattern to pattern map. If GP key already exists in map, a new entry is ignored

Definition at line 95 of file OMTFProcessor.cc.

References OMTFResult::configure(), Exception, GoldenPattern::key(), OMTFProcessor< GoldenPatternType >::myOmtfConfig, OMTFProcessor< GoldenPatternType >::myResults, and OMTFProcessor< GoldenPatternType >::theGPs.

Referenced by OMTFProcessor< GoldenPatternType >::configure().

95  {
96  if (theGPs.find(aGP->key()) != theGPs.end()) {
97  throw cms::Exception("Corrupted Golden Patterns data")
98  << "OMTFProcessor::addGP(...) "
99  << " Reading two Golden Patterns with the same key: " << aGP->key() << std::endl;
100  } else
101  theGPs[aGP->key()] = aGP;
102 
103  for (auto &itRegion : myResults) {
104  OMTFResult aResult;
105  aResult.configure(myOmtfConfig);
106  itRegion[aGP->key()] = aResult;
107  }
108 
109  return true;
110 }
std::vector< OMTFProcessor::resultsMap > myResults
Definition: OMTFProcessor.h:82
std::map< Key, GoldenPattern * > theGPs
Map holding Golden Patterns.
Definition: OMTFProcessor.h:77
Key key() const
Definition: GoldenPattern.h:56
void configure(const OMTFConfiguration *omtfConfig)
Definition: OMTFResult.cc:10
const OMTFConfiguration * myOmtfConfig
Definition: OMTFProcessor.h:86

◆ averagePatterns()

template<class GoldenPatternType >
void OMTFProcessor< GoldenPatternType >::averagePatterns ( int  charge)

Average patterns. Use same meanDistPhi for two patterns neighboring in pt code. Averaging is made saparately fo each charge

Previously pt codes were going by steps of 1, now this is not the case

Definition at line 113 of file OMTFProcessor.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, GoldenPattern::getMeanDistPhi(), ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::if(), OMTFProcessor< GoldenPatternType >::myOmtfConfig, OMTFConfiguration::nLayers(), OMTFConfiguration::nRefLayers(), GoldenPattern::setMeanDistPhi(), OMTFProcessor< GoldenPatternType >::shiftGP(), OMTFProcessor< GoldenPatternType >::theGPs, and Key::thePtCode.

Referenced by OMTFPatternMaker::endJob().

113  {
114  Key aKey(0, 9, charge);
115 
116  while (theGPs.find(aKey) != theGPs.end()) {
117  GoldenPattern *aGP1 = theGPs.find(aKey)->second;
118  GoldenPattern *aGP2 = aGP1;
119  GoldenPattern *aGP3 = aGP1;
120  GoldenPattern *aGP4 = aGP1;
121 
122  ++aKey.thePtCode;
123  while (theGPs.find(aKey) == theGPs.end() && aKey.thePtCode <= 401)
124  ++aKey.thePtCode;
125  if (aKey.thePtCode <= 401 && theGPs.find(aKey) != theGPs.end())
126  aGP2 = theGPs.find(aKey)->second;
127 
128  if (aKey.thePtCode > 71) {
129  ++aKey.thePtCode;
130  while (theGPs.find(aKey) == theGPs.end() && aKey.thePtCode <= 401)
131  ++aKey.thePtCode;
132  if (aKey.thePtCode <= 401 && theGPs.find(aKey) != theGPs.end())
133  aGP3 = theGPs.find(aKey)->second;
134 
135  ++aKey.thePtCode;
136  while (theGPs.find(aKey) == theGPs.end() && aKey.thePtCode <= 401)
137  ++aKey.thePtCode;
138  if (aKey.thePtCode <= 401 && theGPs.find(aKey) != theGPs.end())
139  aGP4 = theGPs.find(aKey)->second;
140  } else {
141  aGP3 = aGP1;
142  aGP4 = aGP2;
143  }
144  //HACK. Have to clean this up.
146  ++aKey.thePtCode;
147  while (theGPs.find(aKey) == theGPs.end() && aKey.thePtCode <= 401)
148  ++aKey.thePtCode;
150 
151  GoldenPattern::vector2D meanDistPhi = aGP1->getMeanDistPhi();
152 
153  GoldenPattern::vector2D meanDistPhi1 = aGP1->getMeanDistPhi();
154  GoldenPattern::vector2D meanDistPhi2 = aGP2->getMeanDistPhi();
155  GoldenPattern::vector2D meanDistPhi3 = aGP3->getMeanDistPhi();
156  GoldenPattern::vector2D meanDistPhi4 = aGP4->getMeanDistPhi();
157 
158  for (unsigned int iLayer = 0; iLayer < myOmtfConfig->nLayers(); ++iLayer) {
159  for (unsigned int iRefLayer = 0; iRefLayer < myOmtfConfig->nRefLayers(); ++iRefLayer) {
160  meanDistPhi[iLayer][iRefLayer] += meanDistPhi2[iLayer][iRefLayer];
161  meanDistPhi[iLayer][iRefLayer] += meanDistPhi3[iLayer][iRefLayer];
162  meanDistPhi[iLayer][iRefLayer] += meanDistPhi4[iLayer][iRefLayer];
163  meanDistPhi[iLayer][iRefLayer] /= 4;
164  }
165  }
166 
167  aGP1->setMeanDistPhi(meanDistPhi);
168  aGP2->setMeanDistPhi(meanDistPhi);
169 
170  shiftGP(aGP1, meanDistPhi, meanDistPhi1);
171  shiftGP(aGP2, meanDistPhi, meanDistPhi2);
172  if (aGP3 != aGP1 && aGP4 != aGP2) {
173  aGP3->setMeanDistPhi(meanDistPhi);
174  aGP4->setMeanDistPhi(meanDistPhi);
175  shiftGP(aGP3, meanDistPhi, meanDistPhi3);
176  shiftGP(aGP4, meanDistPhi, meanDistPhi4);
177  }
178  }
179 }
std::map< Key, GoldenPattern * > theGPs
Map holding Golden Patterns.
Definition: OMTFProcessor.h:77
const vector2D & getMeanDistPhi() const
Definition: GoldenPattern.h:60
std::vector< vector1D > vector2D
Definition: GoldenPattern.h:47
void shiftGP(GoldenPattern *aGP, const GoldenPattern::vector2D &meanDistPhiNew, const GoldenPattern::vector2D &meanDistPhiOld)
unsigned int nLayers() const
unsigned int nRefLayers() const
const OMTFConfiguration * myOmtfConfig
Definition: OMTFProcessor.h:86
void setMeanDistPhi(const vector2D &aMeanDistPhi)
Definition: GoldenPattern.h:58
if(threadIdxLocalY==0 &&threadIdxLocalX==0)

◆ checkHitPatternValidity()

template<class GoldenPatternType >
bool OMTFProcessor< GoldenPatternType >::checkHitPatternValidity ( unsigned int  hits)
overrideprivatevirtual

Check if the hit pattern of given OMTF candite is not on the list of invalid hit patterns. Invalid hit patterns provode very little to efficiency, but gives high contribution to rate. Candidate with invalid hit patterns is assigned quality=0. Currently the list of invalid patterns is hardcoded. This has to be read from configuration.

FIXME: read the list from configuration so this can be controlled at runtime.

Implements IProcessorEmulator.

Definition at line 298 of file OMTFProcessor.cc.

References hfClusterShapes_cfi::hits.

298  {
300  std::vector<unsigned int> badPatterns = {
301  99840, 34304, 3075, 36928, 12300, 98816, 98944, 33408, 66688, 66176, 7171, 20528, 33856, 35840, 4156, 34880};
302 
303  /*
304 99840 01100001 1000 000000 011000011000000000
305 34304 00100001 1000 000000 001000011000000000
306  3075 00000011 0000 000011 000000110000000011
307 36928 00100100 0001 000000 001001000001000000
308 12300 00001100 0000 001100 000011000000001100
309 98816 01100000 1000 000000 011000001000000000
310 98944 01100000 1010 000000 011000001010000000
311 33408 00100000 1010 000000 001000001010000000
312 66688 01000001 0010 000000 010000010010000000
313 66176 01000000 1010 000000 010000001010000000
314  7171 00000111 0000 000011 000001110000000011
315 20528 00010100 0000 110000 000101000000110000
316 33856 00100001 0001 000000 001000010001000000
317 35840 00100011 0000 000000 001000110000000000
318  4156 00000100 0000 111100 000001000000111100
319 34880 00100010 0001 000000 001000100001000000
320  */
321  for (auto aHitPattern : badPatterns) {
322  if (hits == aHitPattern)
323  return false;
324  }
325 
326  return true;
327 }

◆ configure()

template<class GoldenPatternType >
bool OMTFProcessor< GoldenPatternType >::configure ( const OMTFConfiguration omtfParams,
const L1TMuonOverlapParams omtfPatterns 
)

Fill GP map with patterns from CondFormats object.

Mean dist phi data

Pdf data

Definition at line 35 of file OMTFProcessor.cc.

References OMTFProcessor< GoldenPatternType >::addGP(), L1TMuonOverlapParams::chargeLUT(), l1t::LUT::data(), Phase2L1GMT::etaLUT, L1TMuonOverlapParams::etaLUT(), l1tPhase2CaloJetEmulator_cfi::iEta, createfilelist::int, L1TMuonOverlapParams::meanDistPhiLUT(), OMTFProcessor< GoldenPatternType >::myOmtfConfig, OMTFProcessor< GoldenPatternType >::myResults, OMTFConfiguration::nGoldenPatterns(), OMTFConfiguration::nLayers(), OMTFConfiguration::nPdfAddrBits(), l1t::LUT::nrBitsData(), OMTFConfiguration::nRefLayers(), OMTFConfiguration::nTestRefHits(), L1TMuonOverlapParams::pdfLUT(), Phase2L1GMT::ptLUT, L1TMuonOverlapParams::ptLUT(), OMTFProcessor< GoldenPatternType >::resetConfiguration(), GoldenPattern::setMeanDistPhi(), and GoldenPattern::setPdf().

Referenced by OMTFPatternMaker::beginRun(), and OMTFReconstruction::beginRun().

35  {
37 
38  myOmtfConfig = omtfConfig;
39 
41 
42  const l1t::LUT *chargeLUT = omtfPatterns->chargeLUT();
43  const l1t::LUT *etaLUT = omtfPatterns->etaLUT();
44  const l1t::LUT *ptLUT = omtfPatterns->ptLUT();
45  const l1t::LUT *pdfLUT = omtfPatterns->pdfLUT();
46  const l1t::LUT *meanDistPhiLUT = omtfPatterns->meanDistPhiLUT();
47 
48  unsigned int nGPs = myOmtfConfig->nGoldenPatterns();
49  unsigned int address = 0;
50  unsigned int iEta, iPt;
51  int iCharge;
52  for (unsigned int iGP = 0; iGP < nGPs; ++iGP) {
53  address = iGP;
54  iEta = etaLUT->data(address);
55  iCharge = chargeLUT->data(address) == 0 ? -1 : 1;
56  iPt = ptLUT->data(address);
57 
63  for (unsigned int iLayer = 0; iLayer < myOmtfConfig->nLayers(); ++iLayer) {
65  for (unsigned int iRefLayer = 0; iRefLayer < myOmtfConfig->nRefLayers(); ++iRefLayer) {
66  address = iRefLayer + iLayer * myOmtfConfig->nRefLayers() +
68  meanDistPhi1D[iRefLayer] = meanDistPhiLUT->data(address) - (1 << (meanDistPhiLUT->nrBitsData() - 1));
69  }
70  meanDistPhi2D[iLayer] = meanDistPhi1D;
72  for (unsigned int iRefLayer = 0; iRefLayer < myOmtfConfig->nRefLayers(); ++iRefLayer) {
73  pdf1D.assign(1 << myOmtfConfig->nPdfAddrBits(), 0);
74  for (unsigned int iPdf = 0; iPdf < (unsigned int)(1 << myOmtfConfig->nPdfAddrBits()); ++iPdf) {
75  address = iPdf + iRefLayer * (1 << myOmtfConfig->nPdfAddrBits()) +
76  iLayer * myOmtfConfig->nRefLayers() * (1 << myOmtfConfig->nPdfAddrBits()) +
78  pdf1D[iPdf] = pdfLUT->data(address);
79  }
80  pdf2D[iRefLayer] = pdf1D;
81  }
82  pdf3D[iLayer] = pdf2D;
83  }
84  Key aKey(iEta, iPt, iCharge, iGP);
85 
86  GoldenPattern *aGP = new GoldenPattern(aKey, myOmtfConfig);
87  aGP->setMeanDistPhi(meanDistPhi2D);
88  aGP->setPdf(pdf3D);
89  addGP(aGP);
90  }
91  return true;
92 }
std::vector< OMTFProcessor::resultsMap > myResults
Definition: OMTFProcessor.h:82
const l1t::LUT * chargeLUT() const
Golden Patterns definitions.
std::vector< int > vector1D
Definition: GoldenPattern.h:46
unsigned int nrBitsData() const
Definition: LUT.h:53
bool addGP(GoldenPattern *aGP)
std::map< Key, OMTFResult > resultsMap
Definition: OMTFProcessor.h:21
unsigned int nGoldenPatterns() const
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
unsigned int nPdfAddrBits() const
int data(unsigned int address) const
Definition: LUT.h:46
const l1t::LUT * pdfLUT() const
unsigned int nLayers() const
unsigned int nRefLayers() const
unsigned int nTestRefHits() const
Definition: LUT.h:29
const ap_uint< BITSPT > ptLUT[1858]
Definition: Constants.h:18
const OMTFConfiguration * myOmtfConfig
Definition: OMTFProcessor.h:86
void resetConfiguration()
Reset all configuration parameters.
void setMeanDistPhi(const vector2D &aMeanDistPhi)
Definition: GoldenPattern.h:58
const l1t::LUT * meanDistPhiLUT() const
const l1t::LUT * ptLUT() const
const l1t::LUT * etaLUT() const
const uint etaLUT[4082]
Definition: Constants.h:121

◆ extrapolateDtPhiB()

template<class GoldenPatternType >
int OMTFProcessor< GoldenPatternType >::extrapolateDtPhiB ( const MuonStubPtr refStub,
const MuonStubPtr targetStub,
unsigned int  targetLayer,
const OMTFConfiguration omtfConfig 
)

Definition at line 548 of file OMTFProcessor.cc.

References OMTFProcessor< GoldenPatternType >::extrapolateDtPhiBFixedPoint(), OMTFProcessor< GoldenPatternType >::extrapolateDtPhiBFloatPoint(), and simOmtfDigis_extrapolSimple_cfi::useFloatingPointExtrapolation.

551  {
554  refStub->phiHw,
555  refStub->phiBHw,
556  targetLayer,
557  targetStub->phiHw,
558  targetStub->qualityHw,
559  targetStub->etaHw,
560  targetStub->r,
561  omtfConfig);
563  refStub->phiHw,
564  refStub->phiBHw,
565  targetLayer,
566  targetStub->phiHw,
567  targetStub->qualityHw,
568  targetStub->etaHw,
569  targetStub->r,
570  omtfConfig);
571 }
int extrapolateDtPhiBFixedPoint(const int &refLogicLayer, const int &refPhi, const int &refPhiB, unsigned int targetLayer, const int &targetStubPhi, const int &targetStubQuality, const int &targetStubEta, const int &targetStubR, const OMTFConfiguration *omtfConfig)
int extrapolateDtPhiBFloatPoint(const int &refLogicLayer, const int &refPhi, const int &refPhiB, unsigned int targetLayer, const int &targetStubPhi, const int &targetStubQuality, const int &targetStubEta, const int &targetStubR, const OMTFConfiguration *omtfConfig)
Fill GP vec with patterns from CondFormats object.
bool useFloatingPointExtrapolation

◆ extrapolateDtPhiBFixedPoint()

template<class GoldenPatternType >
int OMTFProcessor< GoldenPatternType >::extrapolateDtPhiBFixedPoint ( const int &  refLogicLayer,
const int &  refPhi,
const int &  refPhiB,
unsigned int  targetLayer,
const int &  targetStubPhi,
const int &  targetStubQuality,
const int &  targetStubEta,
const int &  targetStubR,
const OMTFConfiguration omtfConfig 
)

Definition at line 491 of file OMTFProcessor.cc.

References funct::abs(), SiPixelRawToDigiRegional_cfi::deltaPhi, LogTrace, scaleFactor, simOmtfDigis_extrapolSimple_cfi::useEndcapStubsRInExtr, and simOmtfDigis_extrapolSimple_cfi::useStubQualInExtr.

Referenced by OMTFProcessor< GoldenPatternType >::extrapolateDtPhiB().

499  {
500  int phiExtr = 0; //delta phi extrapolated
501 
502  int reflLayerIndex = refLogicLayer == 0 ? 0 : 1;
503  int extrFactor = 0;
504 
505  if (targetLayer == 0 || targetLayer == 2 || targetLayer == 4) {
506  if (useStubQualInExtr)
507  extrFactor = extrapolFactors[reflLayerIndex][targetLayer][targetStubQuality];
508  else
509  extrFactor = extrapolFactors[reflLayerIndex][targetLayer][0];
510  } else if (targetLayer == 1 || targetLayer == 3 || targetLayer == 5) {
511  int deltaPhi = targetStubPhi - refPhi; //[halfStrip]
512 
513  int scaleFactor = this->myOmtfConfig->omtfPhiUnit() * this->myOmtfConfig->dtPhiBUnitsRad() * 512;
514  //= 305 for phase-1, 512 is multiplier so that scaleFactor is non-zero integer
515 
516  deltaPhi = (deltaPhi * scaleFactor) / 512; //here deltaPhi is converted to the phi_b hw scale
517 
518  phiExtr = refPhiB - deltaPhi; //phiExtr is also in phi_b hw scale
519  //LogTrace("l1tOmtfEventPrint") <<__FUNCTION__<<":"<<__LINE__<<" deltaPhi "<<deltaPhi<<" phiExtr "<<phiExtr<<std::endl;
520 
521  } else if (targetLayer >= 10 && targetLayer <= 14) {
522  extrFactor = extrapolFactors[reflLayerIndex][targetLayer][0];
523  } else if ((targetLayer >= 6 && targetLayer <= 9) || (targetLayer >= 15 && targetLayer <= 17)) {
524  if (useEndcapStubsRInExtr) {
525  //if given abs(targetStubEta) value is not present in the map, it is added with default value of 0
526  //so it should be good. The only problem is that the map can grow...
527  extrFactor = extrapolFactors[reflLayerIndex][targetLayer][abs(targetStubEta)];
528  } else {
529  extrFactor = extrapolFactors[reflLayerIndex][targetLayer][0];
530  }
531  }
532 
533  if (this->myOmtfConfig->isBendingLayer(targetLayer) == false) {
534  phiExtr = extrFactor * refPhiB / extrapolMultiplier;
535  }
536 
537  LogTrace("l1tOmtfEventPrint") << "\n"
538  << __FUNCTION__ << ":" << __LINE__ << " refLogicLayer " << refLogicLayer
539  << " targetLayer " << targetLayer << std::endl;
540  LogTrace("l1tOmtfEventPrint") << "refPhi " << refPhi << " refPhiB " << refPhiB << " targetStubPhi " << targetStubPhi
541  << " targetStubQuality " << targetStubQuality << " targetStubEta " << targetStubEta
542  << " extrFactor " << extrFactor << " phiExtr " << phiExtr << std::endl;
543 
544  return phiExtr;
545 }
bool useEndcapStubsRInExtr
#define LogTrace(id)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr G4double scaleFactor
double omtfPhiUnit() const
bool useStubQualInExtr
const OMTFConfiguration * myOmtfConfig
Definition: OMTFProcessor.h:86
bool isBendingLayer(unsigned int iLayer) const override
std::vector< std::vector< std::map< int, double > > > extrapolFactors

◆ extrapolateDtPhiBFloatPoint()

template<class GoldenPatternType >
int OMTFProcessor< GoldenPatternType >::extrapolateDtPhiBFloatPoint ( const int &  refLogicLayer,
const int &  refPhi,
const int &  refPhiB,
unsigned int  targetLayer,
const int &  targetStubPhi,
const int &  targetStubQuality,
const int &  targetStubEta,
const int &  targetStubR,
const OMTFConfiguration omtfConfig 
)

Fill GP vec with patterns from CondFormats object.

Definition at line 337 of file OMTFProcessor.cc.

References funct::abs(), ztail::d, SiPixelRawToDigiRegional_cfi::deltaPhi, ProcConfigurationBase::dtPhiBUnitsRad(), nano_mu_digi_cff::float, LogTrace, OMTFConfiguration::omtfPhiUnit(), funct::tan(), simOmtfDigis_extrapolSimple_cfi::useEndcapStubsRInExtr, and simOmtfDigis_extrapolSimple_cfi::useStubQualInExtr.

Referenced by OMTFProcessor< GoldenPatternType >::extrapolateDtPhiB().

345  {
346  LogTrace("l1tOmtfEventPrint") << "\n"
347  << __FUNCTION__ << ":" << __LINE__ << " refLogicLayer " << refLogicLayer
348  << " targetLayer " << targetLayer << std::endl;
349  LogTrace("l1tOmtfEventPrint") << "refPhi " << refPhi << " refPhiB " << refPhiB << " targetStubPhi " << targetStubPhi
350  << " targetStubQuality " << targetStubQuality << std::endl;
351 
352  int phiExtr = 0; //delta phi extrapolated
353 
354  float rRefLayer = 431.133; //[cm], MB1 i.e. refLogicLayer = 0
355  if (refLogicLayer == 2)
356  rRefLayer = 512.401; //MB2
357  else if (refLogicLayer != 0) {
358  return 0;
359  //throw cms::Exception("OMTFProcessor<GoldenPatternType>::extrapolateDtPhiB: wrong refStubLogicLayer " + std::to_string(refLogicLayer) );
360  }
361 
362  int reflLayerIndex = refLogicLayer == 0 ? 0 : 1;
363 
364  if (targetLayer == 0 || targetLayer == 2 || targetLayer == 4 || (targetLayer >= 10 && targetLayer <= 14)) {
365  //all units are cm. Values from the CMS geometry
366  float rTargetLayer = 512.401; //MB2
367 
368  if (targetLayer == 0)
369  rTargetLayer = 431.133; //MB1
370  else if (targetLayer == 4)
371  rTargetLayer = 617.946; //MB3
372 
373  else if (targetLayer == 10)
374  rTargetLayer = 413.675; //RB1in
375  else if (targetLayer == 11)
376  rTargetLayer = 448.675; //RB1out
377  else if (targetLayer == 12)
378  rTargetLayer = 494.975; //RB2in
379  else if (targetLayer == 13)
380  rTargetLayer = 529.975; //RB2out
381  else if (targetLayer == 14)
382  rTargetLayer = 602.150; //RB3
383 
384  if (useStubQualInExtr) {
385  if (targetLayer == 0 || targetLayer == 2 || targetLayer == 4) {
386  if (targetStubQuality == 2 || targetStubQuality == 0)
387  rTargetLayer = rTargetLayer - 23.5 / 2; //inner superlayer
388  else if (targetStubQuality == 3 || targetStubQuality == 1)
389  rTargetLayer = rTargetLayer + 23.5 / 2; //outer superlayer
390  }
391  }
392 
393  float d = rTargetLayer - rRefLayer;
394  //formula in the form as in the slides explaining the extrapolation algorithm
395  //float deltaPhiExtr = d/rTargetLayer * refPhiB / omtfConfig->dtPhiBUnitsRad(); //[rad]
396  //phiExtr = round(deltaPhiExtr / omtfConfig->omtfPhiUnit()); //[halfStrip]
397 
398  //formula with approximation, used to calculate extrFactor
399  float extrFactor = d / rTargetLayer / omtfConfig->dtPhiBUnitsRad() / omtfConfig->omtfPhiUnit();
400  phiExtr = extrFactor * (float)refPhiB; //[halfStrip]
401 
402  //formula without approximation
403  float deltaPhiExtr = atan(d / rTargetLayer * tan(refPhiB / omtfConfig->dtPhiBUnitsRad())); //[rad]
404  phiExtr = round(deltaPhiExtr / omtfConfig->omtfPhiUnit()); //[halfStrip]
405 
406  if (useStubQualInExtr & (targetLayer == 0 || targetLayer == 2 || targetLayer == 4)) {
407  extrapolFactors[reflLayerIndex][targetLayer][targetStubQuality] = extrFactor;
408  extrapolFactorsNorm[reflLayerIndex][targetLayer][targetStubQuality] = 1;
409  } else {
410  extrapolFactors[reflLayerIndex][targetLayer][0] = extrFactor;
411  extrapolFactorsNorm[reflLayerIndex][targetLayer][0] = 1;
412  }
413 
414  //LogTrace("l1tOmtfEventPrint") <<__FUNCTION__<<":"<<__LINE__<<" deltaPhiExtr "<<deltaPhiExtr<<" phiExtr "<<phiExtr<<std::endl;
415 
416  LogTrace("l1tOmtfEventPrint") << "\n"
417  << __FUNCTION__ << ":" << __LINE__ << " refLogicLayer " << refLogicLayer
418  << " targetLayer " << std::setw(2) << targetLayer << " targetStubQuality "
419  << targetStubQuality << " extrFactor " << extrFactor << std::endl;
420 
421  LogTrace("l1tOmtfEventPrint") << __FUNCTION__ << ":" << __LINE__ << " refPhiB " << refPhiB << " phiExtr " << phiExtr
422  << std::endl;
423 
424  } else if (targetLayer == 1 || targetLayer == 3 || targetLayer == 5) {
425  int deltaPhi = targetStubPhi - refPhi; //[halfStrip]
426 
427  //deltaPhi is here in phi_b hw scale
428  deltaPhi = round(deltaPhi * omtfConfig->omtfPhiUnit() * omtfConfig->dtPhiBUnitsRad());
429 
430  phiExtr = refPhiB - deltaPhi; //phiExtr is also in phi_b hw scale
431  LogTrace("l1tOmtfEventPrint") << __FUNCTION__ << ":" << __LINE__ << " deltaPhi " << deltaPhi << " phiExtr "
432  << phiExtr << std::endl;
433  } else if ((targetLayer >= 6 && targetLayer <= 9) || (targetLayer >= 15 && targetLayer <= 17)) {
434  //if true, for the CSC and endcap RPC the R is taken from the hit coordinates
435 
436  float rME = targetStubR;
437  if (!useEndcapStubsRInExtr) {
438  //all units are cm. This are the average R values for a given chamber (more or less middle of the chamber, but taking into account the OMTF eta range)
439  if (targetLayer == 6 || targetLayer == 15) //ME1/3, RE1/3,
440  rME = 600.;
441  else if (targetLayer == 7 || targetLayer == 15) { //ME2/2, RE2/3,
442  if (refLogicLayer == 0)
443  rME = 600.;
444  else
445  rME = 640.;
446  } else if (targetLayer == 8 || rME == 16) { //ME3/2, RE3/3,
447  if (refLogicLayer == 0)
448  rME = 620.;
449  else
450  rME = 680.;
451  } else if (targetLayer == 9) {
452  rME = 460.; //for the refLogicLayer = 1. refLogicLayer = 2 is impossible
453  }
454  }
455 
456  float d = rME - rRefLayer;
457  //formula in the form as in the slides explaining the extrapolation algorithm
458  //float deltaPhiExtr = d / rME * refPhiB / omtfConfig->dtPhiBUnitsRad(); //[rad]
459  //phiExtr = round(deltaPhiExtr / omtfConfig->omtfPhiUnit()); //[halfStrip]
460 
461  //formula with approximation, used to calculate extrFactor
462  float extrFactor = d / rME / omtfConfig->dtPhiBUnitsRad() / omtfConfig->omtfPhiUnit();
463  phiExtr = extrFactor * refPhiB; //[halfStrip]
464 
465  //formula without approximation
466  float deltaPhiExtr = atan(d / rME * tan(refPhiB / omtfConfig->dtPhiBUnitsRad())); //[rad]
467  phiExtr = round(deltaPhiExtr / omtfConfig->omtfPhiUnit()); //[halfStrip]
468 
469  if (useEndcapStubsRInExtr) {
470  extrapolFactors[reflLayerIndex][targetLayer][abs(targetStubEta)] += extrFactor;
471  extrapolFactorsNorm[reflLayerIndex][targetLayer][abs(targetStubEta)]++;
472  //extrapolFactors[reflLayerIndex][targetLayer][0] += extrFactor;
473  //extrapolFactorsNorm[reflLayerIndex][targetLayer][0]++;
474  } else {
475  extrapolFactors[reflLayerIndex][targetLayer][0] = extrFactor;
476  extrapolFactorsNorm[reflLayerIndex][targetLayer][0] = 1;
477  }
478  LogTrace("l1tOmtfEventPrint") << "\n"
479  << __FUNCTION__ << ":" << __LINE__ << " refLogicLayer " << refLogicLayer
480  << " targetLayer " << std::setw(2) << targetLayer << " targetStubR " << targetStubR
481  << " targetStubEta " << targetStubEta << " extrFactor "
482  << " rRefLayer " << rRefLayer << " d " << d << " deltaPhiExtr " << deltaPhiExtr
483  << " phiExtr " << phiExtr << std::endl;
484  }
485  //TODO restrict the range of the phiExtr and refPhiB !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
486 
487  return phiExtr;
488 }
bool useEndcapStubsRInExtr
#define LogTrace(id)
std::vector< std::vector< std::map< int, int > > > extrapolFactorsNorm
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
d
Definition: ztail.py:151
double omtfPhiUnit() const
bool useStubQualInExtr
std::vector< std::vector< std::map< int, double > > > extrapolFactors

◆ fillCounts()

template<class GoldenPatternType >
void OMTFProcessor< GoldenPatternType >::fillCounts ( unsigned int  iProcessor,
const OMTFinput aInput,
const SimTrack aSimMuon 
)

Fill counts for a GoldenPattern of this processor unit. Pattern key is selcted according to the SimTrack parameters.

Stupid conersion. Have to go through PAC pt scale, as we later shift resulting pt code by +1
Number of reference hits to be checked.

Definition at line 286 of file OMTFProcessor.cc.

References funct::abs(), OMTFConfiguration::getBendingLayers(), OMTFinput::getLayerData(), OMTFinput::getRefHits(), OMTFConfiguration::getRefHitsDefs(), OMTFConfiguration::getRefToLogicNumber(), ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::if(), RefHitDef::iInput, RPCConst::iptFromPt(), RefHitDef::iRefLayer, RefHitDef::iRegion, CoreSimTrack::momentum(), OMTFProcessor< GoldenPatternType >::myOmtfConfig, OMTFConfiguration::nLayers(), OMTFConfiguration::nRefHits(), RPCConst::ptFromIpt(), OMTFProcessor< GoldenPatternType >::restrictInput(), AlignmentTrackSelector_cfi::theCharge, OMTFProcessor< GoldenPatternType >::theGPs, and CoreSimTrack::type().

Referenced by OMTFPatternMaker::analyze().

286  {
287  int theCharge = (abs(aSimMuon->type()) == 13) ? aSimMuon->type() / -13 : 0;
288  unsigned int iPt = RPCConst::iptFromPt(aSimMuon->momentum().pt());
291  iPt += 1;
292  if (iPt > 31)
293  iPt = 200 * 2 + 1;
294  else
295  iPt = RPCConst::ptFromIpt(iPt) * 2.0 +
296  1; //MicroGMT has 0.5 GeV step size, with lower bin edge (uGMT_pt_code - 1)*step_size
298 
300  std::bitset<128> refHitsBits = aInput.getRefHits(iProcessor);
301  if (refHitsBits.none())
302  return;
303 
304  std::ostringstream myStr;
305  myStr << "iProcessor: " << iProcessor << std::endl;
306  myStr << "Input: ------------" << std::endl;
307  myStr << aInput << std::endl;
308  edm::LogInfo("OMTF processor") << myStr.str();
309 
310  for (unsigned int iLayer = 0; iLayer < myOmtfConfig->nLayers(); ++iLayer) {
311  const OMTFinput::vector1D &layerHits = aInput.getLayerData(iLayer);
312  if (layerHits.empty())
313  continue;
315  for (unsigned int iRefHit = 0; iRefHit < myOmtfConfig->nRefHits(); ++iRefHit) {
316  if (!refHitsBits[iRefHit])
317  continue;
318  const RefHitDef &aRefHitDef = myOmtfConfig->getRefHitsDefs()[iProcessor][iRefHit];
319  int phiRef = aInput.getLayerData(myOmtfConfig->getRefToLogicNumber()[aRefHitDef.iRefLayer])[aRefHitDef.iInput];
320  unsigned int iRegion = aRefHitDef.iRegion;
321  if (myOmtfConfig->getBendingLayers().count(iLayer))
322  phiRef = 0;
323  const OMTFinput::vector1D restrictedLayerHits = restrictInput(iProcessor, iRegion, iLayer, layerHits);
324  for (auto itGP : theGPs) {
325  if (itGP.first.theCharge != theCharge)
326  continue;
327  if (itGP.first.thePtCode != iPt)
328  continue;
329  itGP.second->addCount(aRefHitDef.iRefLayer, iLayer, phiRef, restrictedLayerHits);
330  }
331  }
332  }
333 }
std::bitset< 128 > getRefHits(unsigned int iProcessor) const
Definition: OMTFinput.cc:26
unsigned int iInput
Hit input number within a cone.
const std::vector< std::vector< RefHitDef > > & getRefHitsDefs() const
std::vector< int > vector1D
Definition: OMTFinput.h:13
const math::XYZTLorentzVectorD & momentum() const
Definition: CoreSimTrack.h:19
unsigned int nRefHits() const
int type() const
particle type (HEP PDT convension)
Definition: CoreSimTrack.h:22
std::map< Key, GoldenPattern * > theGPs
Map holding Golden Patterns.
Definition: OMTFProcessor.h:77
const OMTFinput::vector1D & getLayerData(unsigned int iLayer, bool giveEta=false) const
Definition: OMTFinput.cc:17
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
unsigned int nLayers() const
const std::vector< int > & getRefToLogicNumber() const
OMTFinput::vector1D restrictInput(unsigned int iProcessor, unsigned int iCone, unsigned int iLayer, const OMTFinput::vector1D &layerHits)
static double ptFromIpt(const int ipt)
Definition: RPCConst.cc:29
Log< level::Info, false > LogInfo
const std::set< int > & getBendingLayers() const
const OMTFConfiguration * myOmtfConfig
Definition: OMTFProcessor.h:86
unsigned int iRefLayer
Reference layer logic number (0-7)
unsigned int iRegion
Region number assigned to this referecne hit.
static int iptFromPt(const double pt)
Definition: RPCConst.cc:10
if(threadIdxLocalY==0 &&threadIdxLocalX==0)

◆ fillInputRange() [1/2]

template<class GoldenPatternType >
void OMTFProcessor< GoldenPatternType >::fillInputRange ( unsigned int  iProcessor,
unsigned int  iCone,
const OMTFinput aInput 
)
private

Fill map of used inputs. FIXME: using hack from OMTFConfiguration

◆ fillInputRange() [2/2]

template<class GoldenPatternType >
void OMTFProcessor< GoldenPatternType >::fillInputRange ( unsigned int  iProcessor,
unsigned int  iCone,
unsigned int  iRefLayer,
unsigned int  iHit 
)
private

◆ getFinalcandidates()

template<class GoldenPatternType >
std::vector< l1t::RegionalMuonCand > OMTFProcessor< GoldenPatternType >::getFinalcandidates ( unsigned int  iProcessor,
l1t::tftype  mtfType,
const AlgoMuons algoCands 
)
overridevirtual

Implements IProcessorEmulator.

Definition at line 102 of file OMTFProcessor.cc.

References funct::abs(), l1t::RegionalMuonCand::hwPt(), l1t::omtf_pos, quality, mps_fire::result, l1t::RegionalMuonCand::setHwEta(), l1t::RegionalMuonCand::setHwPhi(), l1t::RegionalMuonCand::setHwPt(), l1t::RegionalMuonCand::setHwPtUnconstrained(), l1t::RegionalMuonCand::setHwQual(), l1t::RegionalMuonCand::setHwSign(), l1t::RegionalMuonCand::setHwSignValid(), l1t::RegionalMuonCand::setTFIdentifiers(), and l1t::RegionalMuonCand::setTrackAddress().

104  {
105  std::vector<l1t::RegionalMuonCand> result;
106 
107  for (auto& myCand : algoCands) {
108  l1t::RegionalMuonCand candidate;
109 
110  //the charge is only for the constrained measurement. The constrained measurement is always defined for a valid candidate
111  if (ptAssignment) {
112  candidate.setHwPt(myCand->getPtNNConstr());
113  candidate.setHwSign(myCand->getChargeNNConstr() < 0 ? 1 : 0);
114  } else {
115  candidate.setHwPt(myCand->getPtConstr());
116  candidate.setHwSign(myCand->getChargeConstr() < 0 ? 1 : 0);
117  }
118 
119  if (mtfType == l1t::omtf_pos)
120  candidate.setHwEta(myCand->getEtaHw());
121  else
122  candidate.setHwEta((-1) * myCand->getEtaHw());
123 
124  int phiValue = myCand->getPhi();
125  if (phiValue >= int(this->myOmtfConfig->nPhiBins()))
126  phiValue -= this->myOmtfConfig->nPhiBins();
127  phiValue = this->myOmtfConfig->procPhiToGmtPhi(phiValue);
128  candidate.setHwPhi(phiValue);
129 
130  candidate.setHwSignValid(1);
131 
132  if (myCand->getPtUnconstr() >= 0) { //empty PtUnconstrained is -1, maybe should be corrected on the source
133  //the upt has different hardware scale than the pt, the upt unit is 1 GeV
134  candidate.setHwPtUnconstrained(myCand->getPtUnconstr());
135  } else
136  candidate.setHwPtUnconstrained(0);
137 
138  unsigned int quality = 12;
139  if (this->myOmtfConfig->fwVersion() <= 6)
140  quality = checkHitPatternValidity(myCand->getFiredLayerBits()) ? 0 | (1 << 2) | (1 << 3) : 0 | (1 << 2); //12 : 4
141 
142  if (abs(myCand->getEtaHw()) == 115 && //115 is eta 1.25 rrrrrrrrccccdddddd
143  (static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("100000001110000000").to_ulong() ||
144  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000001110000000").to_ulong() ||
145  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("100000000110000000").to_ulong() ||
146  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("100000001100000000").to_ulong() ||
147  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("100000001010000000").to_ulong())) {
148  if (this->myOmtfConfig->fwVersion() <= 6)
149  quality = 4;
150  else
151  quality = 1;
152  }
153 
154  if (this->myOmtfConfig->fwVersion() >= 5 && this->myOmtfConfig->fwVersion() <= 6) {
155  if (static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000010000000011").to_ulong() ||
156  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000100000000011").to_ulong() ||
157  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001000000000011").to_ulong() ||
158  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000010000000000011").to_ulong() ||
159  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000100000000000011").to_ulong() ||
160  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("001000000000000011").to_ulong() ||
161  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("010000000000000011").to_ulong() ||
162  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("100000000000000011").to_ulong() ||
163  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000010000001100").to_ulong() ||
164  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000100000001100").to_ulong() ||
165  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001000000001100").to_ulong() ||
166  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000010000000001100").to_ulong() ||
167  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000100000000001100").to_ulong() ||
168  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("001000000000001100").to_ulong() ||
169  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("010000000000001100").to_ulong() ||
170  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("100000000000001100").to_ulong() ||
171  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000010000110000").to_ulong() ||
172  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000100000110000").to_ulong() ||
173  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001000000110000").to_ulong() ||
174  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000010000000110000").to_ulong() ||
175  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000100000000110000").to_ulong() ||
176  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("001000000000110000").to_ulong() ||
177  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("010000000000110000").to_ulong() ||
178  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("100000000000110000").to_ulong())
179  quality = 1;
180  } else if (this->myOmtfConfig->fwVersion() >= 8) { //TODO fix the fwVersion rrrrrrrrccccdddddd
181  if (static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000110000000011").to_ulong() ||
182  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000100000000011").to_ulong() ||
183  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000010000000011").to_ulong() ||
184  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000110000000001").to_ulong() ||
185 
186  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001000000001100").to_ulong() ||
187  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000011000000001100").to_ulong() ||
188  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000010000000001100").to_ulong() ||
189  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000011000000000100").to_ulong() ||
190 
191  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000011000000001").to_ulong() ||
192  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("001000010000000001").to_ulong())
193  quality = 1;
194  else if (
195  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000010000000101").to_ulong() ||
196  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000010001000001").to_ulong() ||
197  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000011000000001").to_ulong() ||
198  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000011000000011").to_ulong() ||
199  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000011100000001").to_ulong() ||
200  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000100000000011").to_ulong() ||
201  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000100001000100").to_ulong() ||
202  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000100100000001").to_ulong() ||
203  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000110100000001").to_ulong() ||
204  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000111000000000").to_ulong() ||
205  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000111000000001").to_ulong() ||
206  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000111000000011").to_ulong() ||
207  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001000001000100").to_ulong() ||
208  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001010000000001").to_ulong() ||
209  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001010000000011").to_ulong() ||
210  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001010000000100").to_ulong() ||
211  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001100000000001").to_ulong() ||
212  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001100000000100").to_ulong() ||
213  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001100000000111").to_ulong() ||
214  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001100001000000").to_ulong() ||
215  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001110000000100").to_ulong() ||
216  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001110000000101").to_ulong() ||
217  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000010000000000101").to_ulong() ||
218  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000010010000000001").to_ulong() ||
219  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000010010000000100").to_ulong() ||
220  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000010010000000101").to_ulong() ||
221  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000010100000000001").to_ulong() ||
222  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000010100000000101").to_ulong() ||
223  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000011110000000100").to_ulong() ||
224  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000011110000000101").to_ulong() ||
225  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000101000000010101").to_ulong() ||
226  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("001000010000000001").to_ulong() ||
227  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("001000011000000000").to_ulong() ||
228  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("001000011000000001").to_ulong() ||
229  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("001000100000000001").to_ulong() ||
230  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("001000110000000000").to_ulong() ||
231  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("001001000000000100").to_ulong() ||
232  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("001001100000000100").to_ulong() ||
233  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("001010000000000100").to_ulong() ||
234  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("010000000010000001").to_ulong() ||
235  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("010000000011000100").to_ulong() ||
236  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("010000010000000001").to_ulong() ||
237  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("010000100000000001").to_ulong() ||
238  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("100000011000000000").to_ulong() ||
239  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000110000000001").to_ulong() ||
240  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000010000000011").to_ulong() ||
241  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000110000000011").to_ulong() ||
242  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000011000000001100").to_ulong() ||
243  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000011000000000100").to_ulong() ||
244  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000010010000001").to_ulong() ||
245  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000010000000001100").to_ulong() ||
246  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("001001000001000100").to_ulong() ||
247  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001100000000101").to_ulong() ||
248  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000100000000101").to_ulong() ||
249  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001100000000011").to_ulong() ||
250  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001110000000111").to_ulong() ||
251  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("001000110001000001").to_ulong() ||
252  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001110000000011").to_ulong() ||
253  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("001000000001000100").to_ulong() ||
254  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000110001000001").to_ulong() ||
255  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001000000000101").to_ulong() ||
256  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("001010000001000000").to_ulong() ||
257  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("001100000001000000").to_ulong() ||
258  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("100000010000000001").to_ulong() ||
259  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("010000010010000000").to_ulong() ||
260  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000010100000001100").to_ulong() ||
261  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("001000110000000011").to_ulong() ||
262  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001000000001100").to_ulong() ||
263  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000000000000111101").to_ulong() ||
264  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000001100000110001").to_ulong() ||
265  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000100000000010100").to_ulong() ||
266  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("001000100000000011").to_ulong() ||
267  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("001000110000000001").to_ulong() ||
268  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("010000100010000001").to_ulong() ||
269  static_cast<unsigned int>(myCand->getFiredLayerBits()) == std::bitset<18>("000100000000110000").to_ulong())
270  quality = 8;
271  } // if (abs(myCand->getEta()) == 121) quality = 4;
272  if (abs(myCand->getEtaHw()) >= 121)
273  quality = 0; // changed from 4 on request from HI
274 
275  candidate.setHwQual(quality);
276 
277  std::map<int, int> trackAddr;
278  trackAddr[0] = myCand->getFiredLayerBits();
279  //TODO in the hardware, the uPt is sent to the uGMT at the trackAddr = (uPt << 18) + trackAddr;
280  //check if it matters if it needs to be here as well
281  trackAddr[1] = myCand->getRefLayer();
282  trackAddr[2] = myCand->getDisc();
283  trackAddr[3] = myCand->getGpResultUnconstr().getPdfSumUnconstr();
284  if (candidate.hwPt() > 0) {
285  candidate.setTrackAddress(trackAddr);
286  candidate.setTFIdentifiers(iProcessor, mtfType);
287  result.push_back(candidate);
288  }
289  }
290  return result;
291 }
int procPhiToGmtPhi(int procPhi) const
void setHwPhi(int bits)
Set compressed relative phi as transmitted by hardware LSB = 2*pi/576 (8 bits)
const int hwPt() const
Get compressed pT (returned int * 0.5 = pT (GeV))
void setTrackAddress(const std::map< int, int > &address)
Set the whole track address.
string quality
unsigned int fwVersion() const
unsigned int nPhiBins() const
void setTFIdentifiers(int processor, tftype trackFinder)
Set the processor ID, track-finder type. From these two, the link is set.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
PtAssignmentBase * ptAssignment
void setHwQual(int bits)
Set compressed quality code as transmitted by hardware (4 bits)
void setHwPt(int bits)
Set compressed pT as transmitted by hardware LSB = 0.5 (9 bits)
void setHwEta(int bits)
Set compressed eta as transmitted by hardware LSB = 0.010875 (9 bits)
bool checkHitPatternValidity(unsigned int hits) override
const OMTFConfiguration * myOmtfConfig
Definition: OMTFProcessor.h:86
void setHwSignValid(int bits)
Set whether charge measurement is valid (0 for high pT muons)
void setHwPtUnconstrained(int bits)
Set compressed second displaced pT as transmitted by hardware LSB = 1.0 (8 bits)
void setHwSign(int bits)
Set charge sign bit (charge = (-1)^(sign))

◆ getPatterns()

template<class GoldenPatternType >
const std::map< Key, GoldenPattern * > & OMTFProcessor< GoldenPatternType >::getPatterns ( ) const

Return map of GoldenPatterns.

Definition at line 206 of file OMTFProcessor.cc.

References OMTFProcessor< GoldenPatternType >::theGPs.

Referenced by OMTFPatternMaker::beginRun(), OMTFPatternMaker::endJob(), and OMTFPatternMaker::writeMergedGPs().

206 { return theGPs; }
std::map< Key, GoldenPattern * > theGPs
Map holding Golden Patterns.
Definition: OMTFProcessor.h:77

◆ ghostBust()

template<class GoldenPatternType >
AlgoMuons OMTFProcessor< GoldenPatternType >::ghostBust ( AlgoMuons  refHitCands,
int  charge = 0 
)
inlineoverridevirtual

Implements IProcessorEmulator.

Definition at line 96 of file OMTFProcessor.h.

References ALCARECOTkAlJpsiMuMu_cff::charge, and OMTFProcessor< GoldenPatternType >::ghostBuster.

96  {
97  return ghostBuster->select(refHitCands, charge);
98  }
std::unique_ptr< IGhostBuster > ghostBuster

◆ init()

template<class GoldenPatternType >
void OMTFProcessor< GoldenPatternType >::init ( const edm::ParameterSet edmCfg,
edm::EventSetup const &  evSetup 
)
privatevirtual

Definition at line 59 of file OMTFProcessor.cc.

References edm::ParameterSet::exists(), simOmtfDigis_extrapolSimple_cfi::extrapolFactorsFilename, contentValuesFiles::fullPath, edm::ParameterSet::getParameter(), AlCaHLTBitMon_QueryRunRegistry::string, simOmtfDigis_extrapolSimple_cfi::useEndcapStubsRInExtr, simOmtfDigis_extrapolSimple_cfi::useFloatingPointExtrapolation, simOmtfDigis_extrapolSimple_cfi::useStubQualInExtr, and trackerHitRTTI::vector.

Referenced by OMTFProcessor< GoldenPatternType >::OMTFProcessor().

59  {
61  //initialize with the default sorter
62 
63  if (this->myOmtfConfig->getGhostBusterType() == "GhostBusterPreferRefDt" ||
64  this->myOmtfConfig->getGhostBusterType() == "byLLH" || this->myOmtfConfig->getGhostBusterType() == "byFPLLH" ||
65  this->myOmtfConfig->getGhostBusterType() == "byRefLayer") {
67  edm::LogVerbatim("OMTFReconstruction") << "setting " << this->myOmtfConfig->getGhostBusterType() << std::endl;
68  } else {
69  setGhostBuster(new GhostBuster(this->myOmtfConfig)); //initialize with the default sorter
70  edm::LogVerbatim("OMTFReconstruction") << "setting GhostBuster" << std::endl;
71  }
72 
73  edm::LogVerbatim("OMTFReconstruction") << "fwVersion 0x" << hex << this->myOmtfConfig->fwVersion() << std::endl;
74 
77 
78  if (edmCfg.exists("useFloatingPointExtrapolation"))
79  useFloatingPointExtrapolation = edmCfg.getParameter<bool>("useFloatingPointExtrapolation");
80 
82  if (edmCfg.exists("extrapolFactorsFilename")) {
83  extrapolFactorsFilename = edmCfg.getParameter<edm::FileInPath>("extrapolFactorsFilename").fullPath();
84  }
85 
87  extrapolFactors.resize(2, std::vector<std::map<int, double> >(this->myOmtfConfig->nLayers()));
88  extrapolFactorsNorm.resize(2, std::vector<std::map<int, int> >(this->myOmtfConfig->nLayers()));
89 
90  //when useFloatingPointExtrapolation is true the extrapolFactors are not used,
91  //all calculations are done in the extrapolateDtPhiBFloatPoint
92  if (!extrapolFactorsFilename.empty() && !useFloatingPointExtrapolation)
94  }
95 
96  edm::LogVerbatim("OMTFReconstruction") << "useFloatingPointExtrapolation " << useFloatingPointExtrapolation
97  << std::endl;
98  edm::LogVerbatim("OMTFReconstruction") << "extrapolFactorsFilename " << extrapolFactorsFilename << std::endl;
99 }
Log< level::Info, true > LogVerbatim
bool usePhiBExtrapolationMB2() const
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
bool useEndcapStubsRInExtr
bool exists(std::string const &parameterName) const
checks if a parameter exists
bool usePhiBExtrapolationMB1() const
void setGhostBuster(IGhostBuster *ghostBuster) override
allows to use other IGhostBuster implementation than the default one
unsigned int fwVersion() const
std::vector< std::vector< std::map< int, int > > > extrapolFactorsNorm
unsigned int nLayers() const
bool useFloatingPointExtrapolation
int getSorterType() const
virtual void setSorter(SorterBase< GoldenPatternType > *sorter)
allows to use other sorter implementation than the default one
bool useStubQualInExtr
bool useStubQualInExtr() const
bool useEndcapStubsRInExtr() const
const std::string & getGhostBusterType() const
const OMTFConfiguration * myOmtfConfig
Definition: OMTFProcessor.h:86
void loadExtrapolFactors(const std::string &filename)
std::vector< std::vector< std::map< int, double > > > extrapolFactors

◆ loadExtrapolFactors()

template<class GoldenPatternType >
void OMTFProcessor< GoldenPatternType >::loadExtrapolFactors ( const std::string &  filename)

Definition at line 877 of file OMTFProcessor.cc.

References corrVsCorr::filename, submitPVResolutionJobs::key, AlCaHLTBitMon_QueryRunRegistry::string, compare::tree, and relativeConstraints::value.

877  {
878  boost::property_tree::ptree tree;
879 
880  boost::property_tree::read_xml(filename, tree);
881 
882  edm::LogVerbatim("OMTFReconstruction") << "loadExtrapolFactors from file " << filename << std::endl;
883 
884  extrapolMultiplier = tree.get<int>("ExtrapolationFactors.<xmlattr>.multiplier");
885  edm::LogVerbatim("OMTFReconstruction") << "extrapolMultiplier " << extrapolMultiplier << std::endl;
886 
887  auto& lutNodes = tree.get_child("ExtrapolationFactors");
888  for (boost::property_tree::ptree::value_type& lutNode : lutNodes) {
889  if (lutNode.first == "Lut") {
890  int iRefLayer = lutNode.second.get<int>("<xmlattr>.RefLayer");
891  int iLayer = lutNode.second.get<int>("<xmlattr>.Layer");
892  std::string keyType = lutNode.second.get<std::string>("<xmlattr>.KeyType");
893 
894  edm::LogVerbatim("OMTFReconstruction")
895  << "iRefLayer " << iRefLayer << " iLayer " << iLayer << " keyType " << keyType << std::endl;
896 
897  auto& valueNodes = lutNode.second;
898  for (boost::property_tree::ptree::value_type& valueNode : valueNodes) {
899  if (valueNode.first == "LutVal") {
900  int key = valueNode.second.get<int>("<xmlattr>.key");
901  float value = valueNode.second.get<float>("<xmlattr>.value");
902  extrapolFactors.at(iRefLayer).at(iLayer)[key] = value;
903  edm::LogVerbatim("OMTFReconstruction") << "key " << key << " value " << value << std::endl;
904  }
905  }
906  }
907  }
908 }
Log< level::Info, true > LogVerbatim
key
prepare the HTCondor submission files and eventually submit them
Definition: value.py:1
Definition: tree.py:1
std::vector< std::vector< std::map< int, double > > > extrapolFactors

◆ printInfo()

template<class GoldenPatternType >
void OMTFProcessor< GoldenPatternType >::printInfo ( ) const
overridevirtual

Implements IProcessorEmulator.

Definition at line 818 of file OMTFProcessor.cc.

References ProcessorBase< GoldenPatternType >::printInfo().

818  {
819  edm::LogVerbatim("OMTFReconstruction") << __PRETTY_FUNCTION__ << std::endl;
820 
822 }
Log< level::Info, true > LogVerbatim
virtual void printInfo() const

◆ processInput() [1/2]

template<class GoldenPatternType >
const std::vector< OMTFProcessor::resultsMap > & OMTFProcessor< GoldenPatternType >::processInput ( unsigned int  iProcessor,
const OMTFinput aInput 
)

Process input data from a single event Input data is represented by hits in logic layers expressed in local coordinates Vector index: logic region number Map key: GoldenPattern key

Number of reference hits to be checked.

Definition at line 209 of file OMTFProcessor.cc.

References OMTFConfiguration::getBendingLayers(), OMTFinput::getLayerData(), OMTFinput::getRefHits(), OMTFConfiguration::getRefHitsDefs(), OMTFConfiguration::getRefToLogicNumber(), ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::if(), RefHitDef::iInput, RefHitDef::iRefLayer, RefHitDef::iRegion, OMTFProcessor< GoldenPatternType >::myOmtfConfig, OMTFProcessor< GoldenPatternType >::myResults, OMTFConfiguration::nLayers(), OMTFConfiguration::nRefHits(), OMTFConfiguration::nTestRefHits(), OMTFProcessor< GoldenPatternType >::restrictInput(), and OMTFProcessor< GoldenPatternType >::theGPs.

Referenced by OMTFReconstruction::getProcessorCandidates().

210  {
211  for (auto &itRegion : myResults)
212  for (auto &itKey : itRegion)
213  itKey.second.clear();
214 
217  std::bitset<128> refHitsBits = aInput.getRefHits(iProcessor);
218  if (refHitsBits.none())
219  return myResults;
220 
221  for (unsigned int iLayer = 0; iLayer < myOmtfConfig->nLayers(); ++iLayer) {
222  const OMTFinput::vector1D &layerHits = aInput.getLayerData(iLayer);
223  if (layerHits.empty())
224  continue;
226  unsigned int nTestedRefHits = myOmtfConfig->nTestRefHits();
227  for (unsigned int iRefHit = 0; iRefHit < myOmtfConfig->nRefHits(); ++iRefHit) {
228  if (!refHitsBits[iRefHit])
229  continue;
230  if (nTestedRefHits-- == 0)
231  break;
232  const RefHitDef &aRefHitDef = myOmtfConfig->getRefHitsDefs()[iProcessor][iRefHit];
233 
234  int phiRef = aInput.getLayerData(myOmtfConfig->getRefToLogicNumber()[aRefHitDef.iRefLayer])[aRefHitDef.iInput];
235  int etaRef =
236  aInput.getLayerData(myOmtfConfig->getRefToLogicNumber()[aRefHitDef.iRefLayer], true)[aRefHitDef.iInput];
237  unsigned int iRegion = aRefHitDef.iRegion;
238 
239  if (myOmtfConfig->getBendingLayers().count(iLayer))
240  phiRef = 0;
241  const OMTFinput::vector1D restrictedLayerHits = restrictInput(iProcessor, iRegion, iLayer, layerHits);
242  for (auto itGP : theGPs) {
243  GoldenPattern::layerResult aLayerResult =
244  itGP.second->process1Layer1RefLayer(aRefHitDef.iRefLayer, iLayer, phiRef, restrictedLayerHits);
245  int phiRefSt2 = itGP.second->propagateRefPhi(phiRef, etaRef, aRefHitDef.iRefLayer);
246  myResults[myOmtfConfig->nTestRefHits() - nTestedRefHits - 1][itGP.second->key()].setRefPhiRHits(
247  aRefHitDef.iRefLayer, phiRef);
248  myResults[myOmtfConfig->nTestRefHits() - nTestedRefHits - 1][itGP.second->key()].addResult(
249  aRefHitDef.iRefLayer, iLayer, aLayerResult.first, phiRefSt2, etaRef);
250  }
251  }
252  }
255  for (auto &itRefHit : myResults)
256  for (auto &itKey : itRefHit)
257  itKey.second.finalise();
258 
259  std::ostringstream myStr;
260  myStr << "iProcessor: " << iProcessor << std::endl;
261  myStr << "Input: ------------" << std::endl;
262  myStr << aInput << std::endl;
263  edm::LogInfo("OMTF processor") << myStr.str();
264 
265  return myResults;
266 }
std::bitset< 128 > getRefHits(unsigned int iProcessor) const
Definition: OMTFinput.cc:26
std::vector< OMTFProcessor::resultsMap > myResults
Definition: OMTFProcessor.h:82
unsigned int iInput
Hit input number within a cone.
const std::vector< std::vector< RefHitDef > > & getRefHitsDefs() const
std::vector< int > vector1D
Definition: OMTFinput.h:13
std::pair< int, bool > layerResult
Definition: GoldenPattern.h:49
unsigned int nRefHits() const
std::map< Key, GoldenPattern * > theGPs
Map holding Golden Patterns.
Definition: OMTFProcessor.h:77
const OMTFinput::vector1D & getLayerData(unsigned int iLayer, bool giveEta=false) const
Definition: OMTFinput.cc:17
unsigned int nLayers() const
const std::vector< int > & getRefToLogicNumber() const
OMTFinput::vector1D restrictInput(unsigned int iProcessor, unsigned int iCone, unsigned int iLayer, const OMTFinput::vector1D &layerHits)
unsigned int nTestRefHits() const
Log< level::Info, false > LogInfo
const std::set< int > & getBendingLayers() const
const OMTFConfiguration * myOmtfConfig
Definition: OMTFProcessor.h:86
unsigned int iRefLayer
Reference layer logic number (0-7)
unsigned int iRegion
Region number assigned to this referecne hit.
if(threadIdxLocalY==0 &&threadIdxLocalX==0)

◆ processInput() [2/2]

template<class GoldenPatternType >
void OMTFProcessor< GoldenPatternType >::processInput ( unsigned int  iProcessor,
l1t::tftype  mtfType,
const OMTFinput aInput,
std::vector< std::unique_ptr< IOMTFEmulationObserver > > &  observers 
)
overridevirtual

Process input data from a single event Input data is represented by hits in logic layers expressed in local coordinates

Implements IProcessorEmulator.

Definition at line 576 of file OMTFProcessor.cc.

References OMTFinput::getMuonStub(), OMTFinput::getRefHits(), RefHitDef::iInput, RefHitDef::iRefLayer, RefHitDef::iRegion, LogTrace, mps_fire::result, and simOmtfDigis_extrapolSimple_cfi::useFloatingPointExtrapolation.

579  {
580  unsigned int procIndx = this->myOmtfConfig->getProcIndx(iProcessor, mtfType);
581  for (auto& itGP : this->theGPs) {
582  for (auto& result : itGP->getResults()[procIndx]) {
583  result.reset();
584  }
585  }
586 
587  LogTrace("l1tOmtfEventPrint") << __FUNCTION__ << "\n"
588  << __LINE__ << " iProcessor " << iProcessor << " mtfType " << mtfType << " procIndx "
589  << procIndx << " ----------------------" << std::endl;
592  std::vector<const RefHitDef*> refHitDefs;
593 
594  {
595  auto refHitsBits = aInput.getRefHits(iProcessor);
596  if (refHitsBits.none())
597  return; // myResults;
598 
599  //loop over all possible refHits, e.g. 128
600  for (unsigned int iRefHit = 0; iRefHit < this->myOmtfConfig->nRefHits(); ++iRefHit) {
601  if (!refHitsBits[iRefHit])
602  continue;
603 
604  refHitDefs.push_back(&(this->myOmtfConfig->getRefHitsDefs()[iProcessor][iRefHit]));
605 
606  if (refHitDefs.size() == this->myOmtfConfig->nTestRefHits())
607  break;
608  }
609  }
610 
611  boost::property_tree::ptree procDataTree;
612  LogTrace("l1tOmtfEventPrint") << __FUNCTION__ << " " << __LINE__;
613  for (unsigned int iLayer = 0; iLayer < this->myOmtfConfig->nLayers(); ++iLayer) {
614  //debug
615  /*for(auto& h : layerHits) {
616  if(h != 5400)
617  LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<" "<<__LINE__<<" iLayer "<<iLayer<<" layerHit "<<h<<std::endl;
618  }*/
619 
620  for (unsigned int iRefHit = 0; iRefHit < refHitDefs.size(); iRefHit++) {
621  const RefHitDef& aRefHitDef = *(refHitDefs[iRefHit]);
622 
623  unsigned int refLayerLogicNum = this->myOmtfConfig->getRefToLogicNumber()[aRefHitDef.iRefLayer];
624  const MuonStubPtr refStub = aInput.getMuonStub(refLayerLogicNum, aRefHitDef.iInput);
625  //int etaRef = refStub->etaHw;
626 
627  unsigned int iRegion = aRefHitDef.iRegion;
628 
629  MuonStubPtrs1D restrictedLayerStubs = this->restrictInput(iProcessor, iRegion, iLayer, aInput);
630 
631  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<" "<<__LINE__<<" iLayer "<<iLayer<<" iRefLayer "<<aRefHitDef.iRefLayer<<std::endl;
632  //LogTrace("l1tOmtfEventPrint")<<"iLayer "<<iLayer<<" iRefHit "<<iRefHit;
633  //LogTrace("l1tOmtfEventPrint")<<" nTestedRefHits "<<nTestedRefHits<<" aRefHitDef "<<aRefHitDef<<std::endl;
634 
635  std::vector<int> extrapolatedPhi(restrictedLayerStubs.size(), 0);
636 
637  //TODO make sure the that the iRefLayer numbers used here corresponds to this in the hwToLogicLayer_0x000X.xml
638  if ((this->myOmtfConfig->usePhiBExtrapolationMB1() && aRefHitDef.iRefLayer == 0) ||
639  (this->myOmtfConfig->usePhiBExtrapolationMB2() && aRefHitDef.iRefLayer == 2)) {
640  if ((iLayer != refLayerLogicNum) && (iLayer != refLayerLogicNum + 1)) {
641  unsigned int iStub = 0;
642  for (auto& targetStub : restrictedLayerStubs) {
643  if (targetStub) {
644  extrapolatedPhi[iStub] = extrapolateDtPhiB(refStub, targetStub, iLayer, this->myOmtfConfig);
645 
646  LogTrace("l1tOmtfEventPrint")
647  << "\n"
648  << __FUNCTION__ << ":" << __LINE__ << " extrapolating from layer " << refLayerLogicNum
649  << " - iRefLayer " << aRefHitDef.iRefLayer << " to layer " << iLayer << " stub " << targetStub
650  << " value " << extrapolatedPhi[iStub] << std::endl;
651 
652  if (this->myOmtfConfig->getDumpResultToXML()) {
653  auto& extrapolatedPhiTree = procDataTree.add_child("extrapolatedPhi", boost::property_tree::ptree());
654  extrapolatedPhiTree.add("<xmlattr>.refLayer", refLayerLogicNum);
655  extrapolatedPhiTree.add("<xmlattr>.layer", iLayer);
656  extrapolatedPhiTree.add("<xmlattr>.refPhiBHw", refStub->phiBHw);
657  extrapolatedPhiTree.add("<xmlattr>.iStub", iStub);
658  extrapolatedPhiTree.add("<xmlattr>.qualityHw", targetStub->qualityHw);
659  extrapolatedPhiTree.add("<xmlattr>.etaHw", targetStub->etaHw);
660  extrapolatedPhiTree.add("<xmlattr>.phiExtr", extrapolatedPhi[iStub]);
661 
662  if (this->myOmtfConfig->isBendingLayer(iLayer))
663  extrapolatedPhiTree.add("<xmlattr>.dist_phi", targetStub->phiBHw - extrapolatedPhi[iStub]);
664  else
665  extrapolatedPhiTree.add("<xmlattr>.dist_phi", targetStub->phiHw - extrapolatedPhi[iStub]);
666  }
667  }
668  iStub++;
669  }
670  }
671  }
672 
673  for (auto& itGP : this->theGPs) {
674  if (itGP->key().thePt == 0) //empty pattern
675  continue;
676 
677  StubResult stubResult =
678  itGP->process1Layer1RefLayer(aRefHitDef.iRefLayer, iLayer, restrictedLayerStubs, extrapolatedPhi, refStub);
679 
680  /* LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__
681  <<" layerResult: valid"<<stubResult.getValid()
682  <<" pdfVal "<<stubResult.getPdfVal()
683  <<std::endl;*/
684 
685  itGP->getResults()[procIndx][iRefHit].setStubResult(iLayer, stubResult);
686  }
687  }
688  }
689 
690  for (unsigned int iRefHit = 0; iRefHit < refHitDefs.size(); iRefHit++) {
691  const RefHitDef& aRefHitDef = *(refHitDefs[iRefHit]);
692 
693  unsigned int refLayerLogicNum = this->myOmtfConfig->getRefToLogicNumber()[aRefHitDef.iRefLayer];
694  const MuonStubPtr refStub = aInput.getMuonStub(refLayerLogicNum, aRefHitDef.iInput);
695 
696  int phiRef = refStub->phiHw;
697  int etaRef = refStub->etaHw;
698 
699  //calculating the phiExtrp in the case the RefLayer is MB1, to include it in the candidate phi of candidate
700  int phiExtrp = 0;
701  if ((this->myOmtfConfig->usePhiBExtrapolationMB1() && aRefHitDef.iRefLayer == 0)) {
702  //||(this->myOmtfConfig->getUsePhiBExtrapolationMB2() && aRefHitDef.iRefLayer == 2) ) { //the extrapolation from the layer 2 to the layer 2 has no sense, so phiExtrp is 0
703  LogTrace("l1tOmtfEventPrint") << "\n"
704  << __FUNCTION__ << ":" << __LINE__
705  << "extrapolating ref hit to get the phi of the candidate" << std::endl;
707  phiExtrp = extrapolateDtPhiBFloatPoint(
708  aRefHitDef.iRefLayer, phiRef, refStub->phiBHw, 2, 0, 6, 0, 0, this->myOmtfConfig);
709  else
710  phiExtrp = extrapolateDtPhiBFixedPoint(
711  aRefHitDef.iRefLayer, phiRef, refStub->phiBHw, 2, 0, 6, 0, 0, this->myOmtfConfig);
712  }
713 
714  for (auto& itGP : this->theGPs) {
715  if (itGP->key().thePt == 0) //empty pattern
716  continue;
717 
718  int phiRefSt2 = itGP->propagateRefPhi(phiRef + phiExtrp, etaRef, aRefHitDef.iRefLayer);
719  itGP->getResults()[procIndx][iRefHit].set(aRefHitDef.iRefLayer, phiRefSt2, etaRef, phiRef);
720  }
721  }
722 
725  {
726  for (auto& itGP : this->theGPs) {
727  itGP->finalise(procIndx);
728  //debug
729  /*for(unsigned int iRefHit = 0; iRefHit < itGP->getResults()[procIndx].size(); ++iRefHit) {
730  if(itGP->getResults()[procIndx][iRefHit].isValid()) {
731  LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<"__LINE__"<<itGP->getResults()[procIndx][iRefHit]<<std::endl;
732  }
733  }*/
734  }
735  }
736 
737  for (auto& obs : observers)
738  obs->addProcesorData("extrapolation", procDataTree);
739 
740  return;
741 }
bool usePhiBExtrapolationMB2() const
std::bitset< 128 > getRefHits(unsigned int iProcessor) const
Definition: OMTFinput.cc:26
bool getDumpResultToXML() const
int extrapolateDtPhiBFixedPoint(const int &refLogicLayer, const int &refPhi, const int &refPhiB, unsigned int targetLayer, const int &targetStubPhi, const int &targetStubQuality, const int &targetStubEta, const int &targetStubR, const OMTFConfiguration *omtfConfig)
const MuonStubPtr getMuonStub(unsigned int iLayer, unsigned int iInput) const
Definition: OMTFinput.h:33
bool usePhiBExtrapolationMB1() const
unsigned int iInput
Hit input number within a cone.
const std::vector< std::vector< RefHitDef > > & getRefHitsDefs() const
#define LogTrace(id)
unsigned int nRefHits() const
int extrapolateDtPhiB(const MuonStubPtr &refStub, const MuonStubPtr &targetStub, unsigned int targetLayer, const OMTFConfiguration *omtfConfig)
std::map< Key, GoldenPattern * > theGPs
Map holding Golden Patterns.
Definition: OMTFProcessor.h:77
int extrapolateDtPhiBFloatPoint(const int &refLogicLayer, const int &refPhi, const int &refPhiB, unsigned int targetLayer, const int &targetStubPhi, const int &targetStubQuality, const int &targetStubEta, const int &targetStubR, const OMTFConfiguration *omtfConfig)
Fill GP vec with patterns from CondFormats object.
std::vector< MuonStubPtr > MuonStubPtrs1D
Definition: MuonStub.h:68
unsigned int nLayers() const
std::shared_ptr< MuonStub > MuonStubPtr
Definition: MuonStub.h:67
const std::vector< int > & getRefToLogicNumber() const
OMTFinput::vector1D restrictInput(unsigned int iProcessor, unsigned int iCone, unsigned int iLayer, const OMTFinput::vector1D &layerHits)
unsigned int nTestRefHits() const
bool useFloatingPointExtrapolation
const OMTFConfiguration * myOmtfConfig
Definition: OMTFProcessor.h:86
unsigned int iRefLayer
Reference layer logic number (0-7)
unsigned int getProcIndx(unsigned int iProcessor, l1t::tftype mtfType) const
input phi should be in the hardware scale (nPhiBins units for 2pi), can be in range -nPhiBins ...
unsigned int iRegion
Region number assigned to this referecne hit.
bool isBendingLayer(unsigned int iLayer) const override

◆ resetConfiguration()

template<class GoldenPatternType >
void OMTFProcessor< GoldenPatternType >::resetConfiguration ( )
privatevirtual

Reset all configuration parameters.

Reimplemented from ProcessorBase< GoldenPatternType >.

Definition at line 27 of file OMTFProcessor.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, OMTFProcessor< GoldenPatternType >::myResults, and OMTFProcessor< GoldenPatternType >::theGPs.

Referenced by OMTFProcessor< GoldenPatternType >::configure().

27  {
28  myResults.clear();
29  for (auto it : theGPs)
30  delete it.second;
31  theGPs.clear();
32 }
std::vector< OMTFProcessor::resultsMap > myResults
Definition: OMTFProcessor.h:82
std::map< Key, GoldenPattern * > theGPs
Map holding Golden Patterns.
Definition: OMTFProcessor.h:77

◆ restrictInput()

template<class GoldenPatternType >
OMTFinput::vector1D OMTFProcessor< GoldenPatternType >::restrictInput ( unsigned int  iProcessor,
unsigned int  iCone,
unsigned int  iLayer,
const OMTFinput::vector1D layerHits 
)
private

Remove hits whis are outside input range for given processor and cone

Definition at line 269 of file OMTFProcessor.cc.

References OMTFConfiguration::getConnections(), OMTFProcessor< GoldenPatternType >::myOmtfConfig, and OMTFConfiguration::nPhiBins().

Referenced by OMTFProcessor< GoldenPatternType >::fillCounts(), and OMTFProcessor< GoldenPatternType >::processInput().

272  {
273  OMTFinput::vector1D myHits = layerHits;
274 
275  unsigned int iStart = myOmtfConfig->getConnections()[iProcessor][iRegion][iLayer].first;
276  unsigned int iEnd = iStart + myOmtfConfig->getConnections()[iProcessor][iRegion][iLayer].second - 1;
277 
278  for (unsigned int iInput = 0; iInput < 14; ++iInput) {
279  if (iInput < iStart || iInput > iEnd)
280  myHits[iInput] = myOmtfConfig->nPhiBins();
281  }
282  return myHits;
283 }
std::vector< int > vector1D
Definition: OMTFinput.h:13
const vector3D_pair & getConnections() const
unsigned int nPhiBins() const
const OMTFConfiguration * myOmtfConfig
Definition: OMTFProcessor.h:86

◆ run()

template<class GoldenPatternType >
std::vector< l1t::RegionalMuonCand > OMTFProcessor< GoldenPatternType >::run ( unsigned int  iProcessor,
l1t::tftype  mtfType,
int  bx,
OMTFinputMaker inputMaker,
std::vector< std::unique_ptr< IOMTFEmulationObserver > > &  observers 
)
overridevirtual

Implements IProcessorEmulator.

Definition at line 746 of file OMTFProcessor.cc.

References OMTFinputMaker::buildInputForProcessor(), nano_mu_digi_cff::bx, submitPVResolutionJobs::count, input, LogTrace, and RPCpg::pts.

751  {
752  //uncomment if you want to check execution time of each method
753  //boost::timer::auto_cpu_timer t("%ws wall, %us user in getProcessorCandidates\n");
754 
755  for (auto& obs : observers)
756  obs->observeProcesorBegin(iProcessor, mtfType);
757 
758  //input is shared_ptr because the observers may need them after the run() method execution is finished
759  std::shared_ptr<OMTFinput> input = std::make_shared<OMTFinput>(this->myOmtfConfig);
760  inputMaker->buildInputForProcessor(input->getMuonStubs(), iProcessor, mtfType, bx, bx, observers);
761 
762  if (this->myOmtfConfig->cleanStubs()) {
763  //this has sense for the pattern generation from the tracks with the secondaries
764  //if more than one stub is in a given layer, all stubs are removed from this layer
765  for (unsigned int iLayer = 0; iLayer < input->getMuonStubs().size(); ++iLayer) {
766  auto& layerStubs = input->getMuonStubs()[iLayer];
767  int count = std::count_if(layerStubs.begin(), layerStubs.end(), [](auto& ptr) { return ptr != nullptr; });
768  if (count > 1) {
769  for (auto& ptr : layerStubs)
770  ptr.reset();
771 
772  LogTrace("OMTFReconstruction") << __FUNCTION__ << ":" << __LINE__ << "cleaning stubs in the layer " << iLayer
773  << " stubs count :" << count << std::endl;
774  }
775  }
776  }
777 
778  //LogTrace("l1tOmtfEventPrint")<<"buildInputForProce "; t.report();
779  processInput(iProcessor, mtfType, *(input.get()), observers);
780 
781  //LogTrace("l1tOmtfEventPrint")<<"processInput "; t.report();
782  AlgoMuons algoCandidates = sortResults(iProcessor, mtfType);
783 
784  if (ptAssignment) {
785  for (auto& myCand : algoCandidates) {
786  if (myCand->isValid()) {
787  auto pts = ptAssignment->getPts(myCand, observers);
788  /*for (unsigned int i = 0; i < pts.size(); i++) {
789  trackAddr[10 + i] = this->myOmtfConfig->ptGevToHw(pts[i]);
790  }*/
791  }
792  }
793  }
794 
795  //LogTrace("l1tOmtfEventPrint")<<"sortResults "; t.report();
796  // perform GB
797  //watch out: etaBits2HwEta is used in the ghostBust to convert the AlgoMuons eta, it affect algoCandidates as they are pointers
798  AlgoMuons gbCandidates = ghostBust(algoCandidates);
799 
800  //LogTrace("l1tOmtfEventPrint")<<"ghostBust"; t.report();
801  // fill RegionalMuonCand colleciton
802  std::vector<l1t::RegionalMuonCand> candMuons = getFinalcandidates(iProcessor, mtfType, gbCandidates);
803 
804  //LogTrace("l1tOmtfEventPrint")<<"getFinalcandidates "; t.report();
805  //fill outgoing collection
806  for (auto& candMuon : candMuons) {
807  candMuon.setHwQual(candMuon.hwQual());
808  }
809 
810  for (auto& obs : observers) {
811  obs->observeProcesorEmulation(iProcessor, mtfType, input, algoCandidates, gbCandidates, candMuons);
812  }
813 
814  return candMuons;
815 }
OMTFinput buildInputForProcessor(const L1MuDTChambPhContainer *dtPhDigis, const L1MuDTChambThContainer *dtThDigis, const CSCCorrelatedLCTDigiCollection *cscDigis, const RPCDigiCollection *rpcDigis, unsigned int iProcessor, l1t::tftype type=l1t::tftype::omtf_pos, int bx=0)
Method translating trigger digis into input matrix with global phi coordinates.
std::vector< l1t::RegionalMuonCand > getFinalcandidates(unsigned int iProcessor, l1t::tftype mtfType, const AlgoMuons &algoCands) override
#define LogTrace(id)
static std::string const input
Definition: EdmProvDump.cc:50
static const double pts[33]
Definition: Constants.h:30
const std::vector< OMTFProcessor::resultsMap > & processInput(unsigned int iProcessor, const OMTFinput &aInput)
PtAssignmentBase * ptAssignment
AlgoMuons ghostBust(AlgoMuons refHitCands, int charge=0) override
Definition: OMTFProcessor.h:96
bool cleanStubs() const
AlgoMuons sortResults(unsigned int iProcessor, l1t::tftype mtfType, int charge=0) override
std::vector< AlgoMuonPtr > AlgoMuons
Definition: AlgoMuon.h:183
const OMTFConfiguration * myOmtfConfig
Definition: OMTFProcessor.h:86
virtual std::vector< float > getPts(AlgoMuons::value_type &algoMuon, std::vector< std::unique_ptr< IOMTFEmulationObserver > > &observers)=0

◆ saveExtrapolFactors()

template<class GoldenPatternType >
void OMTFProcessor< GoldenPatternType >::saveExtrapolFactors ( )

Definition at line 825 of file OMTFProcessor.cc.

References relativeConstraints::empty, to_string(), compare::tree, simOmtfDigis_extrapolSimple_cfi::useEndcapStubsRInExtr, simOmtfDigis_extrapolSimple_cfi::useStubQualInExtr, and MCScenario_CRAFT1_22X::write_xml().

825  {
826  //if(this->myOmtfConfig->nProcessors() == 3) //phase2
827  extrapolMultiplier = 512;
828 
829  boost::property_tree::ptree tree;
830  auto& extrFactorsTree = tree.add("ExtrapolationFactors", "");
831  extrFactorsTree.add("<xmlattr>.multiplier", extrapolMultiplier);
832 
833  edm::LogVerbatim("OMTFReconstruction") << "saving extrapolFactors to ExtrapolationFactors.xml" << std::endl;
834  for (unsigned int iRefLayer = 0; iRefLayer < extrapolFactors.size(); iRefLayer++) {
835  for (unsigned int iLayer = 0; iLayer < extrapolFactors[iRefLayer].size(); iLayer++) {
836  edm::LogVerbatim("OMTFReconstruction") << " iRefLayer " << iRefLayer << " iLayer " << iLayer << std::endl;
837 
838  auto& layerTree = extrFactorsTree.add_child("Lut", boost::property_tree::ptree());
839  layerTree.add("<xmlattr>.RefLayer", std::to_string(iRefLayer));
840  layerTree.add("<xmlattr>.Layer", iLayer);
841 
842  if (useStubQualInExtr && (iLayer == 0 || iLayer == 2 || iLayer == 4))
843  layerTree.add("<xmlattr>.KeyType", "quality");
844  else if (useEndcapStubsRInExtr && ((iLayer >= 6 && iLayer <= 9) || (iLayer >= 15 && iLayer <= 17)))
845  layerTree.add("<xmlattr>.KeyType", "eta");
846  else
847  layerTree.add("<xmlattr>.KeyType", "none");
848 
849  for (auto& extrFactors : extrapolFactors[iRefLayer][iLayer]) {
850  int norm = 1;
851  if (!extrapolFactorsNorm[iRefLayer][iLayer].empty())
852  norm = extrapolFactorsNorm[iRefLayer][iLayer][extrFactors.first];
853  auto& lutVal = layerTree.add_child("LutVal", boost::property_tree::ptree());
854  if (useEndcapStubsRInExtr && ((iLayer >= 6 && iLayer <= 9) || (iLayer >= 15 && iLayer <= 17)))
855  lutVal.add("<xmlattr>.key", extrFactors.first);
856  else
857  lutVal.add("<xmlattr>.key", extrFactors.first);
858 
859  double value = round(extrapolMultiplier * extrFactors.second / norm);
860  lutVal.add("<xmlattr>.value", value);
861 
862  edm::LogVerbatim("OMTFReconstruction")
863  << std::setw(4) << " key = " << extrFactors.first << " extrFactors.second " << std::setw(10)
864  << extrFactors.second << " norm " << std::setw(6) << norm << " value/norm " << std::setw(10)
865  << extrFactors.second / norm << " value " << value << std::endl;
866  }
867  }
868  }
869 
870  boost::property_tree::write_xml("ExtrapolationFactors.xml",
871  tree,
872  std::locale(),
873  boost::property_tree::xml_parser::xml_writer_make_settings<std::string>(' ', 2));
874 }
Log< level::Info, true > LogVerbatim
bool useEndcapStubsRInExtr
static std::string to_string(const XMLCh *ch)
std::vector< std::vector< std::map< int, int > > > extrapolFactorsNorm
def write_xml(scenario, fileName)
Definition: value.py:1
bool useStubQualInExtr
Definition: tree.py:1
std::vector< std::vector< std::map< int, double > > > extrapolFactors

◆ setGhostBuster()

template<class GoldenPatternType >
void OMTFProcessor< GoldenPatternType >::setGhostBuster ( IGhostBuster ghostBuster)
inlineoverridevirtual

allows to use other IGhostBuster implementation than the default one

Implements IProcessorEmulator.

Definition at line 109 of file OMTFProcessor.h.

References OMTFProcessor< GoldenPatternType >::ghostBuster.

109 { this->ghostBuster.reset(ghostBuster); }
std::unique_ptr< IGhostBuster > ghostBuster

◆ setPtAssignment()

template<class GoldenPatternType >
virtual void OMTFProcessor< GoldenPatternType >::setPtAssignment ( PtAssignmentBase ptAssignment)
inlinevirtual

Definition at line 111 of file OMTFProcessor.h.

References OMTFProcessor< GoldenPatternType >::ptAssignment.

111 { this->ptAssignment = ptAssignment; }
PtAssignmentBase * ptAssignment

◆ setSorter()

template<class GoldenPatternType >
virtual void OMTFProcessor< GoldenPatternType >::setSorter ( SorterBase< GoldenPatternType > *  sorter)
inlinevirtual

allows to use other sorter implementation than the default one

Definition at line 106 of file OMTFProcessor.h.

106 { this->sorter.reset(sorter); }

◆ shiftGP()

template<class GoldenPatternType >
void OMTFProcessor< GoldenPatternType >::shiftGP ( GoldenPattern aGP,
const GoldenPattern::vector2D meanDistPhiNew,
const GoldenPattern::vector2D meanDistPhiOld 
)
private

Shift pdf indexes by differecne between averaged and original meanDistPhi

Shift pdfs by differecne between original menaDistPhi, and the averaged value

Definition at line 182 of file OMTFProcessor.cc.

References GoldenPattern::getPdf(), OMTFProcessor< GoldenPatternType >::myOmtfConfig, OMTFConfiguration::nLayers(), OMTFConfiguration::nPdfAddrBits(), OMTFConfiguration::nRefLayers(), GoldenPattern::pdfValue(), and GoldenPattern::setPdf().

Referenced by OMTFProcessor< GoldenPatternType >::averagePatterns().

184  {
187  unsigned int nPdfBins = exp2(myOmtfConfig->nPdfAddrBits());
188  GoldenPattern::vector3D pdfAllRef = aGP->getPdf();
189 
190  int indexShift = 0;
191  for (unsigned int iLayer = 0; iLayer < myOmtfConfig->nLayers(); ++iLayer) {
192  for (unsigned int iRefLayer = 0; iRefLayer < myOmtfConfig->nRefLayers(); ++iRefLayer) {
193  indexShift = meanDistPhiOld[iLayer][iRefLayer] - meanDistPhiNew[iLayer][iRefLayer];
194  for (unsigned int iPdfBin = 0; iPdfBin < nPdfBins; ++iPdfBin)
195  pdfAllRef[iLayer][iRefLayer][iPdfBin] = 0;
196  for (unsigned int iPdfBin = 0; iPdfBin < nPdfBins; ++iPdfBin) {
197  if ((int)(iPdfBin) + indexShift >= 0 && iPdfBin + indexShift < nPdfBins)
198  pdfAllRef[iLayer][iRefLayer][iPdfBin + indexShift] = aGP->pdfValue(iLayer, iRefLayer, iPdfBin);
199  }
200  }
201  }
202  aGP->setPdf(pdfAllRef);
203 }
int pdfValue(unsigned int iLayer, unsigned int iRefLayer, unsigned int iBin) const
Definition: GoldenPattern.h:68
std::vector< vector2D > vector3D
Definition: GoldenPattern.h:48
void setPdf(const vector3D &aPdf)
Definition: GoldenPattern.h:64
unsigned int nPdfAddrBits() const
unsigned int nLayers() const
unsigned int nRefLayers() const
const OMTFConfiguration * myOmtfConfig
Definition: OMTFProcessor.h:86
const vector3D & getPdf() const
Definition: GoldenPattern.h:62

◆ sortResults()

template<class GoldenPatternType >
AlgoMuons OMTFProcessor< GoldenPatternType >::sortResults ( unsigned int  iProcessor,
l1t::tftype  mtfType,
int  charge = 0 
)
overridevirtual

Implements IProcessorEmulator.

Definition at line 331 of file OMTFProcessor.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge.

331  {
332  unsigned int procIndx = this->myOmtfConfig->getProcIndx(iProcessor, mtfType);
333  return sorter->sortResults(procIndx, this->getPatterns(), charge);
334 }
const std::map< Key, GoldenPattern * > & getPatterns() const
Return map of GoldenPatterns.
const OMTFConfiguration * myOmtfConfig
Definition: OMTFProcessor.h:86
unsigned int getProcIndx(unsigned int iProcessor, l1t::tftype mtfType) const
input phi should be in the hardware scale (nPhiBins units for 2pi), can be in range -nPhiBins ...

Member Data Documentation

◆ extrapolFactors

template<class GoldenPatternType >
std::vector<std::vector<std::map<int, double> > > OMTFProcessor< GoldenPatternType >::extrapolFactors
private

Definition at line 151 of file OMTFProcessor.h.

◆ extrapolFactorsNorm

template<class GoldenPatternType >
std::vector<std::vector<std::map<int, int> > > OMTFProcessor< GoldenPatternType >::extrapolFactorsNorm
private

Definition at line 152 of file OMTFProcessor.h.

◆ extrapolMultiplier

template<class GoldenPatternType >
int OMTFProcessor< GoldenPatternType >::extrapolMultiplier = 128
private

Definition at line 149 of file OMTFProcessor.h.

◆ ghostBuster

template<class GoldenPatternType >
std::unique_ptr<IGhostBuster> OMTFProcessor< GoldenPatternType >::ghostBuster
private

◆ myOmtfConfig

template<class GoldenPatternType >
const OMTFConfiguration* OMTFProcessor< GoldenPatternType >::myOmtfConfig
private

◆ myResults

template<class GoldenPatternType >
std::vector<OMTFProcessor::resultsMap> OMTFProcessor< GoldenPatternType >::myResults
private

Map holding results on current event data for each GP. Reference hit number is isued as a vector index.

Definition at line 82 of file OMTFProcessor.h.

Referenced by OMTFProcessor< GoldenPatternType >::addGP(), OMTFProcessor< GoldenPatternType >::configure(), OMTFProcessor< GoldenPatternType >::processInput(), and OMTFProcessor< GoldenPatternType >::resetConfiguration().

◆ ptAssignment

template<class GoldenPatternType >
PtAssignmentBase* OMTFProcessor< GoldenPatternType >::ptAssignment = nullptr
private

◆ sorter

template<class GoldenPatternType >
std::unique_ptr<SorterBase<GoldenPatternType> > OMTFProcessor< GoldenPatternType >::sorter
private

Definition at line 135 of file OMTFProcessor.h.

◆ theGPs

template<class GoldenPatternType >
std::map<Key, GoldenPattern *> OMTFProcessor< GoldenPatternType >::theGPs
private

◆ useEndcapStubsRInExtr

template<class GoldenPatternType >
bool OMTFProcessor< GoldenPatternType >::useEndcapStubsRInExtr = false
private

Definition at line 143 of file OMTFProcessor.h.

◆ useFloatingPointExtrapolation

template<class GoldenPatternType >
bool OMTFProcessor< GoldenPatternType >::useFloatingPointExtrapolation = false
private

Definition at line 147 of file OMTFProcessor.h.

◆ useStubQualInExtr

template<class GoldenPatternType >
bool OMTFProcessor< GoldenPatternType >::useStubQualInExtr = false
private

Definition at line 142 of file OMTFProcessor.h.