#include <EventFilter/GctRawToDigi/src/GctFormatTranslateBase.h>
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 const BlockLengthMap & | blockLengthMap () const =0 |
get the static block ID to block-length map. | |
virtual BlockLengthMap & | blockLengthMap ()=0 |
get the static block ID to block-length map. | |
virtual const BlockNameMap & | blockNameMap () const =0 |
get the static block ID to blockname map. | |
virtual BlockNameMap & | blockNameMap ()=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. | |
L1CaloRegion | makeL1CaloRegionBackPortHack (const uint16_t raw, const unsigned ieta, const unsigned iphi, const int16_t bx) |
31X to 22X back-port hack: makes an L1CaloRegion in the best/most safe way using what's availble in the 22X DataFormat. | |
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 const BlkToRctCrateMap & | rctEmCrateMap () const =0 |
get static the block ID to RCT crate map for electrons. | |
virtual BlkToRctCrateMap & | rctEmCrateMap ()=0 |
get the static block ID to RCT crate map for electrons. | |
virtual const BlkToRctCrateMap & | rctJetCrateMap () const =0 |
get the static block ID to RCT crate map for jets | |
virtual BlkToRctCrateMap & | rctJetCrateMap ()=0 |
get the static block ID to RCT crate map for jets | |
SourceCardRouting & | srcCardRouting () |
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 | |
GctUnpackCollections * | m_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" |
This class provides the common interface/functionality for the various concrete classes that can translate to/from specific RAW formats.
Definition at line 29 of file GctFormatTranslateBase.h.
typedef std::map<unsigned int, unsigned int> GctFormatTranslateBase::BlkToRctCrateMap [protected] |
typedef std::map<unsigned int, IsoBoundaryPair> GctFormatTranslateBase::BlockIdToEmCandIsoBoundMap [protected] |
A typdef for mapping Block IDs to IsoBoundaryPairs.
Definition at line 87 of file GctFormatTranslateBase.h.
typedef std::map<unsigned int, unsigned int> GctFormatTranslateBase::BlockLengthMap [protected] |
typedef std::pair<unsigned int, unsigned int> GctFormatTranslateBase::BlockLengthPair [protected] |
typedef std::map<unsigned int, std::string> GctFormatTranslateBase::BlockNameMap [protected] |
typedef std::pair<unsigned int, std::string> GctFormatTranslateBase::BlockNamePair [protected] |
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 84 of file GctFormatTranslateBase.h.
enum GctFormatTranslateBase::EmCandCatagory [protected] |
An enum of the EM candidate types.
Note that the order here mimicks the order in the RAW data format.
Definition at line 65 of file GctFormatTranslateBase.h.
00065 { NON_ISO_EM_CANDS, ISO_EM_CANDS, NUM_EM_CAND_CATEGORIES };
enum GctFormatTranslateBase::JetCandCategory [protected] |
Useful enumeration for jet candidate pack/unpack.
Note that the order here mimicks the order in the RAW data format.
Definition at line 69 of file GctFormatTranslateBase.h.
00069 { TAU_JETS, FORWARD_JETS, CENTRAL_JETS, NUM_JET_CATEGORIES };
GctFormatTranslateBase::GctFormatTranslateBase | ( | bool | hltMode = false , |
|
bool | unpackSharedRegions = false | |||
) | [explicit] |
Constructor.
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.
00012 : 00013 m_collections(0), 00014 m_hltMode(hltMode), 00015 m_unpackSharedRegions(unpackSharedRegions), 00016 m_srcCardRouting(), 00017 m_packingBxId(0), 00018 m_packingEventId(0) 00019 { 00020 }
GctFormatTranslateBase::~GctFormatTranslateBase | ( | ) | [virtual] |
void GctFormatTranslateBase::blockDoNothing | ( | const unsigned char * | d, | |
const GctBlockHeader & | hdr | |||
) | [inline, protected] |
The null unpack function - obviously common to all formats.
Definition at line 136 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 const BlockNameMap& GctFormatTranslateBase::blockNameMap | ( | ) | const [protected, pure virtual] |
get the static block ID to blockname 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().
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().
00051 { 00052 // check block is valid 00053 if ( !hdr.valid() ) 00054 { 00055 LogDebug("GCT") << "Block unpack error: cannot unpack the following unknown/invalid block:\n" << hdr; 00056 return false; 00057 } 00058 00059 // check block doesn't have too many time samples 00060 if ( hdr.nSamples() >= 0xf ) { 00061 LogDebug("GCT") << "Block unpack error: cannot unpack a block with 15 or more time samples:\n" << hdr; 00062 return false; 00063 } 00064 return true; 00065 }
GctUnpackCollections* const GctFormatTranslateBase::colls | ( | ) | const [inline, protected] |
Protected access to the GCT Unpack Collections.
Definition at line 110 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::blockToGctJetCandsAndCounts(), GctFormatTranslateV38::blockToGctJetCandsAndCounts(), GctFormatTranslateMCLegacy::blockToGctJetCandsAndCounts(), GctFormatTranslateV35::blockToGctJetClusterMinimal(), GctFormatTranslateV38::blockToGctJetClusterMinimal(), GctFormatTranslateV35::blockToGctJetPreCluster(), GctFormatTranslateV38::blockToGctJetPreCluster(), GctFormatTranslateV35::blockToGctTrigObjects(), GctFormatTranslateV38::blockToGctTrigObjects(), 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] |
Get a specific jet candandiate collection using the JetCandCategory enumeration.
Definition at line 33 of file GctFormatTranslateBase.cc.
References colls(), FORWARD_JETS, GctUnpackCollections::gctCenJets(), GctUnpackCollections::gctForJets(), GctUnpackCollections::gctTauJets(), and TAU_JETS.
Referenced by GctFormatTranslateV35::blockToGctJetCandsAndCounts(), GctFormatTranslateV38::blockToGctJetCandsAndCounts(), and GctFormatTranslateMCLegacy::blockToGctJetCandsAndCounts().
00034 { 00035 switch(cat) 00036 { 00037 case TAU_JETS: return colls()->gctTauJets(); 00038 case FORWARD_JETS: return colls()->gctForJets(); 00039 default: return colls()->gctCenJets(); 00040 } 00041 }
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().
00025 { 00026 if(!header.valid()) { return INVALID_BLOCK_HEADER_STR; } 00027 return blockNameMap().find(header.blockId())->second; 00028 }
bool GctFormatTranslateBase::hltMode | ( | ) | const [inline, protected] |
Protected interface to get HLT optimisation mode flag.
Definition at line 111 of file GctFormatTranslateBase.h.
References m_hltMode.
Referenced by GctFormatTranslateMCLegacy::blockToAllRctCaloRegions(), GctFormatTranslateV35::blockToFibres(), GctFormatTranslateV38::blockToFibres(), GctFormatTranslateMCLegacy::blockToFibres(), GctFormatTranslateV35::blockToGctEmCandsAndEnergySums(), GctFormatTranslateMCLegacy::blockToGctEmCandsAndEnergySums(), GctFormatTranslateV38::blockToGctEmCandsAndEnergySums(), GctFormatTranslateV35::blockToGctInternEmCand(), GctFormatTranslateV38::blockToGctInternEmCand(), GctFormatTranslateV35::blockToGctJetCandsAndCounts(), GctFormatTranslateV38::blockToGctJetCandsAndCounts(), GctFormatTranslateMCLegacy::blockToGctJetCandsAndCounts(), GctFormatTranslateV35::blockToGctJetClusterMinimal(), GctFormatTranslateV38::blockToGctJetClusterMinimal(), GctFormatTranslateV35::blockToGctJetPreCluster(), GctFormatTranslateV38::blockToGctJetPreCluster(), GctFormatTranslateV35::blockToGctTrigObjects(), GctFormatTranslateV38::blockToGctTrigObjects(), 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.
L1CaloRegion GctFormatTranslateBase::makeL1CaloRegionBackPortHack | ( | const uint16_t | raw, | |
const unsigned | ieta, | |||
const unsigned | iphi, | |||
const int16_t | bx | |||
) | [protected] |
31X to 22X back-port hack: makes an L1CaloRegion in the best/most safe way using what's availble in the 22X DataFormat.
Avoids using ambiguous constructors. No capture block or index functionality is available in 22X.
Definition at line 70 of file GctFormatTranslateBase.cc.
References L1CaloRegion::setBx().
Referenced by GctFormatTranslateV35::blockToRctCaloRegions(), and GctFormatTranslateV38::blockToRctCaloRegions().
00074 { 00075 unsigned et = raw & 0x3ff; 00076 bool overflow = (raw & 0x400) != 0; 00077 bool tauVeto = (raw & 0x800) != 0; 00078 L1CaloRegion l1CaloRegion(et, overflow, tauVeto, false, false, ieta, iphi); 00079 l1CaloRegion.setBx(bx); 00080 return l1CaloRegion; 00081 }
const uint32_t GctFormatTranslateBase::packingBxId | ( | ) | const [inline, protected] |
Get the BxId to be used when packing data.
Definition at line 114 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 115 of file GctFormatTranslateBase.h.
References m_packingEventId.
Referenced by writeRawHeader().
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::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::rctJetCrateMap | ( | ) | const [protected, pure virtual] |
get the static block ID to RCT crate map for jets
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.
void GctFormatTranslateBase::setPackingBxId | ( | uint32_t | bxId | ) | [inline] |
Definition at line 44 of file GctFormatTranslateBase.h.
References m_packingBxId.
Referenced by GctDigiToRaw::produce().
00044 { 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().
00047 { 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().
00041 { m_collections = collections; }
SourceCardRouting& GctFormatTranslateBase::srcCardRouting | ( | ) | [inline, protected] |
Protected interface to the unpackSharedRegions commissioning option.
Protected access to SourceCardRouting.
Definition at line 113 of file GctFormatTranslateBase.h.
References m_srcCardRouting.
Referenced by GctFormatTranslateV35::blockToRctEmCand(), GctFormatTranslateV38::blockToRctEmCand(), GctFormatTranslateMCLegacy::blockToRctEmCand(), and GctFormatTranslateMCLegacy::writeRctEmCandBlocks().
bool GctFormatTranslateBase::unpackSharedRegions | ( | ) | const [inline, protected] |
Definition at line 112 of file GctFormatTranslateBase.h.
References m_unpackSharedRegions.
Referenced by GctFormatTranslateV38::blockToRctCaloRegions().
00112 { return m_unpackSharedRegions; }
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 generateRawHeader(), p, packingBxId(), and packingEventId().
Referenced by GctFormatTranslateMCLegacy::writeAllRctCaloRegionBlock(), GctFormatTranslateMCLegacy::writeGctOutEmAndEnergyBlock(), GctFormatTranslateMCLegacy::writeGctOutJetBlock(), and GctFormatTranslateMCLegacy::writeRctEmCandBlocks().
00044 { 00045 uint32_t hdr = generateRawHeader(blockId, nSamples, packingBxId(), packingEventId()); 00046 uint32_t * p = reinterpret_cast<uint32_t*>(const_cast<unsigned char *>(data)); 00047 *p = hdr; 00048 }
const std::string GctFormatTranslateBase::INVALID_BLOCK_HEADER_STR = "UNKNOWN/INVALID BLOCK HEADER" [static, private] |
Pointer to the output collections object.
Definition at line 156 of file GctFormatTranslateBase.h.
Referenced by colls(), and setUnpackCollections().
bool GctFormatTranslateBase::m_hltMode [private] |
If true, unpack only BX zero and GCT output data (i.e. to run as quickly as possible).
Definition at line 159 of file GctFormatTranslateBase.h.
Referenced by hltMode().
uint32_t GctFormatTranslateBase::m_packingBxId [private] |
The bunch-crossing ID to be used by the data packing methods.
Definition at line 169 of file GctFormatTranslateBase.h.
Referenced by packingBxId(), and setPackingBxId().
uint32_t GctFormatTranslateBase::m_packingEventId [private] |
The event ID to be used by the data packing methods.
Definition at line 172 of file GctFormatTranslateBase.h.
Referenced by packingEventId(), and setPackingEventId().
Source card mapping info.
Definition at line 166 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 163 of file GctFormatTranslateBase.h.
Referenced by unpackSharedRegions().