Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef L1GCTJETLEAFCARD_H_
0002 #define L1GCTJETLEAFCARD_H_
0003 
0004 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctEtTotal.h"
0005 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctEtHad.h"
0006 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctEtMiss.h"
0007 
0008 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctProcessor.h"
0009 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetFinderBase.h"
0010 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctTwosComplement.h"
0011 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctUnsignedInt.h"
0012 
0013 #include <vector>
0014 
0015 /*
0016  * \class L1GctJetLeafCard
0017  * \brief Emulates a leaf card programmed for jetfinding
0018  *
0019  * Represents a GCT Leaf Card
0020  * programmed for jet finding
0021  * author: Jim Brooke
0022  * date: 20/2/2006
0023  * 
0024  */
0025 
0026 class L1GctJetCand;
0027 
0028 class L1GctJetLeafCard : public L1GctProcessor {
0029 public:
0030   //Type declaration
0031   enum jetFinderType { tdrJetFinder, hardwareJetFinder, nullJetFinder };
0032 
0033   //Statics
0034   static const int MAX_JET_FINDERS;  ///< Number of jetfinders per jet leaf card
0035 
0036   //Typedefs
0037   typedef L1GctUnsignedInt<L1GctInternEtSum::kTotEtOrHtNBits> etTotalType;
0038   typedef L1GctUnsignedInt<L1GctInternEtSum::kTotEtOrHtNBits> etHadType;
0039 
0040   typedef L1GctTwosComplement<L1GctInternEtSum::kMissExOrEyNBits> etComponentType;
0041   typedef L1GctTwosComplement<L1GctInternHtMiss::kMissHxOrHyNBits> htComponentType;
0042 
0043   typedef L1GctJetFinderBase::hfTowerSumsType hfTowerSumsType;
0044 
0045   enum maxValues {
0046     etTotalMaxValue = L1GctInternEtSum::kTotEtOrHtMaxValue,
0047     htTotalMaxValue = L1GctInternEtSum::kTotEtOrHtMaxValue
0048   };
0049 
0050   //Construtors/destructor
0051   L1GctJetLeafCard(int id, int iphi, jetFinderType jfType = tdrJetFinder);
0052 
0053   ~L1GctJetLeafCard() override;
0054 
0055   /// set pointers to neighbours - needed to complete the setup
0056   void setNeighbourLeafCards(const std::vector<L1GctJetLeafCard*>& neighbours);
0057 
0058   /// Check setup is Ok
0059   bool setupOk() const;
0060 
0061   /// Overload << operator
0062   friend std::ostream& operator<<(std::ostream& os, const L1GctJetLeafCard& card);
0063 
0064   /// clear internal buffers
0065   void reset();
0066 
0067   /// set the input buffers
0068   void fetchInput() override;
0069 
0070   /// process the data and set outputs
0071   void process() override;
0072 
0073   /// define the bunch crossing range to process
0074   void setBxRange(const int firstBx, const int numberOfBx);
0075 
0076   /// partially clear buffers
0077   void setNextBx(const int bx);
0078 
0079   /// get pointers to associated jetfinders
0080   L1GctJetFinderBase* getJetFinderA() const { return m_jetFinderA; }
0081   L1GctJetFinderBase* getJetFinderB() const { return m_jetFinderB; }
0082   L1GctJetFinderBase* getJetFinderC() const { return m_jetFinderC; }
0083 
0084   // get the jet output
0085   std::vector<L1GctJetCand> getOutputJetsA() const;  ///< Output jetfinder A jets (lowest jetFinder in phi)
0086   std::vector<L1GctJetCand> getOutputJetsB() const;  ///< Output jetfinder B jets (middle jetFinder in phi)
0087   std::vector<L1GctJetCand> getOutputJetsC() const;  ///< Ouptut jetfinder C jets (highest jetFinder in phi)
0088 
0089   /// get the Ex output
0090   etComponentType getOutputEx() const { return m_exSum; }
0091 
0092   /// get the Ey output
0093   etComponentType getOutputEy() const { return m_eySum; }
0094 
0095   /// get the output Ht components
0096   etComponentType getOutputHx() const { return m_hxSum; }
0097   etComponentType getOutputHy() const { return m_hySum; }
0098 
0099   /// get the Et output
0100   etTotalType getOutputEt() const { return m_etSum; }
0101   etHadType getOutputHt() const { return m_htSum; }
0102 
0103   hfTowerSumsType getOutputHfSums() const { return m_hfSums; }
0104 
0105   /// Bunch crossing history acces methods
0106   /// get the Ex output history
0107   std::vector<etComponentType> getAllOutputEx() const { return m_exSumPipe.contents; }
0108 
0109   /// get the Ey output history
0110   std::vector<etComponentType> getAllOutputEy() const { return m_eySumPipe.contents; }
0111 
0112   /// get the output Ht components history
0113   std::vector<htComponentType> getAllOutputHx() const { return m_hxSumPipe.contents; }
0114   std::vector<htComponentType> getAllOutputHy() const { return m_hySumPipe.contents; }
0115 
0116   /// get the Et output history
0117   std::vector<etTotalType> getAllOutputEt() const { return m_etSumPipe.contents; }
0118   std::vector<etHadType> getAllOutputHt() const { return m_htSumPipe.contents; }
0119 
0120   std::vector<hfTowerSumsType> getAllOutputHfSums() const { return m_hfSumsPipe.contents; }
0121 
0122   /// get the Et sums in internal component format
0123   std::vector<L1GctInternEtSum> getInternalEtSums() const;
0124   std::vector<L1GctInternHtMiss> getInternalHtMiss() const;
0125 
0126 protected:
0127   /// Separate reset methods for the processor itself and any data stored in pipelines
0128   void resetProcessor() override;
0129   void resetPipelines() override;
0130 
0131   /// Initialise inputs with null objects for the correct bunch crossing if required
0132   void setupObjects() override {}
0133 
0134 private:
0135   // Leaf card ID
0136   int m_id;
0137 
0138   // Which jetFinder to use?
0139   jetFinderType m_whichJetFinder;
0140 
0141   // internal algorithms
0142   L1GctJetFinderBase* m_jetFinderA;  ///< lowest jetFinder in phi
0143   L1GctJetFinderBase* m_jetFinderB;  ///< middle jetFinder in phi
0144   L1GctJetFinderBase* m_jetFinderC;  ///< highest jetFinder in phi
0145 
0146   // internal data (other than jets)
0147 
0148   int phiPosition;
0149 
0150   etComponentType m_exSum;
0151   etComponentType m_eySum;
0152   htComponentType m_hxSum;
0153   htComponentType m_hySum;
0154   etTotalType m_etSum;
0155   etHadType m_htSum;
0156 
0157   hfTowerSumsType m_hfSums;
0158 
0159   // stored copies of output data
0160   Pipeline<etComponentType> m_exSumPipe;
0161   Pipeline<etComponentType> m_eySumPipe;
0162   Pipeline<htComponentType> m_hxSumPipe;
0163   Pipeline<htComponentType> m_hySumPipe;
0164   Pipeline<etTotalType> m_etSumPipe;
0165   Pipeline<etHadType> m_htSumPipe;
0166   Pipeline<hfTowerSumsType> m_hfSumsPipe;
0167 
0168   bool m_ctorInputOk;
0169 };
0170 
0171 std::ostream& operator<<(std::ostream& os, const L1GctJetLeafCard& card);
0172 
0173 #endif /*L1GCTJETLEAFCARD_H_*/