Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23632 from rekovic/pr102_OMTF_Unpacker-GhostBuste…
…r_CaloLayer2_HoEext_QualNtuple L1 PR 10_2 Omtf unpacker and ghost-buster & CaloLayer2 HoEext and Qual bit in ntuple
- Loading branch information
Showing
16 changed files
with
200 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
L1Trigger/L1TMuonOverlap/interface/GhostBusterPreferRefDt.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef OMTF_GhostBusterPreferRefDt_H | ||
#define OMTF_GhostBusterPreferRefDt_H | ||
|
||
#include <vector> | ||
#include <ostream> | ||
|
||
#include <map> | ||
#include <set> | ||
|
||
#include <memory> | ||
|
||
#include "L1Trigger/L1TMuonOverlap/interface/IGhostBuster.h" | ||
#include "L1Trigger/L1TMuonOverlap/interface/AlgoMuon.h" | ||
#include "L1Trigger/L1TMuonOverlap/interface/OMTFConfiguration.h" | ||
|
||
class GhostBusterPreferRefDt: public IGhostBuster { | ||
private: | ||
const OMTFConfiguration* omtfConfig; | ||
public: | ||
GhostBusterPreferRefDt(OMTFConfiguration* omtfConfig):omtfConfig(omtfConfig) {}; | ||
|
||
~GhostBusterPreferRefDt() override {}; | ||
|
||
std::vector<AlgoMuon> select(std::vector<AlgoMuon> refHitCands, int charge=0) override; | ||
|
||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* IGhostBuster.h | ||
* | ||
* Created on: Jun 28, 2017 | ||
* Author: kbunkow | ||
*/ | ||
|
||
#ifndef OMTF_IGHOSTBUSTER_H_ | ||
#define OMTF_IGHOSTBUSTER_H_ | ||
|
||
#include "L1Trigger/L1TMuonOverlap/interface/AlgoMuon.h" | ||
|
||
class IGhostBuster { | ||
public: | ||
virtual ~IGhostBuster() {} | ||
|
||
virtual std::vector<AlgoMuon> select(std::vector<AlgoMuon> refHitCands, int charge=0) = 0; | ||
|
||
}; | ||
|
||
#endif /* OMTF_IGHOSTBUSTER_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#include "L1Trigger/L1TMuonOverlap/interface/GhostBusterPreferRefDt.h" | ||
|
||
#include <sstream> | ||
|
||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "L1Trigger/L1TMuonOverlap/interface/OMTFConfiguration.h" | ||
|
||
namespace { | ||
int phiGMT(int phiAlgo) { return phiAlgo*437/pow(2,12); } | ||
} | ||
|
||
std::vector<AlgoMuon> GhostBusterPreferRefDt::select(std::vector<AlgoMuon> refHitCands, int charge) { | ||
auto customLess = [&](const AlgoMuon& a, const AlgoMuon& b)->bool { | ||
int aRefLayerLogicNum = omtfConfig->getRefToLogicNumber()[a.getRefLayer()]; | ||
int bRefLayerLogicNum = omtfConfig->getRefToLogicNumber()[b.getRefLayer()]; | ||
if(a.getQ() > b.getQ()) | ||
return false; | ||
else if(a.getQ()==b.getQ() && aRefLayerLogicNum < bRefLayerLogicNum) { | ||
return false; | ||
} | ||
else if (a.getQ()==b.getQ() && aRefLayerLogicNum == bRefLayerLogicNum && a.getDisc() > b.getDisc() ) | ||
return false; | ||
else if (a.getQ()==b.getQ() && aRefLayerLogicNum == bRefLayerLogicNum && a.getDisc() == b.getDisc() && a.getPatternNumber() > b.getPatternNumber() ) | ||
return false; | ||
else if (a.getQ()==b.getQ() && aRefLayerLogicNum == bRefLayerLogicNum && a.getDisc() == b.getDisc() && a.getPatternNumber() == b.getPatternNumber() && a.getRefHitNumber() < b.getRefHitNumber()) | ||
return false; | ||
else | ||
return true; | ||
//TODO check if the firmware really includes the pattern number and refHit number here | ||
}; | ||
|
||
/* auto customLess = [&](const AlgoMuon& a, const AlgoMuon& b)->bool { | ||
int aRefLayerLogicNum = omtfConfig->getRefToLogicNumber()[a.getRefLayer()]; | ||
int bRefLayerLogicNum = omtfConfig->getRefToLogicNumber()[b.getRefLayer()]; | ||
if(a.getQ() > b.getQ()) | ||
return false; | ||
else if(a.getQ()==b.getQ() && aRefLayerLogicNum < bRefLayerLogicNum) { | ||
return false; | ||
} | ||
else if (a.getQ()==b.getQ() && aRefLayerLogicNum == bRefLayerLogicNum && a.getPatternNumber() > b.getPatternNumber() ) | ||
return false; | ||
else if (a.getQ()==b.getQ() && aRefLayerLogicNum == bRefLayerLogicNum && a.getPatternNumber() == b.getPatternNumber() && a.getRefHitNumber() < b.getRefHitNumber()) | ||
return false; | ||
else | ||
return true; | ||
//TODO check if the firmware really includes the pattern number and refHit number here | ||
};*/ | ||
|
||
std::vector<AlgoMuon> refHitCleanCands; | ||
// Sort candidates with decreased goodness, | ||
// where goodness definied in < operator of AlgoMuon | ||
std::sort( refHitCands.rbegin(), refHitCands.rend(), customLess ); | ||
|
||
for(std::vector<AlgoMuon>::iterator it1 = refHitCands.begin(); | ||
it1 != refHitCands.end(); ++it1){ | ||
bool isGhost=false; | ||
for(std::vector<AlgoMuon>::iterator it2 = refHitCleanCands.begin(); | ||
it2 != refHitCleanCands.end(); ++it2){ | ||
//do not accept candidates with similar phi (any charge combination) | ||
//veto window 5deg(=half of logic cone)=5/360*5760=80"logic strips" | ||
//veto window 5 degree in GMT scale is 5/360*576=8 units | ||
if (std::abs( phiGMT(it1->getPhi()) - phiGMT(it2->getPhi()) ) < 8 ) { | ||
// if(std::abs(it1->getPhi() - it2->getPhi())<5/360.0*nPhiBins){ | ||
isGhost=true; | ||
break; | ||
//which one candidate is killed depends only on the order in the refHitCands (the one with smaller index is taken), and this order is assured by the sort above | ||
//TODO here the candidate that is killed does not kill other candidates - check if the firmware does the same (KB) | ||
} | ||
} | ||
if(it1->getQ()>0 && !isGhost) refHitCleanCands.push_back(*it1); | ||
} | ||
|
||
refHitCleanCands.resize( 3, AlgoMuon(0,999,9999,0,0,0,0,0) ); //FIXME | ||
//refHitCleanCands.resize( 3, AlgoMuon() ); | ||
|
||
|
||
std::stringstream myStr; | ||
bool hasCandidates = false; | ||
for(unsigned int iRefHit=0;iRefHit<refHitCands.size();++iRefHit){ | ||
if(refHitCands[iRefHit].getQ()){ | ||
hasCandidates=true; | ||
break; | ||
} | ||
} | ||
for(unsigned int iRefHit=0;iRefHit<refHitCands.size();++iRefHit){ | ||
if(refHitCands[iRefHit].getQ()) myStr<<"Ref hit: "<<iRefHit<<" "<<refHitCands[iRefHit]<<std::endl; | ||
} | ||
myStr<<"Selected Candidates with charge: "<<charge<<std::endl; | ||
for(unsigned int iCand=0; iCand<refHitCleanCands.size(); ++iCand){ | ||
myStr<<"Cand: "<<iCand<<" "<<refHitCleanCands[iCand]<<std::endl; | ||
} | ||
|
||
if(hasCandidates) edm::LogInfo("OMTF Sorter")<<myStr.str(); | ||
|
||
// update refHitCands with refHitCleanCands | ||
return refHitCleanCands; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters