|
ATLAS Offline Software
|
Go to the documentation of this file.
17 #include "GaudiKernel/IInterface.h"
18 #include "GaudiKernel/MsgStream.h"
38 static const InterfaceID IID_IZdcByteStreamTool(
"ZdcByteStreamTool", 1, 1);
42 return IID_IZdcByteStreamTool;
47 const std::string&
name,
48 const IInterface*
parent) :
55 m_subDetector(
eformat::FORWARD_ZDC),
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");
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;
137 return StatusCode::SUCCESS;
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;
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;
570 return StatusCode::SUCCESS;
578 if (
stats.empty())
return;
579 const int n =
stats.size();
581 for (
int i = 0;
i <
n; ++
i)
590 msg() <<
"Compression stats format/count: ";
592 for (
int i = 0;
i <
n; ++
i)
606 for (
int crate = 0; crate <
m_crates; ++crate) {
607 for (
int slink = 0; slink < maxlinks; ++slink) {
608 const int daqOrRoi = 0;
624 std::vector<int>::const_iterator
pos;
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
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::FullEventFragment RawEventWrite
data type for writing raw event
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.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
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.
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
::StatusCode StatusCode
StatusCode definition for legacy code.
static int maxSlinks()
Return the maximum possible number of slinks.
static int slink(uint32_t code)
moduleID -> slink
double delay(std::size_t d)
std::vector< const ROBF * > VROBFRAG
void clear()
Erase all the elements in the collection.
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
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.
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