CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GctFormatTranslateMCLegacy.h
Go to the documentation of this file.
1 #ifndef GctFormatTranslateMCLegacy_h_
2 #define GctFormatTranslateMCLegacy_h_
3 
5 
16 // ************************************************************************
17 // *** THE TRANSLATION PROCESS MUST NEVER THROW ANY KIND OF EXCEPTION! ***
18 // ************************************************************************
19 
21 public:
22  /* PUBLIC METHODS */
23 
25 
27  explicit GctFormatTranslateMCLegacy(bool hltMode = false, bool unpackSharedRegions = false);
28 
29  ~GctFormatTranslateMCLegacy() override;
30 
32  GctBlockHeader generateBlockHeader(const unsigned char* data) const override;
33 
35  bool convertBlock(const unsigned char* d, const GctBlockHeader& hdr) override;
36 
37  /* ------------------------------ */
38  /* Public Block Packing Functions */
39  /* ------------------------------ */
40 
42 
43  void writeGctOutEmAndEnergyBlock(unsigned char* d,
44  const L1GctEmCandCollection* iso,
45  const L1GctEmCandCollection* nonIso,
46  const L1GctEtTotalCollection* etTotal,
47  const L1GctEtHadCollection* etHad,
48  const L1GctEtMissCollection* etMiss);
49 
51 
52  void writeGctOutJetBlock(unsigned char* d,
53  const L1GctJetCandCollection* cenJets,
54  const L1GctJetCandCollection* forJets,
55  const L1GctJetCandCollection* tauJets,
56  const L1GctHFRingEtSumsCollection* hfRingSums,
57  const L1GctHFBitCountsCollection* hfBitCounts,
58  const L1GctHtMissCollection* htMiss);
59 
61  void writeRctEmCandBlocks(unsigned char* d, const L1CaloEmCollection* rctEm);
62 
64  void writeAllRctCaloRegionBlock(unsigned char* d, const L1CaloRegionCollection* rctCalo);
65 
66 protected:
67  /* PROTECTED METHODS */
68 
69  /* Static data member access methods */
71  return m_blockLength;
72  }
73 
74  const BlockNameMap& blockNameMap() const final { return m_blockName; }
75 
77  return m_rctEmCrate;
78  }
79 
81  return m_rctJetCrate;
82  }
83 
85  return m_internEmIsoBounds;
86  }
87 
88  /* Other general methods */
90  uint32_t generateRawHeader(const uint32_t blockId,
91  const uint32_t nSamples,
92  const uint32_t bxId,
93  const uint32_t eventId) const override;
94 
95 private:
96  /* PRIVATE TYPES & TYPEDEFS */
97 
99  typedef void (GctFormatTranslateMCLegacy::*PtrToUnpackFn)(const unsigned char*, const GctBlockHeader&);
101  typedef std::map<unsigned int, PtrToUnpackFn> BlockIdToUnpackFnMap;
102 
103  /* PRIVATE MEMBER DATA */
104 
107 
109  static const BlockNameMap m_blockName;
110 
113 
116 
120 
123 
124  /* PRIVATE METHODS */
125 
126  /* --------------------------------- */
127  /* Private Block Unpacking Functions */
128  /* --------------------------------- */
129 
131  void blockToGctEmCandsAndEnergySums(const unsigned char* d, const GctBlockHeader& hdr);
132 
134  void blockToGctJetCandsAndCounts(const unsigned char* d, const GctBlockHeader& hdr);
135 
137  void blockToRctEmCand(const unsigned char* d, const GctBlockHeader& hdr);
138 
140  void blockToFibres(const unsigned char* d, const GctBlockHeader& hdr);
141 
143  void blockToFibresAndToRctEmCand(const unsigned char* d, const GctBlockHeader& hdr);
144 
146  void blockToAllRctCaloRegions(const unsigned char* d, const GctBlockHeader& hdr);
147 
148  /* ----------------------------- */
149  /* Miscellaneous Private Methods */
150  /* ----------------------------- */
151 
153 
154  template <typename Collection>
155  bool findBx0OffsetInCollection(unsigned& bx0Offset, const Collection* coll);
156 };
157 
158 #endif
void writeGctOutEmAndEnergyBlock(unsigned char *d, const L1GctEmCandCollection *iso, const L1GctEmCandCollection *nonIso, const L1GctEtTotalCollection *etTotal, const L1GctEtHadCollection *etHad, const L1GctEtMissCollection *etMiss)
Writes GCT output EM and energy sums block into an unsigned char array, starting at the position poin...
std::vector< L1CaloEmCand > L1CaloEmCollection
void writeAllRctCaloRegionBlock(unsigned char *d, const L1CaloRegionCollection *rctCalo)
Writes the giant hack that is the RCT Calo Regions block.
uint32_t generateRawHeader(const uint32_t blockId, const uint32_t nSamples, const uint32_t bxId, const uint32_t eventId) const override
Returns a raw 32-bit header word generated from the blockId, number of time samples, bunch-crossing and event IDs.
std::vector< L1GctEtMiss > L1GctEtMissCollection
std::vector< L1GctHFRingEtSums > L1GctHFRingEtSumsCollection
void blockToFibresAndToRctEmCand(const unsigned char *d, const GctBlockHeader &hdr)
unpack Fibres and RCT EM Candidates
std::vector< L1GctEtHad > L1GctEtHadCollection
void(GctFormatTranslateMCLegacy::* PtrToUnpackFn)(const unsigned char *, const GctBlockHeader &)
Function pointer typdef to a block unpack function.
void writeRctEmCandBlocks(unsigned char *d, const L1CaloEmCollection *rctEm)
Writes the 4 RCT EM Candidate blocks.
const BlkToRctCrateMap & rctEmCrateMap() const final
get static the block ID to RCT crate map for electrons.
Abstract interface for RawToDigi/DigiToRaw conversions of GCT data.
static const BlockNameMap m_blockName
Map to hold a description for each block number.
void writeGctOutJetBlock(unsigned char *d, const L1GctJetCandCollection *cenJets, const L1GctJetCandCollection *forJets, const L1GctJetCandCollection *tauJets, const L1GctHFRingEtSumsCollection *hfRingSums, const L1GctHFBitCountsCollection *hfBitCounts, const L1GctHtMissCollection *htMiss)
Writes GCT output jet cands and counts into an unsigned char array, starting at the position pointed ...
bool convertBlock(const unsigned char *d, const GctBlockHeader &hdr) override
Get digis from the block - will return true if it succeeds, false otherwise.
void blockToGctEmCandsAndEnergySums(const unsigned char *d, const GctBlockHeader &hdr)
unpack GCT EM Candidates and energy sums.
std::vector< L1GctEtTotal > L1GctEtTotalCollection
std::vector< L1GctHFBitCounts > L1GctHFBitCountsCollection
std::vector< L1GctJetCand > L1GctJetCandCollection
tuple d
Definition: ztail.py:151
GctFormatTranslateMCLegacy(bool hltMode=false, bool unpackSharedRegions=false)
Constructor.
static const BlockLengthMap m_blockLength
Map to translate block number to fundamental size of a block (i.e. for 1 time-sample).
const BlockIdToEmCandIsoBoundMap & internEmIsoBounds() const final
get the static intern EM cand isolated boundary map.
Simple class for holding the basic attributes of an 32-bit block header.
const BlkToRctCrateMap & rctJetCrateMap() const final
get the static block ID to RCT crate map for jets
void blockToRctEmCand(const unsigned char *d, const GctBlockHeader &hdr)
unpack RCT EM Candidates
std::map< unsigned int, unsigned int > BlockLengthMap
Block ID to Block Length map.
const BlockNameMap & blockNameMap() const final
get the static block ID to blockname map.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
constexpr size_t nSamples
~GctFormatTranslateMCLegacy() override
Destructor.
std::vector< L1GctHtMiss > L1GctHtMissCollection
void blockToGctJetCandsAndCounts(const unsigned char *d, const GctBlockHeader &hdr)
Unpack GCT Jet Candidates and jet counts.
const BlockLengthMap & blockLengthMap() const final
get the static block ID to block-length map.
Unpacks/packs the MC Legacy data originally produced by the GctBlockPacker class. ...
static const BlkToRctCrateMap m_rctJetCrate
Map to relate capture block ID to the RCT crate the data originated from (for jets).
static const BlockIdToUnpackFnMap m_blockUnpackFn
Block ID to unpack function map.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
GctBlockHeader generateBlockHeader(const unsigned char *data) const override
Generate a block header from four 8-bit values.
void blockToFibres(const unsigned char *d, const GctBlockHeader &hdr)
unpack Fibres
static const BlkToRctCrateMap m_rctEmCrate
Map to relate capture block ID to the RCT crate the data originated from (for electrons).
std::map< unsigned int, IsoBoundaryPair > BlockIdToEmCandIsoBoundMap
A typdef for mapping Block IDs to IsoBoundaryPairs.
std::vector< L1CaloRegion > L1CaloRegionCollection
std::map< unsigned int, unsigned int > BlkToRctCrateMap
Typedef for mapping block ID to RCT crate.
std::map< unsigned int, std::string > BlockNameMap
Block ID to Block Description map.
std::map< unsigned int, PtrToUnpackFn > BlockIdToUnpackFnMap
Typedef for a block ID to unpack function map.
bool findBx0OffsetInCollection(unsigned &bx0Offset, const Collection *coll)
Template function (used in packing) that will find the offset to first item in a collection vector wh...
void blockToAllRctCaloRegions(const unsigned char *d, const GctBlockHeader &hdr)
Unpack All RCT Calo Regions (&#39;orrible hack for DigiToRaw use)
static const BlockIdToEmCandIsoBoundMap m_internEmIsoBounds
std::vector< L1GctEmCand > L1GctEmCandCollection