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

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

22  {
23  for (auto it : theGPs)
24  delete it.second;
25 }
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 96 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().

96  {
97  if (theGPs.find(aGP->key()) != theGPs.end()) {
98  throw cms::Exception("Corrupted Golden Patterns data")
99  << "OMTFProcessor::addGP(...) "
100  << " Reading two Golden Patterns with the same key: " << aGP->key() << std::endl;
101  } else
102  theGPs[aGP->key()] = aGP;
103 
104  for (auto &itRegion : myResults) {
105  OMTFResult aResult;
106  aResult.configure(myOmtfConfig);
107  itRegion[aGP->key()] = aResult;
108  }
109 
110  return true;
111 }
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 114 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().

114  {
115  Key aKey(0, 9, charge);
116 
117  while (theGPs.find(aKey) != theGPs.end()) {
118  GoldenPattern *aGP1 = theGPs.find(aKey)->second;
119  GoldenPattern *aGP2 = aGP1;
120  GoldenPattern *aGP3 = aGP1;
121  GoldenPattern *aGP4 = aGP1;
122 
123  ++aKey.thePtCode;
124  while (theGPs.find(aKey) == theGPs.end() && aKey.thePtCode <= 401)
125  ++aKey.thePtCode;
126  if (aKey.thePtCode <= 401 && theGPs.find(aKey) != theGPs.end())
127  aGP2 = theGPs.find(aKey)->second;
128 
129  if (aKey.thePtCode > 71) {
130  ++aKey.thePtCode;
131  while (theGPs.find(aKey) == theGPs.end() && aKey.thePtCode <= 401)
132  ++aKey.thePtCode;
133  if (aKey.thePtCode <= 401 && theGPs.find(aKey) != theGPs.end())
134  aGP3 = theGPs.find(aKey)->second;
135 
136  ++aKey.thePtCode;
137  while (theGPs.find(aKey) == theGPs.end() && aKey.thePtCode <= 401)
138  ++aKey.thePtCode;
139  if (aKey.thePtCode <= 401 && theGPs.find(aKey) != theGPs.end())
140  aGP4 = theGPs.find(aKey)->second;
141  } else {
142  aGP3 = aGP1;
143  aGP4 = aGP2;
144  }
145  //HACK. Have to clean this up.
147  ++aKey.thePtCode;
148  while (theGPs.find(aKey) == theGPs.end() && aKey.thePtCode <= 401)
149  ++aKey.thePtCode;
151 
152  GoldenPattern::vector2D meanDistPhi = aGP1->getMeanDistPhi();
153 
154  GoldenPattern::vector2D meanDistPhi1 = aGP1->getMeanDistPhi();
155  GoldenPattern::vector2D meanDistPhi2 = aGP2->getMeanDistPhi();
156  GoldenPattern::vector2D meanDistPhi3 = aGP3->getMeanDistPhi();
157  GoldenPattern::vector2D meanDistPhi4 = aGP4->getMeanDistPhi();
158 
159  for (unsigned int iLayer = 0; iLayer < myOmtfConfig->nLayers(); ++iLayer) {
160  for (unsigned int iRefLayer = 0; iRefLayer < myOmtfConfig->nRefLayers(); ++iRefLayer) {
161  meanDistPhi[iLayer][iRefLayer] += meanDistPhi2[iLayer][iRefLayer];
162  meanDistPhi[iLayer][iRefLayer] += meanDistPhi3[iLayer][iRefLayer];
163  meanDistPhi[iLayer][iRefLayer] += meanDistPhi4[iLayer][iRefLayer];
164  meanDistPhi[iLayer][iRefLayer] /= 4;
165  }
166  }
167 
168  aGP1->setMeanDistPhi(meanDistPhi);
169  aGP2->setMeanDistPhi(meanDistPhi);
170 
171  shiftGP(aGP1, meanDistPhi, meanDistPhi1);
172  shiftGP(aGP2, meanDistPhi, meanDistPhi2);
173  if (aGP3 != aGP1 && aGP4 != aGP2) {
174  aGP3->setMeanDistPhi(meanDistPhi);
175  aGP4->setMeanDistPhi(meanDistPhi);
176  shiftGP(aGP3, meanDistPhi, meanDistPhi3);
177  shiftGP(aGP4, meanDistPhi, meanDistPhi4);
178  }
179  }
180 }
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 312 of file OMTFProcessor.cc.

References hfClusterShapes_cfi::hits.

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

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

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

◆ extrapolateDtPhiB()

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

Definition at line 566 of file OMTFProcessor.cc.

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

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

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

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

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

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

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

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

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

◆ fillInputRange() [1/2]

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

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

◆ fillInputRange() [2/2]

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

◆ getFinalcandidates()

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

Implements IProcessorEmulator.

Definition at line 102 of file OMTFProcessor.cc.

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

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

References OMTFProcessor< GoldenPatternType >::theGPs.

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

207 { 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, and trackerHitRTTI::vector.

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

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

◆ loadExtrapolFactors()

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

Definition at line 895 of file OMTFProcessor.cc.

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

895  {
896  boost::property_tree::ptree tree;
897 
898  boost::property_tree::read_xml(filename, tree);
899 
900  edm::LogVerbatim("OMTFReconstruction") << "loadExtrapolFactors from file " << filename << std::endl;
901 
902  extrapolMultiplier = tree.get<int>("ExtrapolationFactors.<xmlattr>.multiplier");
903  edm::LogVerbatim("OMTFReconstruction") << "extrapolMultiplier " << extrapolMultiplier << std::endl;
904 
905  auto& lutNodes = tree.get_child("ExtrapolationFactors");
906  for (boost::property_tree::ptree::value_type& lutNode : lutNodes) {
907  if (lutNode.first == "Lut") {
908  int iRefLayer = lutNode.second.get<int>("<xmlattr>.RefLayer");
909  int iLayer = lutNode.second.get<int>("<xmlattr>.Layer");
910  std::string keyType = lutNode.second.get<std::string>("<xmlattr>.KeyType");
911 
912  edm::LogVerbatim("OMTFReconstruction")
913  << "iRefLayer " << iRefLayer << " iLayer " << iLayer << " keyType " << keyType << std::endl;
914 
915  auto& valueNodes = lutNode.second;
916  for (boost::property_tree::ptree::value_type& valueNode : valueNodes) {
917  if (valueNode.first == "LutVal") {
918  int key = valueNode.second.get<int>("<xmlattr>.key");
919  float value = valueNode.second.get<float>("<xmlattr>.value");
920  extrapolFactors.at(iRefLayer).at(iLayer)[key] = value;
921  edm::LogVerbatim("OMTFReconstruction") << "key " << key << " value " << value << std::endl;
922  }
923  }
924  }
925  }
926 }
Log< level::Info, true > LogVerbatim
key
prepare the HTCondor submission files and eventually submit them
Definition: value.py:1
Definition: tree.py:1
std::vector< std::vector< std::map< int, double > > > extrapolFactors

◆ printInfo()

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

Implements IProcessorEmulator.

Definition at line 836 of file OMTFProcessor.cc.

References ProcessorBase< GoldenPatternType >::printInfo().

836  {
837  edm::LogVerbatim("OMTFReconstruction") << __PRETTY_FUNCTION__ << std::endl;
838 
840 }
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 210 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().

211  {
212  for (auto &itRegion : myResults)
213  for (auto &itKey : itRegion)
214  itKey.second.clear();
215 
218  std::bitset<128> refHitsBits = aInput.getRefHits(iProcessor);
219  if (refHitsBits.none())
220  return myResults;
221 
222  for (unsigned int iLayer = 0; iLayer < myOmtfConfig->nLayers(); ++iLayer) {
223  const OMTFinput::vector1D &layerHits = aInput.getLayerData(iLayer);
224  if (layerHits.empty())
225  continue;
227  unsigned int nTestedRefHits = myOmtfConfig->nTestRefHits();
228  for (unsigned int iRefHit = 0; iRefHit < myOmtfConfig->nRefHits(); ++iRefHit) {
229  if (!refHitsBits[iRefHit])
230  continue;
231  if (nTestedRefHits-- == 0)
232  break;
233  const RefHitDef &aRefHitDef = myOmtfConfig->getRefHitsDefs()[iProcessor][iRefHit];
234 
235  int phiRef = aInput.getLayerData(myOmtfConfig->getRefToLogicNumber()[aRefHitDef.iRefLayer])[aRefHitDef.iInput];
236  int etaRef =
237  aInput.getLayerData(myOmtfConfig->getRefToLogicNumber()[aRefHitDef.iRefLayer], true)[aRefHitDef.iInput];
238  unsigned int iRegion = aRefHitDef.iRegion;
239 
240  if (myOmtfConfig->getBendingLayers().count(iLayer))
241  phiRef = 0;
242  const OMTFinput::vector1D restrictedLayerHits = restrictInput(iProcessor, iRegion, iLayer, layerHits);
243  for (auto itGP : theGPs) {
244  GoldenPattern::layerResult aLayerResult =
245  itGP.second->process1Layer1RefLayer(aRefHitDef.iRefLayer, iLayer, phiRef, restrictedLayerHits);
246  int phiRefSt2 = itGP.second->propagateRefPhi(phiRef, etaRef, aRefHitDef.iRefLayer);
247  myResults[myOmtfConfig->nTestRefHits() - nTestedRefHits - 1][itGP.second->key()].setRefPhiRHits(
248  aRefHitDef.iRefLayer, phiRef);
249  myResults[myOmtfConfig->nTestRefHits() - nTestedRefHits - 1][itGP.second->key()].addResult(
250  aRefHitDef.iRefLayer, iLayer, aLayerResult.first, phiRefSt2, etaRef);
251  }
252  }
253  }
256  for (auto &itRefHit : myResults)
257  for (auto &itKey : itRefHit)
258  itKey.second.finalise();
259 
260  std::ostringstream myStr;
261  myStr << "iProcessor: " << iProcessor << std::endl;
262  myStr << "Input: ------------" << std::endl;
263  myStr << aInput << std::endl;
264  edm::LogInfo("OMTF processor") << myStr.str();
265 
266  return myResults;
267 }
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 594 of file OMTFProcessor.cc.

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

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

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

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

28  {
29  myResults.clear();
30  for (auto it : theGPs)
31  delete it.second;
32  theGPs.clear();
33 }
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 270 of file OMTFProcessor.cc.

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

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

273  {
274  OMTFinput::vector1D myHits = layerHits;
275 
276  unsigned int iStart = myOmtfConfig->getConnections()[iProcessor][iRegion][iLayer].first;
277  unsigned int iEnd = iStart + myOmtfConfig->getConnections()[iProcessor][iRegion][iLayer].second - 1;
278 
279  for (unsigned int iInput = 0; iInput < 14; ++iInput) {
280  if (iInput < iStart || iInput > iEnd)
281  myHits[iInput] = myOmtfConfig->nPhiBins();
282  }
283  return myHits;
284 }
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 764 of file OMTFProcessor.cc.

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

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

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

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

◆ setGhostBuster()

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

allows to use other IGhostBuster implementation than the default one

Implements IProcessorEmulator.

Definition at line 109 of file OMTFProcessor.h.

References OMTFProcessor< GoldenPatternType >::ghostBuster.

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

◆ setPtAssignment()

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

Definition at line 111 of file OMTFProcessor.h.

References OMTFProcessor< GoldenPatternType >::ptAssignment.

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

◆ setSorter()

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

allows to use other sorter implementation than the default one

Definition at line 106 of file OMTFProcessor.h.

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

◆ shiftGP()

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

Shift pdf indexes by differecne between averaged and original meanDistPhi

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

Definition at line 183 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().

185  {
188  unsigned int nPdfBins = exp2(myOmtfConfig->nPdfAddrBits());
189  GoldenPattern::vector3D pdfAllRef = aGP->getPdf();
190 
191  int indexShift = 0;
192  for (unsigned int iLayer = 0; iLayer < myOmtfConfig->nLayers(); ++iLayer) {
193  for (unsigned int iRefLayer = 0; iRefLayer < myOmtfConfig->nRefLayers(); ++iRefLayer) {
194  indexShift = meanDistPhiOld[iLayer][iRefLayer] - meanDistPhiNew[iLayer][iRefLayer];
195  for (unsigned int iPdfBin = 0; iPdfBin < nPdfBins; ++iPdfBin)
196  pdfAllRef[iLayer][iRefLayer][iPdfBin] = 0;
197  for (unsigned int iPdfBin = 0; iPdfBin < nPdfBins; ++iPdfBin) {
198  if ((int)(iPdfBin) + indexShift >= 0 && iPdfBin + indexShift < nPdfBins)
199  pdfAllRef[iLayer][iRefLayer][iPdfBin + indexShift] = aGP->pdfValue(iLayer, iRefLayer, iPdfBin);
200  }
201  }
202  }
203  aGP->setPdf(pdfAllRef);
204 }
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 345 of file OMTFProcessor.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge.

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