Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:45:26

0001 #ifndef GctFormatTranslateV38_h_
0002 #define GctFormatTranslateV38_h_
0003 
0004 #include "EventFilter/GctRawToDigi/src/GctFormatTranslateBase.h"
0005 
0006 /*!
0007 * \class GctFormatTranslateV38
0008 * \brief Unpacks/packs the V38 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 GctFormatTranslateV38 : 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 GctFormatTranslateV38(bool hltMode = false,
0025                                  bool unpackSharedRegions = false,
0026                                  unsigned numberOfGctSamplesToUnpack = 1,
0027                                  unsigned numberOfRctSamplesToUnpack = 1);
0028 
0029   ~GctFormatTranslateV38() override;  ///< Destructor.
0030 
0031   /// Generate a block header from four 8-bit values.
0032   GctBlockHeader generateBlockHeader(const unsigned char* data) const override;
0033 
0034   /// Get digis from the block - will return true if it succeeds, false otherwise.
0035   bool convertBlock(const unsigned char* d, const GctBlockHeader& hdr) override;
0036 
0037   /* ------------------------------ */
0038   /* Public Block Packing Functions */
0039   /* ------------------------------ */
0040 
0041   // -- TO DO --
0042 
0043 protected:
0044   /* PROTECTED METHODS */
0045 
0046   /* Static data member access methods */
0047   const BlockLengthMap& blockLengthMap() const final {
0048     return m_blockLength;
0049   }  ///< get the static block ID to block-length map.
0050 
0051   const BlockNameMap& blockNameMap() const final { return m_blockName; }  ///< get the static block ID to blockname map.
0052 
0053   const BlkToRctCrateMap& rctEmCrateMap() const final {
0054     return m_rctEmCrate;
0055   }  ///< get static the block ID to RCT crate map for electrons.
0056 
0057   const BlkToRctCrateMap& rctJetCrateMap() const final {
0058     return m_rctJetCrate;
0059   }  ///< get the static block ID to RCT crate map for jets
0060 
0061   const BlockIdToEmCandIsoBoundMap& internEmIsoBounds() const final {
0062     return m_internEmIsoBounds;
0063   }  ///< get the static intern EM cand isolated boundary map.
0064 
0065   /* Other general methods */
0066   /// Returns a raw 32-bit header word generated from the blockId, number of time samples, bunch-crossing and event IDs.
0067   uint32_t generateRawHeader(const uint32_t blockId,
0068                              const uint32_t nSamples,
0069                              const uint32_t bxId,
0070                              const uint32_t eventId) const override;
0071 
0072 private:
0073   /* PRIVATE TYPEDEFS */
0074 
0075   /// Function pointer typdef to a block unpack function.
0076   typedef void (GctFormatTranslateV38::*PtrToUnpackFn)(const unsigned char*, const GctBlockHeader&);
0077   /// Typedef for a block ID to unpack function map.
0078   typedef std::map<unsigned int, PtrToUnpackFn> BlockIdToUnpackFnMap;
0079 
0080   /* PRIVATE MEMBER DATA */
0081 
0082   /// Map to translate block number to fundamental size of a block (i.e. for 1 time-sample).
0083   static const BlockLengthMap m_blockLength;
0084 
0085   /// Map to hold a description for each block number.
0086   static const BlockNameMap m_blockName;
0087 
0088   /// Map to relate capture block ID to the RCT crate the data originated from (for electrons).
0089   static const BlkToRctCrateMap m_rctEmCrate;
0090 
0091   /// Map to relate capture block ID to the RCT crate the data originated from (for jets).
0092   static const BlkToRctCrateMap m_rctJetCrate;
0093 
0094   /*! A map of Block IDs to IsoBoundaryPairs for storing the location of the isolated
0095    *  Internal EM cands in the pipeline, as this differs with Block ID. */
0096   static const BlockIdToEmCandIsoBoundMap m_internEmIsoBounds;
0097 
0098   /// Block ID to unpack function map.
0099   static const BlockIdToUnpackFnMap m_blockUnpackFn;
0100 
0101   /// Number of BXs of GCT data to unpack (assuming they are in the raw data)
0102   const unsigned m_numberOfGctSamplesToUnpack;
0103 
0104   ///< Number of BXs of RCT data to unpack (assuming they are in the raw data)
0105   const unsigned m_numberOfRctSamplesToUnpack;
0106 
0107   /* PRIVATE METHODS */
0108 
0109   /* --------------------------------- */
0110   /* Private Block Unpacking Functions */
0111   /* --------------------------------- */
0112 
0113   /// unpack GCT EM Candidates and energy sums.
0114   void blockToGctEmCandsAndEnergySums(const unsigned char* d, const GctBlockHeader& hdr);
0115 
0116   /// Unpack GCT Jet Candidates and jet counts.
0117   void blockToGctJetCandsAndCounts(const unsigned char* d, const GctBlockHeader& hdr);
0118 
0119   /// unpack GCT internal EM Candidates
0120   void blockToGctInternEmCand(const unsigned char* d, const GctBlockHeader& hdr);
0121 
0122   /// unpack RCT EM Candidates
0123   void blockToRctEmCand(const unsigned char* d, const GctBlockHeader& hdr);
0124 
0125   /// Unpack RCT Calo Regions
0126   void blockToRctCaloRegions(const unsigned char* d, const GctBlockHeader& hdr);
0127 
0128   /// unpack Fibres
0129   void blockToFibres(const unsigned char* d, const GctBlockHeader& hdr);
0130 
0131   /// unpack Fibres and RCT EM Candidates
0132   void blockToFibresAndToRctEmCand(const unsigned char* d, const GctBlockHeader& hdr);
0133 
0134   /// unpack GCT internal Et sums
0135   void blockToGctInternEtSums(const unsigned char* d, const GctBlockHeader& hdr);
0136 
0137   /// unpack GCT internal output of leaf jet finder
0138   void blockToGctInternEtSumsAndJetCluster(const unsigned char* d, const GctBlockHeader& hdr);
0139 
0140   /// unpack GCT internal wheel and conc jets
0141   void blockToGctTrigObjects(const unsigned char* d, const GctBlockHeader& hdr);
0142 
0143   /// unpack GCT internal input to wheel jet sort
0144   void blockToGctJetClusterMinimal(const unsigned char* d, const GctBlockHeader& hdr);
0145 
0146   /// unpack GCT internal shared jet finder info
0147   void blockToGctJetPreCluster(const unsigned char* d, const GctBlockHeader& hdr);
0148 
0149   /// unpack GCT internal HF ring sums
0150   void blockToGctInternRingSums(const unsigned char* d, const GctBlockHeader& hdr);
0151 
0152   /// unpack GCT internal output of wheel
0153   void blockToGctWheelOutputInternEtAndRingSums(const unsigned char* d, const GctBlockHeader& hdr);
0154 
0155   /// unpack GCT internal input to wheel
0156   void blockToGctWheelInputInternEtAndRingSums(const unsigned char* d, const GctBlockHeader& hdr);
0157 
0158   /// unpack GCT internal Missing Ht data that is being input to the wheels.
0159   void blockToGctInternHtMissPreWheel(const unsigned char* d, const GctBlockHeader& hdr);
0160 
0161   /// unpack GCT internal Missing Ht data that is either wheel output or concJet input (i.e. after wheel processing).
0162   void blockToGctInternHtMissPostWheel(const unsigned char* d, const GctBlockHeader& hdr);
0163 };
0164 
0165 #endif