00001 #ifndef L1GCTWHEELJETFPGA_H_ 00002 #define L1GCTWHEELJETFPGA_H_ 00003 00017 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCand.h" 00018 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctEtHad.h" 00019 00020 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctProcessor.h" 00021 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetLeafCard.h" 00022 00023 #include "L1Trigger/GlobalCaloTrigger/src/L1GctUnsignedInt.h" 00024 #include "L1Trigger/GlobalCaloTrigger/src/L1GctJetCount.h" 00025 00026 class L1GctJetSorter; 00027 class L1GctJetCounter; 00028 00029 #include <vector> 00030 00031 class L1GctWheelJetFpga : public L1GctProcessor 00032 { 00033 public: 00034 typedef std::vector<L1GctJetCand> JetVector; 00035 typedef L1GctUnsignedInt<L1GctEtHad::kEtHadNBits> EtHadType; 00036 typedef L1GctJetLeafCard::etComponentType etComponentType; 00037 typedef L1GctJetLeafCard::hfTowerSumsType hfTowerSumsType; 00038 00040 static const int MAX_JETS_OUT; 00041 00043 static const unsigned int MAX_LEAF_CARDS; 00044 00046 static const unsigned int MAX_JETS_PER_LEAF; 00047 00049 static const unsigned int N_JET_COUNTERS; 00050 00052 L1GctWheelJetFpga(int id, 00053 std::vector<L1GctJetLeafCard*> inputLeafCards); 00054 00056 ~L1GctWheelJetFpga(); 00057 00059 friend std::ostream& operator << (std::ostream& os, const L1GctWheelJetFpga& fpga); 00060 00062 void reset(); 00063 00065 virtual void fetchInput(); 00066 00068 virtual void process(); 00069 00071 void setBxRange(const int firstBx, const int numberOfBx); 00072 00074 void setNextBx(const int bx); 00075 00077 void setInputJet(int i, L1GctJetCand jet); 00078 void setInputHt (int i, unsigned ht); 00079 00081 JetVector getInputJets() const { return m_inputJets; } 00082 00084 EtHadType inputHt(unsigned leafnum) const { return m_inputHt.at(leafnum); } 00085 00087 etComponentType inputHx(unsigned leafnum) const { return m_inputHx.at(leafnum); } 00088 etComponentType inputHy(unsigned leafnum) const { return m_inputHy.at(leafnum); } 00089 00091 hfTowerSumsType inputHfSums(unsigned leafnum) const { return m_inputHfSums.at(leafnum); } 00092 00094 JetVector getCentralJets() const { return m_centralJets; } 00095 00097 JetVector getForwardJets() const { return m_forwardJets; } 00098 00100 JetVector getTauJets() const { return m_tauJets; } 00101 00103 EtHadType getOutputHt() const { return m_outputHt; } 00104 00106 etComponentType getOutputHx() const { return m_outputHx; } 00107 etComponentType getOutputHy() const { return m_outputHy; } 00108 00110 hfTowerSumsType getOutputHfSums() const { return m_outputHfSums; } 00111 00113 L1GctJetCount<3> getOutputJc(unsigned jcnum) const 00114 { return ( (jcnum<N_JET_COUNTERS) ? m_outputJc.at(jcnum) : 0); } 00115 00117 L1GctJetCounter* getJetCounter(unsigned jcnum) const 00118 { return ( (jcnum<N_JET_COUNTERS) ? m_jetCounters.at(jcnum) : 0); } 00119 00121 bool setupOk() const { return checkSetup(); } 00122 00123 protected: 00124 00126 virtual void resetProcessor(); 00127 virtual void resetPipelines() {} 00128 00130 virtual void setupObjects(); 00131 00132 private: 00133 00134 static const int MAX_JETS_IN; 00135 00137 int m_id; 00138 00140 std::vector<L1GctJetLeafCard*> m_inputLeafCards; 00141 00143 L1GctJetSorter* m_centralJetSorter; 00144 L1GctJetSorter* m_forwardJetSorter; 00145 L1GctJetSorter* m_tauJetSorter; 00146 00148 std::vector<L1GctJetCounter*> m_jetCounters; 00149 00151 JetVector m_inputJets; 00152 00153 // Holds the all the various inputted jets, re-addressed using proper GCT->GT jet addressing 00154 JetVector m_rawCentralJets; 00155 JetVector m_rawForwardJets; 00156 JetVector m_rawTauJets; 00157 00158 // input Ht sums from each leaf card 00159 std::vector< EtHadType > m_inputHt; 00160 00161 // input Ht component sums from each leaf card 00162 std::vector< etComponentType > m_inputHx; 00163 std::vector< etComponentType > m_inputHy; 00164 00165 // input Hf Et sums from each leaf card 00166 std::vector< hfTowerSumsType > m_inputHfSums; 00167 00168 // output data 00169 JetVector m_centralJets; 00170 JetVector m_forwardJets; 00171 JetVector m_tauJets; 00172 00173 // data sent to GlobalEnergyAlgos 00174 EtHadType m_outputHt; 00175 etComponentType m_outputHx; 00176 etComponentType m_outputHy; 00177 hfTowerSumsType m_outputHfSums; 00178 std::vector< L1GctJetCount<3> > m_outputJc; 00179 00180 //PRIVATE METHODS 00182 bool checkSetup() const; 00184 void storeJets(JetVector jets, unsigned short iLeaf, unsigned short offset); 00186 void classifyJets(); 00188 void setupJetsVectors(const int16_t bx); 00189 }; 00190 00191 std::ostream& operator << (std::ostream& os, const L1GctWheelJetFpga& fpga); 00192 00193 #endif /*L1GCTWHEELJETFPGA_H_*/