CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 {
22 public:
23 
24  /* PUBLIC METHODS */
25 
27 
29  explicit GctFormatTranslateMCLegacy(bool hltMode = false, bool unpackSharedRegions = false);
30 
31  virtual ~GctFormatTranslateMCLegacy();
32 
34  virtual GctBlockHeader generateBlockHeader(const unsigned char * data) const;
35 
37  virtual bool convertBlock(const unsigned char * d, const GctBlockHeader& hdr);
38 
39 
40  /* ------------------------------ */
41  /* Public Block Packing Functions */
42  /* ------------------------------ */
43 
45 
46  void writeGctOutEmAndEnergyBlock(unsigned char * d,
47  const L1GctEmCandCollection* iso,
48  const L1GctEmCandCollection* nonIso,
49  const L1GctEtTotalCollection* etTotal,
50  const L1GctEtHadCollection* etHad,
51  const L1GctEtMissCollection* etMiss);
52 
54 
55  void writeGctOutJetBlock(unsigned char * d,
56  const L1GctJetCandCollection* cenJets,
57  const L1GctJetCandCollection* forJets,
58  const L1GctJetCandCollection* tauJets,
59  const L1GctHFRingEtSumsCollection* hfRingSums,
60  const L1GctHFBitCountsCollection* hfBitCounts,
61  const L1GctHtMissCollection* htMiss);
62 
64  void writeRctEmCandBlocks(unsigned char * d, const L1CaloEmCollection * rctEm);
65 
67  void writeAllRctCaloRegionBlock(unsigned char * d, const L1CaloRegionCollection * rctCalo);
68 
69 
70 protected:
71 
72  /* PROTECTED METHODS */
73 
74  /* Static data member access methods */
76  virtual const BlockLengthMap& blockLengthMap() const { return m_blockLength; }
77 
78  virtual BlockNameMap& blockNameMap() { return m_blockName; }
79  virtual const BlockNameMap& blockNameMap() const { return m_blockName; }
80 
82  virtual const BlkToRctCrateMap& rctEmCrateMap() const { return m_rctEmCrate; }
83 
85  virtual const BlkToRctCrateMap& rctJetCrateMap() const { return m_rctJetCrate; }
86 
89 
90 
91  /* Other general methods */
93  virtual uint32_t generateRawHeader(const uint32_t blockId,
94  const uint32_t nSamples,
95  const uint32_t bxId,
96  const uint32_t eventId) const;
97 
98 
99 private:
100 
101  /* PRIVATE TYPES & TYPEDEFS */
102 
104  typedef void (GctFormatTranslateMCLegacy::*PtrToUnpackFn)(const unsigned char *, const GctBlockHeader&);
106  typedef std::map<unsigned int, PtrToUnpackFn> BlockIdToUnpackFnMap;
107 
108 
109  /* PRIVATE MEMBER DATA */
110 
113 
116 
119 
122 
126 
129 
130 
131  /* PRIVATE METHODS */
132 
133  /* --------------------------------- */
134  /* Private Block Unpacking Functions */
135  /* --------------------------------- */
136 
138  void blockToGctEmCandsAndEnergySums(const unsigned char * d, const GctBlockHeader& hdr);
139 
141  void blockToGctJetCandsAndCounts(const unsigned char * d, const GctBlockHeader& hdr);
142 
144  void blockToRctEmCand(const unsigned char * d, const GctBlockHeader& hdr);
145 
147  void blockToFibres(const unsigned char * d, const GctBlockHeader& hdr);
148 
150  void blockToFibresAndToRctEmCand(const unsigned char * d, const GctBlockHeader& hdr);
151 
153  void blockToAllRctCaloRegions(const unsigned char * d, const GctBlockHeader& hdr);
154 
155 
156  /* ----------------------------- */
157  /* Miscellaneous Private Methods */
158  /* ----------------------------- */
159 
161 
162  template <typename Collection>
163  bool findBx0OffsetInCollection(unsigned& bx0Offset, const Collection* coll);
164 
165 };
166 
167 #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.
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
static BlkToRctCrateMap m_rctJetCrate
Map to relate capture block ID to the RCT crate the data originated from (for jets).
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.
Abstract interface for RawToDigi/DigiToRaw conversions of GCT data.
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 ...
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
GctFormatTranslateMCLegacy(bool hltMode=false, bool unpackSharedRegions=false)
Constructor.
virtual BlockLengthMap & blockLengthMap()
get the static block ID to block-length map.
static BlockLengthMap m_blockLength
Map to translate block number to fundamental size of a block (i.e. for 1 time-sample).
virtual const BlkToRctCrateMap & rctJetCrateMap() const
get the static block ID to RCT crate map for jets
virtual const BlockNameMap & blockNameMap() const
get the static block ID to blockname map.
virtual const BlockLengthMap & blockLengthMap() const
get the static block ID to block-length map.
Simple class for holding the basic attributes of an 32-bit block header.
virtual BlkToRctCrateMap & rctJetCrateMap()
get the static block ID to RCT crate map for jets
virtual const BlockIdToEmCandIsoBoundMap & internEmIsoBounds() const
get the static intern EM cand isolated boundary map.
virtual uint32_t generateRawHeader(const uint32_t blockId, const uint32_t nSamples, const uint32_t bxId, const uint32_t eventId) const
Returns a raw 32-bit header word generated from the blockId, number of time samples, bunch-crossing and event IDs.
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.
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
virtual BlockIdToEmCandIsoBoundMap & internEmIsoBounds()
get the static intern EM cand isolated boundary map.
std::vector< L1GctHtMiss > L1GctHtMissCollection
static BlkToRctCrateMap m_rctEmCrate
Map to relate capture block ID to the RCT crate the data originated from (for electrons).
virtual GctBlockHeader generateBlockHeader(const unsigned char *data) const
Generate a block header from four 8-bit values.
void blockToGctJetCandsAndCounts(const unsigned char *d, const GctBlockHeader &hdr)
Unpack GCT Jet Candidates and jet counts.
Unpacks/packs the MC Legacy data originally produced by the GctBlockPacker class. ...
static BlockIdToEmCandIsoBoundMap m_internEmIsoBounds
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
virtual BlkToRctCrateMap & rctEmCrateMap()
get the static block ID to RCT crate map for electrons.
virtual bool convertBlock(const unsigned char *d, const GctBlockHeader &hdr)
Get digis from the block - will return true if it succeeds, false otherwise.
virtual const BlkToRctCrateMap & rctEmCrateMap() const
get static the block ID to RCT crate map for electrons.
void blockToFibres(const unsigned char *d, const GctBlockHeader &hdr)
unpack Fibres
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.
virtual ~GctFormatTranslateMCLegacy()
Destructor.
static BlockNameMap m_blockName
Map to hold a description for each block number.
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)
virtual BlockNameMap & blockNameMap()
get the static block ID to block-name map.
static BlockIdToUnpackFnMap m_blockUnpackFn
Block ID to unpack function map.
std::vector< L1GctEmCand > L1GctEmCandCollection