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 | Private Attributes
OMTFSorter Class Reference

#include <OMTFSorter.h>

Public Member Functions

void setNphiBins (unsigned int phiBins)
 
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)
 

Private Attributes

unsigned int nPhiBins
 

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 135 of file OMTFSorter.cc.

Referenced by sortProcessorAndFillCandidates().

135  {
136 
138  std::vector<unsigned int> badPatterns = {99840, 34304, 3075, 36928, 12300, 98816, 98944, 33408, 66688, 66176, 7171, 20528, 33856, 35840, 4156, 34880};
139 
140  for(auto aHitPattern: badPatterns){
141  if(hits==aHitPattern) return false;
142  }
143 
144  return true;
145 }
void OMTFSorter::setNphiBins ( unsigned int  phiBins)
inline

Definition at line 19 of file OMTFSorter.h.

References nPhiBins.

Referenced by OMTFReconstruction::beginRun().

19 { nPhiBins = phiBins;}
unsigned int nPhiBins
Definition: OMTFSorter.h:57
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

Definition at line 148 of file OMTFSorter.cc.

References funct::abs(), checkHitPatternValidity(), l1t::RegionalMuonCand::hwPt(), nPhiBins, BXVector< T >::push_back(), HLT_25ns10e33_v2_cff::quality, l1t::RegionalMuonCand::setHwEta(), l1t::RegionalMuonCand::setHwPhi(), l1t::RegionalMuonCand::setHwPt(), l1t::RegionalMuonCand::setHwQual(), l1t::RegionalMuonCand::setHwSign(), l1t::RegionalMuonCand::setHwSignValid(), l1t::RegionalMuonCand::setTFIdentifiers(), and l1t::RegionalMuonCand::setTrackAddress().

Referenced by OMTFReconstruction::getProcessorCandidates().

151  {
152 
153  for(auto myCand: algoCands){
154  l1t::RegionalMuonCand candidate;
155  candidate.setHwPt(myCand.getPt());
156  candidate.setHwEta(myCand.getEta());
157 
158  float phiValue = myCand.getPhi();
159  if(phiValue>=nPhiBins) phiValue-=nPhiBins;
161  phiValue/=9.375;
162  candidate.setHwPhi(phiValue);
163 
164  candidate.setHwSign(myCand.getCharge()<0 ? 1:0 );
165  candidate.setHwSignValid(1);
166 
167  unsigned int quality = checkHitPatternValidity(myCand.getHits()) ? 0 | (1 << 2) | (1 << 3)
168  : 0 | (1 << 2);
169  if ( abs(myCand.getEta()) == 115
170  && ( static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>("100000001110000000").to_ulong()
171  || static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>("000000001110000000").to_ulong()
172  || static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>("100000000110000000").to_ulong()
173  || static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>("100000001100000000").to_ulong()
174  || static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>("100000001010000000").to_ulong()
175  )
176  ) quality =4;
177  if (abs(myCand.getEta()) == 121) quality = 4;
178  candidate.setHwQual (quality);
179 
180  std::map<int, int> trackAddr;
181  trackAddr[0] = myCand.getHits();
182  trackAddr[1] = myCand.getRefLayer();
183  trackAddr[2] = myCand.getDisc();
184  candidate.setTrackAddress(trackAddr);
185  candidate.setTFIdentifiers(iProcessor,mtfType);
186  if(candidate.hwPt()) sortedCands.push_back(bx, candidate);
187  }
188 }
void setHwPhi(int bits)
Set compressed relative phi as transmitted by hardware LSB = 2*pi/576 (8 bits)
unsigned int nPhiBins
Definition: OMTFSorter.h:57
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.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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))
void setHwSignValid(int bits)
Set whether charge measurement is valid (0 for high pT muons)
bool checkHitPatternValidity(unsigned int hits)
Definition: OMTFSorter.cc:135
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 
)

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:38
unsigned int thePtCode
Definition: GoldenPattern.h:37
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:32
assert(m_qm.get())
const OMTFResult::vector1D & getRefPhis() const
Definition: OMTFResult.h:26
const OMTFResult::vector1D & getSummaryVals() const
Definition: OMTFResult.h:22
const OMTFResult::vector1D & getHitsWord() const
Definition: OMTFResult.h:30
const OMTFResult::vector1D & getSummaryHits() const
Definition: OMTFResult.h:24
std::vector< unsigned int > vector1D
Definition: OMTFResult.h:13
const OMTFResult::vector1D & getRefEtas() const
Definition: OMTFResult.h:28

Member Data Documentation

unsigned int OMTFSorter::nPhiBins
private

Definition at line 57 of file OMTFSorter.h.

Referenced by setNphiBins(), and sortProcessorAndFillCandidates().