CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/EventFilter/GctRawToDigi/src/GctFormatTranslateMCLegacy.h

Go to the documentation of this file.
00001 #ifndef GctFormatTranslateMCLegacy_h_
00002 #define GctFormatTranslateMCLegacy_h_
00003 
00004 #include "EventFilter/GctRawToDigi/src/GctFormatTranslateBase.h"
00005 
00018 // ************************************************************************
00019 // ***  THE TRANSLATION PROCESS MUST NEVER THROW ANY KIND OF EXCEPTION! *** 
00020 // ************************************************************************
00021 
00022 class GctFormatTranslateMCLegacy : public GctFormatTranslateBase
00023 {
00024 public:
00025 
00026   /* PUBLIC METHODS */
00027 
00029 
00031   explicit GctFormatTranslateMCLegacy(bool hltMode = false, bool unpackSharedRegions = false);
00032   
00033   virtual ~GctFormatTranslateMCLegacy(); 
00034 
00036   virtual GctBlockHeader generateBlockHeader(const unsigned char * data) const;
00037   
00039   virtual bool convertBlock(const unsigned char * d, const GctBlockHeader& hdr);
00040 
00041 
00042   /* ------------------------------ */
00043   /* Public Block Packing Functions */
00044   /* ------------------------------ */
00045   
00047 
00048   void writeGctOutEmAndEnergyBlock(unsigned char * d,
00049                                    const L1GctEmCandCollection* iso,
00050                                    const L1GctEmCandCollection* nonIso,
00051                                    const L1GctEtTotalCollection* etTotal,
00052                                    const L1GctEtHadCollection* etHad,
00053                                    const L1GctEtMissCollection* etMiss);
00054 
00056 
00057   void writeGctOutJetBlock(unsigned char * d, 
00058                            const L1GctJetCandCollection* cenJets,
00059                            const L1GctJetCandCollection* forJets, 
00060                            const L1GctJetCandCollection* tauJets, 
00061                            const L1GctHFRingEtSumsCollection* hfRingSums,
00062                            const L1GctHFBitCountsCollection* hfBitCounts,
00063                            const L1GctHtMissCollection* htMiss);
00064 
00066   void writeRctEmCandBlocks(unsigned char * d, const L1CaloEmCollection * rctEm);
00067 
00069   void writeAllRctCaloRegionBlock(unsigned char * d, const L1CaloRegionCollection * rctCalo);
00070 
00071 
00072 protected:
00073   
00074   /* PROTECTED METHODS */
00075 
00076   /* Static data member access methods */
00077   virtual BlockLengthMap& blockLengthMap() { return m_blockLength; } 
00078   virtual const BlockLengthMap& blockLengthMap() const { return m_blockLength; } 
00079   
00080   virtual BlockNameMap& blockNameMap() { return m_blockName; }  
00081   virtual const BlockNameMap& blockNameMap() const { return m_blockName; }  
00082   
00083   virtual BlkToRctCrateMap& rctEmCrateMap() { return m_rctEmCrate; }  
00084   virtual const BlkToRctCrateMap& rctEmCrateMap() const { return m_rctEmCrate; }  
00085  
00086   virtual BlkToRctCrateMap& rctJetCrateMap() { return m_rctJetCrate; }  
00087   virtual const BlkToRctCrateMap& rctJetCrateMap() const { return m_rctJetCrate; }  
00088 
00089   virtual BlockIdToEmCandIsoBoundMap& internEmIsoBounds() { return m_internEmIsoBounds; }  
00090   virtual const BlockIdToEmCandIsoBoundMap& internEmIsoBounds() const { return m_internEmIsoBounds; }  
00091 
00092 
00093   /* Other general methods */
00095   virtual uint32_t generateRawHeader(const uint32_t blockId,
00096                                      const uint32_t nSamples,
00097                                      const uint32_t bxId,
00098                                      const uint32_t eventId) const;
00099 
00100 
00101 private:
00102 
00103   /* PRIVATE TYPES & TYPEDEFS */
00104  
00106   typedef void (GctFormatTranslateMCLegacy::*PtrToUnpackFn)(const unsigned char *, const GctBlockHeader&);
00108   typedef std::map<unsigned int, PtrToUnpackFn> BlockIdToUnpackFnMap;
00109 
00110 
00111   /* PRIVATE MEMBER DATA */
00112   
00114   static BlockLengthMap m_blockLength;
00115   
00117   static BlockNameMap m_blockName;
00118   
00120   static BlkToRctCrateMap m_rctEmCrate;
00121 
00123   static BlkToRctCrateMap m_rctJetCrate;
00124   
00127   static BlockIdToEmCandIsoBoundMap m_internEmIsoBounds;
00128 
00130   static BlockIdToUnpackFnMap m_blockUnpackFn;
00131   
00132 
00133   /* PRIVATE METHODS */
00134   
00135   /* --------------------------------- */
00136   /* Private Block Unpacking Functions */
00137   /* --------------------------------- */
00138   
00140   void blockToGctEmCandsAndEnergySums(const unsigned char * d, const GctBlockHeader& hdr);
00141   
00143   void blockToGctJetCandsAndCounts(const unsigned char * d, const GctBlockHeader& hdr);
00144 
00146   void blockToRctEmCand(const unsigned char * d, const GctBlockHeader& hdr);
00147 
00149   void blockToFibres(const unsigned char * d, const GctBlockHeader& hdr);
00150   
00152   void blockToFibresAndToRctEmCand(const unsigned char * d, const GctBlockHeader& hdr);
00153 
00155   void blockToAllRctCaloRegions(const unsigned char * d, const GctBlockHeader& hdr);
00156 
00157 
00158   /* ----------------------------- */
00159   /* Miscellaneous Private Methods */
00160   /* ----------------------------- */
00161     
00163 
00164   template <typename Collection> 
00165   bool findBx0OffsetInCollection(unsigned& bx0Offset, const Collection* coll);
00166 
00167 };
00168 
00169 #endif