CMS 3D CMS Logo

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

L1GctGlobalHfSumAlgos Class Reference

Emulates the GCT summing and packing of Hf Et sums and tower-over-threshold counts. More...

#include <L1GctGlobalHfSumAlgos.h>

Inheritance diagram for L1GctGlobalHfSumAlgos:
L1GctProcessor

List of all members.

Public Types

typedef
L1GctJetFinderBase::hfTowerSumsType 
hfTowerSumsType

Public Member Functions

virtual void fetchInput ()
 get input data from sources; this is the standard way to provide input
const L1GctHfBitCountsLutgetBCLut (const L1GctHfEtSumsLut::hfLutType type) const
 Get lut pointers.
const L1GctHfEtSumsLutgetESLut (const L1GctHfEtSumsLut::hfLutType type) const
L1GctWheelJetFpgagetMinusWheelJetFpga () const
 provide access to input pointer, Wheel Jet Fpga 0
L1GctWheelJetFpgagetPlusWheelJetFpga () const
 provide access to input pointer, Wheel Jet Fpga 1
std::vector< double > getThresholds (const L1GctHfEtSumsLut::hfLutType type) const
 Get thresholds.
std::vector< uint16_t > hfSumsOutput (const L1GctHfEtSumsLut::hfLutType type) const
 Access to output quantities.
std::vector< unsigned > hfSumsWord () const
 L1GctGlobalHfSumAlgos (std::vector< L1GctWheelJetFpga * > WheelJetFpga)
 Constructor needs the Wheel card Fpgas set up first.
virtual void process ()
 process the data, fill output buffers
void setupLuts (const L1CaloEtScale *scale)
 Setup luts.
bool setupOk () const
 check setup
 ~L1GctGlobalHfSumAlgos ()
 Destructor.

Protected Member Functions

virtual void resetPipelines ()
virtual void resetProcessor ()
 Separate reset methods for the processor itself and any data stored in pipelines.
virtual void setupObjects ()
 Initialise inputs with null objects for the correct bunch crossing if required.

Private Member Functions

void storeBitCount (L1GctHfEtSumsLut::hfLutType type, uint16_t value)
void storeEtSum (L1GctHfEtSumsLut::hfLutType type, uint16_t value)

Private Attributes

std::map
< L1GctHfEtSumsLut::hfLutType,
const L1GctHfBitCountsLut * > 
m_bitCountLuts
std::map
< L1GctHfEtSumsLut::hfLutType,
const L1GctHfEtSumsLut * > 
m_etSumLuts
hfTowerSumsType m_hfInputSumsMinusWheel
hfTowerSumsType m_hfInputSumsPlusWheel
std::map
< L1GctHfEtSumsLut::hfLutType,
Pipeline< uint16_t > > 
m_hfOutputSumsPipe
L1GctWheelJetFpgam_minusWheelJetFpga
L1GctWheelJetFpgam_plusWheelJetFpga
bool m_setupOk

Friends

std::ostream & operator<< (std::ostream &os, const L1GctGlobalHfSumAlgos &fpga)
 Overload << operator.

Detailed Description

Emulates the GCT summing and packing of Hf Et sums and tower-over-threshold counts.

Gets the sums from the wheel cards and packs them into the output after compression using look-up tables

Author:
Greg Heath
Date:
09/09/2008

Definition at line 27 of file L1GctGlobalHfSumAlgos.h.


Member Typedef Documentation

Definition at line 31 of file L1GctGlobalHfSumAlgos.h.


Constructor & Destructor Documentation

L1GctGlobalHfSumAlgos::L1GctGlobalHfSumAlgos ( std::vector< L1GctWheelJetFpga * >  WheelJetFpga)

Constructor needs the Wheel card Fpgas set up first.

Definition at line 11 of file L1GctGlobalHfSumAlgos.cc.

References m_minusWheelJetFpga, m_plusWheelJetFpga, m_setupOk, and L1GctProcessor::m_verbose.

                                                                                       :
  L1GctProcessor(),
  m_plusWheelJetFpga(wheelJetFpga.at(1)),
  m_minusWheelJetFpga(wheelJetFpga.at(0)),
  m_bitCountLuts(), m_etSumLuts(),
  m_hfInputSumsPlusWheel(),
  m_hfInputSumsMinusWheel(),
  m_hfOutputSumsPipe(),
  m_setupOk(true)
{
  if(wheelJetFpga.size() != 2)
    {
      m_setupOk = false;
      if (m_verbose) {
        edm::LogWarning("L1GctSetupError")
          << "L1GctGlobalHfSumAlgos::L1GctGlobalHfSumAlgos() : Global HfSum Algos has been incorrectly constructed!\n"
          << "This class needs two wheel jet fpga pointers. "
          << "Number of wheel jet fpga pointers present is " << wheelJetFpga.size() << ".\n";
      }
    }
  
  if(m_plusWheelJetFpga == 0)
    {
      m_setupOk = false;
      if (m_verbose) {
        edm::LogWarning("L1GctSetupError")
          << "L1GctGlobalHfSumAlgos::L1GctGlobalHfSumAlgos() has been incorrectly constructed!\n"
          << "Plus Wheel Jet Fpga pointer has not been set!\n";
      }
    }
  if(m_minusWheelJetFpga == 0)
    {
      m_setupOk = false;
      if (m_verbose) {
        edm::LogWarning("L1GctSetupError")
          << "L1GctGlobalHfSumAlgos::L1GctGlobalHfSumAlgos() has been incorrectly constructed!\n"
          << "Minus Wheel Jet Fpga pointer has not been set!\n";
      }
    }

    if (!m_setupOk && m_verbose) {
      edm::LogError("L1GctSetupError") << "L1GctGlobalEnergyAlgos has been incorrectly constructed";
    }
}
L1GctGlobalHfSumAlgos::~L1GctGlobalHfSumAlgos ( )

Destructor.

Definition at line 56 of file L1GctGlobalHfSumAlgos.cc.

References m_bitCountLuts, and m_etSumLuts.

{
  std::map<L1GctHfEtSumsLut::hfLutType, const L1GctHfBitCountsLut*>::const_iterator bclut = m_bitCountLuts.begin();
  while (bclut != m_bitCountLuts.end()) {
    delete bclut->second;
    bclut++;
  }
  std::map<L1GctHfEtSumsLut::hfLutType, const L1GctHfEtSumsLut*>::const_iterator eslut = m_etSumLuts.begin();
  while (eslut != m_etSumLuts.end()) {
    delete eslut->second;
    eslut++;
  }
}

Member Function Documentation

void L1GctGlobalHfSumAlgos::fetchInput ( ) [virtual]
const L1GctHfBitCountsLut * L1GctGlobalHfSumAlgos::getBCLut ( const L1GctHfEtSumsLut::hfLutType  type) const

Get lut pointers.

Definition at line 238 of file L1GctGlobalHfSumAlgos.cc.

References m_bitCountLuts.

Referenced by L1GctPrintLuts::analyze().

{
  std::map<L1GctHfEtSumsLut::hfLutType, const L1GctHfBitCountsLut*>::const_iterator bclut = m_bitCountLuts.find(type);
  if (bclut != m_bitCountLuts.end()) {
    return (bclut->second);
  } else {
   return 0;
  }
}
const L1GctHfEtSumsLut * L1GctGlobalHfSumAlgos::getESLut ( const L1GctHfEtSumsLut::hfLutType  type) const

Definition at line 248 of file L1GctGlobalHfSumAlgos.cc.

References m_etSumLuts.

Referenced by L1GctPrintLuts::analyze(), and getThresholds().

{
  std::map<L1GctHfEtSumsLut::hfLutType, const L1GctHfEtSumsLut*>::const_iterator eslut = m_etSumLuts.find(type);
  if (eslut != m_etSumLuts.end()) {
    return (eslut->second);
  } else {
    return 0;
  }
}
L1GctWheelJetFpga* L1GctGlobalHfSumAlgos::getMinusWheelJetFpga ( ) const [inline]

provide access to input pointer, Wheel Jet Fpga 0

Definition at line 64 of file L1GctGlobalHfSumAlgos.h.

References m_minusWheelJetFpga.

{ return m_minusWheelJetFpga; }
L1GctWheelJetFpga* L1GctGlobalHfSumAlgos::getPlusWheelJetFpga ( ) const [inline]

provide access to input pointer, Wheel Jet Fpga 1

Definition at line 62 of file L1GctGlobalHfSumAlgos.h.

References m_plusWheelJetFpga.

{ return m_plusWheelJetFpga; }
std::vector< double > L1GctGlobalHfSumAlgos::getThresholds ( const L1GctHfEtSumsLut::hfLutType  type) const

Get thresholds.

Definition at line 259 of file L1GctGlobalHfSumAlgos.cc.

References getESLut(), L1CaloEtScale::getThresholds(), L1GctHfEtSumsLut::lutFunction(), and query::result.

{
  std::vector<double> result;
  const L1GctHfEtSumsLut* ESLut = getESLut(type);
  if (ESLut != 0) { result = ESLut->lutFunction()->getThresholds(); }
  return result;
} 
std::vector< uint16_t > L1GctGlobalHfSumAlgos::hfSumsOutput ( const L1GctHfEtSumsLut::hfLutType  type) const

Access to output quantities.

Definition at line 170 of file L1GctGlobalHfSumAlgos.cc.

References cmsMakeMELists::contents, m_hfOutputSumsPipe, L1GctProcessor::numOfBx(), and query::result.

Referenced by hfSumsWord().

{
  std::vector<uint16_t> result(numOfBx());
  std::map<L1GctHfEtSumsLut::hfLutType, Pipeline<uint16_t> >::const_iterator lut=m_hfOutputSumsPipe.find(type);
  if (lut != m_hfOutputSumsPipe.end()) {
    result = (lut->second).contents;
  }

  return result;

}
std::vector< unsigned > L1GctGlobalHfSumAlgos::hfSumsWord ( ) const

Definition at line 182 of file L1GctGlobalHfSumAlgos.cc.

References L1GctHfEtSumsLut::bitCountNegEtaRing1, L1GctHfEtSumsLut::bitCountNegEtaRing2, L1GctHfEtSumsLut::bitCountPosEtaRing1, L1GctHfEtSumsLut::bitCountPosEtaRing2, L1GctHfEtSumsLut::etSumNegEtaRing1, L1GctHfEtSumsLut::etSumNegEtaRing2, L1GctHfEtSumsLut::etSumPosEtaRing1, L1GctHfEtSumsLut::etSumPosEtaRing2, hfSumsOutput(), L1GctProcessor::numOfBx(), and query::result.

Referenced by operator<<().

                                                            {
  std::vector<unsigned> result(numOfBx(), 0x00001000);
  std::vector<uint16_t> outputBits;

  outputBits = hfSumsOutput(L1GctHfEtSumsLut::bitCountPosEtaRing1);
  for (unsigned bx=0; bx<outputBits.size(); bx++) { result.at(bx) |= outputBits.at(bx); }

  outputBits = hfSumsOutput(L1GctHfEtSumsLut::bitCountNegEtaRing1);
  for (unsigned bx=0; bx<outputBits.size(); bx++) { result.at(bx) |= outputBits.at(bx) << 3; }

  outputBits = hfSumsOutput(L1GctHfEtSumsLut::bitCountPosEtaRing2);
  for (unsigned bx=0; bx<outputBits.size(); bx++) { result.at(bx) |= outputBits.at(bx) << 6; }

  outputBits = hfSumsOutput(L1GctHfEtSumsLut::bitCountNegEtaRing2);
  for (unsigned bx=0; bx<outputBits.size(); bx++) { result.at(bx) |= outputBits.at(bx) << 9; }

  outputBits = hfSumsOutput(L1GctHfEtSumsLut::etSumPosEtaRing1);
  for (unsigned bx=0; bx<outputBits.size(); bx++) { result.at(bx) |= outputBits.at(bx) << 12; }

  outputBits = hfSumsOutput(L1GctHfEtSumsLut::etSumNegEtaRing1);
  for (unsigned bx=0; bx<outputBits.size(); bx++) { result.at(bx) |= outputBits.at(bx) << 16; }

  outputBits = hfSumsOutput(L1GctHfEtSumsLut::etSumPosEtaRing2);
  for (unsigned bx=0; bx<outputBits.size(); bx++) { result.at(bx) |= outputBits.at(bx) << 19; }

  outputBits = hfSumsOutput(L1GctHfEtSumsLut::etSumNegEtaRing2);
  for (unsigned bx=0; bx<outputBits.size(); bx++) { result.at(bx) |= outputBits.at(bx) << 22; }

  return result;
}
void L1GctGlobalHfSumAlgos::process ( ) [virtual]

process the data, fill output buffers

Implements L1GctProcessor.

Definition at line 118 of file L1GctGlobalHfSumAlgos.cc.

References L1GctHfEtSumsLut::bitCountNegEtaRing1, L1GctHfEtSumsLut::bitCountNegEtaRing2, L1GctHfEtSumsLut::bitCountPosEtaRing1, L1GctHfEtSumsLut::bitCountPosEtaRing2, L1GctJetFinderBase::hfTowerSumsType::etSum0, L1GctJetFinderBase::hfTowerSumsType::etSum1, L1GctHfEtSumsLut::etSumNegEtaRing1, L1GctHfEtSumsLut::etSumNegEtaRing2, L1GctHfEtSumsLut::etSumPosEtaRing1, L1GctHfEtSumsLut::etSumPosEtaRing2, m_hfInputSumsMinusWheel, m_hfInputSumsPlusWheel, m_setupOk, L1GctJetFinderBase::hfTowerSumsType::nOverThreshold0, L1GctJetFinderBase::hfTowerSumsType::nOverThreshold1, storeBitCount(), storeEtSum(), and L1GctUnsignedInt< nBits >::value().

Referenced by L1GctGlobalEnergyAlgos::process().

{
  if (m_setupOk) {
    // step through the different types of Hf summed quantity
    // and store each one in turn into the relevant pipeline

    // bit count, positive eta, ring 1
    storeBitCount(L1GctHfEtSumsLut::bitCountPosEtaRing1, m_hfInputSumsPlusWheel.nOverThreshold0.value() );

    // bit count, negative eta, ring 1
    storeBitCount(L1GctHfEtSumsLut::bitCountNegEtaRing1, m_hfInputSumsMinusWheel.nOverThreshold0.value() );

    // bit count, positive eta, ring 2
    storeBitCount(L1GctHfEtSumsLut::bitCountPosEtaRing2, m_hfInputSumsPlusWheel.nOverThreshold1.value() );

    // bit count, negative eta, ring 2
    storeBitCount(L1GctHfEtSumsLut::bitCountNegEtaRing2, m_hfInputSumsMinusWheel.nOverThreshold1.value() );

    // et sum, positive eta, ring 1
    storeEtSum(L1GctHfEtSumsLut::etSumPosEtaRing1, m_hfInputSumsPlusWheel.etSum0.value() );

    // et sum, negative eta, ring 1
    storeEtSum(L1GctHfEtSumsLut::etSumNegEtaRing1, m_hfInputSumsMinusWheel.etSum0.value() );

    // et sum, positive eta, ring 2
    storeEtSum(L1GctHfEtSumsLut::etSumPosEtaRing2, m_hfInputSumsPlusWheel.etSum1.value() );

    // et sum, negative eta, ring 2
    storeEtSum(L1GctHfEtSumsLut::etSumNegEtaRing2, m_hfInputSumsMinusWheel.etSum1.value() );

  }
}
void L1GctGlobalHfSumAlgos::resetPipelines ( ) [protected, virtual]

Implements L1GctProcessor.

Definition at line 99 of file L1GctGlobalHfSumAlgos.cc.

References m_hfOutputSumsPipe, L1GctHfEtSumsLut::numberOfLutTypes, L1GctProcessor::numOfBx(), matplotRender::t, and cond::rpcobtemp::temp.

                                           {
  m_hfOutputSumsPipe.clear();
  Pipeline<uint16_t> temp(numOfBx());
  // Make one copy of the empty pipeline for each type of Hf lut
  unsigned nTypes = (unsigned) L1GctHfEtSumsLut::numberOfLutTypes;
  for (unsigned t=0; t<nTypes; ++t) {
    m_hfOutputSumsPipe[ (L1GctHfEtSumsLut::hfLutType) t] = temp;
  }
}
void L1GctGlobalHfSumAlgos::resetProcessor ( ) [protected, virtual]

Separate reset methods for the processor itself and any data stored in pipelines.

Implements L1GctProcessor.

Definition at line 94 of file L1GctGlobalHfSumAlgos.cc.

References m_hfInputSumsMinusWheel, m_hfInputSumsPlusWheel, and L1GctJetFinderBase::hfTowerSumsType::reset().

void L1GctGlobalHfSumAlgos::setupLuts ( const L1CaloEtScale scale)

Setup luts.

Definition at line 214 of file L1GctGlobalHfSumAlgos.cc.

References L1GctHfEtSumsLut::bitCountNegEtaRing1, L1GctHfEtSumsLut::bitCountNegEtaRing2, L1GctHfEtSumsLut::bitCountPosEtaRing1, L1GctHfEtSumsLut::bitCountPosEtaRing2, L1GctHfEtSumsLut::etSumNegEtaRing1, L1GctHfEtSumsLut::etSumNegEtaRing2, L1GctHfEtSumsLut::etSumPosEtaRing1, L1GctHfEtSumsLut::etSumPosEtaRing2, m_bitCountLuts, and m_etSumLuts.

Referenced by L1GlobalCaloTrigger::setupHfSumLuts().

virtual void L1GctGlobalHfSumAlgos::setupObjects ( ) [inline, protected, virtual]

Initialise inputs with null objects for the correct bunch crossing if required.

Implements L1GctProcessor.

Definition at line 75 of file L1GctGlobalHfSumAlgos.h.

{}
bool L1GctGlobalHfSumAlgos::setupOk ( ) const [inline]

check setup

Reimplemented from L1GctProcessor.

Definition at line 67 of file L1GctGlobalHfSumAlgos.h.

References m_setupOk.

Referenced by L1GctGlobalEnergyAlgos::L1GctGlobalEnergyAlgos(), and L1GctGlobalEnergyAlgos::setupOk().

{ return m_setupOk; }
void L1GctGlobalHfSumAlgos::storeBitCount ( L1GctHfEtSumsLut::hfLutType  type,
uint16_t  value 
) [private]

Definition at line 152 of file L1GctGlobalHfSumAlgos.cc.

References L1GctProcessor::bxRel(), m_bitCountLuts, and m_hfOutputSumsPipe.

Referenced by process().

                                                                                        {
  std::map<L1GctHfEtSumsLut::hfLutType, const L1GctHfBitCountsLut*>::const_iterator bclut = m_bitCountLuts.find(type);
  if (bclut != m_bitCountLuts.end()) {
    m_hfOutputSumsPipe[type].store( (*bclut->second)[value], bxRel() );
  }
}
void L1GctGlobalHfSumAlgos::storeEtSum ( L1GctHfEtSumsLut::hfLutType  type,
uint16_t  value 
) [private]

Definition at line 160 of file L1GctGlobalHfSumAlgos.cc.

References L1GctProcessor::bxRel(), m_etSumLuts, and m_hfOutputSumsPipe.

Referenced by process().

                                                                                     {
  std::map<L1GctHfEtSumsLut::hfLutType, const L1GctHfEtSumsLut*>::const_iterator eslut = m_etSumLuts.find(type);
  if (eslut != m_etSumLuts.end()) {
    m_hfOutputSumsPipe[type].store( (*eslut->second)[value], bxRel() );
  }
}

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const L1GctGlobalHfSumAlgos fpga 
) [friend]

Overload << operator.

Definition at line 70 of file L1GctGlobalHfSumAlgos.cc.

{
  os << "===L1GctGlobalHfSumAlgos===" << std::endl;
  os << "WheelJetFpga* plus  = " << fpga.m_plusWheelJetFpga << std::endl;
  os << "Plus wheel inputs:" << std::endl;
  os << "Bit counts ring 1: " << fpga.m_hfInputSumsPlusWheel.nOverThreshold0 
     << ", ring 2: " << fpga.m_hfInputSumsPlusWheel.nOverThreshold1 << std::endl;
  os << "Et sums ring 1: " << fpga.m_hfInputSumsPlusWheel.etSum0 
     << ", ring 2: " << fpga.m_hfInputSumsPlusWheel.etSum1 << std::endl;
  os << "WheelJetFpga* minus = " << fpga.m_minusWheelJetFpga << std::endl;
  os << "Minus wheel inputs:" << std::endl;
  os << "Bit counts ring 1: " << fpga.m_hfInputSumsMinusWheel.nOverThreshold0 
     << ", ring 2: " << fpga.m_hfInputSumsMinusWheel.nOverThreshold1 << std::endl;
  os << "Et sums ring 1: " << fpga.m_hfInputSumsMinusWheel.etSum0 
     << ", ring 2: " << fpga.m_hfInputSumsMinusWheel.etSum1 << std::endl;

  int bxZero = -fpga.bxMin();
  if (bxZero>=0 && bxZero<fpga.numOfBx()) {
    os << "Output word " << std::hex << fpga.hfSumsWord().at(bxZero) << std::dec << std::endl;
  }

  return os;
}

Member Data Documentation

Definition at line 83 of file L1GctGlobalHfSumAlgos.h.

Referenced by getBCLut(), setupLuts(), storeBitCount(), and ~L1GctGlobalHfSumAlgos().

Definition at line 84 of file L1GctGlobalHfSumAlgos.h.

Referenced by getESLut(), setupLuts(), storeEtSum(), and ~L1GctGlobalHfSumAlgos().

Definition at line 88 of file L1GctGlobalHfSumAlgos.h.

Referenced by fetchInput(), operator<<(), process(), and resetProcessor().

Definition at line 87 of file L1GctGlobalHfSumAlgos.h.

Referenced by fetchInput(), operator<<(), process(), and resetProcessor().

Definition at line 91 of file L1GctGlobalHfSumAlgos.h.

Referenced by hfSumsOutput(), resetPipelines(), storeBitCount(), and storeEtSum().

Definition at line 93 of file L1GctGlobalHfSumAlgos.h.

Referenced by fetchInput(), L1GctGlobalHfSumAlgos(), process(), and setupOk().