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
ZdcDigitsCollection * convertTT2ZD (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< StoreGateSvc > StoreGateSvc_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< ZdcL1CaloErrorByteStreamTool > m_errorTool {"ZdcL1CaloErrorByteStreamTool/ZdcL1CaloErrorByteStreamTool"}
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
 Service for reading bytestream.
std::vector< uint32_t > m_ppmSourceIDs
std::vector< uint32_t > m_ppmSourceIDsMuon
std::vector< uint32_t > m_ppmSourceIDsSpare
ZdcSrcIdMap * m_srcIdMap {}
const ZdcID * m_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 376 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 declareInterface<ZdcByteStreamReadV1V2Tool>(this);
78}
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 1028 of file ZdcByteStreamReadV1V2Tool.cxx.

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

1014 {
1015
1016 std::vector<uint8_t> ljeSat80Vec;
1017
1018 std::vector<int16_t> pedCor;
1019 std::vector<uint8_t> pedEn;
1020
1021 CHECK(addTriggerTowerV2_(state, crate, module, channel, luts, lcpBcidVec,
1022 luts , ljeSat80Vec, fadc, bcidExt, pedCor, pedEn)
1023 );
1024
1025 return StatusCode::SUCCESS;
1026}
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 939 of file ZdcByteStreamReadV1V2Tool.cxx.

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

118{
119 State state;
120 state.m_subDetectorID = eformat::FORWARD_ZDC;
121 state.m_triggerTowers = ttCollection;
122
123 ROBIterator rob = robFrags.begin();
124 ROBIterator robEnd = robFrags.end();
125
126 for (; rob != robEnd; ++rob) {
128 if (!sc.isSuccess()) {
129
130 }
131 }
132 return StatusCode::SUCCESS;
133}
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 136 of file ZdcByteStreamReadV1V2Tool.cxx.

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

175 {
176
177 //std::cout << "convert " << sgKey << std::endl;
178
179 const std::vector<uint32_t>& vID(ppmSourceIDs(sgKey));
180
181 // // get ROB fragments
183 m_robDataProvider->getROBData(Gaudi::Hive::currentContext(), vID, robFrags, "ZdcByteStreamxAODReadTool");
184 ATH_MSG_DEBUG("Number of ROB fragments:" << robFrags.size());
185
186 CHECK(convert(robFrags, ttCollection));
187 return StatusCode::SUCCESS;
188}
std::vector< const ROBF * > VROBFRAG
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Service for reading bytestream.
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 168 of file ZdcByteStreamReadV1V2Tool.cxx.

169 {
170 //return convert(LVL1::TrigT1CaloDefs::xAODTriggerTowerLocation, ttCollection);
171 return convert("ZdcTriggerTowerContainer", ttCollection);
172}

◆ convertTT2ZD()

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

Definition at line 1127 of file ZdcByteStreamReadV1V2Tool.cxx.

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

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

108 {
109 delete m_srcIdMap;
110
111 return StatusCode::SUCCESS;
112}

◆ 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::Event 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::Event, 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::Event 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::Event, 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 536 of file ZdcByteStreamReadV1V2Tool.cxx.

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

◆ getPpmAdcSamplesR4_()

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

Definition at line 824 of file ZdcByteStreamReadV1V2Tool.cxx.

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

84 {
85
86 m_srcIdMap = new ZdcSrcIdMap();
87 CHECK(m_errorTool.retrieve());
88 //CHECK(m_ppmMaps.retrieve());
89 CHECK(m_robDataProvider.retrieve());
90
91 const ZdcID* zdcID = nullptr;
92 if (detStore()->retrieve( zdcID ).isFailure() ) {
93 msg(MSG::ERROR) << "execute: Could not retrieve ZdcID object from the detector store" << endmsg;
94 return StatusCode::FAILURE;
95 }
96 else {
97 msg(MSG::DEBUG) << "execute: retrieved ZdcID" << endmsg;
98 }
99 m_zdcID = zdcID;
100
102
103 return StatusCode::SUCCESS;
104}
#define endmsg
const ServiceHandle< StoreGateSvc > & detStore() const
ToolHandle< ZdcL1CaloErrorByteStreamTool > m_errorTool
MsgStream & msg
Definition testRead.cxx:32

◆ initSourceIDs()

void ZdcByteStreamReadV1V2Tool::initSourceIDs ( )
private

Definition at line 1059 of file ZdcByteStreamReadV1V2Tool.cxx.

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

776 {
777 uint8_t minHeader = 0;
778
779 if (numAdc == 5) {
780 minHeader = br.getField (4);
781 //ATH_MSG_DEBUG("SASHA: minHeader=" << int(minHeader));
782 minIndex = minHeader % 5;
783 if (minHeader < 15){ // Encodings 0-5
784 if (minHeader < 10) {
785 encoding = minHeader / 5;
786 } else {
787 encoding = 2 + br.getField (2);
788 }
789 } else {
790 encoding = 6;
791 }
792 } else {
793 uint8_t numBits = 0;
794 if (numAdc ==3 ) {
795 numBits = 2;
796 } else if (numAdc == 7) {
797 numBits = 3;
798 } else if (numAdc < 16) {
799 numBits = 4;
800 }
801
802 if (numBits > 0) {
803 uint8_t fieldSize = 1 << numBits;
804 minHeader = br.getField (numBits);
805 uint8_t encValue = fieldSize - 1;
806 if (minHeader == encValue) { // Encoding 6
807 encoding = 6;
808 minIndex = 0;
809 } else {
810 minHeader += br.getField (2) << numBits;
811 minIndex = minHeader % fieldSize;
812 encValue = 3 * fieldSize;
813
814 if (minHeader < encValue) { // Encodings 0-2
815 encoding = minHeader / fieldSize;
816 } else {
817 encoding = 3 + br.getField (2);
818 }
819 }
820 }
821 }
822}
encoding
TODO - add here other trackAnalyses configurations depending of the use-case.

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

1089{
1090 if (sgKey.find("Muon") != std::string::npos) {
1091 return m_ppmSourceIDsMuon;
1092 }
1093 else if (sgKey.find("Spare") != std::string::npos) {
1094 return m_ppmSourceIDsSpare;
1095 }
1096
1097 return m_ppmSourceIDs;
1098}

◆ print()

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

Print the state of the tool.

Implements asg::IAsgTool.

Reimplemented in AsgHelloTool, HI::HIPileupTool, JetFromPseudojet, JetPileupLabelingTool, JetPseudojetRetriever, JetSubStructureMomentToolsBase, JetTruthLabelingTool, and KtDeltaRTool.

Definition at line 131 of file AsgTool.cxx.

131 {
132
133 ATH_MSG_INFO( "AsgTool " << name() << " @ " << this );
134 return;
135 }
#define ATH_MSG_INFO(x,...)

◆ processPpmBlock_()

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

Definition at line 328 of file ZdcByteStreamReadV1V2Tool.cxx.

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

857 {
858 if (state.m_subBlockHeader.format() == 1) {
860 return StatusCode::SUCCESS;
861 } else if (state.m_subBlockHeader.format() >= 2) {
862 // TODO: convert compressed
863 return StatusCode::FAILURE;
864 }
865 return StatusCode::FAILURE;
866}
StatusCode processPpmStandardR3V1_(State &state) const

◆ processPpmBlockR4V1_()

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

Definition at line 611 of file ZdcByteStreamReadV1V2Tool.cxx.

611 {
612 if (state.m_subBlockHeader.format() == 1) {
614 return StatusCode::SUCCESS;
615 } else if (state.m_subBlockHeader.format() >= 2) {
616 // TODO: convert compressed
618 return StatusCode::SUCCESS;
619 }
620 return StatusCode::FAILURE;
621}
StatusCode processPpmStandardR4V1_(State &state) const
StatusCode processPpmCompressedR4V1_(State &state) const

◆ processPpmCompressedR3V1_()

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

Definition at line 453 of file ZdcByteStreamReadV1V2Tool.cxx.

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

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

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

◆ processPpmStandardR3V1_() [1/2]

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

Definition at line 926 of file ZdcByteStreamReadV1V2Tool.cxx.

926 {
927 for(const auto& lut : state.m_ppLuts) {
929 state,
930 state.m_subBlockHeader.crate(),
931 state.m_subBlockHeader.module(),
932 lut.first,
933 lut.second,
934 state.m_ppFadcs[lut.first]));
935 }
936 return StatusCode::SUCCESS;
937}
constexpr auto lut(Generator &&f)

◆ processPpmStandardR3V1_() [2/2]

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

Definition at line 574 of file ZdcByteStreamReadV1V2Tool.cxx.

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

◆ processPpmStandardR4V1_()

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

Definition at line 868 of file ZdcByteStreamReadV1V2Tool.cxx.

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

◆ processPpmWord_()

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

Definition at line 309 of file ZdcByteStreamReadV1V2Tool.cxx.

311 {
312 if ( (state.m_subBlockHeader.format() == 0)
313 || (state.m_subBlockHeader.format() >= 2)
314 || (state.m_verCode >= 0x41)) {
315 state.m_ppBlock.push_back(word);
316 } else if ((state.m_verCode == 0x21) || (state.m_verCode == 0x31)) {
317 return processPpmStandardR3V1_(state, word, indata);
318 } else {
319 ATH_MSG_ERROR("Unsupported PPM version:format ("
320 << state.m_verCode << ":" << state.m_subBlockHeader.format()
321 <<") combination");
322 return StatusCode::FAILURE;
323 }
324 return StatusCode::SUCCESS;
325}

◆ processRobFragment_()

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

Definition at line 191 of file ZdcByteStreamReadV1V2Tool.cxx.

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

369 {
370 h.renounce();
372 }
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 352 of file AthCommonDataStore.h.

352 {
354 }

◆ 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 >, and AthCheckedComponent<::AthAlgTool >.

◆ 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 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }
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 381 of file AthCommonDataStore.h.

◆ m_errorTool

ToolHandle<ZdcL1CaloErrorByteStreamTool> ZdcByteStreamReadV1V2Tool::m_errorTool {"ZdcL1CaloErrorByteStreamTool/ZdcL1CaloErrorByteStreamTool"}
private

Definition at line 184 of file ZdcByteStreamReadV1V2Tool.h.

184{"ZdcL1CaloErrorByteStreamTool/ZdcL1CaloErrorByteStreamTool"};

◆ m_evtStore

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

Pointer to StoreGate (event store by default).

Definition at line 378 of file AthCommonDataStore.h.

◆ m_ppmSourceIDs

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

Definition at line 191 of file ZdcByteStreamReadV1V2Tool.h.

◆ m_ppmSourceIDsMuon

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

Definition at line 192 of file ZdcByteStreamReadV1V2Tool.h.

◆ m_ppmSourceIDsSpare

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

Definition at line 193 of file ZdcByteStreamReadV1V2Tool.h.

◆ m_robDataProvider

ServiceHandle<IROBDataProviderSvc> ZdcByteStreamReadV1V2Tool::m_robDataProvider
private
Initial value:
{this, "ROBDataProviderSvc", "ROBDataProviderSvc",
"Get ROB source IDs service"}

Service for reading bytestream.

Definition at line 187 of file ZdcByteStreamReadV1V2Tool.h.

187 {this, "ROBDataProviderSvc", "ROBDataProviderSvc",
188 "Get ROB source IDs service"};

◆ m_srcIdMap

ZdcSrcIdMap* ZdcByteStreamReadV1V2Tool::m_srcIdMap {}
private

Definition at line 194 of file ZdcByteStreamReadV1V2Tool.h.

194{};

◆ m_varHandleArraysDeclared

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

Definition at line 387 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 386 of file AthCommonDataStore.h.

◆ m_zdcID

const ZdcID* ZdcByteStreamReadV1V2Tool::m_zdcID {}
private

Definition at line 195 of file ZdcByteStreamReadV1V2Tool.h.

195{};

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