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 }
GctBlockHeader::valid
bool valid() const
Returns true if it's valid block header - i.e. if the header is known and can be unpacked.
Definition: GctBlockHeader.h:42
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
MessageLogger.h
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
GctUnpackCollections::gctTauJets
L1GctJetCandCollection *const gctTauJets() const
GCT output: Tau Jets collection.
Definition: GctUnpackCollections.h:66
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
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
PresampleTask_cfi.nSamples
nSamples
Definition: PresampleTask_cfi.py:7
GctFormatTranslateBase::~GctFormatTranslateBase
virtual ~GctFormatTranslateBase()
Destructor.
Definition: GctFormatTranslateBase.cc:19
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
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
GctUnpackCollections::gctForJets
L1GctJetCandCollection *const gctForJets() const
GCT output: Forward Jets collection.
Definition: GctUnpackCollections.h:63
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
GctFormatTranslateBase::colls
GctUnpackCollections *const colls() const
Protected access to the GCT Unpack Collections.
Definition: GctFormatTranslateBase.h:97
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,...
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GctFormatTranslateBase::getBlockDescription
const std::string & getBlockDescription(const GctBlockHeader &header) const
Get block description.
Definition: GctFormatTranslateBase.cc:21
GctFormatTranslateBase::gctJets
L1GctJetCandCollection *const gctJets(const unsigned cat) const
Get a specific jet candandiate collection using the JetCandCategory enumeration.
Definition: GctFormatTranslateBase.cc:30
GctFormatTranslateBase::TAU_JETS
Definition: GctFormatTranslateBase.h:61
l1GctHwDigis_cfi.unpackSharedRegions
unpackSharedRegions
Definition: l1GctHwDigis_cfi.py:10
GctBlockHeader::nSamples
uint32_t nSamples() const
Get the number of time samples.
Definition: GctBlockHeader.h:33
l1GctHwDigis_cfi.hltMode
hltMode
Definition: l1GctHwDigis_cfi.py:7
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
GctUnpackCollections::gctCenJets
L1GctJetCandCollection *const gctCenJets() const
GCT output: Central Jets collection.
Definition: GctUnpackCollections.h:60
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:291
GctFormatTranslateBase.h
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