Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-02 03:45:50

0001 #ifndef L1GCTWHEELJETFPGA_H_
0002 #define L1GCTWHEELJETFPGA_H_
0003 
0004 /*!
0005 * \class L1GctWheelJetFpga
0006 * \brief Represents a GCT Wheel Jet FPGA
0007 *
0008 *  Takes as input the Jet and Ht data from one eta half of CMS
0009 *  (three leaf cards of data) and summarises/reduces this data
0010 *  before passing it onto the L1GctJetFinalStage processing that
0011 *  takes place (physically) on the concentrator card.
0012 * 
0013 * \author Jim Brooke & Robert Frazier
0014 * \date May 2006
0015 */
0016 
0017 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCand.h"
0018 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctEtHad.h"
0019 
0020 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctProcessor.h"
0021 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetLeafCard.h"
0022 
0023 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctUnsignedInt.h"
0024 
0025 class L1GctJetSorter;
0026 
0027 #include <vector>
0028 
0029 class L1GctWheelJetFpga : public L1GctProcessor {
0030 public:
0031   typedef std::vector<L1GctJetCand> JetVector;
0032   typedef L1GctTwosComplement<L1GctInternHtMiss::kMissHxOrHyNBits> htComponentType;
0033   typedef L1GctJetLeafCard::hfTowerSumsType hfTowerSumsType;
0034 
0035   /// Max number of jets of each type we output.
0036   static const int MAX_JETS_OUT;
0037 
0038   /// Max number of leaf card pointers
0039   static const unsigned int MAX_LEAF_CARDS;
0040 
0041   /// Max number of jets input from each leaf card
0042   static const unsigned int MAX_JETS_PER_LEAF;
0043 
0044   /// id must be 0 / 1 for -ve/+ve eta halves of CMS
0045   L1GctWheelJetFpga(int id, const std::vector<L1GctJetLeafCard*>& inputLeafCards);
0046 
0047   /// destructor
0048   ~L1GctWheelJetFpga() override;
0049 
0050   /// Overload << operator
0051   friend std::ostream& operator<<(std::ostream& os, const L1GctWheelJetFpga& fpga);
0052 
0053   /// get input data from sources
0054   void fetchInput() override;
0055 
0056   /// process the data, fill output buffers
0057   void process() override;
0058 
0059   /// set input data
0060   void setInputJet(int i, const L1GctJetCand& jet);
0061 
0062   /// get the input jets. Jets 0-5 from leaf card 0, jetfinderA.  Jets 6-11 from leaf card 0, jetfinder B... etc.
0063   JetVector getInputJets() const { return m_inputJets; }
0064 
0065   /// get the input Ht components
0066   htComponentType inputHx(unsigned leafnum) const { return m_inputHx.at(leafnum); }
0067   htComponentType inputHy(unsigned leafnum) const { return m_inputHy.at(leafnum); }
0068 
0069   /// get the input Hf Sums
0070   hfTowerSumsType inputHfSums(unsigned leafnum) const { return m_inputHfSums.at(leafnum); }
0071 
0072   /// get the output jets
0073   JetVector getCentralJets() const { return m_centralJets; }
0074 
0075   /// get the output jets
0076   JetVector getForwardJets() const { return m_forwardJets; }
0077 
0078   /// get the output jets
0079   JetVector getTauJets() const { return m_tauJets; }
0080 
0081   /// get the output Ht components
0082   htComponentType getOutputHx() const { return m_outputHx; }
0083   htComponentType getOutputHy() const { return m_outputHy; }
0084 
0085   /// get the output Hf Sums
0086   hfTowerSumsType getOutputHfSums() const { return m_outputHfSums; }
0087 
0088   /// Public access to setup check
0089   bool setupOk() const { return checkSetup(); }
0090 
0091   /// get the Et sums in internal component format
0092   std::vector<L1GctInternHtMiss> getInternalHtMiss() const;
0093 
0094 protected:
0095   /// Separate reset methods for the processor itself and any data stored in pipelines
0096   void resetProcessor() override;
0097   void resetPipelines() override;
0098 
0099   /// Initialise inputs with null objects for the correct bunch crossing if required
0100   void setupObjects() override;
0101 
0102 private:
0103   static const int MAX_JETS_IN;  ///< Maximum number of jets we can have as input
0104 
0105   /// algo ID
0106   int m_id;
0107 
0108   /// the jet leaf cards
0109   std::vector<L1GctJetLeafCard*> m_inputLeafCards;
0110 
0111   /// Jet sorters
0112   L1GctJetSorter* m_centralJetSorter;
0113   L1GctJetSorter* m_forwardJetSorter;
0114   L1GctJetSorter* m_tauJetSorter;
0115 
0116   /// input data. Jets 0-5 from leaf card 0, jetfinderA.  Jets 6-11 from leaf card 0, jetfinder B... etc.
0117   JetVector m_inputJets;
0118 
0119   // Holds the all the various inputted jets, re-addressed using proper GCT->GT jet addressing
0120   JetVector m_rawCentralJets;
0121   JetVector m_rawForwardJets;
0122   JetVector m_rawTauJets;
0123 
0124   // input Ht component sums from each leaf card
0125   std::vector<htComponentType> m_inputHx;
0126   std::vector<htComponentType> m_inputHy;
0127 
0128   // input Hf Et sums from each leaf card
0129   std::vector<hfTowerSumsType> m_inputHfSums;
0130 
0131   // output data
0132   JetVector m_centralJets;
0133   JetVector m_forwardJets;
0134   JetVector m_tauJets;
0135 
0136   // data sent to GlobalEnergyAlgos
0137   htComponentType m_outputHx;
0138   htComponentType m_outputHy;
0139   hfTowerSumsType m_outputHfSums;
0140 
0141   Pipeline<htComponentType> m_outputHxPipe;
0142   Pipeline<htComponentType> m_outputHyPipe;
0143 
0144   //PRIVATE METHODS
0145   /// Check the setup, independently of how we have been constructed
0146   bool checkSetup() const;
0147   /// Puts the output from a jetfinder into the correct index range of the m_inputJets array.
0148   void storeJets(const JetVector& jets, unsigned short iLeaf, unsigned short offset);
0149   /// Classifies jets into central, forward or tau.
0150   void classifyJets();
0151   /// Initialises all the jet vectors with jets of the correct type.
0152   void setupJetsVectors(const int16_t bx);
0153 };
0154 
0155 std::ostream& operator<<(std::ostream& os, const L1GctWheelJetFpga& fpga);
0156 
0157 #endif /*L1GCTWHEELJETFPGA_H_*/