Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:10:40

0001 #ifndef GctFormatTranslateV35_h_
0002 #define GctFormatTranslateV35_h_
0003 
0004 #include "EventFilter/GctRawToDigi/src/GctFormatTranslateBase.h"
0005 
0006 /*!
0007 * \class GctFormatTranslateV35
0008 * \brief Unpacks/packs the V35 raw format
0009 *
0010 * \author Robert Frazier
0011 */
0012 
0013 // ************************************************************************
0014 // ***  THE TRANSLATION PROCESS MUST NEVER THROW ANY KIND OF EXCEPTION! ***
0015 // ************************************************************************
0016 
0017 class GctFormatTranslateV35 : public GctFormatTranslateBase {
0018 public:
0019   /* PUBLIC METHODS */
0020 
0021   /// Constructor.
0022   /*! \param hltMode - set true to unpack only BX zero and GCT output data (i.e. to run as quick as possible).
0023    *  \param unpackSharedRegions - this is a commissioning option to unpack the shared RCT calo regions. */
0024   explicit GctFormatTranslateV35(bool hltMode = false, bool unpackSharedRegions = false);
0025 
0026   ~GctFormatTranslateV35() override;  ///< Destructor.
0027 
0028   /// Generate a block header from four 8-bit values.
0029   GctBlockHeader generateBlockHeader(const unsigned char* data) const override;
0030 
0031   /// Get digis from the block - will return true if it succeeds, false otherwise.
0032   bool convertBlock(const unsigned char* d, const GctBlockHeader& hdr) override;
0033 
0034   /* ------------------------------ */
0035   /* Public Block Packing Functions */
0036   /* ------------------------------ */
0037 
0038   // -- TO DO --
0039 
0040 protected:
0041   /* PROTECTED METHODS */
0042 
0043   /* Static data member access methods */
0044   const BlockLengthMap& blockLengthMap() const final {
0045     return m_blockLength;
0046   }  ///< get the static block ID to block-length map.
0047 
0048   const BlockNameMap& blockNameMap() const final { return m_blockName; }  ///< get the static block ID to blockname map.
0049 
0050   const BlkToRctCrateMap& rctEmCrateMap() const final {
0051     return m_rctEmCrate;
0052   }  ///< get static the block ID to RCT crate map for electrons.
0053 
0054   const BlkToRctCrateMap& rctJetCrateMap() const final {
0055     return m_rctJetCrate;
0056   }  ///< get the static block ID to RCT crate map for jets
0057 
0058   const BlockIdToEmCandIsoBoundMap& internEmIsoBounds() const final {
0059     return m_internEmIsoBounds;
0060   }  ///< get the static intern EM cand isolated boundary map.
0061 
0062   /* Other general methods */
0063   /// Returns a raw 32-bit header word generated from the blockId, number of time samples, bunch-crossing and event IDs.
0064   uint32_t generateRawHeader(const uint32_t blockId,
0065                              const uint32_t nSamples,
0066                              const uint32_t bxId,
0067                              const uint32_t eventId) const override;
0068 
0069 private:
0070   /* PRIVATE TYPEDEFS */
0071 
0072   /// Function pointer typdef to a block unpack function.
0073   typedef void (GctFormatTranslateV35::*PtrToUnpackFn)(const unsigned char*, const GctBlockHeader&);
0074   /// Typedef for a block ID to unpack function map.
0075   typedef std::map<unsigned int, PtrToUnpackFn> BlockIdToUnpackFnMap;
0076 
0077   /* PRIVATE MEMBER DATA */
0078 
0079   /// Map to translate block number to fundamental size of a block (i.e. for 1 time-sample).
0080   static const BlockLengthMap m_blockLength;
0081 
0082   /// Map to hold a description for each block number.
0083   static const BlockNameMap m_blockName;
0084 
0085   /// Map to relate capture block ID to the RCT crate the data originated from (for electrons).
0086   static const BlkToRctCrateMap m_rctEmCrate;
0087 
0088   /// Map to relate capture block ID to the RCT crate the data originated from (for jets).
0089   static const BlkToRctCrateMap m_rctJetCrate;
0090 
0091   /*! A map of Block IDs to IsoBoundaryPairs for storing the location of the isolated
0092    *  Internal EM cands in the pipeline, as this differs with Block ID. */
0093   static const BlockIdToEmCandIsoBoundMap m_internEmIsoBounds;
0094 
0095   /// Block ID to unpack function map.
0096   static const BlockIdToUnpackFnMap m_blockUnpackFn;
0097 
0098   /* PRIVATE METHODS */
0099 
0100   /* --------------------------------- */
0101   /* Private Block Unpacking Functions */
0102   /* --------------------------------- */
0103 
0104   /// unpack GCT EM Candidates and energy sums.
0105   void blockToGctEmCandsAndEnergySums(const unsigned char* d, const GctBlockHeader& hdr);
0106 
0107   /// Unpack GCT Jet Candidates and jet counts.
0108   void blockToGctJetCandsAndCounts(const unsigned char* d, const GctBlockHeader& hdr);
0109 
0110   /// unpack GCT internal EM Candidates
0111   void blockToGctInternEmCand(const unsigned char* d, const GctBlockHeader& hdr);
0112 
0113   /// unpack RCT EM Candidates
0114   void blockToRctEmCand(const unsigned char* d, const GctBlockHeader& hdr);
0115 
0116   /// Unpack RCT Calo Regions
0117   void blockToRctCaloRegions(const unsigned char* d, const GctBlockHeader& hdr);
0118 
0119   /// unpack Fibres
0120   void blockToFibres(const unsigned char* d, const GctBlockHeader& hdr);
0121 
0122   /// unpack Fibres and RCT EM Candidates
0123   void blockToFibresAndToRctEmCand(const unsigned char* d, const GctBlockHeader& hdr);
0124 
0125   /// unpack GCT internal Et sums
0126   void blockToGctInternEtSums(const unsigned char* d, const GctBlockHeader& hdr);
0127 
0128   /// unpack GCT internal output of leaf jet finder
0129   void blockToGctInternEtSumsAndJetCluster(const unsigned char* d, const GctBlockHeader& hdr);
0130 
0131   /// unpack GCT internal wheel and conc jets
0132   void blockToGctTrigObjects(const unsigned char* d, const GctBlockHeader& hdr);
0133 
0134   /// unpack GCT internal input to wheel jet sort
0135   void blockToGctJetClusterMinimal(const unsigned char* d, const GctBlockHeader& hdr);
0136 
0137   /// unpack GCT internal shared jet finder info
0138   void blockToGctJetPreCluster(const unsigned char* d, const GctBlockHeader& hdr);
0139 
0140   /// unpack GCT internal HF ring sums
0141   void blockToGctInternRingSums(const unsigned char* d, const GctBlockHeader& hdr);
0142 
0143   /// unpack GCT internal output of wheel
0144   void blockToGctWheelOutputInternEtAndRingSums(const unsigned char* d, const GctBlockHeader& hdr);
0145 
0146   /// unpack GCT internal input to wheel
0147   void blockToGctWheelInputInternEtAndRingSums(const unsigned char* d, const GctBlockHeader& hdr);
0148 };
0149 
0150 #endif