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 310 of file OMTFProcessor.cc.

References hfClusterShapes_cfi::hits.

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

◆ 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.
const ap_uint< BITSPT > ptLUT[2251]
Definition: TPSLUTs.h:18
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 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: TPSLUTs.h:142

◆ extrapolateDtPhiB()

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

Definition at line 564 of file OMTFProcessor.cc.

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

567  {
570  refStub->phiHw,
571  refStub->phiBHw,
572  targetLayer,
573  targetStub->phiHw,
574  targetStub->qualityHw,
575  targetStub->etaHw,
576  targetStub->r,
577  omtfConfig);
579  refStub->phiHw,
580  refStub->phiBHw,
581  targetLayer,
582  targetStub->phiHw,
583  targetStub->qualityHw,
584  targetStub->etaHw,
585  targetStub->r,
586  omtfConfig);
587 }
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 505 of file OMTFProcessor.cc.

References funct::abs(), srCondWrite_cfg::deltaPhi, LogTrace, scaleFactor, simOmtfPhase2Digis_cfi::useEndcapStubsRInExtr, and simOmtfPhase2Digis_cfi::useStubQualInExtr.

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

513  {
514  int phiExtr = 0; //delta phi extrapolated
515 
516  int reflLayerIndex = refLogicLayer == 0 ? 0 : 1;
517  int extrFactor = 0;
518 
519  if (targetLayer == 0 || targetLayer == 2 || targetLayer == 4) {
520  if (useStubQualInExtr)
521  extrFactor = extrapolFactors[reflLayerIndex][targetLayer][targetStubQuality];
522  else
523  extrFactor = extrapolFactors[reflLayerIndex][targetLayer][0];
524  } else if (targetLayer == 1 || targetLayer == 3 || targetLayer == 5) {
525  int deltaPhi = targetStubPhi - refPhi; //here targetStubPhi is phi, not phiB
526 
527  int scaleFactor = this->myOmtfConfig->omtfPhiUnit() * this->myOmtfConfig->dtPhiBUnitsRad() * 512;
528  //= 305 for phase-1, 512 is multiplier so that scaleFactor is non-zero integer
529 
530  deltaPhi = (deltaPhi * scaleFactor) / 512; //here deltaPhi is converted to the phi_b hw scale
531 
532  phiExtr = refPhiB - deltaPhi; //phiExtr is also in phi_b hw scale
533  //LogTrace("l1tOmtfEventPrint") <<__FUNCTION__<<":"<<__LINE__<<" deltaPhi "<<deltaPhi<<" phiExtr "<<phiExtr<<std::endl;
534 
535  } else if (targetLayer >= 10 && targetLayer <= 14) {
536  extrFactor = extrapolFactors[reflLayerIndex][targetLayer][0];
537  } else if ((targetLayer >= 6 && targetLayer <= 9) || (targetLayer >= 15 && targetLayer <= 17)) {
538  if (useEndcapStubsRInExtr) {
539  //if given abs(targetStubEta) value is not present in the map, it is added with default value of 0
540  //so it should be good. The only problem is that the map can grow...
541  //TODO change to targetStubR when it is implemented in the FW
542  extrFactor = extrapolFactors[reflLayerIndex][targetLayer][abs(targetStubEta)];
543  //extrFactor = extrapolFactors[reflLayerIndex][targetLayer][abs(targetStubR)];
544  } else {
545  extrFactor = extrapolFactors[reflLayerIndex][targetLayer][0];
546  }
547  }
548 
549  if (this->myOmtfConfig->isBendingLayer(targetLayer) == false) {
550  phiExtr = extrFactor * refPhiB / extrapolMultiplier;
551  }
552 
553  LogTrace("l1tOmtfEventPrint") << "\n"
554  << __FUNCTION__ << ":" << __LINE__ << " refLogicLayer " << refLogicLayer
555  << " targetLayer " << targetLayer << std::endl;
556  LogTrace("l1tOmtfEventPrint") << "refPhi " << refPhi << " refPhiB " << refPhiB << " targetStubPhi " << targetStubPhi
557  << " targetStubQuality " << targetStubQuality << " targetStubEta " << targetStubEta
558  << " extrFactor " << extrFactor << " phiExtr " << phiExtr << std::endl;
559 
560  return phiExtr;
561 }
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 349 of file OMTFProcessor.cc.

References funct::abs(), ztail::d, srCondWrite_cfg::deltaPhi, ProcConfigurationBase::dtPhiBUnitsRad(), ALCARECOEcalPhiSym_cff::float, LogTrace, OMTFConfiguration::omtfPhiUnit(), funct::tan(), simOmtfPhase2Digis_cfi::useEndcapStubsRInExtr, and simOmtfPhase2Digis_cfi::useStubQualInExtr.

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

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

References funct::abs(), l1t::RegionalMuonCand::hwPt(), l1t::RegionalMuonCand::hwPtUnconstrained(), 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().

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

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

893  {
894  boost::property_tree::ptree tree;
895 
896  boost::property_tree::read_xml(filename, tree);
897 
898  edm::LogVerbatim("OMTFReconstruction") << "loadExtrapolFactors from file " << filename << std::endl;
899 
900  extrapolMultiplier = tree.get<int>("ExtrapolationFactors.<xmlattr>.multiplier");
901  edm::LogVerbatim("OMTFReconstruction") << "extrapolMultiplier " << extrapolMultiplier << std::endl;
902 
903  auto& lutNodes = tree.get_child("ExtrapolationFactors");
904  for (boost::property_tree::ptree::value_type& lutNode : lutNodes) {
905  if (lutNode.first == "Lut") {
906  int iRefLayer = lutNode.second.get<int>("<xmlattr>.RefLayer");
907  int iLayer = lutNode.second.get<int>("<xmlattr>.Layer");
908  std::string keyType = lutNode.second.get<std::string>("<xmlattr>.KeyType");
909 
910  LogTrace("OMTFReconstruction") << "iRefLayer " << iRefLayer << " iLayer " << iLayer << " keyType " << keyType
911  << std::endl;
912 
913  auto& valueNodes = lutNode.second;
914  for (boost::property_tree::ptree::value_type& valueNode : valueNodes) {
915  if (valueNode.first == "LutVal") {
916  int key = valueNode.second.get<int>("<xmlattr>.key");
917  float value = valueNode.second.get<float>("<xmlattr>.value");
918  extrapolFactors.at(iRefLayer).at(iLayer)[key] = value;
919  LogTrace("OMTFReconstruction") << "key " << key << " value " << value << std::endl;
920  }
921  }
922  }
923  }
924 }
Log< level::Info, true > LogVerbatim
#define LogTrace(id)
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 834 of file OMTFProcessor.cc.

References ProcessorBase< GoldenPatternType >::printInfo().

834  {
835  edm::LogVerbatim("OMTFReconstruction") << __PRETTY_FUNCTION__ << std::endl;
836 
838 }
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 592 of file OMTFProcessor.cc.

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

595  {
596  unsigned int procIndx = this->myOmtfConfig->getProcIndx(iProcessor, mtfType);
597  for (auto& itGP : this->theGPs) {
598  for (auto& result : itGP->getResults()[procIndx]) {
599  result.reset();
600  }
601  }
602 
603  LogTrace("l1tOmtfEventPrint") << __FUNCTION__ << "\n"
604  << __LINE__ << " iProcessor " << iProcessor << " mtfType " << mtfType << " procIndx "
605  << procIndx << " ----------------------" << std::endl;
608  std::vector<const RefHitDef*> refHitDefs;
609 
610  {
611  auto refHitsBits = aInput.getRefHits(iProcessor);
612  if (refHitsBits.none())
613  return; // myResults;
614 
615  //loop over all possible refHits, e.g. 128
616  for (unsigned int iRefHit = 0; iRefHit < this->myOmtfConfig->nRefHits(); ++iRefHit) {
617  if (!refHitsBits[iRefHit])
618  continue;
619 
620  refHitDefs.push_back(&(this->myOmtfConfig->getRefHitsDefs()[iProcessor][iRefHit]));
621 
622  if (refHitDefs.size() == this->myOmtfConfig->nTestRefHits())
623  break;
624  }
625  }
626 
627  boost::property_tree::ptree procDataTree;
628  LogTrace("l1tOmtfEventPrint") << __FUNCTION__ << " " << __LINE__;
629  for (unsigned int iLayer = 0; iLayer < this->myOmtfConfig->nLayers(); ++iLayer) {
630  //debug
631  /*for(auto& h : layerHits) {
632  if(h != 5400)
633  LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<" "<<__LINE__<<" iLayer "<<iLayer<<" layerHit "<<h<<std::endl;
634  }*/
635 
636  for (unsigned int iRefHit = 0; iRefHit < refHitDefs.size(); iRefHit++) {
637  const RefHitDef& aRefHitDef = *(refHitDefs[iRefHit]);
638 
639  unsigned int refLayerLogicNum = this->myOmtfConfig->getRefToLogicNumber()[aRefHitDef.iRefLayer];
640  const MuonStubPtr refStub = aInput.getMuonStub(refLayerLogicNum, aRefHitDef.iInput);
641  //int etaRef = refStub->etaHw;
642 
643  unsigned int iRegion = aRefHitDef.iRegion;
644 
645  MuonStubPtrs1D restrictedLayerStubs = this->restrictInput(iProcessor, iRegion, iLayer, aInput);
646 
647  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<" "<<__LINE__<<" iLayer "<<iLayer<<" iRefLayer "<<aRefHitDef.iRefLayer<<std::endl;
648  //LogTrace("l1tOmtfEventPrint")<<"iLayer "<<iLayer<<" iRefHit "<<iRefHit;
649  //LogTrace("l1tOmtfEventPrint")<<" nTestedRefHits "<<nTestedRefHits<<" aRefHitDef "<<aRefHitDef<<std::endl;
650 
651  std::vector<int> extrapolatedPhi(restrictedLayerStubs.size(), 0);
652 
653  //TODO make sure the that the iRefLayer numbers used here corresponds to this in the hwToLogicLayer_0x000X.xml
654  if ((this->myOmtfConfig->usePhiBExtrapolationMB1() && aRefHitDef.iRefLayer == 0) ||
655  (this->myOmtfConfig->usePhiBExtrapolationMB2() && aRefHitDef.iRefLayer == 2)) {
656  if ((iLayer != refLayerLogicNum) && (iLayer != refLayerLogicNum + 1)) {
657  unsigned int iStub = 0;
658  for (auto& targetStub : restrictedLayerStubs) {
659  if (targetStub) {
660  extrapolatedPhi[iStub] = extrapolateDtPhiB(refStub, targetStub, iLayer, this->myOmtfConfig);
661 
662  LogTrace("l1tOmtfEventPrint")
663  << "\n"
664  << __FUNCTION__ << ":" << __LINE__ << " extrapolating from layer " << refLayerLogicNum
665  << " - iRefLayer " << aRefHitDef.iRefLayer << " to layer " << iLayer << " stub " << targetStub
666  << " value " << extrapolatedPhi[iStub] << std::endl;
667 
668  if (this->myOmtfConfig->getDumpResultToXML()) {
669  auto& extrapolatedPhiTree = procDataTree.add_child("extrapolatedPhi", boost::property_tree::ptree());
670  extrapolatedPhiTree.add("<xmlattr>.refLayer", refLayerLogicNum);
671  extrapolatedPhiTree.add("<xmlattr>.layer", iLayer);
672  extrapolatedPhiTree.add("<xmlattr>.refPhiBHw", refStub->phiBHw);
673  extrapolatedPhiTree.add("<xmlattr>.iStub", iStub);
674  extrapolatedPhiTree.add("<xmlattr>.qualityHw", targetStub->qualityHw);
675  extrapolatedPhiTree.add("<xmlattr>.etaHw", targetStub->etaHw);
676  extrapolatedPhiTree.add("<xmlattr>.phiExtr", extrapolatedPhi[iStub]);
677 
678  if (this->myOmtfConfig->isBendingLayer(iLayer))
679  extrapolatedPhiTree.add("<xmlattr>.dist_phi", targetStub->phiBHw - extrapolatedPhi[iStub]);
680  else
681  extrapolatedPhiTree.add("<xmlattr>.dist_phi", targetStub->phiHw - extrapolatedPhi[iStub]);
682  }
683  }
684  iStub++;
685  }
686  }
687  }
688 
689  for (auto& itGP : this->theGPs) {
690  if (itGP->key().thePt == 0) //empty pattern
691  continue;
692 
693  StubResult stubResult =
694  itGP->process1Layer1RefLayer(aRefHitDef.iRefLayer, iLayer, restrictedLayerStubs, extrapolatedPhi, refStub);
695 
696  /* LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__
697  <<" layerResult: valid"<<stubResult.getValid()
698  <<" pdfVal "<<stubResult.getPdfVal()
699  <<std::endl;*/
700 
701  itGP->getResults()[procIndx][iRefHit].setStubResult(iLayer, stubResult);
702  }
703  }
704  }
705 
706  for (unsigned int iRefHit = 0; iRefHit < refHitDefs.size(); iRefHit++) {
707  const RefHitDef& aRefHitDef = *(refHitDefs[iRefHit]);
708 
709  unsigned int refLayerLogicNum = this->myOmtfConfig->getRefToLogicNumber()[aRefHitDef.iRefLayer];
710  const MuonStubPtr refStub = aInput.getMuonStub(refLayerLogicNum, aRefHitDef.iInput);
711 
712  int phiRef = refStub->phiHw;
713  int etaRef = refStub->etaHw;
714 
715  //calculating the phiExtrp in the case the RefLayer is MB1, to include it in the candidate phi of candidate
716  int phiExtrp = 0;
717  if ((this->myOmtfConfig->usePhiBExtrapolationMB1() && aRefHitDef.iRefLayer == 0)) {
718  //||(this->myOmtfConfig->getUsePhiBExtrapolationMB2() && aRefHitDef.iRefLayer == 2) ) { //the extrapolation from the layer 2 to the layer 2 has no sense, so phiExtrp is 0
719  LogTrace("l1tOmtfEventPrint") << "\n"
720  << __FUNCTION__ << ":" << __LINE__
721  << "extrapolating ref hit to get the phi of the candidate" << std::endl;
723  phiExtrp = extrapolateDtPhiBFloatPoint(
724  aRefHitDef.iRefLayer, phiRef, refStub->phiBHw, 2, 0, 6, 0, 0, this->myOmtfConfig);
725  else
726  phiExtrp = extrapolateDtPhiBFixedPoint(
727  aRefHitDef.iRefLayer, phiRef, refStub->phiBHw, 2, 0, 6, 0, 0, this->myOmtfConfig);
728  }
729 
730  for (auto& itGP : this->theGPs) {
731  if (itGP->key().thePt == 0) //empty pattern
732  continue;
733 
734  int phiRefSt2 = itGP->propagateRefPhi(phiRef + phiExtrp, etaRef, aRefHitDef.iRefLayer);
735  itGP->getResults()[procIndx][iRefHit].set(aRefHitDef.iRefLayer, phiRefSt2, etaRef, phiRef);
736  }
737  }
738 
741  {
742  for (auto& itGP : this->theGPs) {
743  itGP->finalise(procIndx);
744  //debug
745  /*for(unsigned int iRefHit = 0; iRefHit < itGP->getResults()[procIndx].size(); ++iRefHit) {
746  if(itGP->getResults()[procIndx][iRefHit].isValid()) {
747  LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<"__LINE__"<<itGP->getResults()[procIndx][iRefHit]<<std::endl;
748  }
749  }*/
750  }
751  }
752 
753  for (auto& obs : observers)
754  obs->addProcesorData("extrapolation", procDataTree);
755 
756  return;
757 }
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 762 of file OMTFProcessor.cc.

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

767  {
768  //uncomment if you want to check execution time of each method
769  //boost::timer::auto_cpu_timer t("%ws wall, %us user in getProcessorCandidates\n");
770 
771  for (auto& obs : observers)
772  obs->observeProcesorBegin(iProcessor, mtfType);
773 
774  //input is shared_ptr because the observers may need them after the run() method execution is finished
775  std::shared_ptr<OMTFinput> input = std::make_shared<OMTFinput>(this->myOmtfConfig);
776  inputMaker->buildInputForProcessor(input->getMuonStubs(), iProcessor, mtfType, bx, bx, observers);
777 
778  if (this->myOmtfConfig->cleanStubs()) {
779  //this has sense for the pattern generation from the tracks with the secondaries
780  //if more than one stub is in a given layer, all stubs are removed from this layer
781  for (unsigned int iLayer = 0; iLayer < input->getMuonStubs().size(); ++iLayer) {
782  auto& layerStubs = input->getMuonStubs()[iLayer];
783  int count = std::count_if(layerStubs.begin(), layerStubs.end(), [](auto& ptr) { return ptr != nullptr; });
784  if (count > 1) {
785  for (auto& ptr : layerStubs)
786  ptr.reset();
787 
788  LogTrace("OMTFReconstruction") << __FUNCTION__ << ":" << __LINE__ << "cleaning stubs in the layer " << iLayer
789  << " stubs count :" << count << std::endl;
790  }
791  }
792  }
793 
794  //LogTrace("l1tOmtfEventPrint")<<"buildInputForProce "; t.report();
795  processInput(iProcessor, mtfType, *(input.get()), observers);
796 
797  //LogTrace("l1tOmtfEventPrint")<<"processInput "; t.report();
798  AlgoMuons algoCandidates = sortResults(iProcessor, mtfType);
799 
800  if (ptAssignment) {
801  for (auto& myCand : algoCandidates) {
802  if (myCand->isValid()) {
803  auto pts = ptAssignment->getPts(myCand, observers);
804  /*for (unsigned int i = 0; i < pts.size(); i++) {
805  trackAddr[10 + i] = this->myOmtfConfig->ptGevToHw(pts[i]);
806  }*/
807  }
808  }
809  }
810 
811  //LogTrace("l1tOmtfEventPrint")<<"sortResults "; t.report();
812  // perform GB
813  //watch out: etaBits2HwEta is used in the ghostBust to convert the AlgoMuons eta, it affect algoCandidates as they are pointers
814  AlgoMuons gbCandidates = ghostBust(algoCandidates);
815 
816  //LogTrace("l1tOmtfEventPrint")<<"ghostBust"; t.report();
817  // fill RegionalMuonCand colleciton
818  std::vector<l1t::RegionalMuonCand> candMuons = getFinalcandidates(iProcessor, mtfType, gbCandidates);
819 
820  //LogTrace("l1tOmtfEventPrint")<<"getFinalcandidates "; t.report();
821  //fill outgoing collection
822  for (auto& candMuon : candMuons) {
823  candMuon.setHwQual(candMuon.hwQual());
824  }
825 
826  for (auto& obs : observers) {
827  obs->observeProcesorEmulation(iProcessor, mtfType, input, algoCandidates, gbCandidates, candMuons);
828  }
829 
830  return candMuons;
831 }
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:176
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 841 of file OMTFProcessor.cc.

References relativeConstraints::empty, to_string(), make_classfiles::tree, simOmtfPhase2Digis_cfi::useEndcapStubsRInExtr, simOmtfPhase2Digis_cfi::useStubQualInExtr, and MCScenario_CRAFT1_22X::write_xml().

841  {
842  //if(this->myOmtfConfig->nProcessors() == 3) //phase2
843  extrapolMultiplier = 512;
844 
845  boost::property_tree::ptree tree;
846  auto& extrFactorsTree = tree.add("ExtrapolationFactors", "");
847  extrFactorsTree.add("<xmlattr>.multiplier", extrapolMultiplier);
848 
849  edm::LogVerbatim("OMTFReconstruction") << "saving extrapolFactors to ExtrapolationFactors.xml" << std::endl;
850  for (unsigned int iRefLayer = 0; iRefLayer < extrapolFactors.size(); iRefLayer++) {
851  for (unsigned int iLayer = 0; iLayer < extrapolFactors[iRefLayer].size(); iLayer++) {
852  edm::LogVerbatim("OMTFReconstruction") << " iRefLayer " << iRefLayer << " iLayer " << iLayer << std::endl;
853 
854  auto& layerTree = extrFactorsTree.add_child("Lut", boost::property_tree::ptree());
855  layerTree.add("<xmlattr>.RefLayer", std::to_string(iRefLayer));
856  layerTree.add("<xmlattr>.Layer", iLayer);
857 
858  if (useStubQualInExtr && (iLayer == 0 || iLayer == 2 || iLayer == 4))
859  layerTree.add("<xmlattr>.KeyType", "quality");
860  else if (useEndcapStubsRInExtr && ((iLayer >= 6 && iLayer <= 9) || (iLayer >= 15 && iLayer <= 17)))
861  layerTree.add("<xmlattr>.KeyType", "eta");
862  else
863  layerTree.add("<xmlattr>.KeyType", "none");
864 
865  for (auto& extrFactors : extrapolFactors[iRefLayer][iLayer]) {
866  int norm = 1;
867  if (!extrapolFactorsNorm[iRefLayer][iLayer].empty())
868  norm = extrapolFactorsNorm[iRefLayer][iLayer][extrFactors.first];
869  auto& lutVal = layerTree.add_child("LutVal", boost::property_tree::ptree());
870  if (useEndcapStubsRInExtr && ((iLayer >= 6 && iLayer <= 9) || (iLayer >= 15 && iLayer <= 17)))
871  lutVal.add("<xmlattr>.key", extrFactors.first);
872  else
873  lutVal.add("<xmlattr>.key", extrFactors.first);
874 
875  double value = round(extrapolMultiplier * extrFactors.second / norm);
876  lutVal.add("<xmlattr>.value", value);
877 
878  edm::LogVerbatim("OMTFReconstruction")
879  << std::setw(4) << " key = " << extrFactors.first << " extrFactors.second " << std::setw(10)
880  << extrFactors.second << " norm " << std::setw(6) << norm << " value/norm " << std::setw(10)
881  << extrFactors.second / norm << " value " << value << std::endl;
882  }
883  }
884  }
885 
886  boost::property_tree::write_xml("ExtrapolationFactors.xml",
887  tree,
888  std::locale(),
889  boost::property_tree::xml_parser::xml_writer_make_settings<std::string>(' ', 2));
890 }
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.

Referenced by OmtfEmulation::addObservers().

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 343 of file OMTFProcessor.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge.

343  {
344  unsigned int procIndx = this->myOmtfConfig->getProcIndx(iProcessor, mtfType);
345  return sorter->sortResults(procIndx, this->getPatterns(), charge);
346 }
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.