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 
18 // ************************************************************************
19 // *** THE TRANSLATION PROCESS MUST NEVER THROW ANY KIND OF EXCEPTION! ***
20 // ************************************************************************
21 
23 {
24 public:
25 
26  /* PUBLIC METHODS */
27 
29 
31  explicit GctFormatTranslateMCLegacy(bool hltMode = false, bool unpackSharedRegions = false);
32 
33  virtual ~GctFormatTranslateMCLegacy();
34 
36  virtual GctBlockHeader generateBlockHeader(const unsigned char * data) const;
37 
39  virtual bool convertBlock(const unsigned char * d, const GctBlockHeader& hdr);
40 
41 
42  /* ------------------------------ */
43  /* Public Block Packing Functions */
44  /* ------------------------------ */
45 
47 
48  void writeGctOutEmAndEnergyBlock(unsigned char * d,
49  const L1GctEmCandCollection* iso,
50  const L1GctEmCandCollection* nonIso,
51  const L1GctEtTotalCollection* etTotal,
52  const L1GctEtHadCollection* etHad,
53  const L1GctEtMissCollection* etMiss);
54 
56 
57  void writeGctOutJetBlock(unsigned char * d,
58  const L1GctJetCandCollection* cenJets,
59  const L1GctJetCandCollection* forJets,
60  const L1GctJetCandCollection* tauJets,
61  const L1GctHFRingEtSumsCollection* hfRingSums,
62  const L1GctHFBitCountsCollection* hfBitCounts,
63  const L1GctHtMissCollection* htMiss);
64 
66  void writeRctEmCandBlocks(unsigned char * d, const L1CaloEmCollection * rctEm);
67 
69  void writeAllRctCaloRegionBlock(unsigned char * d, const L1CaloRegionCollection * rctCalo);
70 
71 
72 protected:
73 
74  /* PROTECTED METHODS */
75 
76  /* Static data member access methods */
78  virtual const BlockLengthMap& blockLengthMap() const { return m_blockLength; }
79 
80  virtual BlockNameMap& blockNameMap() { return m_blockName; }
81  virtual const BlockNameMap& blockNameMap() const { return m_blockName; }
82 
84  virtual const BlkToRctCrateMap& rctEmCrateMap() const { return m_rctEmCrate; }
85 
87  virtual const BlkToRctCrateMap& rctJetCrateMap() const { return m_rctJetCrate; }
88 
91 
92 
93  /* Other general methods */
95  virtual uint32_t generateRawHeader(const uint32_t blockId,
96  const uint32_t nSamples,
97  const uint32_t bxId,
98  const uint32_t eventId) const;
99 
100 
101 private:
102 
103  /* PRIVATE TYPES & TYPEDEFS */
104 
106  typedef void (GctFormatTranslateMCLegacy::*PtrToUnpackFn)(const unsigned char *, const GctBlockHeader&);
108  typedef std::map<unsigned int, PtrToUnpackFn> BlockIdToUnpackFnMap;
109 
110 
111  /* PRIVATE MEMBER DATA */
112 
115 
118 
121 
124 
128 
131 
132 
133  /* PRIVATE METHODS */
134 
135  /* --------------------------------- */
136  /* Private Block Unpacking Functions */
137  /* --------------------------------- */
138 
140  void blockToGctEmCandsAndEnergySums(const unsigned char * d, const GctBlockHeader& hdr);
141 
143  void blockToGctJetCandsAndCounts(const unsigned char * d, const GctBlockHeader& hdr);
144 
146  void blockToRctEmCand(const unsigned char * d, const GctBlockHeader& hdr);
147 
149  void blockToFibres(const unsigned char * d, const GctBlockHeader& hdr);
150 
152  void blockToFibresAndToRctEmCand(const unsigned char * d, const GctBlockHeader& hdr);
153 
155  void blockToAllRctCaloRegions(const unsigned char * d, const GctBlockHeader& hdr);
156 
157 
158  /* ----------------------------- */
159  /* Miscellaneous Private Methods */
160  /* ----------------------------- */
161 
163 
164  template <typename Collection>
165  bool findBx0OffsetInCollection(unsigned& bx0Offset, const Collection* coll);
166 
167 };
168 
169 #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.
JetCorrectorParametersCollection coll
Definition: classes.h:14
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