Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef L1GCTGLOBALHFSUMALGOS_H_
0002 #define L1GCTGLOBALHFSUMALGOS_H_
0003 
0004 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctProcessor.h"
0005 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetFinderBase.h"
0006 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctHfEtSumsLut.h"
0007 
0008 #include <vector>
0009 #include <map>
0010 
0011 class L1GctWheelJetFpga;
0012 class L1GctHfLutSetup;
0013 class L1GctHfBitCountsLut;
0014 
0015 /*!
0016  * \class L1GctGlobalHfSumAlgos
0017  * \brief Emulates the GCT summing and packing of Hf Et sums and tower-over-threshold counts
0018  *
0019  * Gets the sums from the wheel cards and packs them
0020  * into the output after compression using look-up tables
0021  *
0022  * \author Greg Heath
0023  * \date 09/09/2008
0024  * 
0025  */
0026 
0027 class L1GctGlobalHfSumAlgos : public L1GctProcessor {
0028 public:
0029   typedef L1GctJetFinderBase::hfTowerSumsType hfTowerSumsType;
0030 
0031   /// Constructor needs the Wheel card Fpgas set up first
0032   L1GctGlobalHfSumAlgos(const std::vector<L1GctWheelJetFpga*>& WheelJetFpga);
0033   /// Destructor
0034   ~L1GctGlobalHfSumAlgos() override;
0035 
0036   /// Overload << operator
0037   friend std::ostream& operator<<(std::ostream& os, const L1GctGlobalHfSumAlgos& fpga);
0038 
0039   /// get input data from sources; this is the standard way to provide input
0040   void fetchInput() override;
0041 
0042   /// process the data, fill output buffers
0043   void process() override;
0044 
0045   /// Access to output quantities
0046   std::vector<uint16_t> hfSumsOutput(const L1GctHfEtSumsLut::hfLutType type) const;
0047   std::vector<unsigned> hfSumsWord() const;
0048 
0049   /// Setup luts
0050   void setupLuts(const L1CaloEtScale* scale);
0051 
0052   /// Get lut pointers
0053   const L1GctHfBitCountsLut* getBCLut(const L1GctHfEtSumsLut::hfLutType type) const;
0054   const L1GctHfEtSumsLut* getESLut(const L1GctHfEtSumsLut::hfLutType type) const;
0055 
0056   /// Get thresholds
0057   std::vector<double> getThresholds(const L1GctHfEtSumsLut::hfLutType type) const;
0058 
0059   /// provide access to input pointer, Wheel Jet Fpga 1
0060   L1GctWheelJetFpga* getPlusWheelJetFpga() const { return m_plusWheelJetFpga; }
0061   /// provide access to input pointer, Wheel Jet Fpga 0
0062   L1GctWheelJetFpga* getMinusWheelJetFpga() const { return m_minusWheelJetFpga; }
0063 
0064   /// check setup
0065   bool setupOk() const { return m_setupOk; }
0066 
0067 protected:
0068   /// Separate reset methods for the processor itself and any data stored in pipelines
0069   void resetProcessor() override;
0070   void resetPipelines() override;
0071 
0072   /// Initialise inputs with null objects for the correct bunch crossing if required
0073   void setupObjects() override {}
0074 
0075 private:
0076   // Here are the algorithm types we get our inputs from
0077   L1GctWheelJetFpga* m_plusWheelJetFpga;
0078   L1GctWheelJetFpga* m_minusWheelJetFpga;
0079 
0080   // Here are the lookup tables
0081   std::map<L1GctHfEtSumsLut::hfLutType, const L1GctHfBitCountsLut*> m_bitCountLuts;
0082   std::map<L1GctHfEtSumsLut::hfLutType, const L1GctHfEtSumsLut*> m_etSumLuts;
0083 
0084   // Input data for one bunch crossing
0085   hfTowerSumsType m_hfInputSumsPlusWheel;
0086   hfTowerSumsType m_hfInputSumsMinusWheel;
0087 
0088   // Output data
0089   std::map<L1GctHfEtSumsLut::hfLutType, Pipeline<uint16_t> > m_hfOutputSumsPipe;
0090 
0091   bool m_setupOk;
0092 
0093   // private methods
0094   // Convert bit count value using LUT and store in the pipeline
0095   void storeBitCount(L1GctHfEtSumsLut::hfLutType type, uint16_t value);
0096   // Convert et sum value using LUT and store in the pipeline
0097   void storeEtSum(L1GctHfEtSumsLut::hfLutType type, uint16_t value);
0098 };
0099 
0100 std::ostream& operator<<(std::ostream& os, const L1GctGlobalHfSumAlgos& fpga);
0101 
0102 #endif /*L1GCTGLOBALHFSUMALGOS_H_*/