CMS 3D CMS Logo

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

L1GctWheelEnergyFpga Class Reference

Emulates the energy summing on a GCT Wheel card. More...

#include <L1GctWheelEnergyFpga.h>

Inheritance diagram for L1GctWheelEnergyFpga:
L1GctProcessor

List of all members.

Public Types

typedef L1GctTwosComplement
< L1GctInternEtSum::kMissExOrEyNBits > 
etComponentType
typedef L1GctUnsignedInt
< L1GctInternEtSum::kTotEtOrHtNBits > 
etHadType
typedef L1GctUnsignedInt
< L1GctInternEtSum::kTotEtOrHtNBits > 
etTotalType
 typedefs for energy values in fixed numbers of bits
enum  maxValues { etTotalMaxValue = L1GctInternEtSum::kTotEtOrHtMaxValue, htTotalMaxValue = L1GctInternEtSum::kTotEtOrHtMaxValue }

Public Member Functions

virtual void fetchInput ()
 get input data from sources; this is the standard way to provide input
etTotalType getInputEt (unsigned leafnum) const
 get input Et value from a Leaf card (0-2)
etComponentType getInputEx (unsigned leafnum) const
 get input Ex value from a Leaf card (0-2)
etComponentType getInputEy (unsigned leafnum) const
 get input Ey value from a Leaf card (0-2)
L1GctJetLeafCardgetinputLeafCard (unsigned leafnum) const
 provide access to input Leaf card pointer (0-2)
std::vector< L1GctInternEtSumgetInternalEtSums () const
 get the Et sums in internal component format
etTotalType getOutputEt () const
 get output Et value
etComponentType getOutputEx () const
 get output Ex value
etComponentType getOutputEy () const
 get output Ey value
etHadType getOutputHt () const
 get the output Ht
etHadType inputHt (unsigned leafnum) const
 get input Ht value from a Leaf card (0-2)
 L1GctWheelEnergyFpga (int id, std::vector< L1GctJetLeafCard * > leafCards)
 Constructor, needs the Leaf cards to be set up first. id should be 0 or 1.
virtual void process ()
 process the data, fill output buffers
void setInputEnergy (unsigned i, int ex, int ey, unsigned et, unsigned ht)
 set input data; not used in normal operation
bool setupOk () const
 check the setup
 ~L1GctWheelEnergyFpga ()
 Destructor.

Static Public Attributes

static const unsigned int MAX_LEAF_CARDS = L1GctWheelJetFpga::MAX_LEAF_CARDS
 Max number of leaf card pointers.

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 Attributes

int m_id
std::vector< etTotalTypem_inputEt
std::vector< etComponentTypem_inputEx
std::vector< etComponentTypem_inputEy
std::vector< etHadTypem_inputHt
std::vector< L1GctJetLeafCard * > m_inputLeafCards
etTotalType m_outputEt
Pipeline< etTotalTypem_outputEtPipe
etComponentType m_outputEx
Pipeline< etComponentTypem_outputExPipe
 record the output data history
etComponentType m_outputEy
Pipeline< etComponentTypem_outputEyPipe
etHadType m_outputHt
Pipeline< etHadTypem_outputHtPipe
bool m_setupOk
 check the setup

Friends

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

Detailed Description

Emulates the energy summing on a GCT Wheel card.

This class carries out the summing of total Et, and missing Et components Ex and Ey, for a single Wheel. The inputs come from the three Leaf cards and the outputs are sent to the L1GctGlobalEnergyAlgos class.

Author:
Jim Brooke & Greg Heath
Date:
20/2/2006

Definition at line 30 of file L1GctWheelEnergyFpga.h.


Member Typedef Documentation

typedef L1GctTwosComplement< L1GctInternEtSum::kMissExOrEyNBits > L1GctWheelEnergyFpga::etComponentType

Definition at line 36 of file L1GctWheelEnergyFpga.h.

typedef L1GctUnsignedInt<L1GctInternEtSum::kTotEtOrHtNBits> L1GctWheelEnergyFpga::etHadType

Definition at line 35 of file L1GctWheelEnergyFpga.h.

typedef L1GctUnsignedInt<L1GctInternEtSum::kTotEtOrHtNBits> L1GctWheelEnergyFpga::etTotalType

typedefs for energy values in fixed numbers of bits

Definition at line 34 of file L1GctWheelEnergyFpga.h.


Member Enumeration Documentation

Enumerator:
etTotalMaxValue 
htTotalMaxValue 

Definition at line 38 of file L1GctWheelEnergyFpga.h.


Constructor & Destructor Documentation

L1GctWheelEnergyFpga::L1GctWheelEnergyFpga ( int  id,
std::vector< L1GctJetLeafCard * >  leafCards 
)

Constructor, needs the Leaf cards to be set up first. id should be 0 or 1.

Definition at line 15 of file L1GctWheelEnergyFpga.cc.

References i, m_id, m_inputLeafCards, m_setupOk, L1GctProcessor::m_verbose, and MAX_LEAF_CARDS.

                                                                                      :
  L1GctProcessor(),
  m_id(id),
  m_inputLeafCards(leafCards),
  m_inputEx(MAX_LEAF_CARDS),
  m_inputEy(MAX_LEAF_CARDS),
  m_inputEt(MAX_LEAF_CARDS),
  m_inputHt(MAX_LEAF_CARDS),
  m_outputEx(0), m_outputEy(0), m_outputEt(0), m_outputHt(0),
  m_setupOk(true),
  m_outputExPipe(), m_outputEyPipe(), m_outputEtPipe(), m_outputHtPipe()
{
  //Check wheelEnergyFpga setup
  if(m_id != 0 && m_id != 1)
    {
      m_setupOk = false;
      if (m_verbose) {
        edm::LogWarning("L1GctSetupError")
          << "L1GctWheelEnergyFpga::L1GctWheelEnergyFpga() : Wheel Energy Fpga ID " << m_id << " has been incorrectly constructed!\n"
          << "ID number should be 0 or 1.\n";
      } 
    }
  
  if(m_inputLeafCards.size() != MAX_LEAF_CARDS)
    {
      m_setupOk = false;
      if (m_verbose) {
        edm::LogWarning("L1GctSetupError")
          << "L1GctWheelEnergyFpga::L1GctWheelEnergyFpga() : Wheel Energy Fpga ID " << m_id << " has been incorrectly constructed!\n"
          << "This class needs " << MAX_LEAF_CARDS << " leaf card pointers, yet only " << m_inputLeafCards.size()
          << " leaf card pointers are present.\n";
      }
    }
  
  for(unsigned int i = 0; i < m_inputLeafCards.size(); ++i)
    {
      if(m_inputLeafCards.at(i) == 0)
        {
          m_setupOk = false;
          if (m_verbose) {
            edm::LogWarning("L1GctSetupError")
              << "L1GctWheelEnergyFpga::L1GctWheelEnergyFpga() : Wheel Energy Fpga ID " << m_id << " has been incorrectly constructed!\n"
              << "Input Leaf card pointer " << i << " has not been set!\n";
          }
        }
    }
  if (!m_setupOk && m_verbose) {
    edm::LogError("L1GctSetupError") << "L1GctWheelEnergyFpga has been incorrectly constructed";
  }
}
L1GctWheelEnergyFpga::~L1GctWheelEnergyFpga ( )

Destructor.

Definition at line 66 of file L1GctWheelEnergyFpga.cc.

{
}

Member Function Documentation

void L1GctWheelEnergyFpga::fetchInput ( ) [virtual]

get input data from sources; this is the standard way to provide input

Implements L1GctProcessor.

Definition at line 129 of file L1GctWheelEnergyFpga.cc.

References i, m_inputEt, m_inputEx, m_inputEy, m_inputHt, m_inputLeafCards, m_setupOk, and MAX_LEAF_CARDS.

{
  if (m_setupOk) {
    // Fetch the output values from each of our input leaf cards.
    for (unsigned int i=0; i<MAX_LEAF_CARDS; i++) {
      m_inputEx.at(i) = m_inputLeafCards.at(i)->getOutputEx();
      m_inputEy.at(i) = m_inputLeafCards.at(i)->getOutputEy();
      m_inputEt.at(i) = m_inputLeafCards.at(i)->getOutputEt();
      m_inputHt.at(i) = m_inputLeafCards.at(i)->getOutputHt();
    }
  }
}
etTotalType L1GctWheelEnergyFpga::getInputEt ( unsigned  leafnum) const [inline]

get input Et value from a Leaf card (0-2)

Definition at line 71 of file L1GctWheelEnergyFpga.h.

References m_inputEt.

{ return m_inputEt.at(leafnum); }
etComponentType L1GctWheelEnergyFpga::getInputEx ( unsigned  leafnum) const [inline]

get input Ex value from a Leaf card (0-2)

Definition at line 67 of file L1GctWheelEnergyFpga.h.

References m_inputEx.

{ return m_inputEx.at(leafnum); }
etComponentType L1GctWheelEnergyFpga::getInputEy ( unsigned  leafnum) const [inline]

get input Ey value from a Leaf card (0-2)

Definition at line 69 of file L1GctWheelEnergyFpga.h.

References m_inputEy.

{ return m_inputEy.at(leafnum); }
L1GctJetLeafCard* L1GctWheelEnergyFpga::getinputLeafCard ( unsigned  leafnum) const [inline]

provide access to input Leaf card pointer (0-2)

Definition at line 64 of file L1GctWheelEnergyFpga.h.

References m_inputLeafCards.

{ return m_inputLeafCards.at(leafnum); }
std::vector< L1GctInternEtSum > L1GctWheelEnergyFpga::getInternalEtSums ( ) const

get the Et sums in internal component format

Definition at line 175 of file L1GctWheelEnergyFpga.cc.

References L1GctProcessor::bxMin(), L1GctInternEtSum::fromEmulatorMissEtxOrEty(), L1GctInternEtSum::fromEmulatorTotalEtOrHt(), m_outputEtPipe, m_outputExPipe, m_outputEyPipe, m_outputHtPipe, L1GctProcessor::numOfBx(), and query::result.

{

  std::vector< L1GctInternEtSum > result;
  for (int bx=0; bx<numOfBx(); bx++) {
    result.push_back( L1GctInternEtSum::fromEmulatorMissEtxOrEty( m_outputExPipe.contents.at(bx).value(),
                                                                  m_outputExPipe.contents.at(bx).overFlow(),
                                                                  static_cast<int16_t> (bx-bxMin()) ) );
    result.push_back( L1GctInternEtSum::fromEmulatorMissEtxOrEty( m_outputEyPipe.contents.at(bx).value(),
                                                                  m_outputEyPipe.contents.at(bx).overFlow(),
                                                                  static_cast<int16_t> (bx-bxMin()) ) );
    result.push_back( L1GctInternEtSum::fromEmulatorTotalEtOrHt( m_outputEtPipe.contents.at(bx).value(),
                                                                 m_outputEtPipe.contents.at(bx).overFlow(),
                                                                 static_cast<int16_t> (bx-bxMin()) ) );
    result.push_back( L1GctInternEtSum::fromEmulatorTotalEtOrHt( m_outputHtPipe.contents.at(bx).value(),
                                                                 m_outputHtPipe.contents.at(bx).overFlow(),
                                                                 static_cast<int16_t> (bx-bxMin()) ) );
  }
  return result;
}
etTotalType L1GctWheelEnergyFpga::getOutputEt ( ) const [inline]

get output Et value

Definition at line 80 of file L1GctWheelEnergyFpga.h.

References m_outputEt.

Referenced by L1GctGlobalEnergyAlgos::fetchInput().

{ return m_outputEt; }    
etComponentType L1GctWheelEnergyFpga::getOutputEx ( ) const [inline]

get output Ex value

Definition at line 76 of file L1GctWheelEnergyFpga.h.

References m_outputEx.

Referenced by L1GctGlobalEnergyAlgos::fetchInput().

{ return m_outputEx; }
etComponentType L1GctWheelEnergyFpga::getOutputEy ( ) const [inline]

get output Ey value

Definition at line 78 of file L1GctWheelEnergyFpga.h.

References m_outputEy.

Referenced by L1GctGlobalEnergyAlgos::fetchInput().

{ return m_outputEy; }
etHadType L1GctWheelEnergyFpga::getOutputHt ( ) const [inline]

get the output Ht

Definition at line 82 of file L1GctWheelEnergyFpga.h.

References m_outputHt.

Referenced by L1GctGlobalEnergyAlgos::fetchInput().

{ return m_outputHt; }
etHadType L1GctWheelEnergyFpga::inputHt ( unsigned  leafnum) const [inline]

get input Ht value from a Leaf card (0-2)

Definition at line 73 of file L1GctWheelEnergyFpga.h.

References m_inputHt.

{ return m_inputHt.at(leafnum); }
void L1GctWheelEnergyFpga::process ( ) [virtual]
void L1GctWheelEnergyFpga::resetPipelines ( ) [protected, virtual]
void L1GctWheelEnergyFpga::resetProcessor ( ) [protected, virtual]

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

Implements L1GctProcessor.

Definition at line 107 of file L1GctWheelEnergyFpga.cc.

References i, m_inputEt, m_inputEx, m_inputEy, m_inputHt, m_outputEt, m_outputEx, m_outputEy, m_outputHt, MAX_LEAF_CARDS, L1GctUnsignedInt< nBits >::reset(), and L1GctTwosComplement< nBits >::reset().

{
  for (unsigned int i=0; i<MAX_LEAF_CARDS; i++) {
    m_inputEx.at(i).reset();
    m_inputEy.at(i).reset();
    m_inputEt.at(i).reset();
    m_inputHt.at(i).reset();
  }
  m_outputEx.reset();
  m_outputEy.reset();
  m_outputEt.reset();
  m_outputHt.reset();
}
void L1GctWheelEnergyFpga::setInputEnergy ( unsigned  i,
int  ex,
int  ey,
unsigned  et,
unsigned  ht 
)

set input data; not used in normal operation

set input data

Definition at line 162 of file L1GctWheelEnergyFpga.cc.

References m_inputEt, m_inputEx, m_inputEy, m_inputHt, and MAX_LEAF_CARDS.

{
  // Set the three input values from this Leaf card
  if (i<MAX_LEAF_CARDS) { // i >= 0, since i is unsigned
    m_inputEx.at(i).setValue(ex);
    m_inputEy.at(i).setValue(ey);
    m_inputEt.at(i).setValue(et);
    m_inputHt.at(i).setValue(ht);
  }

}
virtual void L1GctWheelEnergyFpga::setupObjects ( ) [inline, protected, virtual]

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

Implements L1GctProcessor.

Definition at line 97 of file L1GctWheelEnergyFpga.h.

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

check the setup

Reimplemented from L1GctProcessor.

Definition at line 88 of file L1GctWheelEnergyFpga.h.

References m_setupOk.

{ return m_setupOk; }

Friends And Related Function Documentation

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

Overload << operator.


Member Data Documentation

algo ID

Definition at line 103 of file L1GctWheelEnergyFpga.h.

Referenced by L1GctWheelEnergyFpga(), and operator<<().

std::vector< etTotalType > L1GctWheelEnergyFpga::m_inputEt [private]

the input components from each input card

Definition at line 109 of file L1GctWheelEnergyFpga.h.

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

std::vector< etHadType > L1GctWheelEnergyFpga::m_inputHt [private]

the jet leaf card

Definition at line 106 of file L1GctWheelEnergyFpga.h.

Referenced by fetchInput(), getinputLeafCard(), L1GctWheelEnergyFpga(), and operator<<().

Definition at line 117 of file L1GctWheelEnergyFpga.h.

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

Definition at line 126 of file L1GctWheelEnergyFpga.h.

Referenced by getInternalEtSums(), process(), and resetPipelines().

output data

Definition at line 115 of file L1GctWheelEnergyFpga.h.

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

record the output data history

Definition at line 124 of file L1GctWheelEnergyFpga.h.

Referenced by getInternalEtSums(), process(), and resetPipelines().

Definition at line 116 of file L1GctWheelEnergyFpga.h.

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

Definition at line 125 of file L1GctWheelEnergyFpga.h.

Referenced by getInternalEtSums(), process(), and resetPipelines().

Definition at line 118 of file L1GctWheelEnergyFpga.h.

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

Definition at line 127 of file L1GctWheelEnergyFpga.h.

Referenced by getInternalEtSums(), process(), and resetPipelines().

check the setup

Definition at line 121 of file L1GctWheelEnergyFpga.h.

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

Max number of leaf card pointers.

Definition at line 44 of file L1GctWheelEnergyFpga.h.

Referenced by fetchInput(), L1GctWheelEnergyFpga(), resetProcessor(), and setInputEnergy().