CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/L1Trigger/GlobalCaloTrigger/interface/L1GlobalCaloTrigger.h

Go to the documentation of this file.
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 
00011 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetFinderBase.h"
00012 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetLeafCard.h"
00013 
00014 #include <vector>
00015 
00029 class L1GctJetLeafCard;
00030 class L1GctJetFinderBase;
00031 class L1GctEmLeafCard;
00032 class L1GctElectronSorter;
00033 
00034 class L1GctWheelJetFpga;
00035 class L1GctWheelEnergyFpga;
00036 class L1GctJetFinalStage;
00037 class L1GctGlobalEnergyAlgos;
00038 class L1GctGlobalHfSumAlgos;
00039 class L1GctElectronFinalSort;
00040 class L1GctJetFinderParams;
00041 class L1GctJetEtCalibrationLut;
00042 class L1GctChannelMask;
00043 class L1CaloEtScale;
00044 
00045 
00046 class L1GlobalCaloTrigger {
00047 public:
00049   static const int N_JET_LEAF_CARDS;
00051   static const int N_EM_LEAF_CARDS;
00053   static const int N_WHEEL_CARDS;
00054   
00056   typedef L1GctUnsignedInt< L1GctEtTotal::kEtTotalNBits   > etTotalType;
00057   typedef L1GctUnsignedInt<   L1GctEtHad::kEtHadNBits     > etHadType;
00058   typedef L1GctUnsignedInt<  L1GctEtMiss::kEtMissNBits    > etMissType;
00059   typedef L1GctUnsignedInt<  L1GctEtMiss::kEtMissPhiNBits > etMissPhiType;
00060 
00061   typedef L1GctJetFinderBase::lutPtr       lutPtr;
00062   typedef L1GctJetFinderBase::lutPtrVector lutPtrVector;
00063 
00065   L1GlobalCaloTrigger(const L1GctJetLeafCard::jetFinderType jfType = L1GctJetLeafCard::hardwareJetFinder, unsigned jetLeafMask = 0);
00066 
00068   ~L1GlobalCaloTrigger();
00069   
00071   void reset();
00072   
00074   void process();
00075 
00080   void setJetFinderParams(const L1GctJetFinderParams* const jfpars);
00081 
00083   void setJetEtCalibrationLuts(const lutPtrVector& jfluts);
00084 
00086   void setupTauAlgo(const bool useImprovedAlgo, const bool ignoreVetoBitsForIsolation);
00087 
00089   void setHtMissScale(const L1CaloEtScale* const scale);
00090 
00092   void setupHfSumLuts(const L1CaloEtScale* const scale);
00093 
00095   void setChannelMask(const L1GctChannelMask* const 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   L1GctInternJetDataCollection getInternalJets() const;
00157 
00159   L1GctEtTotalCollection getEtSumCollection() const;
00160   
00162   L1GctEtHadCollection   getEtHadCollection() const;
00163 
00165   L1GctEtMissCollection  getEtMissCollection() const;
00166 
00168   L1GctHtMissCollection  getHtMissCollection() const;
00169 
00171   L1GctInternEtSumCollection getInternalEtSums() const;
00172   L1GctInternHtMissCollection getInternalHtMiss() const;
00173 
00174   // Hf sums output to GT
00175   L1GctHFBitCountsCollection  getHFBitCountsCollection()  const;
00176   L1GctHFRingEtSumsCollection getHFRingEtSumsCollection() const;
00177 
00182   std::vector<L1GctJetLeafCard*> getJetLeafCards() const { return theJetLeafCards; }
00183   
00185   std::vector<L1GctEmLeafCard*> getEmLeafCards() const { return theEmLeafCards; }
00186   
00188   std::vector<L1GctWheelJetFpga*> getWheelJetFpgas() const { return theWheelJetFpgas; }
00189   
00191   std::vector<L1GctWheelEnergyFpga*> getWheelEnergyFpgas() const { return theWheelEnergyFpgas; }
00192   
00194   L1GctJetFinalStage* getJetFinalStage() const { return theJetFinalStage; }
00195   
00197   L1GctGlobalEnergyAlgos* getEnergyFinalStage() const { return theEnergyFinalStage; }
00198 
00200   L1GctGlobalHfSumAlgos* getHfSumProcessor() const;
00201   
00203   L1GctElectronFinalSort* getIsoEmFinalStage() const { return theIsoEmFinalStage; }
00204   L1GctElectronFinalSort* getNonIsoEmFinalStage() const { return theNonIsoEmFinalStage; }
00205 
00207   const L1GctJetFinderParams* getJetFinderParams() const { return m_jetFinderParams; }
00208 
00210   const lutPtrVector getJetEtCalibLuts() const { return m_jetEtCalLuts; }
00211 
00216   void print();
00217   
00219   void setVerbose();
00220   void setTerse();
00221 
00222  private:
00223   
00226   void sortInputData();
00228   void bxSetup();
00230   void bxReset(const int bx);
00232   void fillEmCands(std::vector<L1CaloEmCand>::iterator& emc, const int bx);
00233   void fillRegions(std::vector<L1CaloRegion>::iterator& rgn, const int bx);
00235   void bxProcess(const int bx);
00236 
00238   void build(L1GctJetLeafCard::jetFinderType jfType, unsigned jetLeafMask);
00239 
00241   bool setupOk() const;
00242 
00245   unsigned sorterNo(const L1CaloEmCand& em) const;
00246 
00250   template <class T>
00251   struct CompareBx {
00252     bool operator()(const T& i, const T& j) const {
00253       return i.bx() < j.bx();
00254     }
00255   };
00256   CompareBx<L1CaloEmCand> emcBxComparator;
00257   CompareBx<L1CaloRegion> rgnBxComparator;
00258 
00259  private:
00260   
00262   std::vector<L1GctJetLeafCard*> theJetLeafCards;
00263   
00265   std::vector<L1GctJetFinderBase*> theJetFinders;
00266   
00268   std::vector<L1GctEmLeafCard*> theEmLeafCards;
00269   
00271   std::vector<L1GctElectronSorter*> theIsoElectronSorters;
00272   std::vector<L1GctElectronSorter*> theNonIsoElectronSorters;
00273   
00275   std::vector<L1GctWheelJetFpga*> theWheelJetFpgas;             
00276   
00278   std::vector<L1GctWheelEnergyFpga*> theWheelEnergyFpgas;
00279   
00281   L1GctJetFinalStage* theJetFinalStage;                 
00282   
00284   L1GctGlobalEnergyAlgos* theEnergyFinalStage;  
00285   
00287   L1GctElectronFinalSort* theIsoEmFinalStage;
00288 
00290   L1GctElectronFinalSort* theNonIsoEmFinalStage;
00291 
00293   const L1GctJetFinderParams* m_jetFinderParams;
00294 
00296   lutPtrVector m_jetEtCalLuts;
00297 
00299   const L1GctChannelMask* m_inputChannelMask;
00300 
00302   bool m_bxRangeAuto;
00303   int m_bxStart;
00304   int m_numOfBx;
00305 
00308   std::vector<L1CaloEmCand> m_allInputEmCands;
00309   std::vector<L1CaloRegion> m_allInputRegions;
00310 };
00311 
00312 #endif /*L1GLOBALCALOTRIGGER_H_*/