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

1042 {
1043
1044 std::vector<uint8_t> lcpVal;
1045 std::vector<uint8_t> lcpBcidVec;
1046
1047 std::vector<uint16_t> adcVal;
1048 std::vector<uint8_t> adcExt;
1049
1050 for(auto lut: luts) {
1051 lcpVal.push_back(BitField::get<uint8_t>(lut, 0, 8));
1052 lcpBcidVec.push_back(BitField::get<uint8_t>(lut, 8, 3));
1053 }
1054
1055 for(auto f: fadc) {
1056 adcExt.push_back(BitField::get<uint8_t>(f, 0, 1));
1057 adcVal.push_back(BitField::get<uint16_t>(f, 1, 10));
1058 }
1059
1060 CHECK(addTriggerTowerV1_(state, crate, module, channel, lcpVal, lcpBcidVec,
1061 adcVal, adcExt));
1062
1063 return StatusCode::SUCCESS;
1064}
#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 1012 of file ZdcByteStreamReadV1V2Tool.cxx.

1021 {
1022
1023 std::vector<uint8_t> ljeSat80Vec;
1024
1025 std::vector<int16_t> pedCor;
1026 std::vector<uint8_t> pedEn;
1027
1028 CHECK(addTriggerTowerV2_(state, crate, module, channel, luts, lcpBcidVec,
1029 luts , ljeSat80Vec, fadc, bcidExt, pedCor, pedEn)
1030 );
1031
1032 return StatusCode::SUCCESS;
1033}
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 946 of file ZdcByteStreamReadV1V2Tool.cxx.

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

146{
147
150 ttCollection->setStore(aux);
151
152 ATH_MSG_DEBUG("Getting TT collection!");
153 StatusCode sc = convert(robFrags,ttCollection);
154
155 ATH_MSG_DEBUG("Got it!");
156
157 if (sc != StatusCode::SUCCESS) {
158 ATH_MSG_DEBUG("ZDC TT Conversion failed");
159 return sc;
160 }
161
162 ATH_MSG_DEBUG("convertTT2ZD");
163 //convertTT2ZD 'new-s' and returns a bare ptr for ZdcDigitsCollection...
164 //return by value or a unique_ptr would be safer
165 ZdcDigitsCollection* zc = convertTT2ZD(ttCollection);
166 ATH_MSG_DEBUG("convertedTT2ZD! Now copying");
167 (*zdcCollection) = (*zc);
168 //...so zc should be deleted
169 delete zc;
170 ATH_MSG_DEBUG("Copied!");
171
172 return StatusCode::SUCCESS;
173}
#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 181 of file ZdcByteStreamReadV1V2Tool.cxx.

182 {
183
184 //std::cout << "convert " << sgKey << std::endl;
185
186 const std::vector<uint32_t>& vID(ppmSourceIDs(sgKey));
187
188 // // get ROB fragments
190 m_robDataProvider->getROBData(Gaudi::Hive::currentContext(), vID, robFrags, "ZdcByteStreamxAODReadTool");
191 ATH_MSG_DEBUG("Number of ROB fragments:" << robFrags.size());
192
193 CHECK(convert(robFrags, ttCollection));
194 return StatusCode::SUCCESS;
195}
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 175 of file ZdcByteStreamReadV1V2Tool.cxx.

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

◆ convertTT2ZD()

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

Definition at line 1134 of file ZdcByteStreamReadV1V2Tool.cxx.

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

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

◆ getPpmAdcSamplesR4_()

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

Definition at line 831 of file ZdcByteStreamReadV1V2Tool.cxx.

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

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

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

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

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

◆ print()

◆ processPpmBlock_()

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

Definition at line 335 of file ZdcByteStreamReadV1V2Tool.cxx.

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

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

◆ processPpmBlockR4V1_()

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

Definition at line 618 of file ZdcByteStreamReadV1V2Tool.cxx.

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

◆ processPpmCompressedR3V1_()

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

Definition at line 460 of file ZdcByteStreamReadV1V2Tool.cxx.

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

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

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

◆ processPpmStandardR3V1_() [1/2]

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

Definition at line 933 of file ZdcByteStreamReadV1V2Tool.cxx.

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

◆ processPpmStandardR3V1_() [2/2]

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

Definition at line 581 of file ZdcByteStreamReadV1V2Tool.cxx.

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

◆ processPpmStandardR4V1_()

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

Definition at line 875 of file ZdcByteStreamReadV1V2Tool.cxx.

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

◆ processPpmWord_()

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

Definition at line 316 of file ZdcByteStreamReadV1V2Tool.cxx.

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

◆ processRobFragment_()

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

Definition at line 198 of file ZdcByteStreamReadV1V2Tool.cxx.

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