00001 #ifndef L1GLOBALCALOTRIGGER_H_ 00002 #define L1GLOBALCALOTRIGGER_H_ 00003 00004 #include "DataFormats/L1CaloTrigger/interface/L1CaloRegion.h" 00005 #include "DataFormats/L1CaloTrigger/interface/L1CaloEmCand.h" 00006 00007 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctCollections.h" 00008 00009 #include "L1Trigger/GlobalCaloTrigger/src/L1GctUnsignedInt.h" 00010 #include "L1Trigger/GlobalCaloTrigger/src/L1GctJetCount.h" 00011 00012 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetFinderBase.h" 00013 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetLeafCard.h" 00014 00015 #include <vector> 00016 00030 class L1GctJetLeafCard; 00031 class L1GctJetFinderBase; 00032 class L1GctEmLeafCard; 00033 class L1GctElectronSorter; 00034 00035 class L1GctWheelJetFpga; 00036 class L1GctWheelEnergyFpga; 00037 class L1GctJetFinalStage; 00038 class L1GctGlobalEnergyAlgos; 00039 class L1GctGlobalHfSumAlgos; 00040 class L1GctElectronFinalSort; 00041 class L1GctJetFinderParams; 00042 class L1GctJetEtCalibrationLut; 00043 class L1GctJetCounterSetup; 00044 class L1GctChannelMask; 00045 class L1CaloEtScale; 00046 00047 00048 class L1GlobalCaloTrigger { 00049 public: 00051 static const int N_JET_LEAF_CARDS; 00053 static const int N_EM_LEAF_CARDS; 00055 static const int N_WHEEL_CARDS; 00056 00058 typedef L1GctUnsignedInt< L1GctEtTotal::kEtTotalNBits > etTotalType; 00059 typedef L1GctUnsignedInt< L1GctEtHad::kEtHadNBits > etHadType; 00060 typedef L1GctUnsignedInt< L1GctEtMiss::kEtMissNBits > etMissType; 00061 typedef L1GctUnsignedInt< L1GctEtMiss::kEtMissPhiNBits > etMissPhiType; 00062 00063 typedef L1GctJetFinderBase::lutPtr lutPtr; 00064 typedef L1GctJetFinderBase::lutPtrVector lutPtrVector; 00065 00067 L1GlobalCaloTrigger(const L1GctJetLeafCard::jetFinderType jfType = L1GctJetLeafCard::tdrJetFinder); 00068 00070 ~L1GlobalCaloTrigger(); 00071 00073 void reset(); 00074 00076 void process(); 00077 00082 void setJetFinderParams(const L1GctJetFinderParams* jfpars); 00083 00085 void setJetEtCalibrationLuts(const lutPtrVector& jfluts); 00086 00088 void setupJetCounterLuts(const L1GctJetCounterSetup* jcPosPars, 00089 const L1GctJetCounterSetup* jcNegPars); 00090 00092 void setupHfSumLuts(const L1GctHfLutSetup* iSetup); 00093 00095 void setChannelMask(const L1GctChannelMask* mask); 00096 00102 void setBxRange(const int firstBx, const int lastBx); 00104 void setBxRangeSymmetric(const int numOfBx); 00106 void setBxRangeAutomatic(); 00107 00109 int getFirstBx() const { return m_bxStart; } 00110 int getLastBx() const { return (m_bxStart + m_numOfBx - 1); } 00111 int getTotalBx() const { return m_numOfBx; } 00112 00118 void fillRegions(const std::vector<L1CaloRegion>& rgn); 00119 00121 void fillEmCands(const std::vector<L1CaloEmCand>& rgn); 00122 00125 void setRegion(const L1CaloRegion& region); 00126 00128 void setRegion(const unsigned et, const unsigned ieta, const unsigned iphi, 00129 const bool overFlow=false, const bool fineGrain=true); 00130 00132 void setIsoEm(const L1CaloEmCand& em); 00133 00135 void setNonIsoEm(const L1CaloEmCand& em); 00136 00141 L1GctEmCandCollection getIsoElectrons() const; 00142 00144 L1GctEmCandCollection getNonIsoElectrons() const; 00145 00147 L1GctJetCandCollection getCentralJets() const; 00148 00150 L1GctJetCandCollection getForwardJets() const; 00151 00153 L1GctJetCandCollection getTauJets() const; 00154 00156 L1GctEtTotalCollection getEtSumCollection() const; 00157 00159 L1GctEtHadCollection getEtHadCollection() const; 00160 00162 L1GctEtMissCollection getEtMissCollection() const; 00163 00165 L1GctEtMissCollection getHtMissCollection() const; 00166 00167 // Jet Count output to GT 00168 L1GctJetCountsCollection getJetCountsCollection() const; 00169 00170 // Hf sums output to GT 00171 L1GctHFBitCountsCollection getHFBitCountsCollection() const; 00172 L1GctHFRingEtSumsCollection getHFRingEtSumsCollection() const; 00173 00178 std::vector<L1GctJetLeafCard*> getJetLeafCards() const { return theJetLeafCards; } 00179 00181 std::vector<L1GctEmLeafCard*> getEmLeafCards() const { return theEmLeafCards; } 00182 00184 std::vector<L1GctWheelJetFpga*> getWheelJetFpgas() const { return theWheelJetFpgas; } 00185 00187 std::vector<L1GctWheelEnergyFpga*> getWheelEnergyFpgas() const { return theWheelEnergyFpgas; } 00188 00190 L1GctJetFinalStage* getJetFinalStage() const { return theJetFinalStage; } 00191 00193 L1GctGlobalEnergyAlgos* getEnergyFinalStage() const { return theEnergyFinalStage; } 00194 00196 L1GctGlobalHfSumAlgos* getHfSumProcessor() const; 00197 00199 L1GctElectronFinalSort* getIsoEmFinalStage() const { return theIsoEmFinalStage; } 00200 L1GctElectronFinalSort* getNonIsoEmFinalStage() const { return theNonIsoEmFinalStage; } 00201 00203 const lutPtrVector getJetEtCalibLuts() const { return m_jetEtCalLuts; } 00204 00209 void print(); 00210 00212 void setVerbose(); 00213 void setTerse(); 00214 00215 private: 00216 00219 void sortInputData(); 00221 void bxSetup(); 00223 void bxReset(const int bx); 00225 void fillEmCands(std::vector<L1CaloEmCand>::iterator& emc, const int bx); 00226 void fillRegions(std::vector<L1CaloRegion>::iterator& rgn, const int bx); 00228 void bxProcess(const int bx); 00229 00231 void build(L1GctJetLeafCard::jetFinderType jfType); 00232 00234 bool setupOk() const; 00235 00238 unsigned sorterNo(const L1CaloEmCand& em) const; 00239 00243 template <class T> 00244 struct CompareBx { 00245 bool operator()(const T& i, const T& j) const { 00246 return i.bx() < j.bx(); 00247 } 00248 }; 00249 CompareBx<L1CaloEmCand> emcBxComparator; 00250 CompareBx<L1CaloRegion> rgnBxComparator; 00251 00252 private: 00253 00255 std::vector<L1GctJetLeafCard*> theJetLeafCards; 00256 00258 std::vector<L1GctJetFinderBase*> theJetFinders; 00259 00261 std::vector<L1GctEmLeafCard*> theEmLeafCards; 00262 00264 std::vector<L1GctElectronSorter*> theIsoElectronSorters; 00265 std::vector<L1GctElectronSorter*> theNonIsoElectronSorters; 00266 00268 std::vector<L1GctWheelJetFpga*> theWheelJetFpgas; 00269 00271 std::vector<L1GctWheelEnergyFpga*> theWheelEnergyFpgas; 00272 00274 L1GctJetFinalStage* theJetFinalStage; 00275 00277 L1GctGlobalEnergyAlgos* theEnergyFinalStage; 00278 00280 L1GctElectronFinalSort* theIsoEmFinalStage; 00281 00283 L1GctElectronFinalSort* theNonIsoEmFinalStage; 00284 00286 const L1GctJetFinderParams* m_jetFinderParams; 00287 00289 lutPtrVector m_jetEtCalLuts; 00290 00292 const L1GctChannelMask* m_inputChannelMask; 00293 00295 bool m_bxRangeAuto; 00296 int m_bxStart; 00297 int m_numOfBx; 00298 00301 std::vector<L1CaloEmCand> m_allInputEmCands; 00302 std::vector<L1CaloRegion> m_allInputRegions; 00303 }; 00304 00305 #endif /*L1GLOBALCALOTRIGGER_H_*/