CMS 3D CMS Logo

Public Member Functions | Protected Types | Protected Member Functions | Private Attributes | Static Private Attributes

GctFormatTranslateBase Class Reference

Abstract interface for RawToDigi/DigiToRaw conversions of GCT data. More...

#include <GctFormatTranslateBase.h>

Inheritance diagram for GctFormatTranslateBase:
GctFormatTranslateMCLegacy GctFormatTranslateV35 GctFormatTranslateV38

List of all members.

Public Member Functions

virtual bool convertBlock (const unsigned char *d, const GctBlockHeader &hdr)=0
 Get digis from the block - will return true if it succeeds, false otherwise.
 GctFormatTranslateBase (bool hltMode=false, bool unpackSharedRegions=false)
 Constructor.
virtual GctBlockHeader generateBlockHeader (const unsigned char *data) const =0
 Generate a block header from four 8-bit values.
const std::string & getBlockDescription (const GctBlockHeader &header) const
 Get block description.
void setPackingBxId (uint32_t bxId)
void setPackingEventId (uint32_t eventId)
void setUnpackCollections (GctUnpackCollections *const collections)
 Set the pointer to the unpack collections.
virtual ~GctFormatTranslateBase ()
 Destructor.

Protected Types

typedef std::map< unsigned int,
unsigned int > 
BlkToRctCrateMap
 Typedef for mapping block ID to RCT crate.
typedef std::map< unsigned int,
IsoBoundaryPair
BlockIdToEmCandIsoBoundMap
 A typdef for mapping Block IDs to IsoBoundaryPairs.
typedef std::map< unsigned int,
unsigned int > 
BlockLengthMap
 Block ID to Block Length map.
typedef std::pair< unsigned
int, unsigned int > 
BlockLengthPair
 Block ID/length pair.
typedef std::map< unsigned int,
std::string > 
BlockNameMap
 Block ID to Block Description map.
typedef std::pair< unsigned
int, std::string > 
BlockNamePair
 Block ID/Description pair.
enum  EmCandCatagory { NON_ISO_EM_CANDS, ISO_EM_CANDS, NUM_EM_CAND_CATEGORIES }
 

An enum of the EM candidate types.

More...
typedef std::pair< unsigned
int, unsigned int > 
IsoBoundaryPair
enum  JetCandCategory { TAU_JETS, FORWARD_JETS, CENTRAL_JETS, NUM_JET_CATEGORIES }
 

Useful enumeration for jet candidate pack/unpack.

More...

Protected Member Functions

void blockDoNothing (const unsigned char *d, const GctBlockHeader &hdr)
 The null unpack function - obviously common to all formats.
virtual BlockLengthMapblockLengthMap ()=0
 get the static block ID to block-length map.
virtual const BlockLengthMapblockLengthMap () const =0
 get the static block ID to block-length map.
virtual const BlockNameMapblockNameMap () const =0
 get the static block ID to blockname map.
virtual BlockNameMapblockNameMap ()=0
 get the static block ID to block-name map.
bool checkBlock (const GctBlockHeader &hdr) const
 Performs checks on the block header to see if the block is possible to unpack or not.
GctUnpackCollections *const colls () const
 Protected access to the GCT Unpack Collections.
L1GctJetCandCollection *const gctJets (const unsigned cat) const
 Get a specific jet candandiate collection using the JetCandCategory enumeration.
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.
bool hltMode () const
 Protected interface to get HLT optimisation mode flag.
virtual const
BlockIdToEmCandIsoBoundMap
internEmIsoBounds () const =0
 get the static intern EM cand isolated boundary map.
virtual
BlockIdToEmCandIsoBoundMap
internEmIsoBounds ()=0
 get the static intern EM cand isolated boundary map.
const uint32_t packingBxId () const
 Get the BxId to be used when packing data.
const uint32_t packingEventId () const
 Get the EventId to be used when packing data.
virtual BlkToRctCrateMaprctEmCrateMap ()=0
 get the static block ID to RCT crate map for electrons.
virtual const BlkToRctCrateMaprctEmCrateMap () const =0
 get static the block ID to RCT crate map for electrons.
virtual BlkToRctCrateMaprctJetCrateMap ()=0
 get the static block ID to RCT crate map for jets
virtual const BlkToRctCrateMaprctJetCrateMap () const =0
 get the static block ID to RCT crate map for jets
const SourceCardRoutingsrcCardRouting () const
 Protected interface to the unpackSharedRegions commissioning option.
bool unpackSharedRegions () const
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.

Private Attributes

GctUnpackCollectionsm_collections
 Pointer to the output collections object.
bool m_hltMode
 If true, unpack only BX zero and GCT output data (i.e. to run as quickly as possible)
uint32_t m_packingBxId
 The bunch-crossing ID to be used by the data packing methods.
uint32_t m_packingEventId
 The event ID to be used by the data packing methods.
SourceCardRouting m_srcCardRouting
 Source card mapping info.
bool m_unpackSharedRegions
 If true, the shared RCT Calo regions will be unpacked also.

Static Private Attributes

static const std::string INVALID_BLOCK_HEADER_STR = "UNKNOWN/INVALID BLOCK HEADER"

Detailed Description

Abstract interface for RawToDigi/DigiToRaw conversions of GCT data.

This class provides the common interface/functionality for the various concrete classes that can translate to/from specific RAW formats.

Author:
Robert Frazier
Revision:
1.4
Date:
2009/09/18 15:07:06

Definition at line 29 of file GctFormatTranslateBase.h.


Member Typedef Documentation

typedef std::map<unsigned int, unsigned int> GctFormatTranslateBase::BlkToRctCrateMap [protected]

Typedef for mapping block ID to RCT crate.

Definition at line 76 of file GctFormatTranslateBase.h.

typedef std::map<unsigned int, IsoBoundaryPair> GctFormatTranslateBase::BlockIdToEmCandIsoBoundMap [protected]

A typdef for mapping Block IDs to IsoBoundaryPairs.

Definition at line 86 of file GctFormatTranslateBase.h.

typedef std::map<unsigned int, unsigned int> GctFormatTranslateBase::BlockLengthMap [protected]

Block ID to Block Length map.

Definition at line 70 of file GctFormatTranslateBase.h.

typedef std::pair<unsigned int, unsigned int> GctFormatTranslateBase::BlockLengthPair [protected]

Block ID/length pair.

Definition at line 71 of file GctFormatTranslateBase.h.

typedef std::map<unsigned int, std::string> GctFormatTranslateBase::BlockNameMap [protected]

Block ID to Block Description map.

Definition at line 72 of file GctFormatTranslateBase.h.

typedef std::pair<unsigned int, std::string> GctFormatTranslateBase::BlockNamePair [protected]

Block ID/Description pair.

Definition at line 73 of file GctFormatTranslateBase.h.

typedef std::pair<unsigned int, unsigned int> GctFormatTranslateBase::IsoBoundaryPair [protected]

A typedef that holds the inclusive lower and upper bounds of pipeline gct trigger object pair number for isolated EM candidates. I.e. if the first and second trig object pair in the pipeline payload are isolated cands (4 iso in total), then the IsoBoundaryPair would be (0,1).

Definition at line 83 of file GctFormatTranslateBase.h.


Member Enumeration Documentation

An enum of the EM candidate types.

Note that the order here mimicks the order in the RAW data format.

Enumerator:
NON_ISO_EM_CANDS 
ISO_EM_CANDS 
NUM_EM_CAND_CATEGORIES 

Definition at line 64 of file GctFormatTranslateBase.h.

Useful enumeration for jet candidate pack/unpack.

Note that the order here mimicks the order in the RAW data format.

Enumerator:
TAU_JETS 
FORWARD_JETS 
CENTRAL_JETS 
NUM_JET_CATEGORIES 

Definition at line 68 of file GctFormatTranslateBase.h.


Constructor & Destructor Documentation

GctFormatTranslateBase::GctFormatTranslateBase ( bool  hltMode = false,
bool  unpackSharedRegions = false 
) [explicit]

Constructor.

Parameters:
hltMode- set true to unpack only BX zero and GCT output data (i.e. to run as quick as possible).
unpackSharedRegions- this is a commissioning option to unpack the shared RCT calo regions.

Definition at line 12 of file GctFormatTranslateBase.cc.

GctFormatTranslateBase::~GctFormatTranslateBase ( ) [virtual]

Destructor.

Definition at line 22 of file GctFormatTranslateBase.cc.

{ }

Member Function Documentation

void GctFormatTranslateBase::blockDoNothing ( const unsigned char *  d,
const GctBlockHeader hdr 
) [inline, protected]

The null unpack function - obviously common to all formats.

Definition at line 135 of file GctFormatTranslateBase.h.

Referenced by GctFormatTranslateMCLegacy::GctFormatTranslateMCLegacy(), GctFormatTranslateV35::GctFormatTranslateV35(), and GctFormatTranslateV38::GctFormatTranslateV38().

{}
virtual const BlockLengthMap& GctFormatTranslateBase::blockLengthMap ( ) const [protected, pure virtual]

get the static block ID to block-length map.

Implemented in GctFormatTranslateMCLegacy, GctFormatTranslateV35, and GctFormatTranslateV38.

virtual BlockLengthMap& GctFormatTranslateBase::blockLengthMap ( ) [protected, pure virtual]

get the static block ID to block-length map.

Implemented in GctFormatTranslateMCLegacy, GctFormatTranslateV35, and GctFormatTranslateV38.

virtual BlockNameMap& GctFormatTranslateBase::blockNameMap ( ) [protected, pure virtual]

get the static block ID to block-name map.

Implemented in GctFormatTranslateMCLegacy, GctFormatTranslateV35, and GctFormatTranslateV38.

Referenced by getBlockDescription().

virtual const BlockNameMap& GctFormatTranslateBase::blockNameMap ( ) const [protected, pure virtual]

get the static block ID to blockname map.

Implemented in GctFormatTranslateMCLegacy, GctFormatTranslateV35, and GctFormatTranslateV38.

bool GctFormatTranslateBase::checkBlock ( const GctBlockHeader hdr) const [protected]

Performs checks on the block header to see if the block is possible to unpack or not.

Definition at line 50 of file GctFormatTranslateBase.cc.

References LogDebug, GctBlockHeader::nSamples(), and GctBlockHeader::valid().

Referenced by GctFormatTranslateV35::convertBlock(), GctFormatTranslateV38::convertBlock(), and GctFormatTranslateMCLegacy::convertBlock().

{
  // check block is valid
  if ( !hdr.valid() )
  {
    LogDebug("GCT") << "Block unpack error: cannot unpack the following unknown/invalid block:\n" << hdr;
    return false;     
  }

  // check block doesn't have too many time samples
  if ( hdr.nSamples() >= 0xf ) {
    LogDebug("GCT") << "Block unpack error: cannot unpack a block with 15 or more time samples:\n" << hdr;
    return false; 
  }
  return true;
}
GctUnpackCollections* const GctFormatTranslateBase::colls ( ) const [inline, protected]

Protected access to the GCT Unpack Collections.

Definition at line 109 of file GctFormatTranslateBase.h.

References m_collections.

Referenced by GctFormatTranslateMCLegacy::blockToAllRctCaloRegions(), GctFormatTranslateV35::blockToFibres(), GctFormatTranslateV38::blockToFibres(), GctFormatTranslateMCLegacy::blockToFibres(), GctFormatTranslateV35::blockToGctEmCandsAndEnergySums(), GctFormatTranslateMCLegacy::blockToGctEmCandsAndEnergySums(), GctFormatTranslateV38::blockToGctEmCandsAndEnergySums(), GctFormatTranslateV35::blockToGctInternEmCand(), GctFormatTranslateV38::blockToGctInternEmCand(), GctFormatTranslateV35::blockToGctInternEtSums(), GctFormatTranslateV38::blockToGctInternEtSums(), GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster(), GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster(), GctFormatTranslateV38::blockToGctInternHtMissPostWheel(), GctFormatTranslateV38::blockToGctInternHtMissPreWheel(), GctFormatTranslateV35::blockToGctInternRingSums(), GctFormatTranslateV38::blockToGctInternRingSums(), GctFormatTranslateV35::blockToGctJetCandsAndCounts(), GctFormatTranslateV38::blockToGctJetCandsAndCounts(), GctFormatTranslateMCLegacy::blockToGctJetCandsAndCounts(), GctFormatTranslateV35::blockToGctJetClusterMinimal(), GctFormatTranslateV38::blockToGctJetClusterMinimal(), GctFormatTranslateV35::blockToGctJetPreCluster(), GctFormatTranslateV38::blockToGctJetPreCluster(), GctFormatTranslateV35::blockToGctTrigObjects(), GctFormatTranslateV38::blockToGctTrigObjects(), GctFormatTranslateV35::blockToGctWheelInputInternEtAndRingSums(), GctFormatTranslateV38::blockToGctWheelInputInternEtAndRingSums(), GctFormatTranslateV35::blockToGctWheelOutputInternEtAndRingSums(), GctFormatTranslateV38::blockToGctWheelOutputInternEtAndRingSums(), GctFormatTranslateV35::blockToRctCaloRegions(), GctFormatTranslateV38::blockToRctCaloRegions(), GctFormatTranslateV35::blockToRctEmCand(), GctFormatTranslateV38::blockToRctEmCand(), GctFormatTranslateMCLegacy::blockToRctEmCand(), and gctJets().

virtual bool GctFormatTranslateBase::convertBlock ( const unsigned char *  d,
const GctBlockHeader hdr 
) [pure virtual]

Get digis from the block - will return true if it succeeds, false otherwise.

Implemented in GctFormatTranslateMCLegacy, GctFormatTranslateV35, and GctFormatTranslateV38.

Referenced by GctRawToDigi::unpack().

L1GctJetCandCollection *const GctFormatTranslateBase::gctJets ( const unsigned  cat) const [protected]
virtual GctBlockHeader GctFormatTranslateBase::generateBlockHeader ( const unsigned char *  data) const [pure virtual]

Generate a block header from four 8-bit values.

Implemented in GctFormatTranslateMCLegacy, GctFormatTranslateV35, and GctFormatTranslateV38.

Referenced by GctRawToDigi::unpack().

virtual uint32_t GctFormatTranslateBase::generateRawHeader ( const uint32_t  blockId,
const uint32_t  nSamples,
const uint32_t  bxId,
const uint32_t  eventId 
) const [protected, pure virtual]

Returns a raw 32-bit header word generated from the blockId, number of time samples, bunch-crossing and event IDs.

Implemented in GctFormatTranslateMCLegacy, GctFormatTranslateV35, and GctFormatTranslateV38.

Referenced by writeRawHeader().

const std::string & GctFormatTranslateBase::getBlockDescription ( const GctBlockHeader header) const

Get block description.

Definition at line 24 of file GctFormatTranslateBase.cc.

References GctBlockHeader::blockId(), blockNameMap(), INVALID_BLOCK_HEADER_STR, edm::second(), and GctBlockHeader::valid().

Referenced by GctRawToDigi::doVerboseOutput().

{
  if(!header.valid()) { return INVALID_BLOCK_HEADER_STR; }
  return blockNameMap().find(header.blockId())->second;
}
bool GctFormatTranslateBase::hltMode ( ) const [inline, protected]

Protected interface to get HLT optimisation mode flag.

Definition at line 110 of file GctFormatTranslateBase.h.

References m_hltMode.

Referenced by GctFormatTranslateMCLegacy::blockToAllRctCaloRegions(), GctFormatTranslateV35::blockToFibres(), GctFormatTranslateV38::blockToFibres(), GctFormatTranslateMCLegacy::blockToFibres(), GctFormatTranslateV35::blockToGctEmCandsAndEnergySums(), GctFormatTranslateMCLegacy::blockToGctEmCandsAndEnergySums(), GctFormatTranslateV35::blockToGctInternEmCand(), GctFormatTranslateV38::blockToGctInternEmCand(), GctFormatTranslateV35::blockToGctInternEtSums(), GctFormatTranslateV38::blockToGctInternEtSums(), GctFormatTranslateV35::blockToGctInternEtSumsAndJetCluster(), GctFormatTranslateV38::blockToGctInternEtSumsAndJetCluster(), GctFormatTranslateV38::blockToGctInternHtMissPostWheel(), GctFormatTranslateV38::blockToGctInternHtMissPreWheel(), GctFormatTranslateV35::blockToGctInternRingSums(), GctFormatTranslateV38::blockToGctInternRingSums(), GctFormatTranslateV35::blockToGctJetCandsAndCounts(), GctFormatTranslateMCLegacy::blockToGctJetCandsAndCounts(), GctFormatTranslateV35::blockToGctJetClusterMinimal(), GctFormatTranslateV38::blockToGctJetClusterMinimal(), GctFormatTranslateV35::blockToGctJetPreCluster(), GctFormatTranslateV38::blockToGctJetPreCluster(), GctFormatTranslateV35::blockToGctTrigObjects(), GctFormatTranslateV38::blockToGctTrigObjects(), GctFormatTranslateV35::blockToGctWheelInputInternEtAndRingSums(), GctFormatTranslateV38::blockToGctWheelInputInternEtAndRingSums(), GctFormatTranslateV35::blockToGctWheelOutputInternEtAndRingSums(), GctFormatTranslateV38::blockToGctWheelOutputInternEtAndRingSums(), GctFormatTranslateV35::blockToRctCaloRegions(), GctFormatTranslateV38::blockToRctCaloRegions(), GctFormatTranslateV35::blockToRctEmCand(), GctFormatTranslateV38::blockToRctEmCand(), and GctFormatTranslateMCLegacy::blockToRctEmCand().

virtual const BlockIdToEmCandIsoBoundMap& GctFormatTranslateBase::internEmIsoBounds ( ) const [protected, pure virtual]

get the static intern EM cand isolated boundary map.

Implemented in GctFormatTranslateMCLegacy, GctFormatTranslateV35, and GctFormatTranslateV38.

virtual BlockIdToEmCandIsoBoundMap& GctFormatTranslateBase::internEmIsoBounds ( ) [protected, pure virtual]

get the static intern EM cand isolated boundary map.

Implemented in GctFormatTranslateMCLegacy, GctFormatTranslateV35, and GctFormatTranslateV38.

const uint32_t GctFormatTranslateBase::packingBxId ( ) const [inline, protected]

Get the BxId to be used when packing data.

Definition at line 113 of file GctFormatTranslateBase.h.

References m_packingBxId.

Referenced by writeRawHeader().

const uint32_t GctFormatTranslateBase::packingEventId ( ) const [inline, protected]

Get the EventId to be used when packing data.

Definition at line 114 of file GctFormatTranslateBase.h.

References m_packingEventId.

Referenced by writeRawHeader().

virtual BlkToRctCrateMap& GctFormatTranslateBase::rctEmCrateMap ( ) [protected, pure virtual]

get the static block ID to RCT crate map for electrons.

Implemented in GctFormatTranslateMCLegacy, GctFormatTranslateV35, and GctFormatTranslateV38.

virtual const BlkToRctCrateMap& GctFormatTranslateBase::rctEmCrateMap ( ) const [protected, pure virtual]

get static the block ID to RCT crate map for electrons.

Implemented in GctFormatTranslateMCLegacy, GctFormatTranslateV35, and GctFormatTranslateV38.

virtual BlkToRctCrateMap& GctFormatTranslateBase::rctJetCrateMap ( ) [protected, pure virtual]

get the static block ID to RCT crate map for jets

Implemented in GctFormatTranslateMCLegacy, GctFormatTranslateV35, and GctFormatTranslateV38.

virtual const BlkToRctCrateMap& GctFormatTranslateBase::rctJetCrateMap ( ) const [protected, pure virtual]

get the static block ID to RCT crate map for jets

Implemented in GctFormatTranslateMCLegacy, GctFormatTranslateV35, and GctFormatTranslateV38.

void GctFormatTranslateBase::setPackingBxId ( uint32_t  bxId) [inline]

Definition at line 44 of file GctFormatTranslateBase.h.

References m_packingBxId.

Referenced by GctDigiToRaw::produce().

{ m_packingBxId = bxId; }
void GctFormatTranslateBase::setPackingEventId ( uint32_t  eventId) [inline]

Definition at line 47 of file GctFormatTranslateBase.h.

References m_packingEventId.

Referenced by GctDigiToRaw::produce().

{ m_packingEventId = eventId; }
void GctFormatTranslateBase::setUnpackCollections ( GctUnpackCollections *const  collections) [inline]

Set the pointer to the unpack collections.

Definition at line 41 of file GctFormatTranslateBase.h.

References m_collections.

Referenced by GctRawToDigi::unpack().

{ m_collections = collections; }
const SourceCardRouting& GctFormatTranslateBase::srcCardRouting ( ) const [inline, protected]

Protected interface to the unpackSharedRegions commissioning option.

Protected access to SourceCardRouting.

Definition at line 112 of file GctFormatTranslateBase.h.

References m_srcCardRouting.

Referenced by GctFormatTranslateV35::blockToRctEmCand(), GctFormatTranslateV38::blockToRctEmCand(), GctFormatTranslateMCLegacy::blockToRctEmCand(), and GctFormatTranslateMCLegacy::writeRctEmCandBlocks().

bool GctFormatTranslateBase::unpackSharedRegions ( ) const [inline, protected]
void GctFormatTranslateBase::writeRawHeader ( unsigned char *  data,
uint32_t  blockId,
uint32_t  nSamples 
) const [protected]

Writes a raw block header into the raw data array for a given block ID and number of time-samples.

BxId and EventId values for the raw header are set via the setPackingBxId() and setPackingEventId() methods.

Definition at line 43 of file GctFormatTranslateBase.cc.

References data, generateRawHeader(), AlCaHLTBitMon_ParallelJobs::p, packingBxId(), and packingEventId().

Referenced by GctFormatTranslateMCLegacy::writeAllRctCaloRegionBlock(), GctFormatTranslateMCLegacy::writeGctOutEmAndEnergyBlock(), GctFormatTranslateMCLegacy::writeGctOutJetBlock(), and GctFormatTranslateMCLegacy::writeRctEmCandBlocks().

{
  uint32_t hdr = generateRawHeader(blockId, nSamples, packingBxId(), packingEventId());
  uint32_t * p = reinterpret_cast<uint32_t*>(const_cast<unsigned char *>(data));
  *p = hdr;
}

Member Data Documentation

const std::string GctFormatTranslateBase::INVALID_BLOCK_HEADER_STR = "UNKNOWN/INVALID BLOCK HEADER" [static, private]

Definition at line 141 of file GctFormatTranslateBase.h.

Referenced by getBlockDescription().

Pointer to the output collections object.

Definition at line 146 of file GctFormatTranslateBase.h.

Referenced by colls(), and setUnpackCollections().

If true, unpack only BX zero and GCT output data (i.e. to run as quickly as possible)

Definition at line 149 of file GctFormatTranslateBase.h.

Referenced by hltMode().

The bunch-crossing ID to be used by the data packing methods.

Definition at line 159 of file GctFormatTranslateBase.h.

Referenced by packingBxId(), and setPackingBxId().

The event ID to be used by the data packing methods.

Definition at line 162 of file GctFormatTranslateBase.h.

Referenced by packingEventId(), and setPackingEventId().

Source card mapping info.

Definition at line 156 of file GctFormatTranslateBase.h.

Referenced by srcCardRouting().

If true, the shared RCT Calo regions will be unpacked also.

This is a commissioning option only - may not be relevant to all concrete implementations!

Definition at line 153 of file GctFormatTranslateBase.h.

Referenced by unpackSharedRegions().