25 assert(pdfValsVec.size()==nHitsVec.size());
27 unsigned int nHitsMax = 0;
28 unsigned int pdfValMax = 0;
29 unsigned int hitsWord = 0;
33 int refPhiRHit = 1024;
35 AlgoMuon sortedResult(pdfValMax, refPhi, refEta, refLayer, hitsWord, nHitsMax);
38 for(
auto itHits: nHitsVec){
39 if(itHits>nHitsMax) nHitsMax = itHits;
42 if(!nHitsMax)
return sortedResult;
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];
51 hitsWord = hitsVec[ipdfVal];
52 refPhiRHit = refPhiRHitVec[ipdfVal];
57 sortedResult.
setDisc(pdfValMax);
58 sortedResult.
setPhi(refPhi);
59 sortedResult.
setEta(refEta);
62 sortedResult.
setQ(nHitsMax);
72 unsigned int pdfValMax = 0;
73 unsigned int nHitsMax = 0;
74 unsigned int hitsWord = 0;
78 int refPhiRHit = 9999;
82 for(
auto itKey: aResultsMap){
83 if(charge!=0 && itKey.first.theCharge!=charge)
continue;
86 if(val.
getQ() < 3)
continue;
89 nHitsMax = val.
getQ();
96 bestKey = itKey.first;
106 bestKey = itKey.first;
109 else if(val.
getQ() == (
int)nHitsMax && val.
getDisc() == (
int)pdfValMax && itKey.first.number() < bestKey.
number()) {
117 bestKey = itKey.first;
122 AlgoMuon candidate(pdfValMax, refPhi, refEta, refLayer,
123 hitsWord, nHitsMax, 0,
135 std::vector<AlgoMuon> & refHitCands,
139 for (
unsigned int iRefHit = 0 ; iRefHit < procResults.size(); iRefHit++) {
142 refHitCands.push_back(mu);
150 std::vector<unsigned int> badPatterns = {99840, 34304, 3075, 36928, 12300, 98816, 98944, 33408, 66688, 66176, 7171, 20528, 33856, 35840, 4156, 34880};
152 for(
auto aHitPattern: badPatterns){
153 if(hits==aHitPattern)
return false;
163 std::vector<l1t::RegionalMuonCand>
result;
165 for(
auto myCand: algoCands){
167 candidate.
setHwPt(myCand.getPt());
168 candidate.
setHwEta(myCand.getEta());
170 int phiValue = myCand.getPhi();
173 phiValue = floor(phiValue*437./
pow(2,12));
176 candidate.
setHwSign(myCand.getCharge()<0 ? 1:0 );
181 if (
abs(myCand.getEta()) == 115
182 && ( static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"100000001110000000").to_ulong()
183 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"000000001110000000").to_ulong()
184 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"100000000110000000").to_ulong()
185 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"100000001100000000").to_ulong()
186 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"100000001010000000").to_ulong()
190 if ( static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"000000010000000011").to_ulong()
191 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"000000100000000011").to_ulong()
192 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"000001000000000011").to_ulong()
193 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"000010000000000011").to_ulong()
194 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"000100000000000011").to_ulong()
195 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"001000000000000011").to_ulong()
196 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"010000000000000011").to_ulong()
197 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"100000000000000011").to_ulong()
198 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"000000010000001100").to_ulong()
199 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"000000100000001100").to_ulong()
200 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"000001000000001100").to_ulong()
201 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"000010000000001100").to_ulong()
202 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"000100000000001100").to_ulong()
203 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"001000000000001100").to_ulong()
204 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"010000000000001100").to_ulong()
205 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"100000000000001100").to_ulong()
206 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"000000010000110000").to_ulong()
207 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"000000100000110000").to_ulong()
208 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"000001000000110000").to_ulong()
209 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"000010000000110000").to_ulong()
210 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"000100000000110000").to_ulong()
211 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"001000000000110000").to_ulong()
212 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"010000000000110000").to_ulong()
213 ||
static_cast<unsigned int>(myCand.getHits()) == std::bitset<18>(
"100000000000110000").to_ulong()
218 if (
abs(myCand.getEta()) == 121) quality = 0;
222 std::map<int, int> trackAddr;
223 trackAddr[0] = myCand.getHits();
224 trackAddr[1] = myCand.getRefLayer();
225 trackAddr[2] = myCand.getDisc();
228 if (candidate.
hwPt()) result.push_back(candidate);
unsigned int number() const
void setHwPhi(int bits)
Set compressed relative phi as transmitted by hardware LSB = 2*pi/576 (8 bits)
const OMTFResult::vector1D & getRefPhiRHits() const
unsigned int fwVersion() const
std::map< Key, OMTFResult > resultsMap
const OMTFResult::vector1D & getRefPhis() const
const OMTFConfiguration * myOmtfConfig
void setTrackAddress(const std::map< int, int > &address)
Set the whole track address.
const OMTFResult::vector1D & getSummaryVals() const
void setRefLayer(int refLayer)
const OMTFResult::vector1D & getHitsWord() const
void setTFIdentifiers(int processor, tftype trackFinder)
Set the processor ID, track-finder type. From these two, the link is set.
const OMTFResult::vector1D & getSummaryHits() const
Abs< T >::type abs(const T &t)
void setPatternNumber(unsigned int aPatNum)
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)
std::vector< unsigned int > vector1D
const OMTFResult::vector1D & getRefEtas() const
void sortRefHitResults(const std::vector< OMTFProcessor::resultsMap > &procResults, std::vector< AlgoMuon > &refHitCleanCands, int charge=0)
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)
AlgoMuon sortSingleResult(const OMTFResult &aResult)
void setPhiRHit(int phiRHit)
std::vector< l1t::RegionalMuonCand > candidates(unsigned int iProcessor, l1t::tftype mtfType, const std::vector< AlgoMuon > &algoCands)
void setRefHitNumber(unsigned int aRefHitNum)
Power< A, B >::type pow(const A &a, const B &b)
bool checkHitPatternValidity(unsigned int hits)
void setHwSign(int bits)
Set charge sign bit (charge = (-1)^(sign))