CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/L1Trigger/GlobalCaloTrigger/interface/L1GctJetLeafCard.h

Go to the documentation of this file.
00001 #ifndef L1GCTJETLEAFCARD_H_
00002 #define L1GCTJETLEAFCARD_H_
00003 
00004 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctEtTotal.h"
00005 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctEtHad.h"
00006 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctEtMiss.h"
00007 
00008 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctProcessor.h"
00009 #include "L1Trigger/GlobalCaloTrigger/interface/L1GctJetFinderBase.h"
00010 #include "L1Trigger/GlobalCaloTrigger/src/L1GctTwosComplement.h"
00011 #include "L1Trigger/GlobalCaloTrigger/src/L1GctUnsignedInt.h"
00012 
00013 #include <vector>
00014 
00015 /*
00016  * \class L1GctJetLeafCard
00017  * \brief Emulates a leaf card programmed for jetfinding
00018  *
00019  * Represents a GCT Leaf Card
00020  * programmed for jet finding
00021  * author: Jim Brooke
00022  * date: 20/2/2006
00023  * 
00024  */
00025 
00026 class L1GctJetCand;
00027 
00028 class L1GctJetLeafCard : public L1GctProcessor
00029 {
00030 public:
00031   //Type declaration
00032   enum jetFinderType { tdrJetFinder, hardwareJetFinder, nullJetFinder };
00033 
00034   //Statics
00035   static const int MAX_JET_FINDERS;  
00036 
00037   //Typedefs
00038   typedef L1GctUnsignedInt<L1GctInternEtSum::kTotEtOrHtNBits> etTotalType;
00039   typedef L1GctUnsignedInt<L1GctInternEtSum::kTotEtOrHtNBits> etHadType;
00040 
00041   typedef L1GctTwosComplement<  L1GctInternEtSum::kMissExOrEyNBits > etComponentType;
00042   typedef L1GctTwosComplement< L1GctInternHtMiss::kMissHxOrHyNBits > htComponentType;
00043 
00044   typedef L1GctJetFinderBase::hfTowerSumsType hfTowerSumsType;
00045 
00046   enum maxValues {
00047     etTotalMaxValue = L1GctInternEtSum::kTotEtOrHtMaxValue,
00048     htTotalMaxValue = L1GctInternEtSum::kTotEtOrHtMaxValue
00049   };
00050 
00051   //Construtors/destructor
00052   L1GctJetLeafCard(int id, int iphi, jetFinderType jfType = tdrJetFinder);
00053                    
00054   ~L1GctJetLeafCard();
00055 
00057   void setNeighbourLeafCards(std::vector<L1GctJetLeafCard*> neighbours);
00058 
00060   bool setupOk() const;
00061 
00063   friend std::ostream& operator << (std::ostream& os, const L1GctJetLeafCard& card);
00064 
00066   void reset();
00067 
00069   virtual void fetchInput();
00070  
00072   virtual void process();
00073 
00075   void setBxRange(const int firstBx, const int numberOfBx);
00076 
00078   void setNextBx(const int bx);
00079 
00081   L1GctJetFinderBase* getJetFinderA() const { return m_jetFinderA; }
00082   L1GctJetFinderBase* getJetFinderB() const { return m_jetFinderB; }
00083   L1GctJetFinderBase* getJetFinderC() const { return m_jetFinderC; }
00084 
00085   // get the jet output
00086   std::vector<L1GctJetCand> getOutputJetsA() const;  
00087   std::vector<L1GctJetCand> getOutputJetsB() const;  
00088   std::vector<L1GctJetCand> getOutputJetsC() const;  
00089     
00091   etComponentType getOutputEx() const { return m_exSum; }
00092    
00094   etComponentType getOutputEy() const { return m_eySum; }
00095     
00097   etComponentType getOutputHx() const { return m_hxSum; }
00098   etComponentType getOutputHy() const { return m_hySum; }
00099     
00101   etTotalType getOutputEt() const { return m_etSum; }
00102   etHadType   getOutputHt() const { return m_htSum; }
00103 
00104   hfTowerSumsType getOutputHfSums() const { return m_hfSums; }
00105    
00108   std::vector< etComponentType > getAllOutputEx() const { return m_exSumPipe.contents; }
00109    
00111   std::vector< etComponentType > getAllOutputEy() const { return m_eySumPipe.contents; }
00112 
00114   std::vector< htComponentType > getAllOutputHx() const { return m_hxSumPipe.contents; }
00115   std::vector< htComponentType > getAllOutputHy() const { return m_hySumPipe.contents; }
00116     
00118   std::vector< etTotalType > getAllOutputEt() const { return m_etSumPipe.contents; }
00119   std::vector< etHadType >   getAllOutputHt() const { return m_htSumPipe.contents; }
00120 
00121   std::vector< hfTowerSumsType > getAllOutputHfSums() const { return m_hfSumsPipe.contents; }
00122    
00124   std::vector< L1GctInternEtSum  > getInternalEtSums() const;
00125   std::vector< L1GctInternHtMiss > getInternalHtMiss() const;
00126 
00127  protected:
00128 
00130   virtual void resetProcessor();
00131   virtual void resetPipelines();
00132 
00134   virtual void setupObjects() {}
00135 
00136  private:
00137 
00138   // Leaf card ID
00139   int m_id;
00140 
00141   // Which jetFinder to use?
00142   jetFinderType m_whichJetFinder;
00143 
00144   // internal algorithms
00145   L1GctJetFinderBase* m_jetFinderA;  
00146   L1GctJetFinderBase* m_jetFinderB;  
00147   L1GctJetFinderBase* m_jetFinderC;  
00148   
00149   // internal data (other than jets)
00150 
00151   int phiPosition;
00152 
00153   etComponentType m_exSum;
00154   etComponentType m_eySum;
00155   htComponentType m_hxSum;
00156   htComponentType m_hySum;
00157   etTotalType m_etSum;
00158   etHadType   m_htSum;
00159 
00160   hfTowerSumsType m_hfSums;
00161 
00162   // stored copies of output data
00163   Pipeline<etComponentType> m_exSumPipe;
00164   Pipeline<etComponentType> m_eySumPipe;
00165   Pipeline<htComponentType> m_hxSumPipe;
00166   Pipeline<htComponentType> m_hySumPipe;
00167   Pipeline<etTotalType>     m_etSumPipe;
00168   Pipeline<etHadType>       m_htSumPipe;
00169   Pipeline<hfTowerSumsType> m_hfSumsPipe;
00170 
00171   bool m_ctorInputOk;
00172 
00173 };
00174 
00175 std::ostream& operator << (std::ostream& os, const L1GctJetLeafCard& card);
00176 
00177 #endif /*L1GCTJETLEAFCARD_H_*/