CMS 3D CMS Logo

GctFormatTranslateBase.h
Go to the documentation of this file.
1 #ifndef GctFormatTranslateBase_h_
2 #define GctFormatTranslateBase_h_
3 
4 // C++ includes
5 #include <map>
6 #include <utility>
7 #include <string>
8 
9 // CMSSW includes
14 
26 public:
28 
30  explicit GctFormatTranslateBase(bool hltMode = false, bool unpackSharedRegions = false);
31 
32  virtual ~GctFormatTranslateBase();
33 
36 
37  // Set the bunch crossing ID that will be put into the block headers when packing raw data (i.e. Digi -> Raw).
38  void setPackingBxId(uint32_t bxId) { m_packingBxId = bxId; }
39 
40  // Set the event ID that will be put into the block headers when packing raw data (i.e. Digi -> Raw).
41  void setPackingEventId(uint32_t eventId) { m_packingEventId = eventId; }
42 
44  virtual GctBlockHeader generateBlockHeader(const unsigned char* data) const = 0;
45 
48 
50  virtual bool convertBlock(const unsigned char* d, const GctBlockHeader& hdr) = 0;
51 
52 protected:
53  /* PROTECTED TYPDEFS, ENUMS, AND CLASS CONSTANTS. */
54 
56 
58 
60 
62 
63  typedef std::map<unsigned int, unsigned int> BlockLengthMap;
64  typedef std::pair<unsigned int, unsigned int> BlockLengthPair;
65  typedef std::map<unsigned int, std::string> BlockNameMap;
66  typedef std::pair<unsigned int, std::string> BlockNamePair;
67 
69  typedef std::map<unsigned int, unsigned int> BlkToRctCrateMap;
70 
76  typedef std::pair<unsigned int, unsigned int> IsoBoundaryPair;
77 
79  typedef std::map<unsigned int, IsoBoundaryPair> BlockIdToEmCandIsoBoundMap;
80 
81  /* PROTECTED METHODS */
82 
83  /* Static data member access methods */
84  virtual const BlockLengthMap& blockLengthMap() const = 0;
85 
86  virtual const BlockNameMap& blockNameMap() const = 0;
87 
88  virtual const BlkToRctCrateMap& rctEmCrateMap()
89  const = 0;
90 
91  virtual const BlkToRctCrateMap& rctJetCrateMap() const = 0;
92 
94  const = 0;
95 
96  /* Data member access methods */
97  GctUnpackCollections* const colls() const {
98  return m_collections;
99  }
100  bool hltMode() const { return m_hltMode; }
101  bool unpackSharedRegions() const {
102  return m_unpackSharedRegions;
103  }
105  return m_srcCardRouting;
106  }
107  const uint32_t packingBxId() const { return m_packingBxId; }
108  const uint32_t packingEventId() const { return m_packingEventId; }
109 
110  /* Other general methods */
112  L1GctJetCandCollection* const gctJets(const unsigned cat) const;
113 
115  virtual uint32_t generateRawHeader(const uint32_t blockId,
116  const uint32_t nSamples,
117  const uint32_t bxId,
118  const uint32_t eventId) const = 0;
119 
121 
122  void writeRawHeader(unsigned char* data, uint32_t blockId, uint32_t nSamples) const;
123 
125  bool checkBlock(const GctBlockHeader& hdr) const;
126 
128  void blockDoNothing(const unsigned char* d, const GctBlockHeader& hdr) {}
129 
130 private:
131  /* PRIVATE STATIC CONSTS */
133 
134  /* PRIVATE MEMBER DATA */
135 
138 
140  bool m_hltMode;
141 
143 
145 
148 
150  uint32_t m_packingBxId;
151 
154 };
155 
156 #endif /* GctFormatTranslateBase_h_ */
GctBlockHeader
Simple class for holding the basic attributes of an 32-bit block header.
Definition: GctBlockHeader.h:15
GctFormatTranslateBase::FORWARD_JETS
Definition: GctFormatTranslateBase.h:61
GctUnpackCollections
RAII and useful methods for the many dataformat collections required by the GCT unpacker.
Definition: GctUnpackCollections.h:21
GctFormatTranslateBase::m_packingBxId
uint32_t m_packingBxId
The bunch-crossing ID to be used by the data packing methods.
Definition: GctFormatTranslateBase.h:150
GctFormatTranslateBase::m_hltMode
bool m_hltMode
If true, unpack only BX zero and GCT output data (i.e. to run as quickly as possible)
Definition: GctFormatTranslateBase.h:140
GctFormatTranslateBase::writeRawHeader
void writeRawHeader(unsigned char *data, uint32_t blockId, uint32_t nSamples) const
Writes a raw block header into the raw data array for a given block ID and number of time-samples.
Definition: GctFormatTranslateBase.cc:41
GctFormatTranslateBase::NUM_JET_CATEGORIES
Definition: GctFormatTranslateBase.h:61
GctFormatTranslateBase::setPackingEventId
void setPackingEventId(uint32_t eventId)
Definition: GctFormatTranslateBase.h:41
eostools.cat
def cat(path)
Definition: eostools.py:401
L1GctJetCandCollection
std::vector< L1GctJetCand > L1GctJetCandCollection
Definition: L1GctCollections.h:31
GctFormatTranslateBase::packingBxId
const uint32_t packingBxId() const
Get the BxId to be used when packing data.
Definition: GctFormatTranslateBase.h:107
GctFormatTranslateBase::unpackSharedRegions
bool unpackSharedRegions() const
Definition: GctFormatTranslateBase.h:101
GctFormatTranslateBase::blockDoNothing
void blockDoNothing(const unsigned char *d, const GctBlockHeader &hdr)
The null unpack function - obviously common to all formats.
Definition: GctFormatTranslateBase.h:128
GctFormatTranslateBase::setPackingBxId
void setPackingBxId(uint32_t bxId)
Definition: GctFormatTranslateBase.h:38
GctFormatTranslateBase::rctJetCrateMap
virtual const BlkToRctCrateMap & rctJetCrateMap() const =0
get the static block ID to RCT crate map for jets
PresampleTask_cfi.nSamples
nSamples
Definition: PresampleTask_cfi.py:7
GctFormatTranslateBase::~GctFormatTranslateBase
virtual ~GctFormatTranslateBase()
Destructor.
Definition: GctFormatTranslateBase.cc:19
GctFormatTranslateBase
Abstract interface for RawToDigi/DigiToRaw conversions of GCT data.
Definition: GctFormatTranslateBase.h:25
SourceCardRouting
Definition: SourceCardRouting.h:13
GctUnpackCollections.h
GctFormatTranslateBase::generateBlockHeader
virtual GctBlockHeader generateBlockHeader(const unsigned char *data) const =0
Generate a block header from four 8-bit values.
GctFormatTranslateBase::IsoBoundaryPair
std::pair< unsigned int, unsigned int > IsoBoundaryPair
Definition: GctFormatTranslateBase.h:76
GctFormatTranslateBase::BlockLengthPair
std::pair< unsigned int, unsigned int > BlockLengthPair
Block ID/length pair.
Definition: GctFormatTranslateBase.h:64
GctFormatTranslateBase::m_unpackSharedRegions
bool m_unpackSharedRegions
If true, the shared RCT Calo regions will be unpacked also.
Definition: GctFormatTranslateBase.h:144
GctFormatTranslateBase::BlockNamePair
std::pair< unsigned int, std::string > BlockNamePair
Block ID/Description pair.
Definition: GctFormatTranslateBase.h:66
GctFormatTranslateBase::packingEventId
const uint32_t packingEventId() const
Get the EventId to be used when packing data.
Definition: GctFormatTranslateBase.h:108
GctFormatTranslateBase::GctFormatTranslateBase
GctFormatTranslateBase(bool hltMode=false, bool unpackSharedRegions=false)
Constructor.
Definition: GctFormatTranslateBase.cc:11
GctFormatTranslateBase::m_packingEventId
uint32_t m_packingEventId
The event ID to be used by the data packing methods.
Definition: GctFormatTranslateBase.h:153
GctFormatTranslateBase::convertBlock
virtual bool convertBlock(const unsigned char *d, const GctBlockHeader &hdr)=0
Get digis from the block - will return true if it succeeds, false otherwise.
GctBlockHeader.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
oniaPATMuonsWithTrigger_cff.collections
collections
Definition: oniaPATMuonsWithTrigger_cff.py:37
GctFormatTranslateBase::hltMode
bool hltMode() const
Protected interface to get HLT optimisation mode flag.
Definition: GctFormatTranslateBase.h:100
GctFormatTranslateBase::m_collections
GctUnpackCollections * m_collections
Pointer to the output collections object.
Definition: GctFormatTranslateBase.h:137
GctFormatTranslateBase::CENTRAL_JETS
Definition: GctFormatTranslateBase.h:61
GctFormatTranslateBase::colls
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
Definition: GctFormatTranslateBase.h:97
FEDRawDataCollection.h
GctFormatTranslateBase::BlockIdToEmCandIsoBoundMap
std::map< unsigned int, IsoBoundaryPair > BlockIdToEmCandIsoBoundMap
A typdef for mapping Block IDs to IsoBoundaryPairs.
Definition: GctFormatTranslateBase.h:79
GctFormatTranslateBase::blockNameMap
virtual const BlockNameMap & blockNameMap() const =0
get the static block ID to blockname map.
GctFormatTranslateBase::generateRawHeader
virtual uint32_t generateRawHeader(const uint32_t blockId, const uint32_t nSamples, const uint32_t bxId, const uint32_t eventId) const =0
Returns a raw 32-bit header word generated from the blockId, number of time samples,...
GctFormatTranslateBase::getBlockDescription
const std::string & getBlockDescription(const GctBlockHeader &header) const
Get block description.
Definition: GctFormatTranslateBase.cc:21
GctFormatTranslateBase::rctEmCrateMap
virtual const BlkToRctCrateMap & rctEmCrateMap() const =0
get static the block ID to RCT crate map for electrons.
GctFormatTranslateBase::gctJets
L1GctJetCandCollection *const gctJets(const unsigned cat) const
Get a specific jet candandiate collection using the JetCandCategory enumeration.
Definition: GctFormatTranslateBase.cc:30
GctFormatTranslateBase::blockLengthMap
virtual const BlockLengthMap & blockLengthMap() const =0
get the static block ID to block-length map.
GctFormatTranslateBase::TAU_JETS
Definition: GctFormatTranslateBase.h:61
GctFormatTranslateBase::internEmIsoBounds
virtual const BlockIdToEmCandIsoBoundMap & internEmIsoBounds() const =0
get the static intern EM cand isolated boundary map.
GctFormatTranslateBase::setUnpackCollections
void setUnpackCollections(GctUnpackCollections *const collections)
Set the pointer to the unpack collections.
Definition: GctFormatTranslateBase.h:35
GctFormatTranslateBase::m_srcCardRouting
SourceCardRouting m_srcCardRouting
Source card mapping info.
Definition: GctFormatTranslateBase.h:147
GctFormatTranslateBase::ISO_EM_CANDS
Definition: GctFormatTranslateBase.h:57
GctFormatTranslateBase::NON_ISO_EM_CANDS
Definition: GctFormatTranslateBase.h:57
GctFormatTranslateBase::BlockLengthMap
std::map< unsigned int, unsigned int > BlockLengthMap
Block ID to Block Length map.
Definition: GctFormatTranslateBase.h:63
GctFormatTranslateBase::NUM_EM_CAND_CATEGORIES
Definition: GctFormatTranslateBase.h:57
GctFormatTranslateBase::EmCandCatagory
EmCandCatagory
An enum of the EM candidate types.
Definition: GctFormatTranslateBase.h:57
GctFormatTranslateBase::JetCandCategory
JetCandCategory
Useful enumeration for jet candidate pack/unpack.
Definition: GctFormatTranslateBase.h:61
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
SourceCardRouting.h
GctFormatTranslateBase::BlockNameMap
std::map< unsigned int, std::string > BlockNameMap
Block ID to Block Description map.
Definition: GctFormatTranslateBase.h:65
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:292
ztail.d
d
Definition: ztail.py:151
GctFormatTranslateBase::srcCardRouting
const SourceCardRouting & srcCardRouting() const
Protected interface to the unpackSharedRegions commissioning option.
Definition: GctFormatTranslateBase.h:104
GctFormatTranslateBase::INVALID_BLOCK_HEADER_STR
static const std::string INVALID_BLOCK_HEADER_STR
Definition: GctFormatTranslateBase.h:132
GctFormatTranslateBase::checkBlock
bool checkBlock(const GctBlockHeader &hdr) const
Performs checks on the block header to see if the block is possible to unpack or not.
Definition: GctFormatTranslateBase.cc:47
GctFormatTranslateBase::BlkToRctCrateMap
std::map< unsigned int, unsigned int > BlkToRctCrateMap
Typedef for mapping block ID to RCT crate.
Definition: GctFormatTranslateBase.h:69