|
ATLAS Offline Software
|
Tool to perform ROB fragments to ZdcDigits and from ZdcDigits to raw data conversions.
More...
#include <ZdcByteStreamTool.h>
|
| ZdcByteStreamTool (const std::string &type, const std::string &name, const IInterface *parent) |
|
virtual StatusCode | initialize () override |
|
virtual StatusCode | finalize () override |
|
StatusCode | convert (const IROBDataProviderSvc::VROBFRAG &robFrags, ZdcDigitsCollection *ttCollection) |
| Convert ROB fragments to ZdcCollection. More...
|
|
const std::vector< uint32_t > & | sourceIDs () |
| Return reference to vector with all possible Source Identifiers. More...
|
|
ServiceHandle< StoreGateSvc > & | evtStore () |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysInitialize () override |
| Perform system initialization for an algorithm. More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
Tool to perform ROB fragments to ZdcDigits and from ZdcDigits to raw data conversions.
Based on ROD Tool from Level1 from Peter Faulkner
Definition at line 53 of file ZdcByteStreamTool.h.
◆ ROBIterator
◆ RODPointer
◆ StoreGateSvc_t
◆ ZdcDigitsMap
◆ ZdcDigitsMapConst
◆ ZdcByteStreamTool()
ZdcByteStreamTool::ZdcByteStreamTool |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
Definition at line 46 of file ZdcByteStreamTool.cxx.
62 declareInterface<ZdcByteStreamTool> (
this);
68 "Only make trigger towers with non-zero EM or Had energy");
71 "Pedestal value - needed for compressed formats 0,1 only");
76 "FADC baseline lower bound for compressed formats");
78 "FADC threshold for super-compressed format");
81 "The number of LUT slices in the simulation");
83 "The number of FADC slices in the simulation");
85 "If >0, the number of LUT slices in bytestream");
87 "If >0, the number of FADC slices in bytestream");
◆ addCompStats()
void ZdcByteStreamTool::addCompStats |
( |
const std::vector< uint32_t > & |
stats | ) |
|
|
private |
◆ convert() [1/2]
Convert ROB fragments to ZdcCollection.
Definition at line 143 of file ZdcByteStreamTool.cxx.
157 typedef std::map<uint32_t,ZdcDigits*> hashmapType;
158 hashmapType digits_map;
165 for (; rob != robEnd; ++rob)
171 msg() <<
"ZDC: Treating ROB fragment " << robCount <<
endmsg;
179 (*rob)->rod_data(payloadBeg);
180 payloadEnd = payloadBeg + (*rob)->rod_ndata();
189 const uint32_t sourceID = (*rob)->rod_source_id();
195 msg() <<
"ZDC: Wrong source identifier in data: " << MSG::hex << sourceID << MSG::dec
213 const int minorVersion = (*rob)->rod_version() & 0xffff;
214 userHeader.setVersion(minorVersion);
215 const int headerWords = userHeader.words();
216 if (headerWords != 1 &&
debug)
218 msg() <<
"ZDC: Unexpected number of user header words: " << headerWords <<
endmsg;
221 for (
int i = 0;
i < headerWords; ++
i)
224 const int trigLut = userHeader.ppmLut();
225 const int trigFadc = userHeader.ppmFadc();
230 msg() <<
"ZDC: Minor format version number: " << MSG::hex << minorVersion << MSG::dec
231 <<
endmsg <<
"ZDC: LUT triggered slice offset: " << trigLut <<
endmsg
232 <<
"ZDC: FADC triggered slice offset: " << trigFadc <<
endmsg
235 const int runNumber = (*rob)->rod_run_no() & 0xffffff;
238 int chanPerSubBlock = 0;
243 msg(MSG::ERROR) <<
"Missing Sub-block header" <<
endmsg;
244 return StatusCode::FAILURE;
251 if (chanPerSubBlock == 0)
253 msg(MSG::ERROR) <<
"Unsupported version/data format: " << testBlock.
version()
255 return StatusCode::FAILURE;
259 msg(MSG::ERROR) <<
"Invalid channels per sub-block: " << chanPerSubBlock <<
endmsg;
260 return StatusCode::FAILURE;
262 if (
debug)
msg() <<
"Channels per sub-block: " << chanPerSubBlock <<
endmsg;
266 if (
debug)
msg() <<
"ROB fragment contains user header only" <<
endmsg;
269 const int numSubBlocks =
m_channels / chanPerSubBlock;
274 for (
int i = 0;
i < headerWords; ++
i)
284 for (
int block = 0; block < numSubBlocks; ++block)
289 msg(MSG::ERROR) <<
"Unexpected data sequence" <<
endmsg;
290 return StatusCode::FAILURE;
297 msg() <<
"Unexpected channel sequence number: "
299 * chanPerSubBlock <<
endmsg;
306 msg(MSG::ERROR) <<
"Unexpected channel sequence number" <<
endmsg;
308 return StatusCode::FAILURE;
316 crate = subBlock->
crate();
321 if (crate != rodCrate)
323 msg() <<
"Inconsistent crate number in ROD source ID" <<
endmsg;
329 if (subBlock->
crate() != crate)
331 msg(MSG::ERROR) <<
"Inconsistent crate number in sub-blocks" <<
endmsg;
332 return StatusCode::FAILURE;
336 msg(MSG::ERROR) <<
"Inconsistent module number in sub-blocks" <<
endmsg;
337 return StatusCode::FAILURE;
340 if (
payload == payloadEnd && block != numSubBlocks - 1)
362 msg(MSG::ERROR) <<
"Inconsistent crate number in error block" <<
endmsg;
363 return StatusCode::FAILURE;
367 msg(MSG::ERROR) <<
"Inconsistent module number in error block" <<
endmsg;
368 return StatusCode::FAILURE;
375 msg() <<
"Unpacking error block failed: " << errMsg <<
endmsg;
385 for (
int block = 0; block < actualSubBlocks; ++block)
395 msg() <<
"Unpacking sub-block version/format/seqno: " << subBlock->
version()
403 msg() <<
"Unpacking PPM sub-block failed: " << errMsg <<
endmsg;
409 const int channel = block * chanPerSubBlock +
chan;
410 std::vector<int>
lut;
411 std::vector<int> fadc;
412 std::vector<int> bcidLut;
413 std::vector<int> bcidFadc;
417 if (
lut.size() <
size_t(trigLut + 1))
421 msg() <<
"Triggered LUT slice from header "
422 <<
"inconsistent with number of slices: " << trigLut <<
", "
423 <<
lut.size() <<
", reset to 0" <<
endmsg;
427 if (fadc.size() <
size_t(trigFadc + 1))
431 msg() <<
"Triggered FADC slice from header "
432 <<
"inconsistent with number of slices: " << trigFadc <<
", "
433 << fadc.size() <<
", reset to 0" <<
endmsg;
495 "--> ZDC: [SubDet., Crate, Mod., Slink Chn., PPM Chan.] ";
529 if (iter == digits_map.end())
531 digits_map.insert(std::pair<uint32_t,ZdcDigits*>(chan_hash,
new ZdcDigits(chan_id)));
532 iter = digits_map.find(chan_hash);
534 if (iter != digits_map.end())
536 if (
gain==0&&
delay==0) (*iter).second->set_digits_gain0_delay0(fadc);
537 if (
gain==1&&
delay==0) (*iter).second->set_digits_gain1_delay0(fadc);
538 if (
gain==0&&
delay==1) (*iter).second->set_digits_gain0_delay1(fadc);
539 if (
gain==1&&
delay==1) (*iter).second->set_digits_gain1_delay1(fadc);
551 while (iter != iter_end)
559 return StatusCode::SUCCESS;
◆ convert() [2/2]
Convert ZdcCollection to ROB fragments.
Definition at line 565 of file ZdcByteStreamTool.cxx.
570 return StatusCode::SUCCESS;
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
253 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
229 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
338 return PBASE::declareProperty(
name, property,
doc);
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ detStore()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ extraDeps_update_handler()
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 ZdcByteStreamTool::finalize |
( |
| ) |
|
|
overridevirtual |
◆ initialize()
StatusCode ZdcByteStreamTool::initialize |
( |
| ) |
|
|
overridevirtual |
Definition at line 93 of file ZdcByteStreamTool.cxx.
109 const ZdcID* zdcID =
nullptr;
111 msg(MSG::ERROR) <<
"execute: Could not retrieve ZdcID object from the detector store" <<
endmsg;
112 return StatusCode::FAILURE;
119 return StatusCode::SUCCESS;
◆ inputHandles()
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.
◆ interfaceID()
const InterfaceID & ZdcByteStreamTool::interfaceID |
( |
| ) |
|
|
static |
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ outputHandles()
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.
◆ printCompStats()
void ZdcByteStreamTool::printCompStats |
( |
| ) |
const |
|
private |
Print compression stats.
Definition at line 588 of file ZdcByteStreamTool.cxx.
590 msg() <<
"Compression stats format/count: ";
592 for (
int i = 0;
i <
n; ++
i)
◆ printVec()
void ZdcByteStreamTool::printVec |
( |
const std::vector< int > & |
vec | ) |
const |
|
private |
◆ renounce()
◆ renounceArray()
◆ sourceIDs()
const std::vector< uint32_t > & ZdcByteStreamTool::sourceIDs |
( |
| ) |
|
Return reference to vector with all possible Source Identifiers.
Definition at line 602 of file ZdcByteStreamTool.cxx.
606 for (
int crate = 0; crate <
m_crates; ++crate) {
607 for (
int slink = 0; slink < maxlinks; ++slink) {
608 const int daqOrRoi = 0;
◆ sysInitialize()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
◆ m_channels
int ZdcByteStreamTool::m_channels |
|
private |
◆ m_compStats
std::vector<uint32_t> ZdcByteStreamTool::m_compStats |
|
private |
◆ m_crates
int ZdcByteStreamTool::m_crates |
|
private |
◆ m_dataFormat
int ZdcByteStreamTool::m_dataFormat |
|
private |
◆ m_detStore
◆ m_dfltSlicesFadc
int ZdcByteStreamTool::m_dfltSlicesFadc |
|
private |
◆ m_dfltSlicesLut
int ZdcByteStreamTool::m_dfltSlicesLut |
|
private |
◆ m_errorBlock
◆ m_evtStore
◆ m_fadcBaseline
int ZdcByteStreamTool::m_fadcBaseline |
|
private |
◆ m_fadcThreshold
int ZdcByteStreamTool::m_fadcThreshold |
|
private |
◆ m_forceSlicesFadc
int ZdcByteStreamTool::m_forceSlicesFadc |
|
private |
◆ m_forceSlicesLut
int ZdcByteStreamTool::m_forceSlicesLut |
|
private |
◆ m_pedestal
int ZdcByteStreamTool::m_pedestal |
|
private |
◆ m_ppmBlocks
◆ m_printCompStats
int ZdcByteStreamTool::m_printCompStats |
|
private |
Compression version.
Compression statistics print flag
Definition at line 99 of file ZdcByteStreamTool.h.
◆ m_rodStatus
std::vector<uint32_t>* ZdcByteStreamTool::m_rodStatus |
|
private |
◆ m_rodStatusMap
std::map<uint32_t, std::vector<uint32_t>*> ZdcByteStreamTool::m_rodStatusMap |
|
private |
◆ m_slinks
int ZdcByteStreamTool::m_slinks |
|
private |
Number of modules per crate (may not all exist)
Number of slinks per crate when writing out bytestream
Definition at line 107 of file ZdcByteStreamTool.h.
◆ m_sourceIDs
std::vector<uint32_t> ZdcByteStreamTool::m_sourceIDs |
|
private |
◆ m_srcIdMap
◆ m_subDetector
eformat::SubDetector ZdcByteStreamTool::m_subDetector |
|
private |
◆ m_varHandleArraysDeclared
◆ m_vhka
◆ m_zdcID
◆ m_zeroSuppress
int ZdcByteStreamTool::m_zeroSuppress |
|
private |
The documentation for this class was generated from the following files:
def retrieve(aClass, aKey=None)
JetConstituentVector::iterator iterator
static int crate(uint32_t code)
moduleID -> crate
static int channelsPerSubBlock(int version, int format)
Return the number of channels per sub-block.
static const ZdcCablingService * getInstance()
get pointer to service instance
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
int module(const Identifier &id) const
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
int dataWords() const
Return number of data words.
static uint32_t getRobID(uint32_t rod_id)
ROD -> ROB.
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
std::vector< SG::VarHandleKeyArray * > m_vhka
bool msgLvl(const MSG::Level lvl) const
std::vector< size_t > vec
Identifier h2s_channel_id(int crate, int channel) const
value_type get_compact() const
Get the compact id.
void setLutOffset(int offset)
void setRunNumber(int run)
constexpr auto lut(Generator &&f)
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual void setOwner(IDataHandleHolder *o)=0
static SubBlockWordType wordType(uint32_t word)
Word identification.
bool unpack()
Unpack data.
static eformat::SubDetector subDet(uint32_t code)
ID -> sub-detector.
static int daqOrRoi(uint32_t code)
moduleID -> daqOrRoi
int hwid2delay(int crate, int channel) const
static int maxSlinks()
Return the maximum possible number of slinks.
static int slink(uint32_t code)
moduleID -> slink
double delay(std::size_t d)
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
void clear()
Erase all the elements in the collection.
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
void setFadcOffset(int offset)
static bool errorBlock(uint32_t word)
Check if a header word is for an error block.
void setFadcBaseline(int baseline)
void clear()
Clear all data.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
void ppmData(int chan, std::vector< int > &lut, std::vector< int > &fadc, std::vector< int > &bcidLut, std::vector< int > &bcidFadc) const
Return unpacked data for given channel.
int hwid2gain(int crate, int channel) const
const std::vector< uint32_t > & compStats() const
Return reference to compression stats.
int getPpmChannel(const int channel) const
static uint32_t getRodID(int crate, int slink, int daqOrRoi, eformat::SubDetector subdet)
Make a ROD Source ID.
void setPedestal(int pedval)
std::string getString() const
Provide a string form of the identifier - hexadecimal.
OFFLINE_FRAGMENTS_NAMESPACE::PointerType read(const OFFLINE_FRAGMENTS_NAMESPACE::PointerType beg, const OFFLINE_FRAGMENTS_NAMESPACE::PointerType end)
Input complete packed sub-block from ROD array.
int side(const Identifier &id) const
Values of different levels (failure returns 0)
int type(const Identifier &id) const
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Sub-Block class for PPM data.
This class provides conversion between Lower level Source ID to higher level source ID for L1Calo Byt...
size_type size() const noexcept
Returns the number of elements in the collection.
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
bool empty() const noexcept
Returns true if the collection is empty.
std::string unpackErrorMsg() const
Return the unpacking error message for printing.
int channel(const Identifier &id) const