ATLAS Offline Software
Loading...
Searching...
No Matches
ZdcByteStreamReadV1V2Tool Class Reference

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

#include <ZdcByteStreamReadV1V2Tool.h>

Inheritance diagram for ZdcByteStreamReadV1V2Tool:
Collaboration diagram for ZdcByteStreamReadV1V2Tool:

Classes

class  BitReader
struct  State

Public Member Functions

 ZdcByteStreamReadV1V2Tool (const std::string &name)
virtual ~ZdcByteStreamReadV1V2Tool ()
virtual StatusCode initialize ()
 Dummy implementation of the initialisation function.
virtual StatusCode finalize ()
StatusCode convert (const IROBDataProviderSvc::VROBFRAG &robFrags, xAOD::TriggerTowerContainer *const ttCollection) const
 Convert ROB fragments to trigger towers.
StatusCode convert (const IROBDataProviderSvc::VROBFRAG &robFrags, ZdcDigitsCollection *zdcCollection) const
StatusCode convert (xAOD::TriggerTowerContainer *const ttCollection) const
StatusCode convert (const std::string &sgKey, xAOD::TriggerTowerContainer *const ttCollection) const
ZdcDigitsCollectionconvertTT2ZD (xAOD::TriggerTowerContainer *const ttCollection) const
const std::vector< uint32_t > & ppmSourceIDs (const std::string &sgKey) const
 Return reference to vector with all possible Source Identifiers.
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 ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

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, const std::vector< uint8_t > &lcpVal, const std::vector< uint8_t > &lcpBcidVec, const std::vector< uint8_t > &ljeVal, const std::vector< uint8_t > &ljeSat80Vec, const std::vector< uint16_t > &adcVal, const std::vector< uint8_t > &adcExt, const std::vector< int16_t > &pedCor, const 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, const std::vector< uint8_t > &luts, const std::vector< uint8_t > &lcpBcidVec, const std::vector< uint16_t > &fadc, const std::vector< uint8_t > &bcidExt) const
void initSourceIDs ()
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< ZdcL1CaloErrorByteStreamToolm_errorTool
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
ZdcSrcIdMapm_srcIdMap {}
const ZdcIDm_zdcID {}
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

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 39 of file ZdcByteStreamReadV1V2Tool.h.

Member Typedef Documentation

◆ ROBIterator

typedef IROBDataProviderSvc::VROBFRAG::const_iterator ZdcByteStreamReadV1V2Tool::ROBIterator
private

Definition at line 72 of file ZdcByteStreamReadV1V2Tool.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

enum class ZdcByteStreamReadV1V2Tool::RequestType
strongprivate
Enumerator
PPM 
CPM 
CMX 

Definition at line 71 of file ZdcByteStreamReadV1V2Tool.h.

71{ PPM, CPM, CMX };

Constructor & Destructor Documentation

◆ ZdcByteStreamReadV1V2Tool()

ZdcByteStreamReadV1V2Tool::ZdcByteStreamReadV1V2Tool ( const std::string & name)

Definition at line 74 of file ZdcByteStreamReadV1V2Tool.cxx.

75 :
76 AsgTool(name),
77 m_errorTool("ZdcL1CaloErrorByteStreamTool/ZdcL1CaloErrorByteStreamTool"),
78 //m_ppmMaps("LVL1::PpmMappingTool/PpmMappingTool"),
79 m_robDataProvider("ROBDataProviderSvc", name) {
80 declareInterface<ZdcByteStreamReadV1V2Tool>(this);
81 //declareProperty("PpmMappingTool", m_ppmMaps,
82 // "Crate/Module/Channel to Eta/Phi/Layer mapping tool");
83 declareProperty("ROBDataProviderSvc", m_robDataProvider,
84 "Get ROB source IDs service");
85}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Service for reading bytestream.
ToolHandle< ZdcL1CaloErrorByteStreamTool > m_errorTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58

◆ ~ZdcByteStreamReadV1V2Tool()

virtual ZdcByteStreamReadV1V2Tool::~ZdcByteStreamReadV1V2Tool ( )
inlinevirtual

Definition at line 45 of file ZdcByteStreamReadV1V2Tool.h.

45{};

Member Function Documentation

◆ addTriggerTowerV1_() [1/2]

StatusCode ZdcByteStreamReadV1V2Tool::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 1036 of file ZdcByteStreamReadV1V2Tool.cxx.

1043 {
1044
1045 std::vector<uint8_t> lcpVal;
1046 std::vector<uint8_t> lcpBcidVec;
1047
1048 std::vector<uint16_t> adcVal;
1049 std::vector<uint8_t> adcExt;
1050
1051 for(auto lut: luts) {
1052 lcpVal.push_back(BitField::get<uint8_t>(lut, 0, 8));
1053 lcpBcidVec.push_back(BitField::get<uint8_t>(lut, 8, 3));
1054 }
1055
1056 for(auto f: fadc) {
1057 adcExt.push_back(BitField::get<uint8_t>(f, 0, 1));
1058 adcVal.push_back(BitField::get<uint16_t>(f, 1, 10));
1059 }
1060
1061 CHECK(addTriggerTowerV1_(state, crate, module, channel, lcpVal, lcpBcidVec,
1062 adcVal, adcExt));
1063
1064 return StatusCode::SUCCESS;
1065}
#define CHECK(...)
Evaluate an expression and check for errors.
T get(const uint32_t &word) 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

◆ addTriggerTowerV1_() [2/2]

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

Definition at line 1013 of file ZdcByteStreamReadV1V2Tool.cxx.

1022 {
1023
1024 std::vector<uint8_t> ljeSat80Vec;
1025
1026 std::vector<int16_t> pedCor;
1027 std::vector<uint8_t> pedEn;
1028
1029 CHECK(addTriggerTowerV2_(state, crate, module, channel, luts, lcpBcidVec,
1030 luts , ljeSat80Vec, fadc, bcidExt, pedCor, pedEn)
1031 );
1032
1033 return StatusCode::SUCCESS;
1034}
StatusCode addTriggerTowerV2_(State &state, uint8_t crate, uint8_t module, uint8_t channel, const std::vector< uint8_t > &lcpVal, const std::vector< uint8_t > &lcpBcidVec, const std::vector< uint8_t > &ljeVal, const std::vector< uint8_t > &ljeSat80Vec, const std::vector< uint16_t > &adcVal, const std::vector< uint8_t > &adcExt, const std::vector< int16_t > &pedCor, const std::vector< uint8_t > &pedEn) const

◆ addTriggerTowerV2_()

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

Definition at line 947 of file ZdcByteStreamReadV1V2Tool.cxx.

959 {
960
961 //int layer = 0;
962 int error = 0;
963 double eta = 0.;
964 double phi = 0.;
965
966 bool isNotSpare = false; // PAS - just to minimize changing code
967 // PAS - not using L1Calo PPMMap
968 /*
969 bool isNotSpare = m_ppmMaps->mapping(crate, module, channel, eta, phi, layer);
970 if (!isNotSpare && !m_ppmIsRetSpare && !m_ppmIsRetMuon){
971 return StatusCode::SUCCESS;
972 }
973 */
974
975 if (!isNotSpare) {
976 const int pin = channel % 16;
977 const int asic = channel / 16;
978 eta = 16 * crate + module;
979 phi = 4 * pin + asic;
980 }
981
982 uint32_t coolId = ::coolId(crate, module, channel);
983 CHECK(state.m_coolIds.count(coolId) == 0);
984 state.m_coolIds.insert(coolId);
985
987 //std::cout << ZdcToString(*tt) << std::endl;
988
989 state.m_triggerTowers->push_back(tt);
990 // tt->initialize(
991 // const uint_least32_t& coolId,
992 // const uint_least8_t& layer,
993 // const float& eta,
994 // const float& phi,
995 // const std::vector<uint_least8_t>& lut_cp,
996 // const std::vector<uint_least8_t>& lut_jep,
997 // const std::vector<int_least16_t>& correction,
998 // const std::vector<uint_least8_t>& correctionEnabled,
999 // const std::vector<uint_least8_t>& bcidVec,
1000 // const std::vector<uint_least16_t>& adc,
1001 // const std::vector<uint_least8_t>& bcidExt,
1002 // const std::vector<uint_least8_t>& sat80,
1003 // const uint_least16_t& error,
1004 // const uint_least8_t& peak,
1005 // const uint_least8_t& adcPeak
1006 // );
1007 tt->initialize(coolId, eta, phi, lcpVal, ljeVal, pedCor, pedEn,
1008 lcpBcidVec, adcVal, adcExt, ljeSat80Vec, error, state.m_caloUserHeader.lut(),
1009 state.m_caloUserHeader.ppFadc());
1010 return StatusCode::SUCCESS;
1011}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
TriggerTower_v2 TriggerTower
Define the latest version of the TriggerTower class.
setEventNumber uint32_t

◆ convert() [1/4]

StatusCode ZdcByteStreamReadV1V2Tool::convert ( const IROBDataProviderSvc::VROBFRAG & robFrags,
xAOD::TriggerTowerContainer *const ttCollection ) const

Convert ROB fragments to trigger towers.

Definition at line 122 of file ZdcByteStreamReadV1V2Tool.cxx.

125{
126 State state;
127 state.m_subDetectorID = eformat::FORWARD_ZDC;
128 state.m_triggerTowers = ttCollection;
129
130 ROBIterator rob = robFrags.begin();
131 ROBIterator robEnd = robFrags.end();
132
133 int robCounter = 1;
134 for (; rob != robEnd; ++rob, ++robCounter) {
136 if (!sc.isSuccess()) {
137
138 }
139 }
140 return StatusCode::SUCCESS;
141}
static Double_t sc
IROBDataProviderSvc::VROBFRAG::const_iterator ROBIterator
StatusCode processRobFragment_(State &state, const ROBIterator &robFrag, const RequestType &requestedType) const
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ convert() [2/4]

StatusCode ZdcByteStreamReadV1V2Tool::convert ( const IROBDataProviderSvc::VROBFRAG & robFrags,
ZdcDigitsCollection * zdcCollection ) const

Definition at line 144 of file ZdcByteStreamReadV1V2Tool.cxx.

147{
148
151 ttCollection->setStore(aux);
152
153 ATH_MSG_DEBUG("Getting TT collection!");
154 StatusCode sc = convert(robFrags,ttCollection);
155
156 ATH_MSG_DEBUG("Got it!");
157
158 if (sc != StatusCode::SUCCESS) {
159 ATH_MSG_DEBUG("ZDC TT Conversion failed");
160 return sc;
161 }
162
163 ATH_MSG_DEBUG("convertTT2ZD");
164 //convertTT2ZD 'new-s' and returns a bare ptr for ZdcDigitsCollection...
165 //return by value or a unique_ptr would be safer
166 ZdcDigitsCollection* zc = convertTT2ZD(ttCollection);
167 ATH_MSG_DEBUG("convertedTT2ZD! Now copying");
168 (*zdcCollection) = (*zc);
169 //...so zc should be deleted
170 delete zc;
171 ATH_MSG_DEBUG("Copied!");
172
173 return StatusCode::SUCCESS;
174}
#define ATH_MSG_DEBUG(x)
ZdcDigitsCollection * convertTT2ZD(xAOD::TriggerTowerContainer *const ttCollection) const
StatusCode convert(const IROBDataProviderSvc::VROBFRAG &robFrags, xAOD::TriggerTowerContainer *const ttCollection) const
Convert ROB fragments to trigger towers.
TriggerTowerContainer_v2 TriggerTowerContainer
Define the latest version of the TriggerTower container.
TriggerTowerAuxContainer_v2 TriggerTowerAuxContainer
Define the latest version of the TriggerTower auxiliary container.

◆ convert() [3/4]

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

Definition at line 182 of file ZdcByteStreamReadV1V2Tool.cxx.

183 {
184
185 //std::cout << "convert " << sgKey << std::endl;
186
187 const std::vector<uint32_t>& vID(ppmSourceIDs(sgKey));
188
189 // // get ROB fragments
191 m_robDataProvider->getROBData(Gaudi::Hive::currentContext(), vID, robFrags, "ZdcByteStreamxAODReadTool");
192 ATH_MSG_DEBUG("Number of ROB fragments:" << robFrags.size());
193
194 CHECK(convert(robFrags, ttCollection));
195 return StatusCode::SUCCESS;
196}
std::vector< const ROBF * > VROBFRAG
const std::vector< uint32_t > & ppmSourceIDs(const std::string &sgKey) const
Return reference to vector with all possible Source Identifiers.

◆ convert() [4/4]

StatusCode ZdcByteStreamReadV1V2Tool::convert ( xAOD::TriggerTowerContainer *const ttCollection) const

Definition at line 176 of file ZdcByteStreamReadV1V2Tool.cxx.

177 {
178 //return convert(LVL1::TrigT1CaloDefs::xAODTriggerTowerLocation, ttCollection);
179 return convert("ZdcTriggerTowerContainer", ttCollection);
180}

◆ convertTT2ZD()

ZdcDigitsCollection * ZdcByteStreamReadV1V2Tool::convertTT2ZD ( xAOD::TriggerTowerContainer *const ttCollection) const

Definition at line 1135 of file ZdcByteStreamReadV1V2Tool.cxx.

1136{
1137 typedef std::map<uint32_t,ZdcDigits*> hashmapType;
1138 hashmapType digits_map;
1139 Identifier chan_id;
1140
1141 for (const xAOD::TriggerTower* tt : *ttCollection)
1142 {
1143 uint32_t coolId = tt->coolId();
1144 uint32_t pin = (coolId>>8) & 0xf;
1145 uint32_t asic = coolId & 0xf;
1146 uint32_t slinkChannel = asic*16 + pin;
1147 uint32_t ppmChannel = slink2ppmChannel[slinkChannel];
1148
1149 uint32_t module = (coolId>>16) & 0xf;
1150
1151 ATH_MSG_DEBUG( "--> ZCS: " << ZdcCablingService::getInstance() << " mod=" << module << " slinkC=" << slinkChannel << " ppmC=" << ppmChannel );
1152 chan_id = ZdcCablingService::getInstance()->h2s_channel_id(module, ppmChannel);
1153
1154 const uint32_t chan_hash = chan_id.get_identifier32().get_compact();
1155 int gain = ZdcCablingService::getInstance()->hwid2gain(module,ppmChannel);
1156 int delay = ZdcCablingService::getInstance()->hwid2delay(module,ppmChannel);
1157
1158 ATH_MSG_DEBUG("Trying to find chan_hash " << chan_hash << " g" << gain << "d" << delay);
1159
1160 hashmapType::iterator iter = digits_map.find(chan_hash);
1161 if (iter == digits_map.end())
1162 {
1163 ATH_MSG_DEBUG("new channel for " << chan_id);
1164 digits_map.insert(std::pair<uint32_t,ZdcDigits*>(chan_hash,new ZdcDigits(chan_id)));
1165 iter = digits_map.find(chan_hash);
1166 }
1167 if (iter != digits_map.end())
1168 {
1169 ATH_MSG_DEBUG("new auxdata for " << chan_id);
1170 if (gain==0&&delay==0) (*iter).second->set_digits_gain0_delay0( tt->adc() );
1171 if (gain==1&&delay==0) (*iter).second->set_digits_gain1_delay0( tt->adc() );
1172 if (gain==0&&delay==1) (*iter).second->set_digits_gain0_delay1( tt->adc() );
1173 if (gain==1&&delay==1) (*iter).second->set_digits_gain1_delay1( tt->adc() );
1174 }
1175
1176 }
1177
1178 ZdcDigitsCollection* zdcCollection = new ZdcDigitsCollection();
1179
1180 hashmapType::iterator iter = digits_map.begin();
1181 hashmapType::iterator iter_end = digits_map.end();
1182
1183 while (iter != iter_end)
1184 {
1185 /*
1186 Identifier id = ((*iter).second)->identify();
1187 std::cout
1188 << "side=" << m_zdcID->side(id)
1189 << " mod=" << m_zdcID->module(id)
1190 << " type=" << m_zdcID->type(id)
1191 << " chan=" << m_zdcID->channel(id)
1192 << std::endl;
1193 ((*iter).second)->print();
1194 */
1195 zdcCollection->push_back((*iter).second);
1196 ++iter;
1197 }
1198
1199 return zdcCollection;
1200}
double delay(std::size_t d)
const int slink2ppmChannel[64]
value_type push_back(value_type pElem)
Add an element to the end of the collection.
value_type get_compact() const
Get the compact id.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
int hwid2gain(int crate, int channel) const
static const ZdcCablingService * getInstance()
get pointer to service instance
int hwid2delay(int crate, int channel) const
Identifier h2s_channel_id(int crate, int channel) const

◆ 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 ZdcByteStreamReadV1V2Tool::finalize ( )
virtual

Definition at line 115 of file ZdcByteStreamReadV1V2Tool.cxx.

115 {
116 delete m_srcIdMap;
117
118 return StatusCode::SUCCESS;
119}

◆ 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 > ZdcByteStreamReadV1V2Tool::getPpmAdcSamplesR3_ ( State & state,
BitReader & br,
uint8_t format,
uint8_t minIndex ) const
private

Definition at line 544 of file ZdcByteStreamReadV1V2Tool.cxx.

546 {
547
548 std::vector<uint16_t> adc = {0, 0, 0, 0, 0};
549 uint8_t minAdc = 0;
550
551 for(uint8_t i = 0; i <5; ++i) {
552 uint8_t longField = 0;
553 uint8_t numBits = 0;
554 if (format > 2) {
555 longField = br.getField (1);
556 numBits = longField == 0? 4: (format * 2);
557 } else {
558 numBits = i == 0? 4: (format + 2);
559 }
560
561 if (i == 0) {
562 minAdc = br.getField (numBits);
563 if (longField == 0) {
564 minAdc += state.m_caloUserHeader.ppLowerBound();
565 }
566 } else {
567 adc[i] = minAdc + br.getField (numBits);
568 }
569 }
570
571 if (minIndex == 0) {
572 adc[0] = minAdc;
573 } else {
574 adc[0] = adc[minIndex];
575 adc[minIndex] = minAdc;
576 }
577 return adc;
578}

◆ getPpmAdcSamplesR4_()

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

Definition at line 832 of file ZdcByteStreamReadV1V2Tool.cxx.

834 {
835 uint8_t numAdc = state.m_subBlockHeader.nSlice2();
836
837 if (encoding == 6) {
838 uint16_t val = br.getField (6);
839 return std::vector<uint16_t>(numAdc, val);
840 } else if ( encoding < 3) {
841 std::vector<uint16_t> adc(numAdc, 0);
842 uint16_t minAdc = br.getField (5) + state.m_caloUserHeader.ppLowerBound();
843 adc[minIndex] = minAdc;
844 for(uint8_t i = 1; i < numAdc; ++i) {
845 adc[i == minIndex? 0: i] = br.getField (encoding + 2) + minAdc;
846 }
847 return adc;
848 } else {
849 std::vector<uint16_t> adc(numAdc, 0);
850 uint16_t minAdc = br.getField (1)
851 ? br.getField (encoding * 2)
852 : (br.getField (5) +
853 state.m_caloUserHeader.ppLowerBound());
854
855 adc[minIndex] = minAdc;
856 for (uint8_t i = 1; i < numAdc; ++i) {
857 adc[minIndex == i? 0: i] = br.getField (
858 br.getField (1)? encoding * 2: 4
859 ) + minAdc;
860 }
861 return adc;
862 }
863}
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 ZdcByteStreamReadV1V2Tool::initialize ( void )
virtual

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 91 of file ZdcByteStreamReadV1V2Tool.cxx.

91 {
92
93 m_srcIdMap = new ZdcSrcIdMap();
94 CHECK(m_errorTool.retrieve());
95 //CHECK(m_ppmMaps.retrieve());
96 CHECK(m_robDataProvider.retrieve());
97
98 const ZdcID* zdcID = nullptr;
99 if (detStore()->retrieve( zdcID ).isFailure() ) {
100 msg(MSG::ERROR) << "execute: Could not retrieve ZdcID object from the detector store" << endmsg;
101 return StatusCode::FAILURE;
102 }
103 else {
104 msg(MSG::DEBUG) << "execute: retrieved ZdcID" << endmsg;
105 }
106 m_zdcID = zdcID;
107
109
110 return StatusCode::SUCCESS;
111}
#define endmsg
const ServiceHandle< StoreGateSvc > & detStore() const
retrieve(aClass, aKey=None)
Definition PyKernel.py:110
MsgStream & msg
Definition testRead.cxx:32

◆ initSourceIDs()

void ZdcByteStreamReadV1V2Tool::initSourceIDs ( )
private

Definition at line 1067 of file ZdcByteStreamReadV1V2Tool.cxx.

1068{
1069 const int crates = 8;
1070 m_ppmSourceIDs.clear();
1071 m_ppmSourceIDsSpare.clear();
1072 m_ppmSourceIDsMuon.clear();
1073
1074 for (int crate = 0; crate < crates; ++crate) {
1075 for (int slink = 0; slink < m_srcIdMap->maxSlinks(); ++slink) {
1076 //const uint32_t rodId = m_srcIdMap->getRodID(crate, slink, 0,
1077 // eformat::TDAQ_CALO_PREPROC);
1078 const uint32_t rodId = m_srcIdMap->getRodID(crate, slink, 0,
1079 eformat::FORWARD_ZDC);
1080 const uint32_t robId = m_srcIdMap->getRobID(rodId);
1081 m_ppmSourceIDs.push_back(robId);
1082 //std::cout << "robId=" << std::hex << robId << std::dec << std::endl;
1083 if (crate > 1 && crate < 6) {
1084 m_ppmSourceIDsSpare.push_back(robId);
1085 if (crate < 4 && slink == 0) {
1086 m_ppmSourceIDsMuon.push_back(robId);
1087 }
1088 }
1089 }
1090 }
1091}
std::vector< uint32_t > m_ppmSourceIDs
std::vector< uint32_t > m_ppmSourceIDsMuon
std::vector< uint32_t > m_ppmSourceIDsSpare

◆ 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 ZdcByteStreamReadV1V2Tool::interpretPpmHeaderR4V1_ ( BitReader & br,
uint8_t numAdc,
int8_t & encoding,
int8_t & minIndex ) const
private

Definition at line 782 of file ZdcByteStreamReadV1V2Tool.cxx.

784 {
785 uint8_t minHeader = 0;
786
787 if (numAdc == 5) {
788 minHeader = br.getField (4);
789 //ATH_MSG_DEBUG("SASHA: minHeader=" << int(minHeader));
790 minIndex = minHeader % 5;
791 if (minHeader < 15){ // Encodings 0-5
792 if (minHeader < 10) {
793 encoding = minHeader / 5;
794 } else {
795 encoding = 2 + br.getField (2);
796 }
797 } else {
798 encoding = 6;
799 }
800 } else {
801 uint8_t numBits = 0;
802 if (numAdc ==3 ) {
803 numBits = 2;
804 } else if (numAdc == 7) {
805 numBits = 3;
806 } else if (numAdc < 16) {
807 numBits = 4;
808 }
809
810 if (numBits > 0) {
811 uint8_t fieldSize = 1 << numBits;
812 minHeader = br.getField (numBits);
813 uint8_t encValue = fieldSize - 1;
814 if (minHeader == encValue) { // Encoding 6
815 encoding = 6;
816 minIndex = 0;
817 } else {
818 minHeader += br.getField (2) << numBits;
819 minIndex = minHeader % fieldSize;
820 encValue = 3 * fieldSize;
821
822 if (minHeader < encValue) { // Encodings 0-2
823 encoding = minHeader / fieldSize;
824 } else {
825 encoding = 3 + br.getField (2);
826 }
827 }
828 }
829 }
830}

◆ 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 > & ZdcByteStreamReadV1V2Tool::ppmSourceIDs ( const std::string & sgKey) const

Return reference to vector with all possible Source Identifiers.

Definition at line 1095 of file ZdcByteStreamReadV1V2Tool.cxx.

1097{
1098 if (sgKey.find("Muon") != std::string::npos) {
1099 return m_ppmSourceIDsMuon;
1100 }
1101 else if (sgKey.find("Spare") != std::string::npos) {
1102 return m_ppmSourceIDsSpare;
1103 }
1104
1105 return m_ppmSourceIDs;
1106}

◆ print()

◆ processPpmBlock_()

StatusCode ZdcByteStreamReadV1V2Tool::processPpmBlock_ ( State & state) const
private

Definition at line 336 of file ZdcByteStreamReadV1V2Tool.cxx.

336 {
337 if (!state.m_ppBlock.empty()) {
338 if (state.m_subBlockHeader.format() == 0) {
340 state.m_ppBlock.clear();
341 CHECK(sc);
342 return sc;
343 }
344
345 if (state.m_verCode == 0x31) {
347 state.m_ppBlock.clear();
348 CHECK(sc);
349 return sc;
350 }
351
352 if (state.m_verCode == 0x41 || state.m_verCode == 0x42) {
354 state.m_ppBlock.clear();
355 CHECK(sc);
356 return sc;
357 }
358 }
359
360 if (!state.m_ppLuts.empty()) {
361 if (state.m_verCode == 0x21 || state.m_verCode == 0x31) {
363 state.m_ppLuts.clear();
364 state.m_ppFadcs.clear();
365 CHECK(sc);
366 return sc;
367 }
368 ATH_MSG_ERROR("Unknown PPM subheader format '"
369 << int(state.m_subBlockHeader.format())
370 << "' for rob version '"
371 << MSG::hex << int(state.m_verCode)
372 << MSG::dec << "'" );
373 return StatusCode::FAILURE;
374 }
375 return StatusCode::SUCCESS;
376}
#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 ZdcByteStreamReadV1V2Tool::processPpmBlockR3V1_ ( State & state) const
private

Definition at line 865 of file ZdcByteStreamReadV1V2Tool.cxx.

865 {
866 if (state.m_subBlockHeader.format() == 1) {
868 return StatusCode::SUCCESS;
869 } else if (state.m_subBlockHeader.format() >= 2) {
870 // TODO: convert compressed
871 return StatusCode::FAILURE;
872 }
873 return StatusCode::FAILURE;
874}
StatusCode processPpmStandardR3V1_(State &state) const

◆ processPpmBlockR4V1_()

StatusCode ZdcByteStreamReadV1V2Tool::processPpmBlockR4V1_ ( State & state) const
private

Definition at line 619 of file ZdcByteStreamReadV1V2Tool.cxx.

619 {
620 if (state.m_subBlockHeader.format() == 1) {
622 return StatusCode::SUCCESS;
623 } else if (state.m_subBlockHeader.format() >= 2) {
624 // TODO: convert compressed
626 return StatusCode::SUCCESS;
627 }
628 return StatusCode::FAILURE;
629}
StatusCode processPpmStandardR4V1_(State &state) const
StatusCode processPpmCompressedR4V1_(State &state) const

◆ processPpmCompressedR3V1_()

StatusCode ZdcByteStreamReadV1V2Tool::processPpmCompressedR3V1_ ( State & state) const
private

Definition at line 461 of file ZdcByteStreamReadV1V2Tool.cxx.

461 {
462 uint8_t chan = 0;
463 BitReader br (state.m_ppBlock);
464 try{
465 while (chan < 64) {
466 uint8_t present = 1;
467 if (state.m_subBlockHeader.format() == 3) {
468 present = br.getField (1);
469 }
470
471 if (present == 1) {
472 uint8_t lutVal = 0;
473 uint8_t fmt = 6;
474 uint8_t lutSat=0;
475 uint8_t lutExt=0;
476 uint8_t lutPeak=0;
477
478 std::vector<uint16_t> adcVal = {0 , 0, 0, 0, 0};
479 std::vector<uint8_t> adcExt = {0 , 0, 0, 0, 0};
480
481 uint8_t minHeader = br.getField (4);
482 uint8_t minIndex = minHeader % 5;
483 if (minHeader < 15) { // Formats 0-5
484 if (minHeader < 10) { // Formats 0-1
485 fmt = minHeader / 5;
486 } else { // Formats 2-5
487 fmt = 2 + br.getField (2);
488 uint8_t haveLut = br.getField (1);
489 if (fmt == 2) {
490 if (haveLut == 1) {
491 lutVal = br.getField (3);
492 lutPeak = 1; // Even if LutVal==0 it seems
493 }
494 } else {
495 uint8_t haveExt = br.getField (1);
496 if (haveLut == 1) {
497 lutVal = br.getField (8);
498 lutExt = br.getField (1);
499 lutSat = br.getField (1);
500 lutPeak = br.getField (1);
501 }
502
503 if (haveExt == 1){
504 for(uint8_t i = 0; i < 5; ++i) {
505 adcExt[i] = br.getField (1);
506 }
507 } else {
508 adcExt[2] = lutExt;
509 }
510 }
511 }
512 adcVal = getPpmAdcSamplesR3_(state, br, fmt, minIndex);
513 } else {
514 uint8_t haveAdc = br.getField (1);
515 if (haveAdc == 1) {
516 uint16_t val = br.getField (10);
517 for(uint8_t i = 0; i < 5; ++i) {
518 adcVal[i] = val;
519 }
520 }
521 }
522 // Add Trigger Tower
523 //std::vector<uint8_t> luts = {lutVal};
525 state,
526 state.m_subBlockHeader.crate(),
527 state.m_subBlockHeader.module(),
528 chan,
529 std::vector<uint8_t> {lutVal},
530 std::vector<uint8_t> {uint8_t(lutExt | (lutSat << 1) | (lutPeak << 2))},
531 adcVal,
532 adcExt
533 ));
534 }
535 chan++;
536 }
537 }catch (const std::out_of_range& ex) {
538 ATH_MSG_WARNING("Excess Data in Sub-block");
539 m_errorTool->rodError(state.m_rodSourceId, ZdcL1CaloSubBlock::UNPACK_EXCESS_DATA);
540 }
541 return StatusCode::SUCCESS;
542}
#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 ZdcByteStreamReadV1V2Tool::processPpmCompressedR4V1_ ( State & state) const
private

Definition at line 631 of file ZdcByteStreamReadV1V2Tool.cxx.

631 {
632 BitReader br (state.m_ppBlock);
633
634 uint8_t numAdc = state.m_subBlockHeader.nSlice2();
635 uint8_t numLut = state.m_subBlockHeader.nSlice1();
636 int16_t pedCorBase = -20;
637
638
639 // for(size_t i = 0; i < state.m_ppBlock.size(); ++i) {
640 // std::bitset<32> x(state.m_ppBlock[i]);
641 // std::cout << i << " " << x << std::endl;
642 // }
643
644 try{
645 for(uint8_t chan = 0; chan < 64; ++chan) {
646 uint8_t present = 1;
647
648 std::vector<uint8_t> haveLut(numLut, 0);
649 std::vector<uint8_t> lcpVal(numLut, 0);
650
651 std::vector<uint8_t> lcpExt(numLut, 0);
652 std::vector<uint8_t> lcpSat(numLut, 0);
653 std::vector<uint8_t> lcpPeak(numLut, 0);
654 std::vector<uint8_t> lcpBcidVec(numLut, 0);
655
656 std::vector<uint8_t> ljeVal(numLut, 0);
657
658 std::vector<uint8_t> ljeLow(numLut, 0);
659 std::vector<uint8_t> ljeHigh(numLut, 0);
660 std::vector<uint8_t> ljeRes(numLut, 0);
661 std::vector<uint8_t> ljeSat80Vec(numLut, 0);
662
663 std::vector<uint16_t> adcVal(numAdc, 0);
664 std::vector<uint8_t> adcExt(numAdc, 0);
665 std::vector<int16_t> pedCor(numLut, 0);
666 std::vector<uint8_t> pedEn(numLut, 0);
667
668 int8_t encoding = -1;
669 int8_t minIndex = -1;
670
671 if (state.m_subBlockHeader.format() == 3) {
672 present = br.getField (1);
673 }
674 if (present == 1) {
675 interpretPpmHeaderR4V1_(br, numAdc, encoding, minIndex);
676 CHECK((encoding != -1) && (minIndex != -1));
677 // First get the LIT related quantities
678 if (encoding < 3) {
679 // Get the peal finder bits
680 for(uint i=0; i < numLut; ++i) {
681 lcpPeak[i] = br.getField (1);
682 }
683 // Get Sat80 low bits
684 if (encoding > 0) {
685 for (uint8_t i = 0; i < numLut; ++i) {
686 ljeLow[i] = br.getField (1);
687 }
688 }
689 // Get LutCP and LutJEP values (these are
690 // only present if the peak finder is set).
691 if (encoding == 2) {
692 for (uint8_t i = 0; i < numLut; ++i) {
693 if (lcpPeak[i] == 1) {
694 lcpVal[i] = br.getField (4);
695 }
696 }
697 for(uint8_t i = 0; i < numLut; ++i) {
698 if (lcpPeak[i] == 1){
699 ljeVal[i] = br.getField (3);
700 }
701 }
702 }
703 } else if (encoding < 6) {
704 // Get LUT presence flag for each LUT slice.
705 for(uint8_t i = 0; i < numLut; ++i){
706 haveLut[i] = br.getField (1);
707 }
708
709 // Get external BCID bits (if block is present).
710 uint8_t haveExt = br.getField (1);
711
712 if (haveExt == 1) {
713 for (uint8_t i = 0; i < numAdc; ++i) {
714 adcExt[i] = br.getField (1);
715 }
716 }
717
718 for(uint8_t i = 0; i < numLut; ++i){
719 if (haveLut[i] == 1) {
720 lcpVal[i] = br.getField (8);
721 lcpExt[i] = br.getField (1);
722 lcpSat[i] = br.getField (1);
723 lcpPeak[i] = br.getField (1);
724 }
725 }
726 // Get JEP LUT values and corresponding bits.
727 for(uint8_t i = 0; i < numLut; ++i){
728 if (haveLut[i] == 1) {
729 ljeVal[i] = br.getField (8);
730 ljeLow[i] = br.getField (1);
731 ljeHigh[i] = br.getField (1);
732 ljeRes[i] = br.getField (1);
733 }
734 }
735
736 }
737
738 }
739
740 if (minIndex < 0)
741 return StatusCode::FAILURE;
742
743 // Next get the ADC related quantities (all encodings).
744 adcVal = getPpmAdcSamplesR4_(state, br, encoding, minIndex);
745 // Finally get the pedestal correction.
746 if ((encoding < 3) || (encoding == 6)) {
747 for (uint8_t i = 0; i < numLut; ++i)
748 {
749 pedCor[i] = br.getField (6) + pedCorBase;
750 if (state.m_subBlockHeader.compVer() > 0) {
751 pedEn[i] = 1;
752 }
753 }
754 } else {
755 // At the moment there is an enabled bit for every LUT slice
756 // (even though its really a global flag).
757 // The correction values is a twos complement signed value.
758 for (uint8_t i = 0; i < numLut; ++i)
759 {
760 uint16_t val = br.getField (10);
761 pedCor[i] = ::pedCorrection(val);
762 pedEn[i] = br.getField (1);
763 }
764 }
765
766 for(uint8_t i=0; i < numLut; ++i){
767 lcpBcidVec[i] = uint8_t((lcpPeak[i] << 2) | (lcpSat[i] << 1) | lcpExt[i]);
768 ljeSat80Vec[i] = uint8_t((ljeRes[i] << 2) | (ljeHigh[i] << 1) | ljeLow[i]);
769 }
770 CHECK(addTriggerTowerV2_(state, state.m_subBlockHeader.crate(), state.m_subBlockHeader.module(),
771 chan, lcpVal, lcpBcidVec, ljeVal, ljeSat80Vec, adcVal, adcExt, pedCor,
772 pedEn));
773 }
774 } catch (const std::out_of_range& ex) {
775 ATH_MSG_WARNING("Excess Data in Sub-block");
776 m_errorTool->rodError(state.m_rodSourceId, ZdcL1CaloSubBlock::UNPACK_EXCESS_DATA);
777 }
778 return StatusCode::SUCCESS;
779
780}
unsigned int uint
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

◆ processPpmNeutral_()

StatusCode ZdcByteStreamReadV1V2Tool::processPpmNeutral_ ( State & state) const
private

Definition at line 378 of file ZdcByteStreamReadV1V2Tool.cxx.

378 {
379 uint8_t numLut = state.m_subBlockHeader.nSlice1();
380 uint8_t numFadc = state.m_subBlockHeader.nSlice2();
381 uint8_t totSlice = 3 * numLut + numFadc;
382
383 uint8_t channel = 0;
384 for ( int asic = 0 ; asic < 4 ; ++asic ) {
385 for ( int mcm = 0 ; mcm < 16 ; ++mcm ) {
386 // ----------------------------------------------------------------------
387 std::vector<uint32_t> rotated(totSlice);
388
389 for ( uint8_t slice = 0 ; slice < totSlice ; ++slice ) {
390 for ( uint8_t bit = 0 ; bit < 11 ; ++bit ) {
391 if ( state.m_ppBlock[slice * 11 + asic * (11 * totSlice) + bit + 1] & (1 << mcm))
392 rotated[slice] |= (1 << bit);
393 }
394 }
395
396 bool nonZeroData = false;
397 for (uint8_t slice = 0; slice < numLut; ++slice) {
398 if (rotated[slice]
399 || rotated[slice + numLut]
400 || rotated[slice + 2 * numLut + numFadc]) { // CP, JET
401 nonZeroData = true;
402 break;
403 }
404 }
405
406 std::vector<uint8_t> lcpVal;
407 std::vector<uint8_t> lcpBcidVec;
408 std::vector<uint8_t> ljeVal;
409 std::vector<uint8_t> ljeSat80Vec;
410 std::vector<int16_t> pedCor;
411 std::vector<uint8_t> pedEn;
412
413 std::vector<uint16_t> adcVal;
414 std::vector<uint8_t> adcExt;
415
416 if (nonZeroData) {
417 for (uint8_t slice = 0; slice < numLut; ++slice) {
418 lcpVal.push_back(rotated[slice] & 0xff);
419 ljeVal.push_back(rotated[slice + numLut] & 0xff);
420 pedCor.push_back(::pedCorrection(rotated[slice + 2 * numLut + numFadc] & 0x3ff));
421
422 lcpBcidVec.push_back((rotated[slice] >> 8) & 0x7);
423 ljeSat80Vec.push_back((rotated[slice + numLut] >> 8) & 0x7);
424 pedEn.push_back((rotated[slice + 2 * numLut + numFadc] >> 10) & 0x1);
425 }
426 }
427
428 for (uint8_t slice = 0; slice < numFadc; ++slice) {
429 if (rotated[slice + numLut]) { // CP, JET
430 nonZeroData = true;
431 break;
432 }
433 }
434
435 if (nonZeroData) {
436 for (uint8_t slice = 0; slice < numFadc; ++ slice) {
437 adcVal.push_back(rotated[slice + 2 * numLut] & 0x3ff);
438 adcExt.push_back((rotated[slice + 2 * numLut] >> 10 & 0x1) & 0x3ff);
439 }
440 }
441
443 state,
444 state.m_subBlockHeader.crate(),
445 state.m_subBlockHeader.module(),
446 channel,
447 lcpVal,
448 lcpBcidVec,
449 ljeVal,
450 ljeSat80Vec, adcVal,
451 adcExt,
452 pedCor,
453 pedEn));
454 // ---------------------------------------------------------------------
455 channel++;
456 }
457 }
458 return StatusCode::SUCCESS;
459}

◆ processPpmStandardR3V1_() [1/2]

StatusCode ZdcByteStreamReadV1V2Tool::processPpmStandardR3V1_ ( State & state) const
private

Definition at line 934 of file ZdcByteStreamReadV1V2Tool.cxx.

934 {
935 for(const auto& lut : state.m_ppLuts) {
937 state,
938 state.m_subBlockHeader.crate(),
939 state.m_subBlockHeader.module(),
940 lut.first,
941 lut.second,
942 state.m_ppFadcs[lut.first]));
943 }
944 return StatusCode::SUCCESS;
945}
constexpr auto lut(Generator &&f)

◆ processPpmStandardR3V1_() [2/2]

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

Definition at line 582 of file ZdcByteStreamReadV1V2Tool.cxx.

584 {
586 if (state.m_subBlockHeader.seqNum() == 63) { // Error block
587 ATH_MSG_DEBUG("Error PPM subblock");
588 //TODO: errorTool
589 } else {
590 const uint8_t numAdc = state.m_subBlockHeader.nSlice2();
591 const uint8_t numLut = state.m_subBlockHeader.nSlice1();
592 const uint8_t nTotal = numAdc + numLut;
593 const uint8_t wordsPerBlock = 8; // 16 towers (4 MCMs) / 2 per word
594 const uint8_t iBlk = inData / wordsPerBlock;
595 uint8_t iChan = state.m_subBlockHeader.seqNum() + 2 * (inData % wordsPerBlock);
596
597 if (iBlk < numLut) { // First all LUT values
598 for(uint8_t i = 0; i < 2; ++i) {
599 uint16_t subword = (word >> 16 * i) & 0x7ff;
600 state.m_ppLuts[iChan].push_back(subword);
601 iChan++;
602 }
603 } else if (iBlk < nTotal) { // Next all FADC values
604 for(uint8_t i = 0; i < 2; ++i) {
605 uint16_t subword = (word >> (16 * i)) & 0x7ff;
606 state.m_ppFadcs[iChan].push_back(subword);
607 iChan++;
608 }
609
610 } else{
611 ATH_MSG_WARNING("Error decoding Ppm word (run1)");
612 sc = StatusCode::FAILURE;
613 }
614
615 }
616 return sc;
617}

◆ processPpmStandardR4V1_()

StatusCode ZdcByteStreamReadV1V2Tool::processPpmStandardR4V1_ ( State & state) const
private

Definition at line 876 of file ZdcByteStreamReadV1V2Tool.cxx.

876 {
877
878 //std::cout << "Here I am in processPpmStandardR4V1_" << std::endl;
879 uint8_t numAdc = state.m_subBlockHeader.nSlice2();
880 uint8_t numLut = state.m_subBlockHeader.nSlice1();
881 uint8_t crate = state.m_subBlockHeader.crate();
882 uint8_t module = state.m_subBlockHeader.module();
883
884
885 BitReader br (state.m_ppBlock);
886
887 for (uint8_t chan = 0; chan < 64; ++chan) {
888 //for (uint8_t k = 0; k < 4; ++k) {
889 std::vector<uint8_t> lcpVal;
890 std::vector<uint8_t> lcpBcidVec;
891
892 std::vector<uint8_t> ljeVal;
893 std::vector<uint8_t> ljeSat80Vec;
894
895
896
897 std::vector<uint16_t> adcVal;
898 std::vector<uint8_t> adcExt;
899 std::vector<int16_t> pedCor;
900 std::vector<uint8_t> pedEn;
901 try {
902 for (int i = 0; i < numLut; ++i) {
903 lcpVal.push_back(br.getField (8));
904 lcpBcidVec.push_back(br.getField (3));
905 }
906
907 for (int i = 0; i < numLut; ++i) {
908 ljeVal.push_back(br.getField (8));
909 ljeSat80Vec.push_back(br.getField (3));
910 }
911
912 for (int i = 0; i < numAdc; ++i) {
913 adcVal.push_back(br.getField (10));
914 adcExt.push_back(br.getField (1));
915 }
916
917 for (int i = 0; i < numLut; ++i) {
918 uint16_t pc = br.getField (10);
919 pedCor.push_back(pedCorrection(pc));
920 pedEn.push_back(br.getField (1));
921 }
922 } catch (const std::out_of_range& ex) {
923 ATH_MSG_WARNING("Excess Data in Sub-block");
924 m_errorTool->rodError(state.m_rodSourceId, ZdcL1CaloSubBlock::UNPACK_EXCESS_DATA);
925 }
926 CHECK(
927 addTriggerTowerV2_(state, crate, module, chan, lcpVal, lcpBcidVec,
928 ljeVal, ljeSat80Vec, adcVal, adcExt, pedCor, pedEn));
929 }
930
931 return StatusCode::SUCCESS;
932}

◆ processPpmWord_()

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

Definition at line 317 of file ZdcByteStreamReadV1V2Tool.cxx.

319 {
320 if ( (state.m_subBlockHeader.format() == 0)
321 || (state.m_subBlockHeader.format() >= 2)
322 || (state.m_verCode >= 0x41)) {
323 state.m_ppBlock.push_back(word);
324 } else if ((state.m_verCode == 0x21) || (state.m_verCode == 0x31)) {
325 return processPpmStandardR3V1_(state, word, indata);
326 } else {
327 ATH_MSG_ERROR("Unsupported PPM version:format ("
328 << state.m_verCode << ":" << state.m_subBlockHeader.format()
329 <<") combination");
330 return StatusCode::FAILURE;
331 }
332 return StatusCode::SUCCESS;
333}

◆ processRobFragment_()

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

Definition at line 199 of file ZdcByteStreamReadV1V2Tool.cxx.

201 {
202
203 auto rob = **robIter;
204
206 "Treating ROB fragment source id #" << MSG::hex << rob.rob_source_id());
207
208
209 state.m_rodSourceId = rob.rod_source_id();
210 state.m_robSourceId = rob.source_id();
211 const auto sourceID = (state.m_rodSourceId >> 16) & 0xff;
212 const auto rodCrate = ZdcSrcIdMap::crate(state.m_rodSourceId);
213 const auto rodSlink = ZdcSrcIdMap::slink(state.m_rodSourceId);
214 // -------------------------------------------------------------------------
215 // Check Rob status
216 if (rob.nstatus() > 0) {
217 ROBPointer robData;
218 rob.status(robData);
219 if (*robData != 0) {
220 ATH_MSG_WARNING("ROB status error - skipping fragment");
221 m_errorTool->robError(state.m_rodSourceId, *robData);
222 return StatusCode::FAILURE;
223 }
224 }
225 // -------------------------------------------------------------------------
226 RODPointer payloadBeg;
227 RODPointer payloadEnd;
229
230 rob.rod_data(payloadBeg);
231 payloadEnd = payloadBeg + rob.rod_ndata();
232 payload = payloadBeg;
233 // -------------------------------------------------------------------------
234 if (payload == payloadEnd) {
235 ATH_MSG_DEBUG("ROB fragment empty");
236 return StatusCode::FAILURE;
237 }
238 // -------------------------------------------------------------------------
239
240
241 uint16_t rodVer = rob.rod_version() & 0xffff;
242 state.m_verCode = ((rodVer & 0xfff) << 4) | 1;
243 uint32_t rodRunNumber = rob.rod_run_no() & 0xffffff;
244
245
246 if (sourceID != state.m_subDetectorID) {
247 ATH_MSG_ERROR("Wrong subdetector source id for requested objects: " << state.m_rodSourceId);
248 return StatusCode::FAILURE;
249 }
250
251 ATH_MSG_DEBUG("Treating crate " << rodCrate << " slink " << rodSlink);
252
253 state.m_caloUserHeader = ZdcCaloUserHeader(*payload);
254 if (!state.m_caloUserHeader.isValid()) {
255 ATH_MSG_ERROR("Invalid or missing user header");
256 return StatusCode::FAILURE;
257 }
258
260 "Run number: " << MSG::dec << rodRunNumber << endmsg
261 << "Version code: 0x" << MSG::hex << int(state.m_verCode) << MSG::dec
262 << endmsg << "LUT triggered slice offset: "
263 << int(state.m_caloUserHeader.lut()) << endmsg
264 << "FADC triggered slice offset: " << int(state.m_caloUserHeader.ppFadc())
265 << endmsg << "FADC baseline lower bound: "
266 << int(state.m_caloUserHeader.ppLowerBound()));
267
268 int indata = 0;
269 uint8_t blockType = 0;
270 int subBlock = 0;
271
272 for (; payload != payloadEnd; ++payload) {
273 if (ZdcCaloUserHeader::isValid(*payload) && (subBlock == 0)) {
274
275 } else if (ZdcSubBlockHeader::isSubBlockHeader(*payload)) {
276 indata = 0;
277 CHECK(processPpmBlock_(state));
278
279 state.m_ppLuts.clear();
280 state.m_ppFadcs.clear();
281 state.m_ppBlock.clear();
282
283 blockType = (*payload >> 28) & 0xf;
284
285 if ((blockType & 0xd) == 0xc) {
286 state.m_subBlockHeader = ZdcSubBlockHeader(*payload);
288 "SubBlock version #" << int(state.m_subBlockHeader.version())
289 << " format #" << int(state.m_subBlockHeader.format())
290 << " seqNum (compVer) #" << int(state.m_subBlockHeader.seqNum())
291 << " nslice1 #" << int(state.m_subBlockHeader.nSlice1())
292 << " nslice2 #" << int(state.m_subBlockHeader.nSlice2())
293 );
294 subBlock = blockType & 0xe;
295 } else if (blockType == (subBlock | 1)) {
296 //m_subBlockStatus = ZdcSubBlockStatus(*payload);
297 subBlock = 0;
298 }
299 } else {
300 switch(state.m_subDetectorID){
301 case eformat::TDAQ_CALO_PREPROC:
302 CHECK(processPpmWord_(state, *payload, indata));
303 break;
304 case eformat::FORWARD_ZDC:
305 CHECK(processPpmWord_(state, *payload, indata));
306 break;
307 default:
308 break;
309 }
310 indata++;
311 }
312 }
313 CHECK(processPpmBlock_(state));
314 return StatusCode::SUCCESS;
315}
#define ATH_MSG_VERBOSE(x)
OFFLINE_FRAGMENTS_NAMESPACE::PointerType RODPointer
StatusCode processPpmWord_(State &state, uint32_t word, int indata) const
OFFLINE_FRAGMENTS_NAMESPACE::PointerType ROBPointer
StatusCode processPpmBlock_(State &state) const
static int crate(uint32_t code)
moduleID -> crate
static int slink(uint32_t code)
moduleID -> slink
bool isSubBlockHeader() const
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

◆ 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<ZdcL1CaloErrorByteStreamTool> ZdcByteStreamReadV1V2Tool::m_errorTool
private

Definition at line 184 of file ZdcByteStreamReadV1V2Tool.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_ppmSourceIDs

std::vector<uint32_t> ZdcByteStreamReadV1V2Tool::m_ppmSourceIDs
private

Definition at line 190 of file ZdcByteStreamReadV1V2Tool.h.

◆ m_ppmSourceIDsMuon

std::vector<uint32_t> ZdcByteStreamReadV1V2Tool::m_ppmSourceIDsMuon
private

Definition at line 191 of file ZdcByteStreamReadV1V2Tool.h.

◆ m_ppmSourceIDsSpare

std::vector<uint32_t> ZdcByteStreamReadV1V2Tool::m_ppmSourceIDsSpare
private

Definition at line 192 of file ZdcByteStreamReadV1V2Tool.h.

◆ m_robDataProvider

ServiceHandle<IROBDataProviderSvc> ZdcByteStreamReadV1V2Tool::m_robDataProvider
private

Service for reading bytestream.

Definition at line 187 of file ZdcByteStreamReadV1V2Tool.h.

◆ m_srcIdMap

ZdcSrcIdMap* ZdcByteStreamReadV1V2Tool::m_srcIdMap {}
private

Definition at line 193 of file ZdcByteStreamReadV1V2Tool.h.

193{};

◆ 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.

◆ m_zdcID

const ZdcID* ZdcByteStreamReadV1V2Tool::m_zdcID {}
private

Definition at line 194 of file ZdcByteStreamReadV1V2Tool.h.

194{};

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