CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions
OMTFSorter Class Reference

#include <OMTFSorter.h>

Public Member Functions

void sortProcessorAndFillCandidates (unsigned int iProcessor, l1t::tftype mtfType, const std::vector< AlgoMuon > &algoCands, l1t::RegionalMuonCandBxCollection &sortedCands, int bx, int charge=0)
 
void sortRefHitResults (const std::vector< OMTFProcessor::resultsMap > &procResults, std::vector< AlgoMuon > &refHitCleanCands, int charge=0)
 
AlgoMuon sortRefHitResults (const OMTFProcessor::resultsMap &aResultsMap, int charge=0)
 

Private Member Functions

bool checkHitPatternValidity (unsigned int hits)
 
AlgoMuon sortSingleResult (const OMTFResult &aResult)
 

Detailed Description

Definition at line 15 of file OMTFSorter.h.

Member Function Documentation

bool OMTFSorter::checkHitPatternValidity ( unsigned int  hits)
private

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.

Definition at line 231 of file OMTFSorter.cc.

Referenced by sortProcessorAndFillCandidates().

231  {
232 
234  std::vector<unsigned int> badPatterns = {99840, 34304, 3075, 36928, 12300, 98816, 98944, 33408, 66688, 66176, 7171, 20528, 33856, 35840, 4156, 34880};
235 
236  for(auto aHitPattern: badPatterns){
237  if(hits==aHitPattern) return false;
238  }
239 
240  return true;
241 }
void OMTFSorter::sortProcessorAndFillCandidates ( unsigned int  iProcessor,
l1t::tftype  mtfType,
const std::vector< AlgoMuon > &  algoCands,
l1t::RegionalMuonCandBxCollection sortedCands,
int  bx,
int  charge = 0 
)

conversion factor from OMTF to uGMT scale: 5400/576

Quality is set to number of leayers hit. DT bending and position hit is counted as one. thus we subtract 1 for each DT station hit.

Candidates with bad hit patterns get quality 0.

Now quality based on hit pattern

Definition at line 244 of file OMTFSorter.cc.

References bits, checkHitPatternValidity(), l1t::RegionalMuonCand::hwPt(), OMTFConfiguration::instance(), ecaldqm::binning::nPhiBins, OMTFConfiguration::nPhiBins, BXVector< T >::push_back(), HLT_FULL_cff::quality, l1t::RegionalMuonCand::setHwEta(), l1t::RegionalMuonCand::setHwPhi(), l1t::RegionalMuonCand::setHwPt(), l1t::RegionalMuonCand::setHwQual(), l1t::RegionalMuonCand::setHwSign(), l1t::RegionalMuonCand::setTFIdentifiers(), and l1t::RegionalMuonCand::setTrackAddress().

Referenced by OMTFReconstruction::getProcessorCandidates().

247  {
248 
249  for(auto myCand: algoCands){
250  l1t::RegionalMuonCand candidate;
251  std::bitset<17> bits(myCand.getHits());
252  candidate.setHwPt(myCand.getPt());
253  candidate.setHwEta(myCand.getEta());
254 
255  float phiValue = myCand.getPhi();
258  phiValue/=9.375;
259  candidate.setHwPhi(phiValue);
260 
261  candidate.setHwSign(myCand.getCharge()<0 ? 1:0 );
262  //FIXME: Obsolete
266  //candidate.setHwQual(bits.count() - bits.test(0) - bits.test(2) - bits.test(4));
268  //if(!checkHitPatternValidity(myCand.getHits())) candidate.setHwQual(0);
269 
272  unsigned int quality = checkHitPatternValidity(myCand.getHits()) ? 0 | (1 << 2) | (1 << 3)
273  : 0 | (1 << 2);
274  candidate.setHwQual ( quality);
275 
276  std::map<int, int> trackAddr;
277  trackAddr[0] = myCand.getHits();
278  trackAddr[1] = myCand.getRefLayer();
279  trackAddr[2] = myCand.getDisc();
280  candidate.setTrackAddress(trackAddr);
281  candidate.setTFIdentifiers(iProcessor,mtfType);
282  if(candidate.hwPt()) sortedCands.push_back(bx, candidate);
283  }
284 }
void setHwPhi(int bits)
Set compressed relative phi as transmitted by hardware LSB = 2*pi/576 (8 bits)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision bits
void setTrackAddress(const std::map< int, int > &address)
Set the whole track address.
void setTFIdentifiers(int processor, tftype trackFinder)
Set the processor ID, track-finder type. From these two, the link is set.
unsigned int nPhiBins
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 hwPt() const
Get compressed pT (returned int * 0.5 = pT (GeV))
static const OMTFConfiguration * instance()
bool checkHitPatternValidity(unsigned int hits)
Definition: OMTFSorter.cc:231
void push_back(int bx, T object)
void setHwSign(int bits)
Set charge sign bit (charge = (-1)^(sign))
void OMTFSorter::sortRefHitResults ( const std::vector< OMTFProcessor::resultsMap > &  procResults,
std::vector< AlgoMuon > &  refHitCleanCands,
int  charge = 0 
)

Sort all processor results. First for each region cone find a best candidate using sortRegionResults() Then select best candidate amongs found for each logic region. The sorting is made for candidates with a given charge Sort all processor results. First for each region cone find a best candidate using sortRegionResults() Then select best candidate amongs found for each logic region

Definition at line 127 of file OMTFSorter.cc.

Referenced by OMTFReconstruction::getProcessorCandidates(), and OMTFReconstruction::writeResultToXML().

129  {
130 
131  for(auto itRefHit: procResults) refHitCands.push_back(sortRefHitResults(itRefHit,charge));
132 }
void sortRefHitResults(const std::vector< OMTFProcessor::resultsMap > &procResults, std::vector< AlgoMuon > &refHitCleanCands, int charge=0)
Definition: OMTFSorter.cc:127
AlgoMuon OMTFSorter::sortRefHitResults ( const OMTFProcessor::resultsMap aResultsMap,
int  charge = 0 
)

Sort results from a single reference hit. Select candidate with highest number of hit layers Then select a candidate with largest likelihood value and given charge as we allow two candidates with opposite charge from single 10deg region

Accept only candidates with >2 hits

Definition at line 69 of file OMTFSorter.cc.

References AlgoMuon::getDisc(), AlgoMuon::getEta(), AlgoMuon::getHits(), AlgoMuon::getPhi(), AlgoMuon::getPhiRHit(), AlgoMuon::getQ(), AlgoMuon::getRefLayer(), AlgoMuon::setPhiRHit(), sortSingleResult(), Key::theCharge, and Key::thePtCode.

70  {
71 
72  unsigned int pdfValMax = 0;
73  unsigned int nHitsMax = 0;
74  unsigned int hitsWord = 0;
75  int refPhi = 9999;
76  int refEta = 999;
77  int refLayer = -1;
78  int refPhiRHit = 9999;
79  Key bestKey;
80 
81  for(auto itKey: aResultsMap){
82  if(charge!=0 && itKey.first.theCharge!=charge) continue; //charge==0 means ignore charge
83  AlgoMuon val = sortSingleResult(itKey.second);
85  if(val.getQ() < 3) continue;
86  if(val.getQ() > (int)nHitsMax){
87  nHitsMax = val.getQ();
88  pdfValMax = val.getDisc();
89  refPhi = val.getPhi();
90  refEta = val.getEta();
91  refLayer = val.getRefLayer();
92  hitsWord = val.getHits();
93  refPhiRHit = val.getPhiRHit();
94  bestKey = itKey.first;
95  }
96  else if(val.getQ() == (int)nHitsMax && val.getDisc() > (int)pdfValMax){
97  pdfValMax = val.getDisc();
98  refPhi = val.getPhi();
99  refEta = val.getEta();
100  refLayer = val.getRefLayer();
101  hitsWord = val.getHits();
102  refPhiRHit = val.getPhiRHit();
103  bestKey = itKey.first;
104  }
105  else if(val.getQ() == (int)nHitsMax && val.getDisc() == (int)pdfValMax &&
106  itKey.first.thePtCode < bestKey.thePtCode){
107  pdfValMax = val.getDisc();
108  refPhi = val.getPhi();
109  refEta = val.getEta();
110  refLayer = val.getRefLayer();
111  hitsWord = val.getHits();
112  refPhiRHit = val.getPhiRHit();
113  bestKey = itKey.first;
114  }
115  }
116 
117  AlgoMuon candidate(pdfValMax, refPhi, refEta, refLayer,
118  hitsWord, nHitsMax, 0,
119  bestKey.thePtCode, bestKey.theCharge);
120 
121  candidate.setPhiRHit(refPhiRHit); // for backward compatibility
122 
123  return candidate;
124 }
int getEta() const
Definition: AlgoMuon.h:19
int getQ() const
Definition: AlgoMuon.h:22
int theCharge
Definition: GoldenPattern.h:37
unsigned int thePtCode
Definition: GoldenPattern.h:36
int getDisc() const
Definition: AlgoMuon.h:17
int getRefLayer() const
Definition: AlgoMuon.h:20
int getHits() const
Definition: AlgoMuon.h:21
AlgoMuon sortSingleResult(const OMTFResult &aResult)
Definition: OMTFSorter.cc:16
int getPhi() const
Definition: AlgoMuon.h:18
int getPhiRHit() const
Definition: AlgoMuon.h:26
AlgoMuon OMTFSorter::sortSingleResult ( const OMTFResult aResult)
private

Find a candidate with best parameters for given GoldenPattern Sorting is made amongs candidates with different reference layers The output tuple contains (nHitsMax, pdfValMax, refPhi, refLayer, hitsWord, refEta) hitsWord codes number of layers hit: hitsWord= sum 2**iLogicLayer, where sum runs over layers which were hit

Find a result with biggest number of hits

Definition at line 16 of file OMTFSorter.cc.

References assert(), OMTFResult::getHitsWord(), OMTFResult::getRefEtas(), OMTFResult::getRefPhiRHits(), OMTFResult::getRefPhis(), OMTFResult::getSummaryHits(), OMTFResult::getSummaryVals(), AlgoMuon::setDisc(), AlgoMuon::setEta(), AlgoMuon::setHits(), AlgoMuon::setPhi(), AlgoMuon::setPhiRHit(), AlgoMuon::setQ(), and AlgoMuon::setRefLayer().

Referenced by sortRefHitResults().

16  {
17 
18  OMTFResult::vector1D pdfValsVec = aResult.getSummaryVals();
19  OMTFResult::vector1D nHitsVec = aResult.getSummaryHits();
20  OMTFResult::vector1D refPhiVec = aResult.getRefPhis();
21  OMTFResult::vector1D refEtaVec = aResult.getRefEtas();
22  OMTFResult::vector1D hitsVec = aResult.getHitsWord();
23  OMTFResult::vector1D refPhiRHitVec = aResult.getRefPhiRHits();
24 
25  assert(pdfValsVec.size()==nHitsVec.size());
26 
27  unsigned int nHitsMax = 0;
28  unsigned int pdfValMax = 0;
29  unsigned int hitsWord = 0;
30  int refPhi = 1024;
31  int refEta = -10;
32  int refLayer = -1;
33  int refPhiRHit = 1024;
34 
35  AlgoMuon sortedResult(pdfValMax, refPhi, refEta, refLayer, hitsWord, nHitsMax);
36 
38  for(auto itHits: nHitsVec){
39  if(itHits>nHitsMax) nHitsMax = itHits;
40  }
41 
42  if(!nHitsMax) return sortedResult;
43 
44  for(unsigned int ipdfVal=0;ipdfVal<pdfValsVec.size();++ipdfVal){
45  if(nHitsVec[ipdfVal] == nHitsMax){
46  if(pdfValsVec[ipdfVal]>pdfValMax){
47  pdfValMax = pdfValsVec[ipdfVal];
48  refPhi = refPhiVec[ipdfVal];
49  refEta = refEtaVec[ipdfVal];
50  refLayer = ipdfVal;
51  hitsWord = hitsVec[ipdfVal];
52  refPhiRHit = refPhiRHitVec[ipdfVal];
53  }
54  }
55  }
56 
57  sortedResult.setDisc(pdfValMax);
58  sortedResult.setPhi(refPhi);
59  sortedResult.setEta(refEta);
60  sortedResult.setRefLayer(refLayer);
61  sortedResult.setHits(hitsWord);
62  sortedResult.setQ(nHitsMax);
63  sortedResult.setPhiRHit(refPhiRHit);
64 
65  return sortedResult;
66 }
const OMTFResult::vector1D & getRefPhiRHits() const
Definition: OMTFResult.h:28
assert(m_qm.get())
const OMTFResult::vector1D & getRefPhis() const
Definition: OMTFResult.h:22
const OMTFResult::vector1D & getSummaryVals() const
Definition: OMTFResult.h:18
const OMTFResult::vector1D & getHitsWord() const
Definition: OMTFResult.h:26
const OMTFResult::vector1D & getSummaryHits() const
Definition: OMTFResult.h:20
std::vector< unsigned int > vector1D
Definition: OMTFResult.h:11
const OMTFResult::vector1D & getRefEtas() const
Definition: OMTFResult.h:24