Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:51

0001 #ifndef L1GCTWHEELENERGYFPGA_H_
0002 #define L1GCTWHEELENERGYFPGA_H_
0003 
0004 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctEtTotal.h"
0005 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctEtMiss.h"
0006 
0007 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctProcessor.h"
0008 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetLeafCard.h"
0009 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctTwosComplement.h"
0010 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctUnsignedInt.h"
0011 
0012 #include <vector>
0013 
0014 class L1GctJetLeafCard;
0015 
0016 /*!
0017  * \class L1GctWheelEnergyFpga
0018  * \brief Emulates the energy summing on a GCT Wheel card
0019  *
0020  * This class carries out the summing of total Et, and
0021  * missing Et components Ex and Ey, for a single Wheel.
0022  * The inputs come from the three Leaf cards and the
0023  * outputs are sent to the L1GctGlobalEnergyAlgos class.
0024  *
0025  * \author Jim Brooke & Greg Heath
0026  * \date 20/2/2006
0027  * 
0028  */
0029 
0030 class L1GctWheelEnergyFpga : public L1GctProcessor {
0031 public:
0032   /// typedefs for energy values in fixed numbers of bits
0033   typedef L1GctUnsignedInt<L1GctInternEtSum::kTotEtOrHtNBits> etTotalType;
0034   typedef L1GctUnsignedInt<L1GctInternEtSum::kTotEtOrHtNBits> etHadType;
0035   typedef L1GctTwosComplement<L1GctInternEtSum::kMissExOrEyNBits> etComponentType;
0036 
0037   enum maxValues {
0038     etTotalMaxValue = L1GctInternEtSum::kTotEtOrHtMaxValue,
0039     htTotalMaxValue = L1GctInternEtSum::kTotEtOrHtMaxValue
0040   };
0041 
0042   /// Max number of leaf card pointers
0043   static const unsigned int MAX_LEAF_CARDS;
0044 
0045   /// Constructor, needs the Leaf cards to be set up first. id should be 0 or 1.
0046   L1GctWheelEnergyFpga(int id, const std::vector<L1GctJetLeafCard*>& leafCards);
0047   /// Destructor
0048   ~L1GctWheelEnergyFpga() override;
0049 
0050   /// Overload << operator
0051   friend std::ostream& operator<<(std::ostream& os, const L1GctWheelEnergyFpga& fpga);
0052 
0053   /// get input data from sources; this is the standard way to provide input
0054   void fetchInput() override;
0055 
0056   /// process the data, fill output buffers
0057   void process() override;
0058 
0059   /// set input data; not used in normal operation
0060   void setInputEnergy(unsigned i, int ex, int ey, unsigned et, unsigned ht);
0061 
0062   /// provide access to input Leaf card pointer (0-2)
0063   L1GctJetLeafCard* getinputLeafCard(unsigned leafnum) const { return m_inputLeafCards.at(leafnum); }
0064 
0065   /// get input Ex value from a Leaf card (0-2)
0066   inline etComponentType getInputEx(unsigned leafnum) const { return m_inputEx.at(leafnum); }
0067   /// get input Ey value from a Leaf card (0-2)
0068   inline etComponentType getInputEy(unsigned leafnum) const { return m_inputEy.at(leafnum); }
0069   /// get input Et value from a Leaf card (0-2)
0070   inline etTotalType getInputEt(unsigned leafnum) const { return m_inputEt.at(leafnum); }
0071   /// get input Ht value from a Leaf card (0-2)
0072   inline etHadType inputHt(unsigned leafnum) const { return m_inputHt.at(leafnum); }
0073 
0074   /// get output Ex value
0075   inline etComponentType getOutputEx() const { return m_outputEx; }
0076   /// get output Ey value
0077   inline etComponentType getOutputEy() const { return m_outputEy; }
0078   /// get output Et value
0079   inline etTotalType getOutputEt() const { return m_outputEt; }
0080   /// get the output Ht
0081   inline etHadType getOutputHt() const { return m_outputHt; }
0082 
0083   /// get the Et sums in internal component format
0084   std::vector<L1GctInternEtSum> getInternalEtSums() const;
0085 
0086   /// check the setup
0087   bool setupOk() const { return m_setupOk; }
0088 
0089 protected:
0090   /// Separate reset methods for the processor itself and any data stored in pipelines
0091   void resetProcessor() override;
0092   void resetPipelines() override;
0093 
0094   /// Initialise inputs with null objects for the correct bunch crossing if required
0095   void setupObjects() override {}
0096 
0097 private:
0098   ///
0099   /// algo ID
0100   int m_id;
0101   ///
0102   /// the jet leaf card
0103   std::vector<L1GctJetLeafCard*> m_inputLeafCards;
0104   ///
0105   /// the input components from each input card
0106   std::vector<etComponentType> m_inputEx;
0107   std::vector<etComponentType> m_inputEy;
0108   std::vector<etTotalType> m_inputEt;
0109   std::vector<etHadType> m_inputHt;
0110   ///
0111   /// output data
0112   etComponentType m_outputEx;
0113   etComponentType m_outputEy;
0114   etTotalType m_outputEt;
0115   etHadType m_outputHt;
0116 
0117   /// check the setup
0118   bool m_setupOk;
0119 
0120   /// record the output data history
0121   Pipeline<etComponentType> m_outputExPipe;
0122   Pipeline<etComponentType> m_outputEyPipe;
0123   Pipeline<etTotalType> m_outputEtPipe;
0124   Pipeline<etHadType> m_outputHtPipe;
0125 };
0126 
0127 std::ostream& operator<<(std::ostream& os, const L1GctWheelEnergyFpga& fpga);
0128 
0129 #endif /*L1GCTWHEELENERGYFPGA_H_*/