CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 }
L1GctJetCandCollection *const gctTauJets() const
GCT output: Tau Jets collection.
bool valid() const
Returns true if it&#39;s valid block header - i.e. if the header is known and can be unpacked.
const std::string & getBlockDescription(const GctBlockHeader &header) const
Get block description.
bool checkBlock(const GctBlockHeader &hdr) const
Performs checks on the block header to see if the block is possible to unpack or not.
virtual ~GctFormatTranslateBase()
Destructor.
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...
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
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
L1GctJetCandCollection *const gctCenJets() const
GCT output: Central Jets collection.
virtual const BlockNameMap & blockNameMap() const =0
get the static block ID to blockname map.
def cat
Definition: eostools.py:401
Simple class for holding the basic attributes of an 32-bit block header.
constexpr size_t nSamples
tuple unpackSharedRegions
Definition: HLT_Fake_cff.py:50
const uint32_t packingEventId() const
Get the EventId to be used when packing data.
L1GctJetCandCollection *const gctJets(const unsigned cat) const
Get a specific jet candandiate collection using the JetCandCategory enumeration.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
uint32_t blockId() const
Get the block ID.
uint32_t nSamples() const
Get the number of time samples.
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.
const uint32_t packingBxId() const
Get the BxId to be used when packing data.
#define LogDebug(id)
L1GctJetCandCollection *const gctForJets() const
GCT output: Forward Jets collection.