CMS 3D CMS Logo

GctFormatTranslateBase.cc
Go to the documentation of this file.
2 
3 // Framework headers
5 
6 // INITIALISE STATICS
7 const std::string GctFormatTranslateBase::INVALID_BLOCK_HEADER_STR = "UNKNOWN/INVALID BLOCK HEADER";
8 
9 // PUBLIC METHODS
10 
12  : m_collections(nullptr),
13  m_hltMode(hltMode),
14  m_unpackSharedRegions(unpackSharedRegions),
15  m_srcCardRouting(),
16  m_packingBxId(0),
17  m_packingEventId(0) {}
18 
20 
22  if (!header.valid()) {
24  }
25  return blockNameMap().find(header.blockId())->second;
26 }
27 
28 // PROTECTED METHODS
29 
31  switch (cat) {
32  case TAU_JETS:
33  return colls()->gctTauJets();
34  case FORWARD_JETS:
35  return colls()->gctForJets();
36  default:
37  return colls()->gctCenJets();
38  }
39 }
40 
41 void GctFormatTranslateBase::writeRawHeader(unsigned char* data, uint32_t blockId, uint32_t nSamples) const {
42  uint32_t hdr = generateRawHeader(blockId, nSamples, packingBxId(), packingEventId());
43  uint32_t* p = reinterpret_cast<uint32_t*>(const_cast<unsigned char*>(data));
44  *p = hdr;
45 }
46 
48  // check block is valid
49  if (!hdr.valid()) {
50  LogDebug("GCT") << "Block unpack error: cannot unpack the following unknown/invalid block:\n" << hdr;
51  return false;
52  }
53 
54  // check block doesn't have too many time samples
55  if (hdr.nSamples() >= 0xf) {
56  LogDebug("GCT") << "Block unpack error: cannot unpack a block with 15 or more time samples:\n" << hdr;
57  return false;
58  }
59  return true;
60 }
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...
virtual ~GctFormatTranslateBase()
Destructor.
bool valid() const
Returns true if it&#39;s valid block header - i.e. if the header is known and can be unpacked.
static const std::string INVALID_BLOCK_HEADER_STR
GctFormatTranslateBase(bool hltMode=false, bool unpackSharedRegions=false)
Constructor.
U second(std::pair< T, U > const &p)
std::vector< L1GctJetCand > L1GctJetCandCollection
def cat(path)
Definition: eostools.py:401
virtual const BlockNameMap & blockNameMap() const =0
get the static block ID to blockname map.
L1GctJetCandCollection *const gctJets(const unsigned cat) const
Get a specific jet candandiate collection using the JetCandCategory enumeration.
Simple class for holding the basic attributes of an 32-bit block header.
const uint32_t packingEventId() const
Get the EventId to be used when packing data.
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
L1GctJetCandCollection *const gctTauJets() const
GCT output: Tau Jets collection.
const std::string & getBlockDescription(const GctBlockHeader &header) const
Get block description.
uint32_t nSamples() const
Get the number of time samples.
L1GctJetCandCollection *const gctCenJets() const
GCT output: Central Jets collection.
const uint32_t packingBxId() const
Get the BxId to be used when packing data.
bool checkBlock(const GctBlockHeader &hdr) const
Performs checks on the block header to see if the block is possible to unpack or not.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
L1GctJetCandCollection *const gctForJets() const
GCT output: Forward Jets collection.
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, bunch-crossing and event IDs.
#define LogDebug(id)