CMS 3D CMS Logo

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

Emulation of the hardware jet finder. More...

#include <L1GctHardwareJetFinder.h>

Inheritance diagram for L1GctHardwareJetFinder:
L1GctJetFinderBase L1GctProcessor

Public Member Functions

virtual void fetchInput ()
 get input data from sources More...
 
 L1GctHardwareJetFinder (int id)
 id is 0-8 for -ve Eta jetfinders, 9-17 for +ve Eta, for increasing Phi. More...
 
virtual void process ()
 process the data, fill output buffers More...
 
virtual void reset ()
 include additional reset functionality More...
 
 ~L1GctHardwareJetFinder ()
 
- Public Member Functions inherited from L1GctJetFinderBase
unsigned getCenJetSeed () const
 
unsigned getEtaBoundry () const
 
etTotalType getEtSum () const
 Get the scalar sum of Et summed over the input regions. More...
 
etCompInternJfType getExSum () const
 Get the x component of vector Et summed over the input regions. More...
 
etCompInternJfType getEySum () const
 Get the y component of vector Et summed over the input regions. More...
 
unsigned getFwdJetSeed () const
 
hfTowerSumsType getHfSums () const
 Get the Hf tower Et sums and tower-over-threshold counts. More...
 
unsigned getHtmSumJetThreshold () const
 
etHadType getHtSum () const
 Get the scalar sum of Ht summed over jets above threshold. More...
 
unsigned getHttSumJetThreshold () const
 
htCompInternJfType getHxSum () const
 Get the x component of vector Ht summed over jets above threshold. More...
 
htCompInternJfType getHySum () const
 Get the y component of vector Ht summed over jets above threshold. More...
 
RegionsVector getInputRegions () const
 Return input data. More...
 
std::vector< L1GctInternEtSumgetInternalEtSums () const
 get et sums in raw format - to be stored in the event More...
 
std::vector< L1GctInternHtMissgetInternalHtMiss () const
 
std::vector< L1GctInternJetDatagetInternalJets () const
 get output jets in raw format - to be stored in the event More...
 
const lutPtrVector getJetEtCalLuts () const
 Return pointers to calibration LUTs. More...
 
JetVector getJets () const
 Get the located jets. More...
 
RegionsVector getKeptProtoJets () const
 get protoJets kept More...
 
RawJetVector getRawJets () const
 get output jets in raw format More...
 
RegionsVector getRcvdProtoJets () const
 get protoJets received from neighbour More...
 
RegionsVector getSentProtoJets () const
 get protoJets sent to neighbour More...
 
unsigned getTauIsolationThreshold () const
 
unsigned getTauJetSeed () const
 
 L1GctJetFinderBase (int id)
 id is 0-8 for -ve Eta jetfinders, 9-17 for +ve Eta, for increasing Phi. More...
 
void setInputRegion (const L1CaloRegion &region)
 Set input data. More...
 
void setJetEtCalibrationLuts (const lutPtrVector &jfluts)
 Set pointer to calibration Lut - needed to complete the setup. More...
 
void setJetFinderParams (const L1GctJetFinderParams *jfpars)
 Set pointer to parameters - needed to complete the setup. More...
 
void setNeighbourJetFinders (std::vector< L1GctJetFinderBase * > neighbours)
 Set pointers to neighbours - needed to complete the setup. More...
 
bool setupOk () const
 Check setup is Ok. More...
 
void setupTauAlgo (const bool useImprovedAlgo, const bool ignoreVetoBitsForIsolation)
 Setup the tau algorithm parameters. More...
 
 ~L1GctJetFinderBase ()
 
- Public Member Functions inherited from L1GctProcessor
 L1GctProcessor ()
 
void reset ()
 complete reset of processor More...
 
void setBxRange (const int firstBx, const int numberOfBx)
 define the bunch crossing range to process More...
 
void setNextBx (const int bxnum)
 clear input data buffers and process a new bunch crossing More...
 
void setTerse ()
 
bool setupOk () const
 Method to check the setup for this processor. Returns true by default. More...
 
void setVerbose ()
 control output messages More...
 
virtual ~L1GctProcessor ()
 

Protected Member Functions

virtual unsigned centralCol0 () const
 
virtual unsigned maxRegionsIn () const
 
virtual unsigned nCols () const
 
- Protected Member Functions inherited from L1GctJetFinderBase
etTotalType calcEtStrip (const UShort strip) const
 Calculates total (raw) energy in a phi strip. More...
 
hfTowerSumsType calcHfSums () const
 Calculates Et sum and number of towers over threshold in Hf. More...
 
etTotalType calcHtStrip (const UShort strip) const
 Calculates total calibrated energy in jets (Ht) sum. More...
 
void doEnergySums ()
 Fill the Et strip sums and Ht sum. All jetFinders should call this in process(). More...
 
void doEtSums ()
 Calculates scalar and vector sum of Et over input regions. More...
 
void doHtSums ()
 Calculates scalar and vector sum of Ht over calibrated jets. More...
 
void fetchProtoJetsFromNeighbour (const fetchType ft)
 fetch the protoJets from neighbour jetFinder More...
 
virtual void resetPipelines ()
 
virtual void resetProcessor ()
 Separate reset methods for the processor itself and any data stored in pipelines. More...
 
virtual void setupObjects ()
 Initialise inputs with null objects for the correct bunch crossing if required. More...
 
void sortJets ()
 Sort the found jets. All jetFinders should call this in process(). More...
 
- Protected Member Functions inherited from L1GctProcessor
int bxAbs () const
 
int bxMax () const
 
int bxMin () const
 Support for multiple beam crossing operation. More...
 
int bxRel () const
 
int numOfBx () const
 

Private Member Functions

void convertClustersToOutputJets ()
 Organise the final clustered jets into L1GctJets. More...
 
void convertClustersToProtoJets ()
 Organise the pre-clustered jets into the ones we keep and those we send to the neighbour. More...
 
void findFinalClusters ()
 Convert protojets to final jets. More...
 
void findJets ()
 The second stage of clustering, called by process() More...
 
void findLocalMaxima ()
 Find local maxima in the search array. More...
 
void findProtoClusters ()
 Convert local maxima to clusters. More...
 
void findProtoJets ()
 The first stage of clustering, called by fetchInput() More...
 
L1GctRegion makeProtoJet (L1GctRegion localMax)
 Method to make a single proto-jet. More...
 

Private Attributes

RegionsVector m_cluster00
 
RegionsVector m_clusters
 Each local maximum becomes a cluster. More...
 
RegionsVector m_localMax00
 
RegionsVector m_localMaxima
 Local vectors used during both stages of clustering. More...
 
unsigned m_numberOfClusters
 The number of local Maxima/clusters found at each stage of clustering. More...
 
bool m_positiveEtaWheel
 Positive/negative eta flag used in the initial clustering. More...
 

Static Private Attributes

static const unsigned int CENTRAL_COL0 = 0
 
static const unsigned int MAX_REGIONS_IN = (((L1CaloRegionDetId::N_ETA)/2)+N_EXTRA_REGIONS_ETA00)*L1GctHardwareJetFinder::N_COLS
 The real jetFinders must define these constants. More...
 
static const unsigned int N_COLS = 2
 

Friends

std::ostream & operator<< (std::ostream &os, const L1GctHardwareJetFinder &algo)
 Overload << operator. More...
 

Additional Inherited Members

- Public Types inherited from L1GctJetFinderBase
typedef L1GctTwosComplement
< L1GctInternEtSum::kJetMissEtNBits
etCompInternJfType
 
typedef L1GctUnsignedInt
< L1GctInternEtSum::kTotEtOrHtNBits
etHadType
 
typedef L1GctUnsignedInt
< L1GctInternEtSum::kTotEtOrHtNBits
etTotalType
 
typedef L1GctTwosComplement
< L1GctInternHtMiss::kJetMissHtNBits
htCompInternJfType
 
typedef std::vector< L1GctJetCandJetVector
 
typedef L1GctJet::lutPtr lutPtr
 
typedef std::vector< lutPtrlutPtrVector
 
enum  maxValues { etTotalMaxValue = L1GctInternEtSum::kTotEtOrHtMaxValue, htTotalMaxValue = L1GctInternEtSum::kTotEtOrHtMaxValue }
 
typedef Pipeline< L1GctJetRawJetPipeline
 
typedef std::vector< L1GctJetRawJetVector
 
typedef std::vector< L1GctRegionRegionsVector
 
typedef unsigned long int ULong
 
typedef unsigned short int UShort
 
- Static Public Attributes inherited from L1GctJetFinderBase
static const unsigned int COL_OFFSET = L1GctJetFinderParams::NUMBER_ETA_VALUES+N_EXTRA_REGIONS_ETA00
 The index offset between columns. More...
 
static const unsigned int MAX_JETS_OUT = 6
 Max of 6 jets found per jetfinder in a 2*11 search area. More...
 
static const unsigned int N_EXTRA_REGIONS_ETA00 = 2
 Number of additional regions to process on the "wrong" side of eta=0 (determines COL_OFFSET) More...
 
static const unsigned int N_JF_PER_WHEEL = ((L1CaloRegionDetId::N_PHI)/2)
 No of jetFinders per Wheel. More...
 
- Protected Types inherited from L1GctJetFinderBase
enum  fetchType { TOP, BOT, TOPBOT }
 different ways of getting the neighbour data More...
 
- Protected Attributes inherited from L1GctJetFinderBase
unsigned m_CenJetSeed
 jetFinder parameters (from EventSetup) More...
 
unsigned m_EtaBoundry
 
unsigned m_FwdJetSeed
 
bool m_gotJetEtCalLuts
 Remember whether jet Et calibration Lut pointers have been stored. More...
 
bool m_gotJetFinderParams
 Remember whether jetfinder parameters have been stored. More...
 
bool m_gotNeighbourPointers
 Remember whether the neighbour pointers have been stored. More...
 
unsigned m_HtmSumJetThreshold
 
unsigned m_HttSumJetThreshold
 
int m_id
 algo ID More...
 
bool m_idInRange
 Remember whether range check on the input ID was ok. More...
 
bool m_ignoreTauVetoBitsForIsolation
 
RegionsVector m_inputRegions
 input data required for jet finding More...
 
lutPtrVector m_jetEtCalLuts
 Jet Et Conversion LUT pointer. More...
 
RegionsVector m_keptProtoJets
 List of pre-clustered jets retained locally as input to the final clustering. More...
 
unsigned m_minColThisJf
 parameter to determine which Regions belong in our acceptance More...
 
std::vector< L1GctJetFinderBase * > m_neighbourJetFinders
 Store neighbour pointers. More...
 
etTotalType m_outputEtSum
 output Et strip sums and Ht - refactored More...
 
etCompInternJfType m_outputExSum
 
etCompInternJfType m_outputEySum
 
hfTowerSumsType m_outputHfSums
 
etHadType m_outputHtSum
 
htCompInternJfType m_outputHxSum
 
htCompInternJfType m_outputHySum
 
RawJetVector m_outputJets
 output jets More...
 
RegionsVector m_rcvdProtoJets
 List of pre-clustered jets received from neighbour before the final stage of clustering. More...
 
RegionsVector m_sentProtoJets
 List of pre-clustered jets to be sent to neighbour after the first stage of clustering. More...
 
JetVector m_sortedJets
 
unsigned m_tauIsolationThreshold
 
unsigned m_TauJetSeed
 
bool m_useImprovedTauAlgo
 Setup parameters for the tau jet algorithm. More...
 
- Protected Attributes inherited from L1GctProcessor
bool m_verbose
 Flag to control output messages. More...
 

Detailed Description

Emulation of the hardware jet finder.

Definition at line 21 of file L1GctHardwareJetFinder.h.

Constructor & Destructor Documentation

L1GctHardwareJetFinder::L1GctHardwareJetFinder ( int  id)

id is 0-8 for -ve Eta jetfinders, 9-17 for +ve Eta, for increasing Phi.

Definition at line 8 of file L1GctHardwareJetFinder.cc.

References CENTRAL_COL0, L1GctJetFinderBase::m_id, L1GctJetFinderBase::m_minColThisJf, L1CaloRegionDetId::N_PHI, and reset().

8  :
14  m_localMax00(2),
15  m_cluster00 (2)
16 {
17  this->reset();
18  // Initialise parameters for Region input calculations in the
19  // derived class so we get the right values of constants.
20  static const unsigned NPHI = L1CaloRegionDetId::N_PHI;
21  m_minColThisJf = (NPHI + m_id*2 - CENTRAL_COL0) % NPHI;
22 }
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.
bool m_positiveEtaWheel
Positive/negative eta flag used in the initial clustering.
RegionsVector m_clusters
Each local maximum becomes a cluster.
L1GctJetFinderBase(int id)
id is 0-8 for -ve Eta jetfinders, 9-17 for +ve Eta, for increasing Phi.
static const unsigned N_PHI
virtual void reset()
include additional reset functionality
unsigned m_minColThisJf
parameter to determine which Regions belong in our acceptance
static const unsigned int CENTRAL_COL0
RegionsVector m_localMaxima
Local vectors used during both stages of clustering.
L1GctHardwareJetFinder::~L1GctHardwareJetFinder ( )

Definition at line 24 of file L1GctHardwareJetFinder.cc.

25 {
26 }

Member Function Documentation

virtual unsigned L1GctHardwareJetFinder::centralCol0 ( ) const
inlineprotectedvirtual

Reimplemented from L1GctJetFinderBase.

Definition at line 47 of file L1GctHardwareJetFinder.h.

References CENTRAL_COL0.

Referenced by findFinalClusters(), and findLocalMaxima().

47 { return CENTRAL_COL0; }
static const unsigned int CENTRAL_COL0
void L1GctHardwareJetFinder::convertClustersToOutputJets ( )
private

Organise the final clustered jets into L1GctJets.

Definition at line 435 of file L1GctHardwareJetFinder.cc.

References j, L1GctJetFinderBase::m_CenJetSeed, m_clusters, L1GctJetFinderBase::m_EtaBoundry, L1GctJetFinderBase::m_FwdJetSeed, L1GctJetFinderBase::m_outputJets, L1GctJetFinderBase::MAX_JETS_OUT, and cond::rpcobtemp::temp.

Referenced by findJets().

436 {
437  for (unsigned j=0; j<MAX_JETS_OUT; ++j) {
438  bool isForward = (m_clusters.at(j).rctEta()>=m_EtaBoundry);
439  unsigned JET_THRESHOLD = ( isForward ? m_FwdJetSeed : m_CenJetSeed);
440  if (m_clusters.at(j).et()>=JET_THRESHOLD) {
441  L1GctJet temp(m_clusters.at(j).et(), m_clusters.at(j).gctEta(), m_clusters.at(j).gctPhi(),
442  m_clusters.at(j).overFlow(), isForward, m_clusters.at(j).tauVeto(), m_clusters.at(j).bx());
443  m_outputJets.at(j) = temp;
444  }
445  }
446 }
static const unsigned int MAX_JETS_OUT
Max of 6 jets found per jetfinder in a 2*11 search area.
RegionsVector m_clusters
Each local maximum becomes a cluster.
A Level-1 jet candidate, used within GCT emulation.
Definition: L1GctJet.h:27
int j
Definition: DBlmapReader.cc:9
RawJetVector m_outputJets
output jets
unsigned m_CenJetSeed
jetFinder parameters (from EventSetup)
void L1GctHardwareJetFinder::convertClustersToProtoJets ( )
private

Organise the pre-clustered jets into the ones we keep and those we send to the neighbour.

Definition at line 422 of file L1GctHardwareJetFinder.cc.

References j, L1GctJetFinderBase::m_CenJetSeed, m_clusters, L1GctJetFinderBase::m_EtaBoundry, L1GctJetFinderBase::m_FwdJetSeed, L1GctJetFinderBase::m_keptProtoJets, L1GctJetFinderBase::m_sentProtoJets, and L1GctJetFinderBase::MAX_JETS_OUT.

Referenced by findProtoJets().

423 {
424  for (unsigned j=0; j<MAX_JETS_OUT; ++j) {
425  bool isForward = (m_clusters.at(j).rctEta()>=m_EtaBoundry);
426  unsigned JET_THRESHOLD = ( isForward ? m_FwdJetSeed : m_CenJetSeed);
427  if (m_clusters.at(j).et()>=JET_THRESHOLD) {
428  m_keptProtoJets.at(j) = m_clusters.at(j);
429  m_sentProtoJets.at(j) = m_clusters.at(j);
430  }
431  }
432 }
static const unsigned int MAX_JETS_OUT
Max of 6 jets found per jetfinder in a 2*11 search area.
RegionsVector m_sentProtoJets
List of pre-clustered jets to be sent to neighbour after the first stage of clustering.
RegionsVector m_clusters
Each local maximum becomes a cluster.
int j
Definition: DBlmapReader.cc:9
RegionsVector m_keptProtoJets
List of pre-clustered jets retained locally as input to the final clustering.
unsigned m_CenJetSeed
jetFinder parameters (from EventSetup)
void L1GctHardwareJetFinder::fetchInput ( )
virtual

get input data from sources

Implements L1GctJetFinderBase.

Definition at line 41 of file L1GctHardwareJetFinder.cc.

References findProtoJets(), and L1GctJetFinderBase::setupOk().

42 {
43  if (setupOk()) {
44  findProtoJets();
45  }
46 }
void findProtoJets()
The first stage of clustering, called by fetchInput()
bool setupOk() const
Check setup is Ok.
void L1GctHardwareJetFinder::findFinalClusters ( )
private

Convert protojets to final jets.

Definition at line 323 of file L1GctHardwareJetFinder.cc.

References centralCol0(), L1GctJetFinderBase::COL_OFFSET, eta(), getHLTprescales::index, j, gen::k, L1GctJetFinderBase::m_CenJetSeed, m_cluster00, m_clusters, L1GctJetFinderBase::m_EtaBoundry, L1GctJetFinderBase::m_FwdJetSeed, L1GctJetFinderBase::m_ignoreTauVetoBitsForIsolation, L1GctJetFinderBase::m_inputRegions, L1GctJetFinderBase::m_keptProtoJets, L1GctJetFinderBase::m_rcvdProtoJets, L1GctJetFinderBase::m_tauIsolationThreshold, L1GctJetFinderBase::m_useImprovedTauAlgo, L1GctRegion::makeFinalJetRegion(), L1GctJetFinderBase::MAX_JETS_OUT, L1GctJetFinderBase::N_EXTRA_REGIONS_ETA00, phi, and cond::rpcobtemp::temp.

Referenced by findJets().

324 {
325  m_clusters.clear();
326  m_clusters.resize(MAX_JETS_OUT);
327 
328  // Loop over proto-jets received from neighbours.
329  // Form a jet to send to the output if there is no proto-jet nearby in the
330  // list of jets found locally. If local jets are found nearby, form a jet
331  // if the received jet has higher Et than any one of the local ones.
332  for (unsigned j=0; j<MAX_JETS_OUT; ++j) {
333  unsigned et0 = m_rcvdProtoJets.at(j).et();
334  unsigned localEta0 = m_rcvdProtoJets.at(j).rctEta();
335  unsigned localPhi0 = m_rcvdProtoJets.at(j).rctPhi();
336  unsigned JET_THRESHOLD = ( (localEta0 >= m_EtaBoundry) ? m_FwdJetSeed : m_CenJetSeed);
337  if (et0>=JET_THRESHOLD) {
338  bool storeJet=false;
339  bool isolated=true;
340  // eta00 boundary check/veto
341  if (localEta0==0) {
342  unsigned neighbourEt=m_cluster00.at(1-localPhi0).et();
343  isolated &= et0 >= neighbourEt;
344  }
345  // If the jet is NOT vetoed, look at the jets found locally (m_keptProtoJets).
346  // We accept the jet if there are no local jets nearby, or if the local jet
347  // (there should be no more than one) has lower Et.
348  if (isolated) {
349  for (unsigned k=0; k<MAX_JETS_OUT; ++k) {
350  unsigned et1 = m_keptProtoJets.at(k).et();
351  unsigned localEta1 = m_keptProtoJets.at(k).rctEta();
352  unsigned localPhi1 = m_keptProtoJets.at(k).rctPhi();
353  if (et1>0) {
354  bool distantJet = ((localPhi0==localPhi1) ||
355  (localEta1 > localEta0+1) || (localEta0 > localEta1+1));
356 
357  isolated &= distantJet;
358  storeJet |= !distantJet && ((et0 > et1) || ((et0 == et1) && localPhi0==1));
359  }
360  }
361  }
362 
363  storeJet |= isolated;
364 
365  if (storeJet) {
366  // Start with the et sum, tau veto and overflow flags of the protoJet (2x3 regions)
367  unsigned etCluster = et0;
368  bool ovrFlowOr = m_rcvdProtoJets.at(j).overFlow();
369  bool tauVetoOr = m_rcvdProtoJets.at(j).tauVeto();
370  unsigned rgnsAboveIsoThreshold = ( m_rcvdProtoJets.at(j).featureBit0() ? 1 : 0);
371 
372  // Combine with the corresponding regions from
373  // the local array to make a 3x3 jet cluster
374  unsigned column=1-localPhi0;
375  // Which rows are we looking over?
376  unsigned rowStart, rowEnd;
377  static const unsigned row0 = N_EXTRA_REGIONS_ETA00 - 1;
378  rowStart = row0 + localEta0;
379  if (localEta0 < COL_OFFSET - row0 - 2) {
380  rowEnd = rowStart + 3;
381  } else {
382  rowEnd = COL_OFFSET;
383  }
384  unsigned index = COL_OFFSET*(this->centralCol0()+column) + rowStart;
385  for (unsigned row=rowStart; row<rowEnd; ++row) {
386  etCluster += m_inputRegions.at(index).et();
387  ovrFlowOr |= m_inputRegions.at(index).overFlow();
388  if (m_useImprovedTauAlgo) {
390  tauVetoOr |= m_inputRegions.at(index).tauVeto();
391  }
392  // check the region energy against the isolation threshold
393  if (m_inputRegions.at(index).et() >= m_tauIsolationThreshold) {
394  rgnsAboveIsoThreshold++;
395  }
396  } else {
397  tauVetoOr |= m_inputRegions.at(index).tauVeto();
398  }
399 
400  ++index;
401  }
402 
403  // Store the new jet
404  unsigned eta = m_rcvdProtoJets.at(j).gctEta();
405  unsigned phi = m_rcvdProtoJets.at(j).gctPhi();
406  int16_t bx = m_rcvdProtoJets.at(j).bx();
407 
408  // Use the number of towers over threshold for the isolated tau algorithm
409  if (m_useImprovedTauAlgo) {
410  tauVetoOr |= (rgnsAboveIsoThreshold > 1);
411  }
412 
413  L1GctRegion temp(L1GctRegion::makeFinalJetRegion(etCluster, ovrFlowOr, tauVetoOr, eta, phi, bx));
414  m_clusters.at(j) = temp;
415 
416  }
417  }
418  }
419 }
static const unsigned int MAX_JETS_OUT
Max of 6 jets found per jetfinder in a 2*11 search area.
Gct version of a calorimeter region, used within GCT emulation.
Definition: L1GctRegion.h:17
RegionsVector m_clusters
Each local maximum becomes a cluster.
T eta() const
static L1GctRegion makeFinalJetRegion(const unsigned et, const bool overFlow, const bool fineGrain, const unsigned ieta, const unsigned iphi, const int16_t bx)
Definition: L1GctRegion.cc:26
int j
Definition: DBlmapReader.cc:9
static const unsigned int N_EXTRA_REGIONS_ETA00
Number of additional regions to process on the &quot;wrong&quot; side of eta=0 (determines COL_OFFSET) ...
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.
RegionsVector m_inputRegions
input data required for jet finding
int k[5][pyjets_maxn]
unsigned m_CenJetSeed
jetFinder parameters (from EventSetup)
RegionsVector m_rcvdProtoJets
List of pre-clustered jets received from neighbour before the final stage of clustering.
bool m_useImprovedTauAlgo
Setup parameters for the tau jet algorithm.
virtual unsigned centralCol0() const
Definition: DDAxes.h:10
void L1GctHardwareJetFinder::findJets ( )
private

The second stage of clustering, called by process()

Definition at line 69 of file L1GctHardwareJetFinder.cc.

References convertClustersToOutputJets(), and findFinalClusters().

Referenced by process().

70 {
73 }
void findFinalClusters()
Convert protojets to final jets.
void convertClustersToOutputJets()
Organise the final clustered jets into L1GctJets.
void L1GctHardwareJetFinder::findLocalMaxima ( )
private

Find local maxima in the search array.

Both clustering stages need to find local maxima in the search array.

Definition at line 77 of file L1GctHardwareJetFinder.cc.

References centralCol0(), L1GctJetFinderBase::COL_OFFSET, L1GctJetFinderBase::m_CenJetSeed, L1GctJetFinderBase::m_EtaBoundry, L1GctJetFinderBase::m_FwdJetSeed, L1GctJetFinderBase::m_inputRegions, m_localMax00, m_localMaxima, m_numberOfClusters, m_positiveEtaWheel, L1GctJetFinderBase::MAX_JETS_OUT, and phi.

Referenced by findProtoJets().

78 {
79  m_localMaxima.clear();
81  m_localMax00.clear();
82  m_localMax00.resize(2);
83 
84  UShort jetNum = 0; //holds the number of jets currently found
85  UShort centreIndex = COL_OFFSET*this->centralCol0();
86  for(UShort column = 0; column <2; ++column) //Find jets in the central search region
87  {
88  // The input regions include two extra bins on the other side of eta=0. This allows "seamless"
89  // jetfinding across the eta=0 boundary. We skip the first input region in each row. We perform
90  // the full pre-clustering on the next region but store the resulting clusters separately
91  // from the main list of output pre-clusters - they will be used in the final cluster stage to
92  // make sure we do not produce jets in adjacent regions on opposite sides of eta=0.
93  ++centreIndex;
94  for (UShort row = 1; row < COL_OFFSET; ++row)
95  {
96  // Here's the array of greater-than and greater-or-equal tests
97  // to ensure each localMaximum appears once and only once in the list
98  // It is different for forward and backward eta.
99  unsigned JET_THRESHOLD = ( (row > m_EtaBoundry) ? m_FwdJetSeed : m_CenJetSeed);
100  bool localMax = !m_inputRegions.at(centreIndex).empty() && (m_inputRegions.at(centreIndex).et()>=JET_THRESHOLD);
101  if (m_positiveEtaWheel) { // Forward eta
102  localMax &= (m_inputRegions.at(centreIndex).et() >= m_inputRegions.at(centreIndex-1).et());
103  if (row < (COL_OFFSET-1)) {
104  localMax &= (m_inputRegions.at(centreIndex).et() > m_inputRegions.at(centreIndex+1).et());
105  }
106  if (column==0) {
107  localMax &= (m_inputRegions.at(centreIndex).et() > m_inputRegions.at(centreIndex+COL_OFFSET).et());
108  localMax &= (m_inputRegions.at(centreIndex).et() > m_inputRegions.at(centreIndex+COL_OFFSET-1).et());
109  if (row < (COL_OFFSET-1)) {
110  localMax &= (m_inputRegions.at(centreIndex).et() > m_inputRegions.at(centreIndex+COL_OFFSET+1).et());
111  }
112  } else {
113  localMax &= (m_inputRegions.at(centreIndex).et() >= m_inputRegions.at(centreIndex-COL_OFFSET).et());
114  localMax &= (m_inputRegions.at(centreIndex).et() >= m_inputRegions.at(centreIndex-COL_OFFSET-1).et());
115  if (row < (COL_OFFSET-1)) {
116  localMax &= (m_inputRegions.at(centreIndex).et() >= m_inputRegions.at(centreIndex-COL_OFFSET+1).et());
117  }
118  }
119  } else { // Backward eta
120  localMax &= (m_inputRegions.at(centreIndex).et() > m_inputRegions.at(centreIndex-1).et());
121  if (row < (COL_OFFSET-1)) {
122  localMax &= (m_inputRegions.at(centreIndex).et() >= m_inputRegions.at(centreIndex+1).et());
123  }
124  if (column==0) {
125  localMax &= (m_inputRegions.at(centreIndex).et() >= m_inputRegions.at(centreIndex+COL_OFFSET).et());
126  localMax &= (m_inputRegions.at(centreIndex).et() >= m_inputRegions.at(centreIndex+COL_OFFSET-1).et());
127  if (row < (COL_OFFSET-1)) {
128  localMax &= (m_inputRegions.at(centreIndex).et() >= m_inputRegions.at(centreIndex+COL_OFFSET+1).et());
129  }
130  } else {
131  localMax &= (m_inputRegions.at(centreIndex).et() > m_inputRegions.at(centreIndex-COL_OFFSET).et());
132  localMax &= (m_inputRegions.at(centreIndex).et() > m_inputRegions.at(centreIndex-COL_OFFSET-1).et());
133  if (row < (COL_OFFSET-1)) {
134  localMax &= (m_inputRegions.at(centreIndex).et() > m_inputRegions.at(centreIndex-COL_OFFSET+1).et());
135  }
136  }
137  }
138  if (localMax) {
139  if (row>1) {
140  if (jetNum < MAX_JETS_OUT) {
141  m_localMaxima.at(jetNum) = m_inputRegions.at(centreIndex);
142  ++jetNum;
143  }
144  }
145  // Treat row 1 as a separate case. It's not required for jetfinding but
146  // is used for vetoing of jets double counted across the eta=0 boundary
147  else {
148  unsigned phi = m_inputRegions.at(centreIndex).rctPhi();
149  m_localMax00.at(phi) = m_inputRegions.at(centreIndex);
150  }
151  }
152  ++centreIndex;
153  }
154  }
155 
156  m_numberOfClusters = jetNum;
157 }
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.
bool m_positiveEtaWheel
Positive/negative eta flag used in the initial clustering.
unsigned short int UShort
static const unsigned int COL_OFFSET
The index offset between columns.
RegionsVector m_inputRegions
input data required for jet finding
unsigned m_CenJetSeed
jetFinder parameters (from EventSetup)
virtual unsigned centralCol0() const
RegionsVector m_localMaxima
Local vectors used during both stages of clustering.
Definition: DDAxes.h:10
void L1GctHardwareJetFinder::findProtoClusters ( )
private

Convert local maxima to clusters.

Definition at line 162 of file L1GctHardwareJetFinder.cc.

References j, gen::k, m_cluster00, m_clusters, m_localMax00, m_localMaxima, m_numberOfClusters, makeProtoJet(), L1GctJetFinderBase::MAX_JETS_OUT, pos, and cond::rpcobtemp::temp.

Referenced by findProtoJets().

163 {
164  m_clusters.clear();
165  m_clusters.resize(MAX_JETS_OUT);
166  m_cluster00.clear();
167  m_cluster00.resize(2);
168 
169  RegionsVector topJets(MAX_JETS_OUT), botJets(MAX_JETS_OUT);
170  std::vector<unsigned> topJetsPosition(MAX_JETS_OUT), botJetsPosition(MAX_JETS_OUT);
171  unsigned numberOfTopJets=0, numberOfBotJets=0;
172 
173  // Loop over local maxima
174  for (unsigned j=0; j<m_numberOfClusters; ++j) {
175  // Make a proto-jet cluster
177 
178  if (m_localMaxima.at(j).rctPhi()==0) {
179  // Store "top edge" jets
180  topJets.at(numberOfTopJets) = temp;
181  topJetsPosition.at(numberOfTopJets) = 0;
182  for (unsigned k=0; k<numberOfTopJets; ++k) {
183  if (topJets.at(numberOfTopJets).et() >= topJets.at(k).et()) { ++topJetsPosition.at(k); }
184  if (topJets.at(numberOfTopJets).et() <= topJets.at(k).et()) { ++topJetsPosition.at(numberOfTopJets); }
185  }
186  ++numberOfTopJets;
187  } else {
188  // Store "bottom edge" jets
189  botJets.at(numberOfBotJets) = temp;
190  botJetsPosition.at(numberOfBotJets) = 0;
191  for (unsigned k=0; k<numberOfBotJets; ++k) {
192  if (botJets.at(numberOfBotJets).et() >= botJets.at(k).et()) { ++botJetsPosition.at(k); }
193  if (botJets.at(numberOfBotJets).et() <= botJets.at(k).et()) { ++botJetsPosition.at(numberOfBotJets); }
194  }
195  ++numberOfBotJets;
196  }
197  }
198  // Now we've found all the proto-jets, copy the best ones to the output array
199  //
200  // We fill the first half of the array with "bottom jets"
201  // and the remainder with "top jets". For cases where
202  // we have found too many jets in one phi column,
203  // we keep those with the highest Et.
204  static const unsigned int MAX_TOPBOT_JETS = MAX_JETS_OUT/2;
205  unsigned pos=0;
206  for (unsigned j=0; j<numberOfBotJets; ++j) {
207  if (botJetsPosition.at(j)<MAX_TOPBOT_JETS) {
208  m_clusters.at(pos++) = botJets.at(j);
209  }
210  }
211  pos=MAX_TOPBOT_JETS;
212  for (unsigned j=0; j<numberOfTopJets; ++j) {
213  if (topJetsPosition.at(j)<MAX_TOPBOT_JETS) {
214  m_clusters.at(pos++) = topJets.at(j);
215  }
216  }
217  // Finally, deal with eta00 maxima
218  if (!m_localMax00.at(0).empty()) m_cluster00.at(0) = makeProtoJet(m_localMax00.at(0));
219  if (!m_localMax00.at(1).empty()) m_cluster00.at(1) = makeProtoJet(m_localMax00.at(1));
220 }
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.
Gct version of a calorimeter region, used within GCT emulation.
Definition: L1GctRegion.h:17
RegionsVector m_clusters
Each local maximum becomes a cluster.
int j
Definition: DBlmapReader.cc:9
int k[5][pyjets_maxn]
std::vector< L1GctRegion > RegionsVector
L1GctRegion makeProtoJet(L1GctRegion localMax)
Method to make a single proto-jet.
RegionsVector m_localMaxima
Local vectors used during both stages of clustering.
void L1GctHardwareJetFinder::findProtoJets ( )
private

The first stage of clustering, called by fetchInput()

HERE IS THE JETFINDER CODE.

The first stage of clustering, called by fetchInput()

Definition at line 61 of file L1GctHardwareJetFinder.cc.

References convertClustersToProtoJets(), findLocalMaxima(), and findProtoClusters().

Referenced by fetchInput().

62 {
66 }
void convertClustersToProtoJets()
Organise the pre-clustered jets into the ones we keep and those we send to the neighbour.
void findLocalMaxima()
Find local maxima in the search array.
void findProtoClusters()
Convert local maxima to clusters.
L1GctRegion L1GctHardwareJetFinder::makeProtoJet ( L1GctRegion  localMax)
private

Method to make a single proto-jet.

Definition at line 224 of file L1GctHardwareJetFinder.cc.

References L1CaloRegion::bx(), L1GctJetFinderBase::COL_OFFSET, eta(), L1CaloRegion::gctEta(), L1CaloRegion::gctPhi(), getHLTprescales::index, L1GctJetFinderBase::m_ignoreTauVetoBitsForIsolation, L1GctJetFinderBase::m_inputRegions, m_positiveEtaWheel, L1GctJetFinderBase::m_tauIsolationThreshold, L1GctJetFinderBase::m_useImprovedTauAlgo, L1GctRegion::makeProtoJetRegion(), L1CaloRegionDetId::N_ETA, L1GctJetFinderBase::N_EXTRA_REGIONS_ETA00, phi, L1GctRegion::rctEta(), L1CaloRegion::rctPhi(), and cond::rpcobtemp::temp.

Referenced by findProtoClusters().

224  {
225  unsigned eta = localMax.gctEta();
226  unsigned phi = localMax.gctPhi();
227  int16_t bx = localMax.bx();
228 
229  unsigned localEta = localMax.rctEta();
230  unsigned localPhi = localMax.rctPhi();
231 
232  unsigned etCluster = 0;
233  bool ovrFlowOr = false;
234  bool tauVetoOr = false;
235  unsigned rgnsAboveIsoThreshold = 0;
236 
237  // check for row00
238  const unsigned midEta=(L1CaloRegionDetId::N_ETA)/2;
239  bool wrongEtaWheel = ( (!m_positiveEtaWheel) && (eta>=midEta) ) || ( (m_positiveEtaWheel) && (eta<midEta) );
240 
241  // Which rows are we looking over?
242  unsigned rowStart, rowEnd, rowMid;
243  static const unsigned row0 = N_EXTRA_REGIONS_ETA00 - 1;
244  if (wrongEtaWheel) {
245  if (localEta > row0 - 1) {
246  rowStart = 0;
247  rowMid = 0;
248  } else {
249  rowStart = row0 - 1 - localEta;
250  rowMid = rowStart + 1;
251  }
252  if (localEta > row0 + 2) { // Shouldn't happen, but big problems if it does
253  rowEnd = 0;
254  } else {
255  rowEnd = row0 + 2 - localEta;
256  }
257  } else {
258  rowStart = row0 + localEta;
259  rowMid = rowStart + 1;
260  if (localEta < COL_OFFSET - row0 - 2) {
261  rowEnd = rowStart + 3;
262  } else {
263  rowEnd = COL_OFFSET;
264  }
265  }
266 
267  for (unsigned row=rowStart; row<rowEnd; ++row) {
268  for (unsigned column=0; column<2; ++column) {
269  unsigned index = column*COL_OFFSET + row;
270  etCluster += m_inputRegions.at(index).et();
271  ovrFlowOr |= m_inputRegions.at(index).overFlow();
272  // Distinguish between central and tau-flagged jets. Two versions of the algorithm.
273  if (m_useImprovedTauAlgo) {
274 
275 //===========================================================================================
276 // "Old" version of improved tau algorithm tests the tau veto for the central region always
277 // if ((row==(localEta+N_EXTRA_REGIONS_ETA00)) && (column==localPhi)) {
278 // // central region - check the tau veto
279 // tauVetoOr |= m_inputRegions.at(index).tauVeto();
280 // } else {
281 // // other regions - check the tau veto if required
282 // if (!m_ignoreTauVetoBitsForIsolation) {
283 // tauVetoOr |= m_inputRegions.at(index).tauVeto();
284 // }
285 // // check the region energy against the isolation threshold
286 // if (m_inputRegions.at(index).et() >= m_tauIsolationThreshold) {
287 // rgnsAboveIsoThreshold++;
288 // }
289 // }
290 //===========================================================================================
291 
292  // In the hardware, the ignoreTauVetoBitsForIsolation switch ignores all the veto bits,
293  // including the one for the central region.
294  if (!((row==rowMid) && (column==localPhi))) {
295  // non-central region - check the region energy against the isolation threshold
296  if (m_inputRegions.at(index).et() >= m_tauIsolationThreshold) {
297  rgnsAboveIsoThreshold++;
298  }
299  }
300  // all regions - check the tau veto if required
302  tauVetoOr |= m_inputRegions.at(index).tauVeto();
303  }
304  // End of improved tau algorithm
305  } else {
306  // Original tau algorithm
307  tauVetoOr |= m_inputRegions.at(index).tauVeto();
308  }
309  }
310  }
311  // Encode the number of towers over threshold for the isolated tau algorithm
312  bool tauFeatureBit = false;
313  if (m_useImprovedTauAlgo) {
314  tauVetoOr |= (rgnsAboveIsoThreshold > 1);
315  tauFeatureBit |= (rgnsAboveIsoThreshold == 1);
316  }
317 
318  L1GctRegion temp(L1GctRegion::makeProtoJetRegion(etCluster, ovrFlowOr, tauVetoOr, tauFeatureBit, eta, phi, bx));
319  return temp;
320 }
int16_t bx() const
get bunch-crossing index
Definition: L1CaloRegion.h:192
unsigned rctEta() const
Definition: L1GctRegion.h:43
bool m_positiveEtaWheel
Positive/negative eta flag used in the initial clustering.
Gct version of a calorimeter region, used within GCT emulation.
Definition: L1GctRegion.h:17
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)
Definition: L1GctRegion.cc:14
T eta() const
static const unsigned N_ETA
unsigned rctPhi() const
get local phi index (within RCT crate)
Definition: L1CaloRegion.h:177
static const unsigned int N_EXTRA_REGIONS_ETA00
Number of additional regions to process on the &quot;wrong&quot; side of eta=0 (determines COL_OFFSET) ...
static const unsigned int COL_OFFSET
The index offset between columns.
RegionsVector m_inputRegions
input data required for jet finding
unsigned gctEta() const
get GCT eta index
Definition: L1CaloRegion.h:180
unsigned gctPhi() const
get GCT phi index
Definition: L1CaloRegion.h:183
bool m_useImprovedTauAlgo
Setup parameters for the tau jet algorithm.
Definition: DDAxes.h:10
virtual unsigned L1GctHardwareJetFinder::maxRegionsIn ( ) const
inlineprotectedvirtual

Reimplemented from L1GctJetFinderBase.

Definition at line 46 of file L1GctHardwareJetFinder.h.

References MAX_REGIONS_IN.

46 { return MAX_REGIONS_IN; }
static const unsigned int MAX_REGIONS_IN
The real jetFinders must define these constants.
virtual unsigned L1GctHardwareJetFinder::nCols ( ) const
inlineprotectedvirtual

Reimplemented from L1GctJetFinderBase.

Definition at line 48 of file L1GctHardwareJetFinder.h.

References N_COLS.

48 { return N_COLS; }
static const unsigned int N_COLS
void L1GctHardwareJetFinder::process ( )
virtual

process the data, fill output buffers

Implements L1GctJetFinderBase.

Definition at line 48 of file L1GctHardwareJetFinder.cc.

References L1GctJetFinderBase::doEnergySums(), L1GctJetFinderBase::fetchProtoJetsFromNeighbour(), findJets(), L1GctJetFinderBase::setupOk(), L1GctJetFinderBase::sortJets(), and L1GctJetFinderBase::TOPBOT.

49 {
50  if (setupOk()) {
52  findJets();
53  sortJets();
54  doEnergySums();
55  }
56 }
void findJets()
The second stage of clustering, called by process()
bool setupOk() const
Check setup is Ok.
void sortJets()
Sort the found jets. All jetFinders should call this in process().
void fetchProtoJetsFromNeighbour(const fetchType ft)
fetch the protoJets from neighbour jetFinder
void doEnergySums()
Fill the Et strip sums and Ht sum. All jetFinders should call this in process().
void L1GctHardwareJetFinder::reset ( void  )
virtual

include additional reset functionality

Definition at line 36 of file L1GctHardwareJetFinder.cc.

References L1GctProcessor::reset().

Referenced by L1GctHardwareJetFinder().

37 {
39 }
void reset()
complete reset of processor

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const L1GctHardwareJetFinder algo 
)
friend

Overload << operator.

Definition at line 28 of file L1GctHardwareJetFinder.cc.

29 {
30  os << "===L1GctHardwareJetFinder===" << std::endl;
31  const L1GctJetFinderBase* temp = &algo;
32  os << *temp;
33  return os;
34 }
Base class to allow implementation of jetFinder algorithms.

Member Data Documentation

const unsigned int L1GctHardwareJetFinder::CENTRAL_COL0 = 0
staticprivate

Definition at line 55 of file L1GctHardwareJetFinder.h.

Referenced by centralCol0(), and L1GctHardwareJetFinder().

RegionsVector L1GctHardwareJetFinder::m_cluster00
private

Definition at line 70 of file L1GctHardwareJetFinder.h.

Referenced by findFinalClusters(), and findProtoClusters().

RegionsVector L1GctHardwareJetFinder::m_clusters
private

Each local maximum becomes a cluster.

Definition at line 63 of file L1GctHardwareJetFinder.h.

Referenced by convertClustersToOutputJets(), convertClustersToProtoJets(), findFinalClusters(), and findProtoClusters().

RegionsVector L1GctHardwareJetFinder::m_localMax00
private

Definition at line 69 of file L1GctHardwareJetFinder.h.

Referenced by findLocalMaxima(), and findProtoClusters().

RegionsVector L1GctHardwareJetFinder::m_localMaxima
private

Local vectors used during both stages of clustering.

Definition at line 61 of file L1GctHardwareJetFinder.h.

Referenced by findLocalMaxima(), and findProtoClusters().

unsigned L1GctHardwareJetFinder::m_numberOfClusters
private

The number of local Maxima/clusters found at each stage of clustering.

Definition at line 66 of file L1GctHardwareJetFinder.h.

Referenced by findLocalMaxima(), and findProtoClusters().

bool L1GctHardwareJetFinder::m_positiveEtaWheel
private

Positive/negative eta flag used in the initial clustering.

Definition at line 58 of file L1GctHardwareJetFinder.h.

Referenced by findLocalMaxima(), and makeProtoJet().

const unsigned int L1GctHardwareJetFinder::MAX_REGIONS_IN = (((L1CaloRegionDetId::N_ETA)/2)+N_EXTRA_REGIONS_ETA00)*L1GctHardwareJetFinder::N_COLS
staticprivate

The real jetFinders must define these constants.

Dependent on number of rows and columns.

Definition at line 53 of file L1GctHardwareJetFinder.h.

Referenced by maxRegionsIn().

const unsigned int L1GctHardwareJetFinder::N_COLS = 2
staticprivate

Definition at line 54 of file L1GctHardwareJetFinder.h.

Referenced by nCols().