CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Attributes | Friends

L1GctTdrJetFinder Class Reference

3*3 sliding window algorithm jet finder. More...

#include <L1GctTdrJetFinder.h>

Inheritance diagram for L1GctTdrJetFinder:
L1GctJetFinderBase L1GctProcessor

List of all members.

Public Member Functions

virtual void fetchInput ()
 get input data from sources
 L1GctTdrJetFinder (int id)
 id is 0-8 for -ve Eta jetfinders, 9-17 for +ve Eta, for increasing Phi.
virtual void process ()
 process the data, fill output buffers
 ~L1GctTdrJetFinder ()

Protected Member Functions

virtual unsigned centralCol0 () const
virtual unsigned maxRegionsIn () const
virtual unsigned int nCols () const

Private Member Functions

ULong calcJetEnergy (const UShort centreIndex, const bool boundary=false) const
 Returns energy sum of the 9 regions centred (physically) about centreIndex. Set boundary = true if at edge of HCAL.
L1CaloRegionDetId calcJetPosition (const UShort centreIndex) const
 returns the encoded (eta, phi) position of the centre region
bool calcJetTauVeto (const UShort centreIndex, const bool boundary=false) const
 Returns combined tauVeto of the 9 regions centred (physically) about centreIndex. Set boundary = true if at edge of Endcap.
bool detectJet (const UShort centreIndex, const bool boundary=false) const
 Returns true if region index is the centre of a jet. Set boundary = true if at edge of HCAL.
void findJets ()
 Here is the TDR 3x3 sliding window jet finder algorithm.

Static Private Attributes

static const unsigned int CENTRAL_COL0 = 1
static const unsigned int MAX_REGIONS_IN = (((L1CaloRegionDetId::N_ETA)/2)+1)*L1GctTdrJetFinder::N_COLS
 The real jetFinders must define these constants.
static const unsigned int N_COLS = 4

Friends

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

Detailed Description

3*3 sliding window algorithm jet finder.

Locates the jets from 48 inputted L1CaloRegions. This uses the 3*3 sliding window algorithm.

The the filling of the input L1CaloRegions happens in the L1GctJetFinderBase class

Inputted regions are expected in a certain order with respect to the index i:

Regions should arrive running from the middle (eta=0) of the detector out towards the edge of the forward HCAL, and then moving across in columns like this but increasing in phi each time.

E.g. for 48 inputted regions: region 0: phi=0, other side of eta=0 line (shared data). region 1: phi=0, but correct side of eta=0 (shared data). region 11: phi=0, edge of Forward HCAL (shared data). region 12: phi=20, other side of eta=0 line (shared data) region 13: phi=20, start of jet search area region 23: phi=20, edge of HF (jet search area) etc.

In the event of neighbouring regions having the same energy, this will locate the jet in the region furthest from eta=0 that has the lowest value of phi.

The jet finder now stores jets with (eta, phi) information encoded in an L1CaloRegionDetId.

Modified to use L1GctJetFinderBase class by Greg Heath, June 2006.

Definition at line 54 of file L1GctTdrJetFinder.h.


Constructor & Destructor Documentation

L1GctTdrJetFinder::L1GctTdrJetFinder ( int  id)

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

Definition at line 15 of file L1GctTdrJetFinder.cc.

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

                                          :
  L1GctJetFinderBase(id)
{
  this->reset();
  // Initialise parameters for Region input calculations in the 
  // derived class so we get the right values of constants.
  static const unsigned NPHI = L1CaloRegionDetId::N_PHI;
  m_minColThisJf = (NPHI + m_id*2 - CENTRAL_COL0) % NPHI;
}
L1GctTdrJetFinder::~L1GctTdrJetFinder ( )

Definition at line 25 of file L1GctTdrJetFinder.cc.

{
}

Member Function Documentation

L1GctJetFinderBase::ULong L1GctTdrJetFinder::calcJetEnergy ( const UShort  centreIndex,
const bool  boundary = false 
) const [private]

Returns energy sum of the 9 regions centred (physically) about centreIndex. Set boundary = true if at edge of HCAL.

Definition at line 166 of file L1GctTdrJetFinder.cc.

References L1GctJetFinderBase::COL_OFFSET, relval_parameters_module::energy, and L1GctJetFinderBase::m_inputRegions.

Referenced by findJets().

{
  ULong energy = 0;
    
  if(!boundary)
  {
    for(int column = -1; column <= +1; ++column)
    {
      energy += m_inputRegions.at(centreIndex-1 + (column*COL_OFFSET)).et() +
                m_inputRegions.at( centreIndex  + (column*COL_OFFSET)).et() +
                m_inputRegions.at(centreIndex+1 + (column*COL_OFFSET)).et();
    }
  }
  else
  {
    for(int column = -1; column <= +1; ++column)
    {
      energy += m_inputRegions.at(centreIndex-1 + (column*COL_OFFSET)).et() +
                m_inputRegions.at( centreIndex  + (column*COL_OFFSET)).et();
    }
  }

  return energy;                                   
}
L1CaloRegionDetId L1GctTdrJetFinder::calcJetPosition ( const UShort  centreIndex) const [private]

returns the encoded (eta, phi) position of the centre region

Definition at line 192 of file L1GctTdrJetFinder.cc.

References L1GctJetFinderBase::m_inputRegions.

Referenced by findJets().

{
  return m_inputRegions.at(centreIndex).id();
}
bool L1GctTdrJetFinder::calcJetTauVeto ( const UShort  centreIndex,
const bool  boundary = false 
) const [private]

Returns combined tauVeto of the 9 regions centred (physically) about centreIndex. Set boundary = true if at edge of Endcap.

Definition at line 198 of file L1GctTdrJetFinder.cc.

References L1GctJetFinderBase::COL_OFFSET, and L1GctJetFinderBase::m_inputRegions.

Referenced by findJets().

{
  bool partial[3] = {false, false, false};
    
  if(!boundary)
  {
    for(int column = -1; column <= +1; ++column)
    {
      partial[column+1] = m_inputRegions.at(centreIndex-1 + (column*COL_OFFSET)).tauVeto() ||
                          m_inputRegions.at( centreIndex  + (column*COL_OFFSET)).tauVeto() ||
                          m_inputRegions.at(centreIndex+1 + (column*COL_OFFSET)).tauVeto();
    }
  }
  else
  {
    for(int column = -1; column <= +1; ++column)
    {
      partial[column+1] = m_inputRegions.at(centreIndex-1 + (column*COL_OFFSET)).tauVeto() ||
                          m_inputRegions.at( centreIndex  + (column*COL_OFFSET)).tauVeto();
    }
  }
  return partial[0] || partial[1] || partial[2];
}
virtual unsigned L1GctTdrJetFinder::centralCol0 ( ) const [inline, protected, virtual]

Reimplemented from L1GctJetFinderBase.

Definition at line 77 of file L1GctTdrJetFinder.h.

References CENTRAL_COL0.

Referenced by findJets().

{ return CENTRAL_COL0; }
bool L1GctTdrJetFinder::detectJet ( const UShort  centreIndex,
const bool  boundary = false 
) const [private]

Returns true if region index is the centre of a jet. Set boundary = true if at edge of HCAL.

Definition at line 99 of file L1GctTdrJetFinder.cc.

References L1GctJetFinderBase::COL_OFFSET, and L1GctJetFinderBase::m_inputRegions.

Referenced by findJets().

{
  if(!boundary)  //Not at boundary, so use 3*3 window of regions to determine if a jet
  {
    // Get the energy of the central region
    ULong testEt = m_inputRegions.at(centreIndex).et();
        
    //Test if our region qualifies as a jet by comparing its energy with the energies of the
    //surrounding eight regions.  In the event of neighbouring regions with identical energy,
    //this will locate the jet in the lower-most (furthest away from eta=0), left-most (least phi) region.
    if(testEt >  m_inputRegions.at(centreIndex-1-COL_OFFSET).et() &&
       testEt >  m_inputRegions.at(centreIndex - COL_OFFSET).et() &&
       testEt >  m_inputRegions.at(centreIndex+1-COL_OFFSET).et() &&
           
       testEt >= m_inputRegions.at(centreIndex - 1).et() &&
       testEt >  m_inputRegions.at(centreIndex + 1).et() &&
           
       testEt >= m_inputRegions.at(centreIndex-1+COL_OFFSET).et() &&
       testEt >= m_inputRegions.at(centreIndex + COL_OFFSET).et() &&
       testEt >= m_inputRegions.at(centreIndex+1+COL_OFFSET).et())
    {
      return true;
    }
//USE THIS BLOCK INSTEAD IF YOU WANT OVERFLOW BIT FUNCTIONALITY        
//*** BUT IT WILL NEED MODIFICATION SINCE L1GctRegion IS OBSOLETE ***
/*    // Get the energy of the central region & OR the overflow bit to become the MSB
    ULong testEt = (m_inputRegions.at(centreIndex).et() | (m_inputRegions.at(centreIndex).getOverFlow() << L1GctRegion::ET_BITWIDTH));
        
    //Test if our region qualifies as a jet by comparing its energy with the energies of the
    //surrounding eight regions.  In the event of neighbouring regions with identical energy,
    //this will locate the jet in the lower-most (furthest away from eta=0), left-most (least phi) region.
    if(testEt >  (m_inputRegions.at(centreIndex-1-COL_OFFSET).et() | (m_inputRegions.at(centreIndex-1-COL_OFFSET).getOverFlow() << L1GctRegion::ET_BITWIDTH)) &&
       testEt >  (m_inputRegions.at(centreIndex - COL_OFFSET).et() | (m_inputRegions.at(centreIndex - COL_OFFSET).getOverFlow() << L1GctRegion::ET_BITWIDTH)) &&
       testEt >  (m_inputRegions.at(centreIndex+1-COL_OFFSET).et() | (m_inputRegions.at(centreIndex+1-COL_OFFSET).getOverFlow() << L1GctRegion::ET_BITWIDTH)) &&
           
       testEt >= (m_inputRegions.at(centreIndex - 1).et() | (m_inputRegions.at(centreIndex - 1).getOverFlow() << L1GctRegion::ET_BITWIDTH)) &&
       testEt >  (m_inputRegions.at(centreIndex + 1).et() | (m_inputRegions.at(centreIndex + 1).getOverFlow() << L1GctRegion::ET_BITWIDTH)) &&
           
       testEt >= (m_inputRegions.at(centreIndex-1+COL_OFFSET).et() | (m_inputRegions.at(centreIndex-1+COL_OFFSET).getOverFlow() << L1GctRegion::ET_BITWIDTH)) &&
       testEt >= (m_inputRegions.at(centreIndex + COL_OFFSET).et() | (m_inputRegions.at(centreIndex + COL_OFFSET).getOverFlow() << L1GctRegion::ET_BITWIDTH)) &&
       testEt >= (m_inputRegions.at(centreIndex+1+COL_OFFSET).et() | (m_inputRegions.at(centreIndex+1+COL_OFFSET).getOverFlow() << L1GctRegion::ET_BITWIDTH)))
    {
      return true;
    }
*/  //END OVERFLOW FUNCTIONALITY       
  }
  else    //...so only test surround 5 regions in our jet testing.
  {    
    // Get the energy of the central region
    // Don't need all the overflow bit adjustments as above, since we are in the HF here
    ULong testEt = m_inputRegions.at(centreIndex).et();        
        
    if(testEt >  m_inputRegions.at(centreIndex-1-COL_OFFSET).et() &&
       testEt >  m_inputRegions.at(centreIndex - COL_OFFSET).et() &&
       
       testEt >= m_inputRegions.at(centreIndex - 1).et() &&
           
       testEt >= m_inputRegions.at(centreIndex-1+COL_OFFSET).et() &&
       testEt >= m_inputRegions.at(centreIndex + COL_OFFSET).et())
    {
      return true;
    }
  }
  return false;           
}
void L1GctTdrJetFinder::fetchInput ( ) [virtual]

get input data from sources

Implements L1GctJetFinderBase.

Definition at line 37 of file L1GctTdrJetFinder.cc.

{
}
void L1GctTdrJetFinder::findJets ( ) [private]

Here is the TDR 3x3 sliding window jet finder algorithm.

HERE IS THE JETFINDER CODE.

Definition at line 52 of file L1GctTdrJetFinder.cc.

References calcJetEnergy(), calcJetPosition(), calcJetTauVeto(), centralCol0(), L1GctJetFinderBase::COL_OFFSET, detectJet(), L1GctJetFinderBase::m_inputRegions, L1GctJetFinderBase::m_outputJets, L1GctJetFinderBase::MAX_JETS_OUT, and MAX_REGIONS_IN.

Referenced by process().

{
  UShort jetNum = 0; //holds the number of jets currently found
  UShort centreIndex = COL_OFFSET*this->centralCol0();
  for(UShort column = 0; column <2; ++column)  //Find jets in the central search region
  {
    //don't include row zero as it is not in the search region
    ++centreIndex;
    for (UShort row = 1; row < COL_OFFSET; ++row)  
    {
      //Determine if we are at end of the HF or not (so need 3*2 window)
      bool hfBoundary = (row == COL_OFFSET-1);
      //Determine if we are at the end of the endcap HCAL regions, so need boundary condition tauveto
      bool heBoundary = (row == COL_OFFSET-5);

      //debug checks for improper input indices
      if ((centreIndex % COL_OFFSET != 0)  //Don't want the 4 regions from other half of detector
          && (centreIndex >= COL_OFFSET)  //Don't want the shared column to left of jet finding area
          && (centreIndex < (MAX_REGIONS_IN - COL_OFFSET))) { //Don't want column to the right either
                        
        if(detectJet(centreIndex, hfBoundary))
          {
            if (jetNum < MAX_JETS_OUT) {
            
              m_outputJets.at(jetNum).setRawsum(calcJetEnergy(centreIndex, hfBoundary));
              m_outputJets.at(jetNum).setDetId(calcJetPosition(centreIndex));
              m_outputJets.at(jetNum).setBx(m_inputRegions.at(centreIndex).bx());
              if(row < COL_OFFSET-4)  //if we are not in the HF, perform tauVeto analysis
                {
                  m_outputJets.at(jetNum).setForward(false);
                  m_outputJets.at(jetNum).setTauVeto(calcJetTauVeto(centreIndex,heBoundary));
                }
              else //can't be a tau jet because we are in the HF
                {
                  m_outputJets.at(jetNum).setForward(true);
                  m_outputJets.at(jetNum).setTauVeto(true);
                }
              ++jetNum;
            }
          }
        ++centreIndex;
      }
    }
  }
}
virtual unsigned L1GctTdrJetFinder::maxRegionsIn ( ) const [inline, protected, virtual]

End of event data ***

---------------------------------------------------------------------------------------

Reimplemented from L1GctJetFinderBase.

Definition at line 76 of file L1GctTdrJetFinder.h.

References MAX_REGIONS_IN.

{ return MAX_REGIONS_IN; }
virtual unsigned int L1GctTdrJetFinder::nCols ( ) const [inline, protected, virtual]

Reimplemented from L1GctJetFinderBase.

Definition at line 78 of file L1GctTdrJetFinder.h.

References N_COLS.

{ return N_COLS; }
void L1GctTdrJetFinder::process ( ) [virtual]

process the data, fill output buffers

Implements L1GctJetFinderBase.

Definition at line 41 of file L1GctTdrJetFinder.cc.

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

{
  if (setupOk()) {
    findJets();
    sortJets();
    doEnergySums();
  }
}

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const L1GctTdrJetFinder algo 
) [friend]

Overload << operator.


Member Data Documentation

const unsigned int L1GctTdrJetFinder::CENTRAL_COL0 = 1 [static, private]

Reimplemented from L1GctJetFinderBase.

Definition at line 85 of file L1GctTdrJetFinder.h.

Referenced by centralCol0(), and L1GctTdrJetFinder().

The real jetFinders must define these constants.

Dependent on number of rows and columns.

Reimplemented from L1GctJetFinderBase.

Definition at line 83 of file L1GctTdrJetFinder.h.

Referenced by findJets(), and maxRegionsIn().

const unsigned int L1GctTdrJetFinder::N_COLS = 4 [static, private]

Reimplemented from L1GctJetFinderBase.

Definition at line 84 of file L1GctTdrJetFinder.h.

Referenced by nCols().