CMS 3D CMS Logo

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
GctFormatTranslateMCLegacy::blockToGctJetCandsAndCounts
void blockToGctJetCandsAndCounts(const unsigned char *d, const GctBlockHeader &hdr)
Unpack GCT Jet Candidates and jet counts.
Definition: GctFormatTranslateMCLegacy.cc:524
GctFormatTranslateMCLegacy::m_blockLength
static const BlockLengthMap m_blockLength
Map to translate block number to fundamental size of a block (i.e. for 1 time-sample).
Definition: GctFormatTranslateMCLegacy.h:106
GctBlockHeader
Simple class for holding the basic attributes of an 32-bit block header.
Definition: GctBlockHeader.h:15
GctFormatTranslateMCLegacy::generateBlockHeader
GctBlockHeader generateBlockHeader(const unsigned char *data) const override
Generate a block header from four 8-bit values.
Definition: GctFormatTranslateMCLegacy.cc:85
GctFormatTranslateMCLegacy::blockToAllRctCaloRegions
void blockToAllRctCaloRegions(const unsigned char *d, const GctBlockHeader &hdr)
Unpack All RCT Calo Regions ('orrible hack for DigiToRaw use)
Definition: GctFormatTranslateMCLegacy.cc:670
GctFormatTranslateMCLegacy::convertBlock
bool convertBlock(const unsigned char *d, const GctBlockHeader &hdr) override
Get digis from the block - will return true if it succeeds, false otherwise.
Definition: GctFormatTranslateMCLegacy.cc:114
GctFormatTranslateMCLegacy::blockToFibresAndToRctEmCand
void blockToFibresAndToRctEmCand(const unsigned char *d, const GctBlockHeader &hdr)
unpack Fibres and RCT EM Candidates
Definition: GctFormatTranslateMCLegacy.cc:665
GctFormatTranslateMCLegacy::blockToGctEmCandsAndEnergySums
void blockToGctEmCandsAndEnergySums(const unsigned char *d, const GctBlockHeader &hdr)
unpack GCT EM Candidates and energy sums.
Definition: GctFormatTranslateMCLegacy.cc:466
L1GctJetCandCollection
std::vector< L1GctJetCand > L1GctJetCandCollection
Definition: L1GctCollections.h:31
GctFormatTranslateBase::unpackSharedRegions
bool unpackSharedRegions() const
Definition: GctFormatTranslateBase.h:101
GctFormatTranslateMCLegacy::writeGctOutJetBlock
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 ...
Definition: GctFormatTranslateMCLegacy.cc:220
GctFormatTranslateMCLegacy::m_rctEmCrate
static const BlkToRctCrateMap m_rctEmCrate
Map to relate capture block ID to the RCT crate the data originated from (for electrons).
Definition: GctFormatTranslateMCLegacy.h:112
GctFormatTranslateMCLegacy::blockLengthMap
const BlockLengthMap & blockLengthMap() const final
get the static block ID to block-length map.
Definition: GctFormatTranslateMCLegacy.h:70
watchdog.const
const
Definition: watchdog.py:83
PresampleTask_cfi.nSamples
nSamples
Definition: PresampleTask_cfi.py:7
GctFormatTranslateMCLegacy
Unpacks/packs the MC Legacy data originally produced by the GctBlockPacker class.
Definition: GctFormatTranslateMCLegacy.h:20
GctFormatTranslateMCLegacy::internEmIsoBounds
const BlockIdToEmCandIsoBoundMap & internEmIsoBounds() const final
get the static intern EM cand isolated boundary map.
Definition: GctFormatTranslateMCLegacy.h:84
GctFormatTranslateBase
Abstract interface for RawToDigi/DigiToRaw conversions of GCT data.
Definition: GctFormatTranslateBase.h:25
GctFormatTranslateMCLegacy::rctJetCrateMap
const BlkToRctCrateMap & rctJetCrateMap() const final
get the static block ID to RCT crate map for jets
Definition: GctFormatTranslateMCLegacy.h:80
L1GctEtMissCollection
std::vector< L1GctEtMiss > L1GctEtMissCollection
Definition: L1GctCollections.h:34
GctFormatTranslateMCLegacy::m_internEmIsoBounds
static const BlockIdToEmCandIsoBoundMap m_internEmIsoBounds
Definition: GctFormatTranslateMCLegacy.h:119
GctFormatTranslateMCLegacy::blockNameMap
const BlockNameMap & blockNameMap() const final
get the static block ID to blockname map.
Definition: GctFormatTranslateMCLegacy.h:74
GctFormatTranslateMCLegacy::writeRctEmCandBlocks
void writeRctEmCandBlocks(unsigned char *d, const L1CaloEmCollection *rctEm)
Writes the 4 RCT EM Candidate blocks.
Definition: GctFormatTranslateMCLegacy.cc:312
GctFormatTranslateMCLegacy::PtrToUnpackFn
void(GctFormatTranslateMCLegacy::* PtrToUnpackFn)(const unsigned char *, const GctBlockHeader &)
Function pointer typdef to a block unpack function.
Definition: GctFormatTranslateMCLegacy.h:99
L1CaloEmCollection
std::vector< L1CaloEmCand > L1CaloEmCollection
Definition: L1CaloCollections.h:10
GctFormatTranslateMCLegacy::writeGctOutEmAndEnergyBlock
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...
Definition: GctFormatTranslateMCLegacy.cc:134
GctFormatTranslateMCLegacy::~GctFormatTranslateMCLegacy
~GctFormatTranslateMCLegacy() override
Destructor.
Definition: GctFormatTranslateMCLegacy.cc:83
L1GctEtTotalCollection
std::vector< L1GctEtTotal > L1GctEtTotalCollection
Definition: L1GctCollections.h:35
GctFormatTranslateBase::hltMode
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
Definition: GctFormatTranslateBase.h:100
GctFormatTranslateMCLegacy::findBx0OffsetInCollection
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...
Definition: GctFormatTranslateMCLegacy.cc:715
GctFormatTranslateMCLegacy::blockToFibres
void blockToFibres(const unsigned char *d, const GctBlockHeader &hdr)
unpack Fibres
Definition: GctFormatTranslateMCLegacy.cc:643
GctFormatTranslateMCLegacy::m_rctJetCrate
static const BlkToRctCrateMap m_rctJetCrate
Map to relate capture block ID to the RCT crate the data originated from (for jets).
Definition: GctFormatTranslateMCLegacy.h:115
GctFormatTranslateMCLegacy::rctEmCrateMap
const BlkToRctCrateMap & rctEmCrateMap() const final
get static the block ID to RCT crate map for electrons.
Definition: GctFormatTranslateMCLegacy.h:76
GctFormatTranslateMCLegacy::generateRawHeader
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,...
Definition: GctFormatTranslateMCLegacy.cc:446
GctFormatTranslateBase::BlockIdToEmCandIsoBoundMap
std::map< unsigned int, IsoBoundaryPair > BlockIdToEmCandIsoBoundMap
A typdef for mapping Block IDs to IsoBoundaryPairs.
Definition: GctFormatTranslateBase.h:79
L1GctHFBitCountsCollection
std::vector< L1GctHFBitCounts > L1GctHFBitCountsCollection
Definition: L1GctCollections.h:39
GctFormatTranslateMCLegacy::m_blockName
static const BlockNameMap m_blockName
Map to hold a description for each block number.
Definition: GctFormatTranslateMCLegacy.h:109
GctFormatTranslateMCLegacy::writeAllRctCaloRegionBlock
void writeAllRctCaloRegionBlock(unsigned char *d, const L1CaloRegionCollection *rctCalo)
Writes the giant hack that is the RCT Calo Regions block.
Definition: GctFormatTranslateMCLegacy.cc:397
L1CaloRegionCollection
std::vector< L1CaloRegion > L1CaloRegionCollection
Definition: L1CaloCollections.h:11
L1GctEmCandCollection
std::vector< L1GctEmCand > L1GctEmCandCollection
Definition: L1GctCollections.h:30
GctFormatTranslateMCLegacy::m_blockUnpackFn
static const BlockIdToUnpackFnMap m_blockUnpackFn
Block ID to unpack function map.
Definition: GctFormatTranslateMCLegacy.h:122
GctFormatTranslateBase::BlockLengthMap
std::map< unsigned int, unsigned int > BlockLengthMap
Block ID to Block Length map.
Definition: GctFormatTranslateBase.h:63
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
funct::void
TEMPL(T2) struct Divides void
Definition: Factorize.h:29
GctFormatTranslateBase::BlockNameMap
std::map< unsigned int, std::string > BlockNameMap
Block ID to Block Description map.
Definition: GctFormatTranslateBase.h:65
ztail.d
d
Definition: ztail.py:151
GctFormatTranslateMCLegacy::GctFormatTranslateMCLegacy
GctFormatTranslateMCLegacy(bool hltMode=false, bool unpackSharedRegions=false)
Constructor.
Definition: GctFormatTranslateMCLegacy.cc:80
GctFormatTranslateMCLegacy::blockToRctEmCand
void blockToRctEmCand(const unsigned char *d, const GctBlockHeader &hdr)
unpack RCT EM Candidates
Definition: GctFormatTranslateMCLegacy.cc:584
L1GctEtHadCollection
std::vector< L1GctEtHad > L1GctEtHadCollection
Definition: L1GctCollections.h:33
GctFormatTranslateBase.h
GctFormatTranslateBase::BlkToRctCrateMap
std::map< unsigned int, unsigned int > BlkToRctCrateMap
Typedef for mapping block ID to RCT crate.
Definition: GctFormatTranslateBase.h:69
L1GctHFRingEtSumsCollection
std::vector< L1GctHFRingEtSums > L1GctHFRingEtSumsCollection
Definition: L1GctCollections.h:38
L1GctHtMissCollection
std::vector< L1GctHtMiss > L1GctHtMissCollection
Definition: L1GctCollections.h:36
GctFormatTranslateMCLegacy::BlockIdToUnpackFnMap
std::map< unsigned int, PtrToUnpackFn > BlockIdToUnpackFnMap
Typedef for a block ID to unpack function map.
Definition: GctFormatTranslateMCLegacy.h:101