CMS 3D CMS Logo

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 };
00033 
00034   //Statics
00035   static const int MAX_JET_FINDERS;  
00036 
00037   //Typedefs
00038   typedef L1GctUnsignedInt< L1GctEtTotal::kEtTotalNBits   > etTotalType;
00039   typedef L1GctUnsignedInt<   L1GctEtHad::kEtHadNBits     > etHadType;
00040   typedef L1GctUnsignedInt<  L1GctEtMiss::kEtMissNBits    > etMissType;
00041   typedef L1GctUnsignedInt<  L1GctEtMiss::kEtMissPhiNBits > etMissPhiType;
00042 
00043   // Use the same number of bits as the firmware (range -131072 to 131071)
00044   enum { etComponentSize=18 };
00045   typedef L1GctTwosComplement<etComponentSize> etComponentType;
00046 
00047   typedef L1GctJetFinderBase::hfTowerSumsType hfTowerSumsType;
00048 
00049   //Construtors/destructor
00050   L1GctJetLeafCard(int id, int iphi, jetFinderType jfType = tdrJetFinder);
00051                    
00052   ~L1GctJetLeafCard();
00053 
00055   void setNeighbourLeafCards(std::vector<L1GctJetLeafCard*> neighbours);
00056 
00058   bool setupOk() const;
00059 
00061   friend std::ostream& operator << (std::ostream& os, const L1GctJetLeafCard& card);
00062 
00064   void reset();
00065 
00067   virtual void fetchInput();
00068  
00070   virtual void process();
00071 
00073   void setBxRange(const int firstBx, const int numberOfBx);
00074 
00076   void setNextBx(const int bx);
00077 
00079   L1GctJetFinderBase* getJetFinderA() const { return m_jetFinderA; }
00080   L1GctJetFinderBase* getJetFinderB() const { return m_jetFinderB; }
00081   L1GctJetFinderBase* getJetFinderC() const { return m_jetFinderC; }
00082 
00083   // get the jet output
00084   std::vector<L1GctJetCand> getOutputJetsA() const;  
00085   std::vector<L1GctJetCand> getOutputJetsB() const;  
00086   std::vector<L1GctJetCand> getOutputJetsC() const;  
00087     
00089   etComponentType getOutputEx() const { return m_exSum; }
00090    
00092   etComponentType getOutputEy() const { return m_eySum; }
00093     
00095   etComponentType getOutputHx() const { return m_hxSum; }
00096   etComponentType getOutputHy() const { return m_hySum; }
00097     
00099   etTotalType getOutputEt() const { return m_etSum; }
00100   etHadType   getOutputHt() const { return m_htSum; }
00101 
00102   hfTowerSumsType getOutputHfSums() const { return m_hfSums; }
00103    
00106   std::vector< etComponentType > getAllOutputEx() const { return m_exSumPipe.contents; }
00107    
00109   std::vector< etComponentType > getAllOutputEy() const { return m_eySumPipe.contents; }
00110 
00112   std::vector< etComponentType > getAllOutputHx() const { return m_hxSumPipe.contents; }
00113   std::vector< etComponentType > getAllOutputHy() const { return m_hySumPipe.contents; }
00114     
00116   std::vector< etTotalType > getAllOutputEt() const { return m_etSumPipe.contents; }
00117   std::vector< etHadType >   getAllOutputHt() const { return m_htSumPipe.contents; }
00118 
00119   std::vector< hfTowerSumsType > getAllOutputHfSums() const { return m_hfSumsPipe.contents; }
00120    
00121  protected:
00122 
00124   virtual void resetProcessor();
00125   virtual void resetPipelines();
00126 
00128   virtual void setupObjects() {}
00129 
00130  private:
00131 
00132   // Leaf card ID
00133   int m_id;
00134 
00135   // Which jetFinder to use?
00136   jetFinderType m_whichJetFinder;
00137 
00138   // internal algorithms
00139   L1GctJetFinderBase* m_jetFinderA;  
00140   L1GctJetFinderBase* m_jetFinderB;  
00141   L1GctJetFinderBase* m_jetFinderC;  
00142   
00143   // internal data (other than jets)
00144 
00145   int phiPosition;
00146 
00147   etComponentType m_exSum;
00148   etComponentType m_eySum;
00149   etComponentType m_hxSum;
00150   etComponentType m_hySum;
00151   etTotalType m_etSum;
00152   etHadType   m_htSum;
00153 
00154   hfTowerSumsType m_hfSums;
00155 
00156   // stored copies of output data
00157   Pipeline<etComponentType> m_exSumPipe;
00158   Pipeline<etComponentType> m_eySumPipe;
00159   Pipeline<etComponentType> m_hxSumPipe;
00160   Pipeline<etComponentType> m_hySumPipe;
00161   Pipeline<etTotalType>     m_etSumPipe;
00162   Pipeline<etHadType>       m_htSumPipe;
00163   Pipeline<hfTowerSumsType> m_hfSumsPipe;
00164 
00165   bool m_ctorInputOk;
00166 
00167   // PRIVATE MEMBER FUNCTIONS
00168   // Given a strip Et sum, perform rotations by sine and cosine
00169   // factors to find the corresponding Ex and Ey
00170   etComponentType exComponent(const etTotalType etStrip0, const etTotalType etStrip1, const unsigned jphi) const;
00171   etComponentType eyComponent(const etTotalType etStrip0, const etTotalType etStrip1, const unsigned jphi) const;
00172   // Here is where the rotations are actually done
00173   etComponentType etValueForJetFinder(const etTotalType etStrip0, const unsigned fact0,
00174                                       const etTotalType etStrip1, const unsigned fact1) const;
00175 
00176 };
00177 
00178 std::ostream& operator << (std::ostream& os, const L1GctJetLeafCard& card);
00179 
00180 #endif /*L1GCTJETLEAFCARD_H_*/

Generated on Tue Jun 9 17:40:09 2009 for CMSSW by  doxygen 1.5.4