CMS 3D CMS Logo

GctFormatTranslateBase.h

Go to the documentation of this file.
00001 #ifndef GctFormatTranslateBase_h_
00002 #define GctFormatTranslateBase_h_
00003 
00004 // C++ includes
00005 #include <map>
00006 #include <utility>
00007 #include <string>
00008 
00009 // CMSSW includes
00010 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
00011 #include "L1Trigger/TextToDigi/src/SourceCardRouting.h"
00012 #include "EventFilter/GctRawToDigi/src/GctBlockHeader.h"
00013 #include "EventFilter/GctRawToDigi/src/GctUnpackCollections.h"
00014 
00015 
00029 class GctFormatTranslateBase
00030 {
00031 public:
00032 
00034 
00036   explicit GctFormatTranslateBase(bool hltMode = false, bool unpackSharedRegions = false);
00037   
00038   virtual ~GctFormatTranslateBase(); 
00039   
00041   void setUnpackCollections(GctUnpackCollections * const collections) { m_collections = collections; }
00042   
00043   // Set the bunch crossing ID that will be put into the block headers when packing raw data (i.e. Digi -> Raw).
00044   void setPackingBxId(uint32_t bxId) { m_packingBxId = bxId; }
00045   
00046   // Set the event ID that will be put into the block headers when packing raw data (i.e. Digi -> Raw).
00047   void setPackingEventId(uint32_t eventId) { m_packingEventId = eventId; }
00048 
00050   virtual GctBlockHeader generateBlockHeader(const unsigned char * data) const = 0;
00051   
00053   const std::string& getBlockDescription(const GctBlockHeader& header) const;
00054 
00056   virtual bool convertBlock(const unsigned char * d, const GctBlockHeader& hdr) = 0;
00057 
00058 
00059 protected:
00060  
00061   /* PROTECTED TYPDEFS, ENUMS, AND CLASS CONSTANTS. */
00062 
00064 
00065   enum EmCandCatagory { NON_ISO_EM_CANDS, ISO_EM_CANDS, NUM_EM_CAND_CATEGORIES };
00066 
00068 
00069   enum JetCandCategory { TAU_JETS, FORWARD_JETS, CENTRAL_JETS, NUM_JET_CATEGORIES };
00070 
00071   typedef std::map<unsigned int, unsigned int> BlockLengthMap;   
00072   typedef std::pair<unsigned int, unsigned int> BlockLengthPair; 
00073   typedef std::map<unsigned int, std::string> BlockNameMap;   
00074   typedef std::pair<unsigned int, std::string> BlockNamePair; 
00075 
00077   typedef std::map<unsigned int, unsigned int> BlkToRctCrateMap;
00078 
00084   typedef std::pair<unsigned int, unsigned int> IsoBoundaryPair;
00085   
00087   typedef std::map<unsigned int, IsoBoundaryPair> BlockIdToEmCandIsoBoundMap;
00088 
00089 
00090   /* PROTECTED METHODS */
00091 
00092   /* Static data member access methods */
00093   virtual BlockLengthMap& blockLengthMap() = 0; 
00094   virtual const BlockLengthMap& blockLengthMap() const = 0; 
00095   
00096   virtual BlockNameMap& blockNameMap() = 0;  
00097   virtual const BlockNameMap& blockNameMap() const = 0;  
00098   
00099   virtual BlkToRctCrateMap& rctEmCrateMap() = 0;  
00100   virtual const BlkToRctCrateMap& rctEmCrateMap() const = 0;  
00101  
00102   virtual BlkToRctCrateMap& rctJetCrateMap() = 0;  
00103   virtual const BlkToRctCrateMap& rctJetCrateMap() const = 0;  
00104 
00105   virtual BlockIdToEmCandIsoBoundMap& internEmIsoBounds() = 0;  
00106   virtual const BlockIdToEmCandIsoBoundMap& internEmIsoBounds() const = 0;  
00107 
00108 
00109   /* Data member access methods */
00110   GctUnpackCollections * const colls() const { return m_collections; } 
00111   bool hltMode() const { return m_hltMode; }  
00112   bool unpackSharedRegions() const { return m_unpackSharedRegions; }  
00113   SourceCardRouting& srcCardRouting() { return m_srcCardRouting; } 
00114   const uint32_t packingBxId() const { return m_packingBxId; } 
00115   const uint32_t packingEventId() const { return m_packingEventId; } 
00116 
00117 
00118   /* Other general methods */
00120   L1GctJetCandCollection * const gctJets(const unsigned cat) const;
00121 
00123   virtual uint32_t generateRawHeader(const uint32_t blockId,
00124                                      const uint32_t nSamples,
00125                                      const uint32_t bxId,
00126                                      const uint32_t eventId) const = 0;
00127 
00129 
00130   void writeRawHeader(unsigned char * data, uint32_t blockId, uint32_t nSamples) const;
00131 
00133   bool checkBlock(const GctBlockHeader& hdr) const;
00134   
00136   void blockDoNothing(const unsigned char * d, const GctBlockHeader& hdr) {}
00137   
00138   
00139   /* Hack methods added in for the GctFormatTranslate 31X to 22X BackPort */
00141 
00142   L1CaloRegion makeL1CaloRegionBackPortHack(const uint16_t raw,
00143                                             const unsigned ieta, 
00144                                             const unsigned iphi,
00145                                             const int16_t bx); 
00146   
00147 
00148 private:
00149 
00150   /* PRIVATE STATIC CONSTS */
00151   static const std::string INVALID_BLOCK_HEADER_STR;
00152 
00153   /* PRIVATE MEMBER DATA */
00154 
00156   GctUnpackCollections * m_collections;  
00157 
00159   bool m_hltMode;
00160   
00162 
00163   bool m_unpackSharedRegions;
00164 
00166   SourceCardRouting m_srcCardRouting;
00167   
00169   uint32_t m_packingBxId;
00170   
00172   uint32_t m_packingEventId;
00173 
00174 };
00175 
00176 #endif /* GctFormatTranslateBase_h_ */

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