11 m_localMaxima(MAX_JETS_OUT),
12 m_clusters(MAX_JETS_OUT),
13 m_numberOfClusters(0),
26 os <<
"===L1GctHardwareJetFinder===" << std::endl;
74 for (
UShort column = 0; column < 2; ++column)
157 unsigned numberOfTopJets = 0, numberOfBotJets = 0;
166 topJets.at(numberOfTopJets) =
temp;
167 topJetsPosition.at(numberOfTopJets) = 0;
168 for (
unsigned k = 0;
k < numberOfTopJets; ++
k) {
169 if (topJets.at(numberOfTopJets).et() >= topJets.at(
k).et()) {
170 ++topJetsPosition.at(
k);
172 if (topJets.at(numberOfTopJets).et() <= topJets.at(
k).et()) {
173 ++topJetsPosition.at(numberOfTopJets);
179 botJets.at(numberOfBotJets) =
temp;
180 botJetsPosition.at(numberOfBotJets) = 0;
181 for (
unsigned k = 0;
k < numberOfBotJets; ++
k) {
182 if (botJets.at(numberOfBotJets).et() >= botJets.at(
k).et()) {
183 ++botJetsPosition.at(
k);
185 if (botJets.at(numberOfBotJets).et() <= botJets.at(
k).et()) {
186 ++botJetsPosition.at(numberOfBotJets);
198 static const unsigned int MAX_TOPBOT_JETS =
MAX_JETS_OUT / 2;
200 for (
unsigned j = 0;
j < numberOfBotJets; ++
j) {
201 if (botJetsPosition.at(
j) < MAX_TOPBOT_JETS) {
205 pos = MAX_TOPBOT_JETS;
206 for (
unsigned j = 0;
j < numberOfTopJets; ++
j) {
207 if (topJetsPosition.at(
j) < MAX_TOPBOT_JETS) {
222 int16_t
bx = localMax.
bx();
224 unsigned localEta = localMax.
rctEta();
225 unsigned localPhi = localMax.
rctPhi();
227 unsigned etCluster = 0;
228 bool ovrFlowOr =
false;
229 bool tauVetoOr =
false;
230 unsigned rgnsAboveIsoThreshold = 0;
237 unsigned rowStart, rowEnd, rowMid;
240 if (localEta > row0 - 1) {
244 rowStart = row0 - 1 - localEta;
245 rowMid = rowStart + 1;
247 if (localEta > row0 + 2) {
250 rowEnd = row0 + 2 - localEta;
253 rowStart = row0 + localEta;
254 rowMid = rowStart + 1;
256 rowEnd = rowStart + 3;
262 for (
unsigned row = rowStart; row < rowEnd; ++row) {
263 for (
unsigned column = 0; column < 2; ++column) {
288 if (!((row == rowMid) && (column == localPhi))) {
291 rgnsAboveIsoThreshold++;
306 bool tauFeatureBit =
false;
308 tauVetoOr |= (rgnsAboveIsoThreshold > 1);
309 tauFeatureBit |= (rgnsAboveIsoThreshold == 1);
330 if (et0 >= JET_THRESHOLD) {
331 bool storeJet =
false;
332 bool isolated =
true;
334 if (localEta0 == 0) {
335 unsigned neighbourEt =
m_cluster00.at(1 - localPhi0).et();
336 isolated &= et0 >= neighbourEt;
347 bool distantJet = ((localPhi0 == localPhi1) || (localEta1 > localEta0 + 1) || (localEta0 > localEta1 + 1));
349 isolated &= distantJet;
350 storeJet |= !distantJet && ((et0 > et1) || ((et0 == et1) && localPhi0 == 1));
355 storeJet |= isolated;
359 unsigned etCluster = et0;
362 unsigned rgnsAboveIsoThreshold = (
m_rcvdProtoJets.at(
j).featureBit0() ? 1 : 0);
366 unsigned column = 1 - localPhi0;
368 unsigned rowStart, rowEnd;
370 rowStart = row0 + localEta0;
372 rowEnd = rowStart + 3;
377 for (
unsigned row = rowStart; row < rowEnd; ++row) {
386 rgnsAboveIsoThreshold++;
402 tauVetoOr |= (rgnsAboveIsoThreshold > 1);
void reset()
complete reset of processor
bool m_ignoreTauVetoBitsForIsolation
unsigned m_numberOfClusters
The number of local Maxima/clusters found at each stage of clustering.
static const unsigned int MAX_JETS_OUT
Max of 6 jets found per jetfinder in a 2*11 search area.
void findFinalClusters()
Convert protojets to final jets.
unsigned rctPhi() const
get local phi index (within RCT crate)
void process() override
process the data, fill output buffers
RegionsVector m_sentProtoJets
List of pre-clustered jets to be sent to neighbour after the first stage of clustering.
void findProtoJets()
The first stage of clustering, called by fetchInput()
void convertClustersToProtoJets()
Organise the pre-clustered jets into the ones we keep and those we send to the neighbour.
void findJets()
The second stage of clustering, called by process()
RegionsVector m_cluster00
static const unsigned int MAX_REGIONS_IN
The real jetFinders must define these constants.
bool isForward(DetId const &)
Gct version of a calorimeter region, used within GCT emulation.
RegionsVector m_clusters
Each local maximum becomes a cluster.
L1GctHardwareJetFinder(int id)
id is 0-8 for -ve Eta jetfinders, 9-17 for +ve Eta, for increasing Phi.
static L1GctRegion makeProtoJetRegion(const unsigned et, const bool overFlow, const bool fineGrain, const bool tauIsolationVeto, const unsigned ieta, const unsigned iphi, const int16_t bx)
A Level-1 jet candidate, used within GCT emulation.
void fetchInput() override
get input data from sources
static const unsigned N_ETA
void findLocalMaxima()
Find local maxima in the search array.
Base class to allow implementation of jetFinder algorithms.
void findProtoClusters()
Convert local maxima to clusters.
void sortJets()
Sort the found jets. All jetFinders should call this in process().
unsigned m_tauIsolationThreshold
static L1GctRegion makeFinalJetRegion(const unsigned et, const bool overFlow, const bool fineGrain, const unsigned ieta, const unsigned iphi, const int16_t bx)
static const unsigned int N_EXTRA_REGIONS_ETA00
Number of additional regions to process on the "wrong" side of eta=0 (determines COL_OFFSET) ...
unsigned short int UShort
RegionsVector m_keptProtoJets
List of pre-clustered jets retained locally as input to the final clustering.
static const unsigned int COL_OFFSET
The index offset between columns.
RawJetVector m_outputJets
output jets
int16_t bx() const
get bunch-crossing index
RegionsVector m_inputRegions
bool setupOk() const
Check setup is Ok.
static const unsigned int N_COLS
unsigned gctEta() const
get GCT eta index
virtual void reset()
include additional reset functionality
void fetchProtoJetsFromNeighbour(const fetchType ft)
fetch the protoJets from neighbour jetFinder
void convertClustersToOutputJets()
Organise the final clustered jets into L1GctJets.
std::ostream & operator<<(std::ostream &os, const L1GctHardwareJetFinder &algo)
~L1GctHardwareJetFinder() override
RegionsVector m_localMax00
unsigned gctPhi() const
get GCT phi index
Emulation of the hardware jet finder.
static const unsigned N_PHI
unsigned m_minColThisJf
parameter to determine which Regions belong in our acceptance
static const unsigned int CENTRAL_COL0
RegionsVector m_rcvdProtoJets
List of pre-clustered jets received from neighbour before the final stage of clustering.
std::vector< L1GctRegion > RegionsVector
bool m_useImprovedTauAlgo
Setup parameters for the tau jet algorithm.
void doEnergySums()
Fill the Et strip sums and Ht sum. All jetFinders should call this in process().
unsigned centralCol0() const override
L1GctRegion makeProtoJet(L1GctRegion localMax)
Method to make a single proto-jet.
RegionsVector m_localMaxima
Local vectors used during both stages of clustering.