ATLAS Offline Software
Loading...
Searching...
No Matches
LVL1BS::PpmByteStreamReadV1V2Tool Class Reference

Tool to perform ROB fragments to trigger towers and trigger towers to raw data conversions. More...

#include <PpmByteStreamReadV1V2Tool.h>

Inheritance diagram for LVL1BS::PpmByteStreamReadV1V2Tool:
Collaboration diagram for LVL1BS::PpmByteStreamReadV1V2Tool:

Classes

class  BitReader
struct  State

Public Member Functions

 PpmByteStreamReadV1V2Tool (const std::string &name)
virtual ~PpmByteStreamReadV1V2Tool ()
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function.
virtual StatusCode finalize () override
StatusCode convert (xAOD::TriggerTowerContainer *const ttCollection) const
 Convert ROB fragments to trigger towers.
StatusCode convert (const std::string &sgKey, xAOD::TriggerTowerContainer *const ttCollection) const
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

enum class  RequestType { PPM , CPM , CMX }
typedef IROBDataProviderSvc::VROBFRAG::const_iterator ROBIterator
typedef OFFLINE_FRAGMENTS_NAMESPACE::PointerType ROBPointer
typedef OFFLINE_FRAGMENTS_NAMESPACE::PointerType RODPointer
typedef std::map< uint8_t, std::vector< uint16_t > > LutsMap
typedef std::map< uint8_t, std::vector< uint16_t > > FadcsMap
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

StatusCode convert (State &state, const IROBDataProviderSvc::VROBFRAG &robFrags) const
void initSourceIDs ()
const std::vector< uint32_t > & ppmSourceIDs (State &state, const std::string &sgKey) const
 Return reference to vector with all possible Source Identifiers.
StatusCode processRobFragment_ (State &state, const ROBIterator &robFrag, const RequestType &requestedType) const
StatusCode processPpmWord_ (State &state, uint32_t word, int indata) const
StatusCode processPpmBlock_ (State &state) const
StatusCode processPpmBlockR4V1_ (State &state) const
StatusCode processPpmBlockR3V1_ (State &state) const
StatusCode processPpmStandardR4V1_ (State &state) const
StatusCode processPpmStandardR3V1_ (State &state) const
StatusCode processPpmStandardR3V1_ (State &state, uint32_t word, int indata) const
StatusCode processPpmCompressedR3V1_ (State &state) const
std::vector< uint16_t > getPpmAdcSamplesR3_ (State &state, BitReader &br, uint8_t format, uint8_t minIndex) const
StatusCode processPpmCompressedR4V1_ (State &state) const
void interpretPpmHeaderR4V1_ (BitReader &br, uint8_t numAdc, int8_t &encoding, int8_t &minIndex) const
std::vector< uint16_t > getPpmAdcSamplesR4_ (State &state, BitReader &br, uint8_t encoding, uint8_t minIndex) const
StatusCode processPpmNeutral_ (State &state) const
StatusCode addTriggerTowerV2_ (State &state, uint8_t crate, uint8_t module, uint8_t channel, std::vector< uint8_t > &&lcpVal, std::vector< uint8_t > &&lcpBcidVec, std::vector< uint8_t > &&ljeVal, std::vector< uint8_t > &&ljeSat80Vec, std::vector< uint16_t > &&adcVal, std::vector< uint8_t > &&adcExt, std::vector< int16_t > &&pedCor, std::vector< uint8_t > &&pedEn) const
StatusCode addTriggerTowerV1_ (State &state, uint8_t crate, uint8_t module, uint8_t channel, const std::vector< uint16_t > &luts, const std::vector< uint16_t > &fadc) const
StatusCode addTriggerTowerV1_ (State &state, uint8_t crate, uint8_t module, uint8_t channel, std::vector< uint8_t > &&luts, std::vector< uint8_t > &&lcpBcidVec, std::vector< uint16_t > &&fadc, std::vector< uint8_t > &&bcidExt) const
void processSubBlockStatus_ (State &state, uint8_t crate, uint8_t module, uint32_t word) const
void processPpmErrorBits_ (State &state, uint8_t crate, uint8_t module, BitReader &br) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< LVL1BS::L1CaloErrorByteStreamToolm_errorTool
ToolHandle< LVL1::IL1CaloMappingToolm_ppmMaps
 Channel mapping tool.
ServiceHandle< IROBDataProviderSvcm_robDataProvider
 Service for reading bytestream.
std::vector< uint32_t > m_ppmSourceIDs
std::vector< uint32_t > m_ppmSourceIDsMuon
std::vector< uint32_t > m_ppmSourceIDsSpare
L1CaloSrcIdMapm_srcIdMap
std::atomic< size_t > m_maxSizeSeen
bool m_useSWROD = false
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Static Private Attributes

static const uint8_t s_crates = 8
static const uint8_t s_modules = 16
static const uint8_t s_submodules = 16
static const uint8_t s_channels = 64
static const uint16_t s_maxtowers = s_crates * s_modules * s_channels

Detailed Description

Tool to perform ROB fragments to trigger towers and trigger towers to raw data conversions.

Author
alexa.nosp@m.nder.nosp@m..mazu.nosp@m.rov@.nosp@m.cern..nosp@m.ch

Definition at line 58 of file PpmByteStreamReadV1V2Tool.h.

Member Typedef Documentation

◆ FadcsMap

typedef std::map<uint8_t, std::vector<uint16_t> > LVL1BS::PpmByteStreamReadV1V2Tool::FadcsMap
private

Definition at line 101 of file PpmByteStreamReadV1V2Tool.h.

◆ LutsMap

typedef std::map<uint8_t, std::vector<uint16_t> > LVL1BS::PpmByteStreamReadV1V2Tool::LutsMap
private

Definition at line 100 of file PpmByteStreamReadV1V2Tool.h.

◆ ROBIterator

typedef IROBDataProviderSvc::VROBFRAG::const_iterator LVL1BS::PpmByteStreamReadV1V2Tool::ROBIterator
private

Definition at line 77 of file PpmByteStreamReadV1V2Tool.h.

◆ ROBPointer

◆ RODPointer

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ RequestType

Enumerator
PPM 
CPM 
CMX 

Definition at line 76 of file PpmByteStreamReadV1V2Tool.h.

76{ PPM, CPM, CMX };

Constructor & Destructor Documentation

◆ PpmByteStreamReadV1V2Tool()

LVL1BS::PpmByteStreamReadV1V2Tool::PpmByteStreamReadV1V2Tool ( const std::string & name)

Definition at line 63 of file PpmByteStreamReadV1V2Tool.cxx.

64 :
65 AsgTool(name),
66 m_errorTool("LVL1BS::L1CaloErrorByteStreamTool/L1CaloErrorByteStreamTool"),
67 m_ppmMaps("LVL1::PpmMappingTool/PpmMappingTool"),
68 m_robDataProvider("ROBDataProviderSvc", name),
69 m_srcIdMap(nullptr),
71{
72 declareInterface<PpmByteStreamReadV1V2Tool>(this);
73 declareProperty("UseSWROD",m_useSWROD = false, "Use SWROD readout instead of legacy (which was removed in 2024)");
74 declareProperty("PpmMappingTool", m_ppmMaps,
75 "Crate/Module/Channel to Eta/Phi/Layer mapping tool");
76 declareProperty("ROBDataProviderSvc", m_robDataProvider,
77 "Get ROB source IDs service");
78}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ToolHandle< LVL1::IL1CaloMappingTool > m_ppmMaps
Channel mapping tool.
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Service for reading bytestream.
ToolHandle< LVL1BS::L1CaloErrorByteStreamTool > m_errorTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58

◆ ~PpmByteStreamReadV1V2Tool()

virtual LVL1BS::PpmByteStreamReadV1V2Tool::~PpmByteStreamReadV1V2Tool ( )
inlinevirtual

Definition at line 64 of file PpmByteStreamReadV1V2Tool.h.

64{};

Member Function Documentation

◆ addTriggerTowerV1_() [1/2]

StatusCode LVL1BS::PpmByteStreamReadV1V2Tool::addTriggerTowerV1_ ( State & state,
uint8_t crate,
uint8_t module,
uint8_t channel,
const std::vector< uint16_t > & luts,
const std::vector< uint16_t > & fadc ) const
private

Definition at line 1070 of file PpmByteStreamReadV1V2Tool.cxx.

1078{
1079 std::vector<uint8_t> lcpVal;
1080 std::vector<uint8_t> lcpBcidVec;
1081
1082 std::vector<uint16_t> adcVal;
1083 std::vector<uint8_t> adcExt;
1084
1085 for(auto lut: luts) {
1086 lcpVal.push_back(BitField::get<uint8_t>(lut, 0, 8));
1087 lcpBcidVec.push_back(BitField::get<uint8_t>(lut, 8, 3));
1088 }
1089
1090 for(auto f: fadc) {
1091 adcExt.push_back(BitField::get<uint8_t>(f, 0, 1));
1092 adcVal.push_back(BitField::get<uint16_t>(f, 1, 10));
1093 }
1094
1096 crate, module, channel,
1097 std::move(lcpVal), std::move(lcpBcidVec),
1098 std::move(adcVal), std::move(adcExt)));
1099
1100 return StatusCode::SUCCESS;
1101}
#define CHECK(...)
Evaluate an expression and check for errors.
T get(const uint32_t &word) const
Definition WordDecoder.h:22
StatusCode addTriggerTowerV1_(State &state, uint8_t crate, uint8_t module, uint8_t channel, const std::vector< uint16_t > &luts, const std::vector< uint16_t > &fadc) const

◆ addTriggerTowerV1_() [2/2]

StatusCode LVL1BS::PpmByteStreamReadV1V2Tool::addTriggerTowerV1_ ( State & state,
uint8_t crate,
uint8_t module,
uint8_t channel,
std::vector< uint8_t > && luts,
std::vector< uint8_t > && lcpBcidVec,
std::vector< uint16_t > && fadc,
std::vector< uint8_t > && bcidExt ) const
private

Definition at line 1042 of file PpmByteStreamReadV1V2Tool.cxx.

1052{
1053 std::vector<uint8_t> ljeSat80Vec;
1054
1055 std::vector<int16_t> pedCor;
1056 std::vector<uint8_t> pedEn;
1057 std::vector<uint8_t> luts_copy =luts;
1058
1060 crate, module, channel,
1061 std::move(luts), std::move(lcpBcidVec),
1062 std::move(luts_copy) , std::move(ljeSat80Vec),
1063 std::move(fadc), std::move(bcidExt),
1064 std::move(pedCor), std::move(pedEn))
1065 );
1066
1067 return StatusCode::SUCCESS;
1068}
StatusCode addTriggerTowerV2_(State &state, uint8_t crate, uint8_t module, uint8_t channel, std::vector< uint8_t > &&lcpVal, std::vector< uint8_t > &&lcpBcidVec, std::vector< uint8_t > &&ljeVal, std::vector< uint8_t > &&ljeSat80Vec, std::vector< uint16_t > &&adcVal, std::vector< uint8_t > &&adcExt, std::vector< int16_t > &&pedCor, std::vector< uint8_t > &&pedEn) const

◆ addTriggerTowerV2_()

StatusCode LVL1BS::PpmByteStreamReadV1V2Tool::addTriggerTowerV2_ ( State & state,
uint8_t crate,
uint8_t module,
uint8_t channel,
std::vector< uint8_t > && lcpVal,
std::vector< uint8_t > && lcpBcidVec,
std::vector< uint8_t > && ljeVal,
std::vector< uint8_t > && ljeSat80Vec,
std::vector< uint16_t > && adcVal,
std::vector< uint8_t > && adcExt,
std::vector< int16_t > && pedCor,
std::vector< uint8_t > && pedEn ) const
private

Definition at line 996 of file PpmByteStreamReadV1V2Tool.cxx.

1009{
1010 uint32_t coolId = ::coolId(crate, module, channel);
1011
1012 int layer = 0;
1013 double eta = 0.;
1014 double phi = 0.;
1015
1016 bool isData = m_ppmMaps->mapping(crate, module, channel, eta, phi, layer);
1017
1018 if (!isData && !state.m_ppmIsRetSpare && !state.m_ppmIsRetMuon){
1019 return StatusCode::SUCCESS;
1020 }
1021
1022 if (!isData) {
1023 const int pin = channel % 16;
1024 const int asic = channel / 16;
1025 eta = 16 * crate + module;
1026 phi = 4 * pin + asic;
1027 }
1028
1030 state.m_triggerTowers->push_back(tt);
1031
1032 tt->initialize(coolId, eta, phi,
1033 std::move(lcpVal), std::move(ljeVal),
1034 std::move(pedCor), std::move(pedEn),
1035 std::move(lcpBcidVec), std::move(adcVal),
1036 std::move(adcExt), std::move(ljeSat80Vec),
1037 0, state.m_caloUserHeader.lut(),
1038 state.m_caloUserHeader.ppFadc());
1039 return StatusCode::SUCCESS;
1040}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
@ layer
Definition HitInfo.h:79
TriggerTower_v2 TriggerTower
Define the latest version of the TriggerTower class.
setEventNumber uint32_t

◆ convert() [1/3]

StatusCode LVL1BS::PpmByteStreamReadV1V2Tool::convert ( const std::string & sgKey,
xAOD::TriggerTowerContainer *const ttCollection ) const

Definition at line 139 of file PpmByteStreamReadV1V2Tool.cxx.

141{
142 State state;
143 state.m_triggerTowers = ttCollection;
144 const std::vector<uint32_t>& vID(ppmSourceIDs(state, sgKey));
145 // // get ROB fragments
147 m_robDataProvider->getROBData(Gaudi::Hive::currentContext(), vID, robFrags, "PpmByteStreamxAODReadTool");
148 ATH_MSG_DEBUG("Number of ROB fragments:" << robFrags.size());
149
150 CHECK(convert(state, robFrags));
151 return StatusCode::SUCCESS;
152}
#define ATH_MSG_DEBUG(x)
std::vector< const ROBF * > VROBFRAG
const std::vector< uint32_t > & ppmSourceIDs(State &state, const std::string &sgKey) const
Return reference to vector with all possible Source Identifiers.
StatusCode convert(xAOD::TriggerTowerContainer *const ttCollection) const
Convert ROB fragments to trigger towers.

◆ convert() [2/3]

StatusCode LVL1BS::PpmByteStreamReadV1V2Tool::convert ( State & state,
const IROBDataProviderSvc::VROBFRAG & robFrags ) const
private

Definition at line 107 of file PpmByteStreamReadV1V2Tool.cxx.

110{
111 if (m_maxSizeSeen > state.m_triggerTowers->capacity()){
112 state.m_triggerTowers->reserve (m_maxSizeSeen);
113 }
114
115 state.m_subDetectorID = eformat::TDAQ_CALO_PREPROC;
116
117 ROBIterator rob = robFrags.begin();
118 ROBIterator robEnd = robFrags.end();
119
120 for (; rob != robEnd; ++rob) {
121
123 if (!sc.isSuccess()) {
124
125 }
126 }
127
128 CxxUtils::atomic_fetch_max (&m_maxSizeSeen, state.m_triggerTowers->size());
129 return StatusCode::SUCCESS;
130}
static Double_t sc
IROBDataProviderSvc::VROBFRAG::const_iterator ROBIterator
StatusCode processRobFragment_(State &state, const ROBIterator &robFrag, const RequestType &requestedType) const
T atomic_fetch_max(std::atomic< T > *a, T v, std::memory_order memorder=std::memory_order_seq_cst)
Atomically calculate maximum.
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ convert() [3/3]

StatusCode LVL1BS::PpmByteStreamReadV1V2Tool::convert ( xAOD::TriggerTowerContainer *const ttCollection) const

Convert ROB fragments to trigger towers.

Definition at line 133 of file PpmByteStreamReadV1V2Tool.cxx.

135{
137}
static const std::string xAODTriggerTowerLocation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode LVL1BS::PpmByteStreamReadV1V2Tool::finalize ( )
overridevirtual

Definition at line 100 of file PpmByteStreamReadV1V2Tool.cxx.

100 {
101 delete m_srcIdMap;
102
103 return StatusCode::SUCCESS;
104}

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getPpmAdcSamplesR3_()

std::vector< uint16_t > LVL1BS::PpmByteStreamReadV1V2Tool::getPpmAdcSamplesR3_ ( State & state,
BitReader & br,
uint8_t format,
uint8_t minIndex ) const
private

Definition at line 499 of file PpmByteStreamReadV1V2Tool.cxx.

502{
503 std::vector<uint16_t> adc = {0, 0, 0, 0, 0};
504 uint8_t minAdc = 0;
505
506 for(uint8_t i = 0; i <5; ++i) {
507 uint8_t longField = 0;
508 uint8_t numBits = 0;
509 if (format > 2) {
510 longField = br.getField(1);
511 numBits = longField == 0? 4: (format * 2);
512 } else {
513 numBits = i == 0? 4: (format + 2);
514 }
515
516 if (i == 0) {
517 minAdc = br.getField(numBits);
518 if (longField == 0) {
519 minAdc += state.m_caloUserHeader.ppLowerBound();
520 }
521 } else {
522 adc[i] = minAdc + br.getField(numBits);
523 }
524 }
525
526 if (minIndex == 0) {
527 adc[0] = minAdc;
528 } else {
529 adc[0] = adc[minIndex];
530 adc[minIndex] = minAdc;
531 }
532 return adc;
533}

◆ getPpmAdcSamplesR4_()

std::vector< uint16_t > LVL1BS::PpmByteStreamReadV1V2Tool::getPpmAdcSamplesR4_ ( State & state,
BitReader & br,
uint8_t encoding,
uint8_t minIndex ) const
private

Definition at line 790 of file PpmByteStreamReadV1V2Tool.cxx.

794{
795 uint8_t numAdc = state.m_subBlockHeader.nSlice2();
796
797 if (encoding == 6) {
798 uint16_t val = br.getField(6);
799 return std::vector<uint16_t>(numAdc, val);
800 } else if ( encoding < 3) {
801 std::vector<uint16_t> adc(numAdc, 0);
802 uint16_t minAdc = br.getField(5) + state.m_caloUserHeader.ppLowerBound();
803 adc[minIndex] = minAdc;
804 for(uint8_t i = 1; i < numAdc; ++i) {
805 adc[i == minIndex? 0: i] = br.getField(encoding + 2) + minAdc;
806 }
807 return adc;
808 } else {
809 std::vector<uint16_t> adc(numAdc, 0);
810 uint16_t minAdc = br.getField(1)
811 ? br.getField(encoding * 2)
812 : (br.getField(5) +
813 state.m_caloUserHeader.ppLowerBound());
814
815 adc[minIndex] = minAdc;
816 for (uint8_t i = 1; i < numAdc; ++i) {
817 adc[minIndex == i? 0: i] = br.getField(
818 br.getField(1)? encoding * 2: 4
819 ) + minAdc;
820 }
821 return adc;
822 }
823}
setWord1 uint16_t

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ initialize()

StatusCode LVL1BS::PpmByteStreamReadV1V2Tool::initialize ( void )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from asg::AsgTool.

Definition at line 84 of file PpmByteStreamReadV1V2Tool.cxx.

84 {
85 ATH_MSG_DEBUG("Initializing " << name());
86
87 m_srcIdMap = new L1CaloSrcIdMap();
88 m_srcIdMap->useSWROD(m_useSWROD);
89 CHECK(m_errorTool.retrieve());
90 CHECK(m_ppmMaps.retrieve());
91 CHECK(m_robDataProvider.retrieve());
92
94
95 return StatusCode::SUCCESS;
96}

◆ initSourceIDs()

void LVL1BS::PpmByteStreamReadV1V2Tool::initSourceIDs ( )
private

Definition at line 1106 of file PpmByteStreamReadV1V2Tool.cxx.

1107{
1108 const int crates = 8;
1109
1110 m_ppmSourceIDs.clear();
1111 m_ppmSourceIDsSpare.clear();
1112 m_ppmSourceIDsMuon.clear();
1113
1114 for (int crate = 0; crate < crates; ++crate) {
1115 for (int slink = 0; slink < m_srcIdMap->maxSlinks(); ++slink) {
1116 const uint32_t rodId = m_srcIdMap->getRodID(crate, slink, 0,
1117 eformat::TDAQ_CALO_PREPROC);
1118 const uint32_t robId = m_srcIdMap->getRobID(rodId);
1119 m_ppmSourceIDs.push_back(robId);
1120 if (crate > 1 && crate < 6) {
1121 m_ppmSourceIDsSpare.push_back(robId);
1122 if (crate < 4 && slink == 0) {
1123 m_ppmSourceIDsMuon.push_back(robId);
1124 }
1125 }
1126 }
1127 }
1128}

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interpretPpmHeaderR4V1_()

void LVL1BS::PpmByteStreamReadV1V2Tool::interpretPpmHeaderR4V1_ ( BitReader & br,
uint8_t numAdc,
int8_t & encoding,
int8_t & minIndex ) const
private

Definition at line 739 of file PpmByteStreamReadV1V2Tool.cxx.

742{
743 uint8_t minHeader = 0;
744
745 if (numAdc == 5) {
746 minHeader = br.getField(4);
747
748 minIndex = minHeader % 5;
749 if (minHeader < 15){ // Encodings 0-5
750 if (minHeader < 10) {
751 encoding = minHeader / 5;
752 } else {
753 encoding = 2 + br.getField(2);
754 }
755 } else {
756 encoding = 6;
757 }
758 } else {
759 uint8_t numBits = 0;
760 if (numAdc ==3 ) {
761 numBits = 2;
762 } else if (numAdc == 7) {
763 numBits = 3;
764 } else if (numAdc < 16) {
765 numBits = 4;
766 }
767
768 if (numBits > 0) {
769 uint8_t fieldSize = 1 << numBits;
770 minHeader = br.getField(numBits);
771 uint8_t encValue = fieldSize - 1;
772 if (minHeader == encValue) { // Encoding 6
773 encoding = 6;
774 minIndex = 0;
775 } else {
776 minHeader += br.getField(2) << numBits;
777 minIndex = minHeader % fieldSize;
778 encValue = 3 * fieldSize;
779
780 if (minHeader < encValue) { // Encodings 0-2
781 encoding = minHeader / fieldSize;
782 } else {
783 encoding = 3 + br.getField(2);
784 }
785 }
786 }
787 }
788}

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ ppmSourceIDs()

const std::vector< uint32_t > & LVL1BS::PpmByteStreamReadV1V2Tool::ppmSourceIDs ( State & state,
const std::string & sgKey ) const
private

Return reference to vector with all possible Source Identifiers.

Definition at line 1132 of file PpmByteStreamReadV1V2Tool.cxx.

1135{
1136 state.m_ppmIsRetMuon = false;
1137 state.m_ppmIsRetSpare = false;
1138
1139 if (sgKey.find("Muon") != std::string::npos) {
1140 state.m_ppmIsRetMuon = true;
1141 } else if (sgKey.find("Spare") != std::string::npos) {
1142 state.m_ppmIsRetSpare = true;
1143 }
1144
1145 if (state.m_ppmIsRetSpare) {
1146 return m_ppmSourceIDsSpare;
1147 }
1148
1149 if (state.m_ppmIsRetMuon) {
1150 return m_ppmSourceIDsMuon;
1151 }
1152
1153 return m_ppmSourceIDs;
1154}

◆ print()

void asg::AsgTool::print ( ) const
virtualinherited

◆ processPpmBlock_()

StatusCode LVL1BS::PpmByteStreamReadV1V2Tool::processPpmBlock_ ( State & state) const
private

Definition at line 292 of file PpmByteStreamReadV1V2Tool.cxx.

293{
294 if (state.m_ppBlock.size() > 0) {
295 if (state.m_subBlockHeader.format() == 0) {
297 CHECK(sc);
298 return sc;
299 }
300
301 if (state.m_verCode == 0x31) {
303 CHECK(sc);
304 return sc;
305 }
306
307 if (state.m_verCode == 0x41 || state.m_verCode == 0x42) {
309 CHECK(sc);
310 return sc;
311 }
312 }
313
314 if (state.m_ppLuts.size() > 0) {
315 if (state.m_verCode == 0x21 || state.m_verCode == 0x31) {
317 CHECK(sc);
318 return sc;
319 }
320 ATH_MSG_ERROR("Unknown PPM subheader format '"
321 << int(state.m_subBlockHeader.format())
322 << "' for rob version '"
323 << MSG::hex << int(state.m_verCode)
324 << MSG::dec << "'" );
325 return StatusCode::FAILURE;
326 }
327 return StatusCode::SUCCESS;
328}
#define ATH_MSG_ERROR(x)
StatusCode processPpmBlockR3V1_(State &state) const
StatusCode processPpmCompressedR3V1_(State &state) const
StatusCode processPpmBlockR4V1_(State &state) const
StatusCode processPpmNeutral_(State &state) const

◆ processPpmBlockR3V1_()

StatusCode LVL1BS::PpmByteStreamReadV1V2Tool::processPpmBlockR3V1_ ( State & state) const
private

Definition at line 825 of file PpmByteStreamReadV1V2Tool.cxx.

826{
827 if (state.m_subBlockHeader.format() == 1) {
829 return StatusCode::SUCCESS;
830 } else if (state.m_subBlockHeader.format() >= 2) {
831 // TODO: convert compressed
832 return StatusCode::FAILURE;
833 }
834 return StatusCode::FAILURE;
835}
StatusCode processPpmStandardR3V1_(State &state) const

◆ processPpmBlockR4V1_()

StatusCode LVL1BS::PpmByteStreamReadV1V2Tool::processPpmBlockR4V1_ ( State & state) const
private

Definition at line 576 of file PpmByteStreamReadV1V2Tool.cxx.

577{
578 if (state.m_subBlockHeader.format() == 1) {
580 return StatusCode::SUCCESS;
581 } else if (state.m_subBlockHeader.format() >= 2) {
583 return StatusCode::SUCCESS;
584 }
585 return StatusCode::FAILURE;
586}
StatusCode processPpmStandardR4V1_(State &state) const
StatusCode processPpmCompressedR4V1_(State &state) const

◆ processPpmCompressedR3V1_()

StatusCode LVL1BS::PpmByteStreamReadV1V2Tool::processPpmCompressedR3V1_ ( State & state) const
private

Definition at line 415 of file PpmByteStreamReadV1V2Tool.cxx.

416{
417 BitReader br (state.m_ppBlock);
418 uint8_t chan = 0;
419 try{
420 while (chan < 64) {
421 uint8_t present = 1;
422 if (state.m_subBlockHeader.format() == 3) {
423 present = br.getField(1);
424 }
425
426 if (present == 1) {
427 uint8_t lutVal = 0;
428 uint8_t fmt = 6;
429 uint8_t lutSat=0;
430 uint8_t lutExt=0;
431 uint8_t lutPeak=0;
432
433 std::vector<uint16_t> adcVal = {0 , 0, 0, 0, 0};
434 std::vector<uint8_t> adcExt = {0 , 0, 0, 0, 0};
435
436 uint8_t minHeader = br.getField(4);
437 uint8_t minIndex = minHeader % 5;
438 if (minHeader < 15) { // Formats 0-5
439 if (minHeader < 10) { // Formats 0-1
440 fmt = minHeader / 5;
441 } else { // Formats 2-5
442 fmt = 2 + br.getField( 2);
443 uint8_t haveLut = br.getField(1);
444 if (fmt == 2) {
445 if (haveLut == 1) {
446 lutVal = br.getField(3);
447 lutPeak = 1; // Even if LutVal==0 it seems
448 }
449 } else {
450 uint8_t haveExt = br.getField(1);
451 if (haveLut == 1) {
452 lutVal = br.getField(8);
453 lutExt = br.getField(1);
454 lutSat = br.getField(1);
455 lutPeak = br.getField(1);
456 }
457
458 if (haveExt == 1){
459 for(uint8_t i = 0; i < 5; ++i) {
460 adcExt[i] = br.getField(1);
461 }
462 } else {
463 adcExt[2] = lutExt;
464 }
465 }
466 }
467 adcVal = getPpmAdcSamplesR3_(state, br, fmt, minIndex);
468 } else {
469 uint8_t haveAdc = br.getField(1);
470 if (haveAdc == 1) {
471 uint16_t val = br.getField(10);
472 for(uint8_t i = 0; i < 5; ++i) {
473 adcVal[i] = val;
474 }
475 }
476 }
477 // Add Trigger Tower
478 //std::vector<uint8_t> luts = {lutVal};
480 state,
481 state.m_subBlockHeader.crate(),
482 state.m_subBlockHeader.module(),
483 chan,
484 std::vector<uint8_t> {lutVal},
485 std::vector<uint8_t> {uint8_t(lutExt | (lutSat << 1) | (lutPeak << 2))},
486 std::move(adcVal),
487 std::move(adcExt)
488 ));
489 }
490 chan++;
491 }
492 }catch (const std::out_of_range& ex) {
493 ATH_MSG_WARNING("Excess Data in Sub-block");
494 m_errorTool->rodError(state.m_rodSourceId, L1CaloSubBlock::UNPACK_EXCESS_DATA);
495 }
496 return StatusCode::SUCCESS;
497}
#define ATH_MSG_WARNING(x)
const char *const fmt
std::vector< uint16_t > getPpmAdcSamplesR3_(State &state, BitReader &br, uint8_t format, uint8_t minIndex) const

◆ processPpmCompressedR4V1_()

StatusCode LVL1BS::PpmByteStreamReadV1V2Tool::processPpmCompressedR4V1_ ( State & state) const
private

Definition at line 588 of file PpmByteStreamReadV1V2Tool.cxx.

589{
590 BitReader br (state.m_ppBlock);
591 uint8_t numAdc = state.m_subBlockHeader.nSlice2();
592 uint8_t numLut = state.m_subBlockHeader.nSlice1();
593 int16_t pedCorBase = -20;
594
595
596 try{
597 for(uint8_t chan = 0; chan < s_channels; ++chan) {
598 uint8_t present = 1;
599
600 std::vector<uint8_t> haveLut(numLut, 0);
601 std::vector<uint8_t> lcpVal(numLut, 0);
602
603 std::vector<uint8_t> lcpExt(numLut, 0);
604 std::vector<uint8_t> lcpSat(numLut, 0);
605 std::vector<uint8_t> lcpPeak(numLut, 0);
606 std::vector<uint8_t> lcpBcidVec(numLut, 0);
607
608 std::vector<uint8_t> ljeVal(numLut, 0);
609
610 std::vector<uint8_t> ljeLow(numLut, 0);
611 std::vector<uint8_t> ljeHigh(numLut, 0);
612 std::vector<uint8_t> ljeRes(numLut, 0);
613 std::vector<uint8_t> ljeSat80Vec(numLut, 0);
614
615 std::vector<uint16_t> adcVal(numAdc, 0);
616 std::vector<uint8_t> adcExt(numAdc, 0);
617 std::vector<int16_t> pedCor(numLut, 0);
618 std::vector<uint8_t> pedEn(numLut, 0);
619
620 int8_t encoding = -1;
621 int8_t minIndex = -1;
622
623 if (state.m_subBlockHeader.format() == 3) {
624 present = br.getField(1);
625 }
626 if (present == 1) {
627 interpretPpmHeaderR4V1_(br, numAdc, encoding, minIndex);
628 CHECK((encoding != -1) && (minIndex != -1));
629 // First get the LUT related quantities
630 if (encoding < 3) {
631 // Get the peak finder bits
632 for(uint i=0; i < numLut; ++i) {
633 lcpPeak[i] = br.getField(1);
634 }
635 // Get Sat80 low bits
636 if (encoding > 0) {
637 for (uint8_t i = 0; i < numLut; ++i) {
638 ljeLow[i] = br.getField(1);
639 }
640 }
641 // Get LutCP and LutJEP values (these are
642 // only present if the peak finder is set).
643 if (encoding == 2) {
644 for (uint8_t i = 0; i < numLut; ++i) {
645 if (lcpPeak[i] == 1) {
646 lcpVal[i] = br.getField(4);
647 }
648 }
649 for(uint8_t i = 0; i < numLut; ++i) {
650 if (lcpPeak[i] == 1){
651 ljeVal[i] = br.getField(3);
652 }
653 }
654 }
655 } else if (encoding < 6) {
656 // Get LUT presence flag for each LUT slice.
657 for(uint8_t i = 0; i < numLut; ++i){
658 haveLut[i] = br.getField(1);
659 }
660
661 // Get external BCID bits (if block is present).
662 uint8_t haveExt = br.getField(1);
663
664 if (haveExt == 1) {
665 for (uint8_t i = 0; i < numAdc; ++i) {
666 adcExt[i] = br.getField(1);
667 }
668 }
669
670 for(uint8_t i = 0; i < numLut; ++i){
671 if (haveLut[i] == 1) {
672 lcpVal[i] = br.getField(8);
673 lcpExt[i] = br.getField(1);
674 lcpSat[i] = br.getField(1);
675 lcpPeak[i] = br.getField(1);
676 }
677 }
678 // Get JEP LUT values and corresponding bits.
679 for(uint8_t i = 0; i < numLut; ++i){
680 if (haveLut[i] == 1) {
681 ljeVal[i] = br.getField(8);
682 ljeLow[i] = br.getField(1);
683 ljeHigh[i] = br.getField(1);
684 ljeRes[i] = br.getField(1);
685 }
686 }
687
688 }
689
690 }
691 // Next get the ADC related quantities (all encodings).
692 if (minIndex <0) return StatusCode::FAILURE;
693 adcVal = getPpmAdcSamplesR4_(state, br, encoding, minIndex);
694 // Finally get the pedestal correction.
695 if ((encoding < 3) || (encoding == 6)) {
696 for (uint8_t i = 0; i < numLut; ++i)
697 {
698 pedCor[i] = br.getField(6) + pedCorBase;
699 if (state.m_subBlockHeader.compVer() > 0) {
700 pedEn[i] = 1;
701 }
702 }
703 } else {
704 // At the moment there is an enabled bit for every LUT slice
705 // (even though its really a global flag).
706 // The correction values is a twos complement signed value.
707 for (uint8_t i = 0; i < numLut; ++i)
708 {
709 uint16_t val = br.getField(10);
710 pedCor[i] = ::pedCorrection(val);
711 pedEn[i] = br.getField(1);
712 }
713 }
714
715 for(uint8_t i=0; i < numLut; ++i){
716 lcpBcidVec[i] = uint8_t((lcpPeak[i] << 2) | (lcpSat[i] << 1) | lcpExt[i]);
717 ljeSat80Vec[i] = uint8_t((ljeRes[i] << 2) | (ljeHigh[i] << 1) | ljeLow[i]);
718 }
720 state.m_subBlockHeader.crate(), state.m_subBlockHeader.module(),
721 chan,
722 std::move(lcpVal), std::move(lcpBcidVec),
723 std::move(ljeVal), std::move(ljeSat80Vec),
724 std::move(adcVal), std::move(adcExt),
725 std::move(pedCor), std::move(pedEn)));
726 } // End for loop: done with that channel, move on to the next one.
727 // Finally decode the error and status blocks (if any).
729 state.m_subBlockHeader.crate(), state.m_subBlockHeader.module(), br);
730 } catch (const std::out_of_range& ex) {
731 ATH_MSG_WARNING("Excess Data in Sub-block");
732 m_errorTool->rodError(state.m_rodSourceId, L1CaloSubBlock::UNPACK_EXCESS_DATA);
733 }
734 //Check status word
735 return StatusCode::SUCCESS;
736
737}
unsigned int uint
void processPpmErrorBits_(State &state, uint8_t crate, uint8_t module, BitReader &br) const
void interpretPpmHeaderR4V1_(BitReader &br, uint8_t numAdc, int8_t &encoding, int8_t &minIndex) const
std::vector< uint16_t > getPpmAdcSamplesR4_(State &state, BitReader &br, uint8_t encoding, uint8_t minIndex) const
setScaleOne setStatusOne setSaturated int16_t

◆ processPpmErrorBits_()

void LVL1BS::PpmByteStreamReadV1V2Tool::processPpmErrorBits_ ( State & state,
uint8_t crate,
uint8_t module,
BitReader & br ) const
private

Definition at line 931 of file PpmByteStreamReadV1V2Tool.cxx.

933{
934 // These bits come at the end of a PPM block. This code assumes the main part of the block
935 // has already been decoded and the pointer is set to the start of the error bits.
936 uint8_t haveStatus = br.getField(1);
937 uint8_t haveErrors = br.getField(1);
938
939 // If either or both of these bits is set, then follows a single 16 bit map to indicate the MCM
940 if (haveStatus || haveErrors) {
941 uint16_t mcmMap = br.getField(s_submodules);
942 std::vector<uint16_t> mcmErrors(s_submodules);
943 uint16_t errorWord = 0;
944
945 // For each so indicated MCM, there is either the 5 bit status block, or the 6 bit error block, or both
946 for(int i=0; i < s_submodules; ++i){
947 errorWord = 0;
948 if ((mcmMap & (1 << i)) != 0) {
949 uint16_t blockStatus = 0;
950 uint16_t blockErrors = 0;
951
952 if (haveStatus) {
953 blockStatus = br.getField(5);
954 errorWord |= blockStatus;
955 }
956 if (haveErrors) {
957 blockErrors = br.getField(6);
958 errorWord |= (blockErrors<<5);
959 }
960 }
961 mcmErrors.at(i)=errorWord;
962 }
963
964 int curr = state.m_triggerTowers->size() - 1;
965 for(int i=0; i < s_channels; ++i){
966 if (curr < 0){
967 break;
968 }
969 auto tt = (*state.m_triggerTowers)[curr--];
970 if (tt->coolId() >> 16 & crateModuleMask(crate, module)){
971 uint16_t mcmID = (tt->coolId() >> 8) & 0xff;
972 uint16_t chnID = tt->coolId() & 0xff;
973 uint16_t error = mcmErrors.at(mcmID);
974
975 // Now translate the error into Athena language
976 LVL1::DataError errorBits( tt->errorWord() );
977 if ( error & (1<<chnID) ) { errorBits.set(LVL1::DataError::ChannelDisabled); }
978 if ( error & (1<<4) ) { errorBits.set(LVL1::DataError::MCMAbsent); }
979 if ( error & (1<<5) ) { errorBits.set(LVL1::DataError::Timeout); }
980 if ( error & (1<<6) ) { errorBits.set(LVL1::DataError::ASICFull); }
981 if ( error & (1<<7) ) { errorBits.set(LVL1::DataError::EventMismatch); }
982 if ( error & (1<<8) ) { errorBits.set(LVL1::DataError::BunchMismatch); }
983 if ( error & (1<<9) ) { errorBits.set(LVL1::DataError::FIFOCorrupt); }
984 if ( error & (1<<10) ) { errorBits.set(LVL1::DataError::PinParity); }
985
986 // Set the modified error word for this channel
987 tt->setErrorWord( errorBits.error() );
988 }else{
989 break;
990 }
991 }
992 }
993}

◆ processPpmNeutral_()

StatusCode LVL1BS::PpmByteStreamReadV1V2Tool::processPpmNeutral_ ( State & state) const
private

Definition at line 330 of file PpmByteStreamReadV1V2Tool.cxx.

331{
332 uint8_t numLut = state.m_subBlockHeader.nSlice1();
333 uint8_t numFadc = state.m_subBlockHeader.nSlice2();
334 uint8_t totSlice = 3 * numLut + numFadc;
335
336 uint8_t channel = 0;
337 for ( int asic = 0 ; asic < 4 ; ++asic ) {
338 for ( int mcm = 0 ; mcm < 16 ; ++mcm ) {
339 // ----------------------------------------------------------------------
340 std::vector<uint32_t> rotated(totSlice);
341
342 for ( uint8_t slice = 0 ; slice < totSlice ; ++slice ) {
343 for ( uint8_t bit = 0 ; bit < 11 ; ++bit ) {
344 if ( state.m_ppBlock[slice * 11 + asic * (11 * totSlice) + bit + 1] & (1 << mcm))
345 rotated[slice] |= (1 << bit);
346 }
347 }
348
349 bool nonZeroData = false;
350 for (uint8_t slice = 0; slice < numLut; ++slice) {
351 if (rotated[slice]
352 || rotated[slice + numLut]
353 || rotated[slice + 2 * numLut + numFadc]) { // CP, JET
354 nonZeroData = true;
355 break;
356 }
357 }
358
359 std::vector<uint8_t> lcpVal;
360 std::vector<uint8_t> lcpBcidVec;
361 std::vector<uint8_t> ljeVal;
362 std::vector<uint8_t> ljeSat80Vec;
363 std::vector<int16_t> pedCor;
364 std::vector<uint8_t> pedEn;
365
366 std::vector<uint16_t> adcVal;
367 std::vector<uint8_t> adcExt;
368
369 if (nonZeroData) {
370 for (uint8_t slice = 0; slice < numLut; ++slice) {
371 lcpVal.push_back(rotated[slice] & 0xff);
372 ljeVal.push_back(rotated[slice + numLut] & 0xff);
373 pedCor.push_back(::pedCorrection(rotated[slice + 2 * numLut + numFadc] & 0x3ff));
374
375 lcpBcidVec.push_back((rotated[slice] >> 8) & 0x7);
376 ljeSat80Vec.push_back((rotated[slice + numLut] >> 8) & 0x7);
377 pedEn.push_back((rotated[slice + 2 * numLut + numFadc] >> 10) & 0x1);
378 }
379 }
380
381 for (uint8_t slice = 0; slice < numFadc; ++slice) {
382 if (rotated[slice + numLut]) { // CP, JET
383 nonZeroData = true;
384 break;
385 }
386 }
387
388 if (nonZeroData) {
389 for (uint8_t slice = 0; slice < numFadc; ++ slice) {
390 adcVal.push_back(rotated[slice + 2 * numLut] & 0x3ff);
391 adcExt.push_back((rotated[slice + 2 * numLut] >> 10 & 0x1) & 0x3ff);
392 }
393 }
394
396 state,
397 state.m_subBlockHeader.crate(),
398 state.m_subBlockHeader.module(),
399 channel,
400 std::move(lcpVal),
401 std::move(lcpBcidVec),
402 std::move(ljeVal),
403 std::move(ljeSat80Vec),
404 std::move(adcVal),
405 std::move(adcExt),
406 std::move(pedCor),
407 std::move(pedEn)));
408 // ---------------------------------------------------------------------
409 channel++;
410 }
411 }
412 return StatusCode::SUCCESS;
413}
constexpr unsigned int bit(int n)

◆ processPpmStandardR3V1_() [1/2]

StatusCode LVL1BS::PpmByteStreamReadV1V2Tool::processPpmStandardR3V1_ ( State & state) const
private

Definition at line 897 of file PpmByteStreamReadV1V2Tool.cxx.

898{
899 for(const auto & lut : state.m_ppLuts) {
901 state,
902 state.m_subBlockHeader.crate(),
903 state.m_subBlockHeader.module(),
904 lut.first,
905 lut.second,
906 state.m_ppFadcs[lut.first]));
907 }
908 return StatusCode::SUCCESS;
909}
constexpr auto lut(Generator &&f)

◆ processPpmStandardR3V1_() [2/2]

StatusCode LVL1BS::PpmByteStreamReadV1V2Tool::processPpmStandardR3V1_ ( State & state,
uint32_t word,
int indata ) const
private

Definition at line 537 of file PpmByteStreamReadV1V2Tool.cxx.

540{
541
542 StatusCode sc = StatusCode::SUCCESS;
543 if (state.m_subBlockHeader.seqNum() == 63) { // Error block
544 ATH_MSG_DEBUG("Error PPM subblock");
545 //TODO: errorTool
546 } else {
547 const uint8_t numAdc = state.m_subBlockHeader.nSlice2();
548 const uint8_t numLut = state.m_subBlockHeader.nSlice1();
549 const uint8_t nTotal = numAdc + numLut;
550 const uint8_t wordsPerBlock = 8; // 16 towers (4 MCMs) / 2 per word
551 const uint8_t iBlk = inData / wordsPerBlock;
552 uint8_t iChan = state.m_subBlockHeader.seqNum() + 2 * (inData % wordsPerBlock);
553
554 if (iBlk < numLut) { // First all LUT values
555 for(uint8_t i = 0; i < 2; ++i) {
556 uint16_t subword = (word >> 16 * i) & 0x7ff;
557 state.m_ppLuts[iChan].push_back(subword);
558 iChan++;
559 }
560 } else if (iBlk < nTotal) { // Next all FADC values
561 for(uint8_t i = 0; i < 2; ++i) {
562 uint16_t subword = (word >> (16 * i)) & 0x7ff;
563 state.m_ppFadcs[iChan].push_back(subword);
564 iChan++;
565 }
566
567 } else{
568 ATH_MSG_WARNING("Error decoding Ppm word (run1)");
569 sc = StatusCode::FAILURE;
570 }
571
572 }
573 return sc;
574}

◆ processPpmStandardR4V1_()

StatusCode LVL1BS::PpmByteStreamReadV1V2Tool::processPpmStandardR4V1_ ( State & state) const
private

Definition at line 837 of file PpmByteStreamReadV1V2Tool.cxx.

838{
839 BitReader br (state.m_ppBlock);
840 uint8_t numAdc = state.m_subBlockHeader.nSlice2();
841 uint8_t numLut = state.m_subBlockHeader.nSlice1();
842 uint8_t crate = state.m_subBlockHeader.crate();
843 uint8_t module = state.m_subBlockHeader.module();
844
845 for (uint8_t chan = 0; chan < 64; ++chan) {
846
847 //for (uint8_t k = 0; k < 4; ++k) {
848 std::vector<uint8_t> lcpVal;
849 std::vector<uint8_t> lcpBcidVec;
850
851 std::vector<uint8_t> ljeVal;
852 std::vector<uint8_t> ljeSat80Vec;
853
854
855
856 std::vector<uint16_t> adcVal;
857 std::vector<uint8_t> adcExt;
858 std::vector<int16_t> pedCor;
859 std::vector<uint8_t> pedEn;
860 try {
861 for (int i = 0; i < numLut; ++i) {
862 lcpVal.push_back(br.getField(8));
863 lcpBcidVec.push_back(br.getField(3));
864 }
865
866 for (int i = 0; i < numLut; ++i) {
867 ljeVal.push_back(br.getField(8));
868 ljeSat80Vec.push_back(br.getField(3));
869 }
870
871 for (int i = 0; i < numAdc; ++i) {
872 adcVal.push_back(br.getField(10));
873 adcExt.push_back(br.getField(1));
874 }
875
876 for (int i = 0; i < numLut; ++i) {
877 uint16_t pc = br.getField(10);
878 pedCor.push_back(pedCorrection(pc));
879 pedEn.push_back(br.getField(1));
880 }
881 } catch (const std::out_of_range& ex) {
882 ATH_MSG_WARNING("Excess Data in Sub-block");
883 m_errorTool->rodError(state.m_rodSourceId, L1CaloSubBlock::UNPACK_EXCESS_DATA);
884 }
885 CHECK(
886 addTriggerTowerV2_(state,
887 crate, module, chan,
888 std::move(lcpVal), std::move(lcpBcidVec),
889 std::move(ljeVal), std::move(ljeSat80Vec),
890 std::move(adcVal), std::move(adcExt),
891 std::move(pedCor), std::move(pedEn)));
892 }
893
894 return StatusCode::SUCCESS;
895}

◆ processPpmWord_()

StatusCode LVL1BS::PpmByteStreamReadV1V2Tool::processPpmWord_ ( State & state,
uint32_t word,
int indata ) const
private

Definition at line 272 of file PpmByteStreamReadV1V2Tool.cxx.

275{
276 if ( (state.m_subBlockHeader.format() == 0)
277 || (state.m_subBlockHeader.format() >= 2)
278 || (state.m_verCode >= 0x41)) {
279 state.m_ppBlock.push_back(word);
280 } else if ((state.m_verCode == 0x21) || (state.m_verCode == 0x31)) {
281 return processPpmStandardR3V1_(state, word, indata);
282 } else {
283 ATH_MSG_ERROR("Unsupported PPM version:format ("
284 << state.m_verCode << ":" << state.m_subBlockHeader.format()
285 <<") combination");
286 return StatusCode::FAILURE;
287 }
288 return StatusCode::SUCCESS;
289}

◆ processRobFragment_()

StatusCode LVL1BS::PpmByteStreamReadV1V2Tool::processRobFragment_ ( State & state,
const ROBIterator & robFrag,
const RequestType & requestedType ) const
private

Definition at line 155 of file PpmByteStreamReadV1V2Tool.cxx.

158{
159 auto rob = **robIter;
160
162 "Treating ROB fragment source id #" << MSG::hex << rob.rob_source_id());
163
164
165 state.m_rodSourceId = rob.rod_source_id();
166 state.m_robSourceId = rob.source_id();
167 const auto sourceID = (state.m_rodSourceId >> 16) & 0xff;
168 const auto rodCrate = m_srcIdMap->crate(state.m_rodSourceId);
169 const auto rodSlink = m_srcIdMap->slink(state.m_rodSourceId);
170 // -------------------------------------------------------------------------
171 // Check Rob status
172 if (rob.nstatus() > 0) {
173 ROBPointer robData;
174 rob.status(robData);
175 if (*robData != 0) {
176 ATH_MSG_WARNING("ROB status error - skipping fragment");
177 m_errorTool->robError(state.m_rodSourceId, *robData);
178 return StatusCode::FAILURE;
179 }
180 }
181 // -------------------------------------------------------------------------
182 RODPointer payloadBeg;
183 RODPointer payloadEnd;
185
186 rob.rod_data(payloadBeg);
187 payloadEnd = payloadBeg + rob.rod_ndata();
188 payload = payloadBeg;
189 // -------------------------------------------------------------------------
190 if (payload == payloadEnd) {
191 ATH_MSG_DEBUG("ROB fragment empty");
192 return StatusCode::FAILURE;
193 }
194 // -------------------------------------------------------------------------
195
196
197 uint16_t rodVer = rob.rod_version() & 0xffff;
198 uint32_t rodRunNumber = rob.rod_run_no() & 0xffffff;
199 state.m_verCode = ((rodVer & 0xfff) << 4) | 1;
200
201
202 if (sourceID != state.m_subDetectorID) {
203 ATH_MSG_ERROR("Wrong subdetector source id for requested objects: " << state.m_rodSourceId);
204 return StatusCode::FAILURE;
205 }
206
207 ATH_MSG_DEBUG("Treating crate " << rodCrate << " slink " << rodSlink);
208 state.m_caloUserHeader = CaloUserHeader(*payload);
209 if (!state.m_caloUserHeader.isValid()) {
210 ATH_MSG_ERROR("Invalid or missing user header");
211 return StatusCode::FAILURE;
212 }
213
215 "Run number: " << MSG::dec << rodRunNumber << endmsg
216 << "Version code: 0x" << MSG::hex << int(state.m_verCode) << MSG::dec
217 << endmsg << "LUT triggered slice offset: "
218 << int(state.m_caloUserHeader.lut()) << endmsg
219 << "FADC triggered slice offset: " << int(state.m_caloUserHeader.ppFadc())
220 << endmsg << "FADC baseline lower bound: "
221 << int(state.m_caloUserHeader.ppLowerBound()));
222
223 int indata = 0;
224 uint8_t blockType = 0;
225 int subBlock = 0;
226
227 for (; payload != payloadEnd; ++payload) {
228 if (CaloUserHeader::isValid(*payload) && (subBlock == 0)) {
229
230 } else if (SubBlockHeader::isSubBlockHeader(*payload)) {
231 indata = 0;
232 CHECK(processPpmBlock_(state));
233
234 state.m_ppLuts.clear();
235 state.m_ppFadcs.clear();
236 state.m_ppBlock.clear();
237
238 blockType = (*payload >> 28) & 0xf;
239
240 if ((blockType & 0xd) == 0xc) {
241 state.m_subBlockHeader = SubBlockHeader(*payload);
243 "SubBlock version #" << int(state.m_subBlockHeader.version())
244 << " format #" << int(state.m_subBlockHeader.format())
245 << " seqNum (compVer) #" << int(state.m_subBlockHeader.seqNum())
246 << " nslice1 #" << int(state.m_subBlockHeader.nSlice1())
247 << " nslice2 #" << int(state.m_subBlockHeader.nSlice2())
248 );
249 subBlock = blockType & 0xe;
250 } else if (blockType == (subBlock | 1)) {
251 processSubBlockStatus_(state, state.m_subBlockHeader.crate(), state.m_subBlockHeader.module(), *payload);
252 subBlock = 0;
253 }
254 } else {
255 switch(state.m_subDetectorID){
256 case eformat::TDAQ_CALO_PREPROC:
257 CHECK(processPpmWord_(state, *payload, indata));
258 break;
259 default:
260 break;
261 }
262 indata++;
263 }
264 }
265 CHECK(processPpmBlock_(state));
266 state.m_ppLuts.clear();
267 state.m_ppFadcs.clear();
268 state.m_ppBlock.clear();
269 return StatusCode::SUCCESS;
270}
#define endmsg
#define ATH_MSG_VERBOSE(x)
OFFLINE_FRAGMENTS_NAMESPACE::PointerType RODPointer
StatusCode processPpmBlock_(State &state) const
StatusCode processPpmWord_(State &state, uint32_t word, int indata) const
void processSubBlockStatus_(State &state, uint8_t crate, uint8_t module, uint32_t word) const
OFFLINE_FRAGMENTS_NAMESPACE::PointerType ROBPointer
L1Topo::BlockTypes blockType(const uint32_t word, uint32_t offset=28, uint32_t size=0x0f)
Function to return the block type of a data word from L1Topo.
Definition BlockTypes.cxx:9

◆ processSubBlockStatus_()

void LVL1BS::PpmByteStreamReadV1V2Tool::processSubBlockStatus_ ( State & state,
uint8_t crate,
uint8_t module,
uint32_t word ) const
private

Definition at line 911 of file PpmByteStreamReadV1V2Tool.cxx.

913{
914 int curr = state.m_triggerTowers->size() - 1;
915 for(int i=0; i < s_channels; ++i){
916 if (curr < 0){
917 break;
918 }
919 auto tt = (*state.m_triggerTowers)[curr--];
920 if (tt->coolId() >> 16 & crateModuleMask(crate, module)){
921 LVL1::DataError errorBits( tt->errorWord() );
922 errorBits.set(LVL1::DataError::SubStatusWord, payload);
923 tt->setErrorWord( errorBits.error() );
924 }else{
925 break;
926 }
927 }
928}

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_errorTool

ToolHandle<LVL1BS::L1CaloErrorByteStreamTool> LVL1BS::PpmByteStreamReadV1V2Tool::m_errorTool
private

Definition at line 204 of file PpmByteStreamReadV1V2Tool.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_maxSizeSeen

std::atomic<size_t> LVL1BS::PpmByteStreamReadV1V2Tool::m_maxSizeSeen
mutableprivate

Definition at line 216 of file PpmByteStreamReadV1V2Tool.h.

◆ m_ppmMaps

ToolHandle<LVL1::IL1CaloMappingTool> LVL1BS::PpmByteStreamReadV1V2Tool::m_ppmMaps
private

Channel mapping tool.

Definition at line 206 of file PpmByteStreamReadV1V2Tool.h.

◆ m_ppmSourceIDs

std::vector<uint32_t> LVL1BS::PpmByteStreamReadV1V2Tool::m_ppmSourceIDs
private

Definition at line 211 of file PpmByteStreamReadV1V2Tool.h.

◆ m_ppmSourceIDsMuon

std::vector<uint32_t> LVL1BS::PpmByteStreamReadV1V2Tool::m_ppmSourceIDsMuon
private

Definition at line 212 of file PpmByteStreamReadV1V2Tool.h.

◆ m_ppmSourceIDsSpare

std::vector<uint32_t> LVL1BS::PpmByteStreamReadV1V2Tool::m_ppmSourceIDsSpare
private

Definition at line 213 of file PpmByteStreamReadV1V2Tool.h.

◆ m_robDataProvider

ServiceHandle<IROBDataProviderSvc> LVL1BS::PpmByteStreamReadV1V2Tool::m_robDataProvider
private

Service for reading bytestream.

Definition at line 208 of file PpmByteStreamReadV1V2Tool.h.

◆ m_srcIdMap

L1CaloSrcIdMap* LVL1BS::PpmByteStreamReadV1V2Tool::m_srcIdMap
private

Definition at line 214 of file PpmByteStreamReadV1V2Tool.h.

◆ m_useSWROD

bool LVL1BS::PpmByteStreamReadV1V2Tool::m_useSWROD = false
private

Definition at line 226 of file PpmByteStreamReadV1V2Tool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ s_channels

const uint8_t LVL1BS::PpmByteStreamReadV1V2Tool::s_channels = 64
staticprivate

Definition at line 223 of file PpmByteStreamReadV1V2Tool.h.

◆ s_crates

const uint8_t LVL1BS::PpmByteStreamReadV1V2Tool::s_crates = 8
staticprivate

Definition at line 220 of file PpmByteStreamReadV1V2Tool.h.

◆ s_maxtowers

const uint16_t LVL1BS::PpmByteStreamReadV1V2Tool::s_maxtowers = s_crates * s_modules * s_channels
staticprivate

Definition at line 224 of file PpmByteStreamReadV1V2Tool.h.

◆ s_modules

const uint8_t LVL1BS::PpmByteStreamReadV1V2Tool::s_modules = 16
staticprivate

Definition at line 221 of file PpmByteStreamReadV1V2Tool.h.

◆ s_submodules

const uint8_t LVL1BS::PpmByteStreamReadV1V2Tool::s_submodules = 16
staticprivate

Definition at line 222 of file PpmByteStreamReadV1V2Tool.h.


The documentation for this class was generated from the following files: