ATLAS Offline Software
Loading...
Searching...
No Matches
LVL1BS::JepRoiByteStreamV2Tool Class Reference

Tool to perform ROB fragments to JEM RoI and CMX RoI, and JEP RoI container to raw data conversions. More...

#include <JepRoiByteStreamV2Tool.h>

Inheritance diagram for LVL1BS::JepRoiByteStreamV2Tool:
Collaboration diagram for LVL1BS::JepRoiByteStreamV2Tool:

Public Member Functions

 JepRoiByteStreamV2Tool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~JepRoiByteStreamV2Tool ()
virtual StatusCode initialize () override
virtual StatusCode finalize () override
StatusCode convert (const EventContext &ctx, const std::string &name, DataVector< LVL1::JEMTobRoI > *jeCollection) const
 Convert ROB fragments to JEM RoIs.
StatusCode convert (const IROBDataProviderSvc::VROBFRAG &robFrags, DataVector< LVL1::JEMTobRoI > *jeCollection) const
StatusCode convert (const EventContext &ctx, const std::string &name, LVL1::CMXRoI *cmCollection) const
 Convert ROB fragments to CMX RoIs.
StatusCode convert (const IROBDataProviderSvc::VROBFRAG &robFrags, LVL1::CMXRoI *cmCollection) const
StatusCode convert (const LVL1::JEPRoIBSCollectionV2 *jep) const
 Convert JEP RoI Container to bytestream.
const std::vector< uint32_t > & sourceIDs (const std::string &sgKey) const
 Return reference to vector with all possible Source Identifiers.
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

Static Public Member Functions

static const InterfaceID & interfaceID ()
 AlgTool InterfaceID.

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

typedef DataVector< LVL1::JEMTobRoIJemRoiCollection
typedef DataVector< LVL1::CMXEtSumsCmxSumsCollection
typedef std::map< uint32_t, const LVL1::JEMTobRoI * > JemRoiMap
typedef std::map< int, const LVL1::CMXEtSums * > CmxSumsMap
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 convertBs (const IROBDataProviderSvc::VROBFRAG &robFrags, DataVector< LVL1::JEMTobRoI > *jeCollection, LVL1::CMXRoI *cmCollection) const
 Convert bytestream to given container type.
const LVL1::CMXEtSumsfindCmxSums (int crate, int source, const CmxSumsMap &cmxEtMap) const
 Find CMX energy sums for given crate, source.
std::vector< uint32_t > makeSourceIDs (bool roiDaq) const
void setupJemRoiMap (const JemRoiCollection *jeCollection, JemRoiMap &roiMap) const
 Set up JEM RoIs map.
void setupCmxEtMap (const CmxSumsCollection *enCollection, CmxSumsMap &cmxEtMap) const
 Set up CMX energy sums map.
void energySubBlockTypes (int source, CmxEnergySubBlock::SourceType &srcType, CmxEnergySubBlock::SumType &sumType, CmxEnergySubBlock::HitsType &hitType) const
 Get energy subBlock types from CMXEtSums source type.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ServiceHandle< IByteStreamCnvSvcm_byteStreamCnvSvc { this, "ByteStreamCnvSvc", "ByteStreamCnvSvc" }
ServiceHandle< IROBDataProviderSvcm_robDataProvider
ToolHandle< LVL1BS::L1CaloErrorByteStreamToolm_errorTool
 Property: Error collection tool.
int m_crateOffsetHw
 Property: Hardware crate number offset.
int m_crateOffsetSw
 Property: Software crate number offset.
int m_version
 Property: Sub_block header version.
int m_dataFormat
 Property: Data compression format.
const int m_crates
 Number of crates.
const int m_modules
 Number of JEM modules per crate.
const int m_frames
 Number of RoI frames.
const int m_maxRoiWords
 Number of CMX energy RoI words.
int m_slinks
 Property: Number of slinks per crate when writing out bytestream.
int m_crateMin
 Property: Minimum crate number when writing out bytestream.
int m_crateMax
 Property: Maximum crate number when writing out bytestream.
std::vector< uint32_t > m_sourceIDsProp
 Property: ROB source IDs.
std::vector< uint32_t > m_sourceIDsRoIBProp
 Property: ROB source IDs for RoIB.
const eformat::SubDetector m_subDetector
 Sub-detector type.
const L1CaloSrcIdMap m_srcIdMap
 Source ID converter.
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 JEM RoI and CMX RoI, and JEP RoI container to raw data conversions.

Based on ROD document version X_xxx. <<== CHECK

Author
Peter Faulkner

Definition at line 50 of file JepRoiByteStreamV2Tool.h.

Member Typedef Documentation

◆ CmxSumsCollection

◆ CmxSumsMap

Definition at line 90 of file JepRoiByteStreamV2Tool.h.

◆ JemRoiCollection

◆ JemRoiMap

typedef std::map<uint32_t, const LVL1::JEMTobRoI*> LVL1BS::JepRoiByteStreamV2Tool::JemRoiMap
private

Definition at line 89 of file JepRoiByteStreamV2Tool.h.

◆ ROBIterator

typedef IROBDataProviderSvc::VROBFRAG::const_iterator LVL1BS::JepRoiByteStreamV2Tool::ROBIterator
private

Definition at line 91 of file JepRoiByteStreamV2Tool.h.

◆ ROBPointer

◆ RODPointer

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ JepRoiByteStreamV2Tool()

LVL1BS::JepRoiByteStreamV2Tool::JepRoiByteStreamV2Tool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 44 of file JepRoiByteStreamV2Tool.cxx.

47 : AthAlgTool(type, name, parent),
48 m_robDataProvider("ROBDataProviderSvc", name),
49 m_errorTool("LVL1BS::L1CaloErrorByteStreamTool/L1CaloErrorByteStreamTool"),
51 m_subDetector (eformat::TDAQ_CALO_JET_PROC_ROI)
52{
53 declareInterface<JepRoiByteStreamV2Tool>(this);
54
55 declareProperty("ErrorTool", m_errorTool,
56 "Tool to collect errors for monitoring");
57 declareProperty("CrateOffsetHw", m_crateOffsetHw = 12,
58 "Offset of JEP crate numbers in bytestream");
59 declareProperty("CrateOffsetSw", m_crateOffsetSw = 0,
60 "Offset of JEP crate numbers in RDOs");
61
62 // Properties for reading bytestream only
63 declareProperty("ROBSourceIDs", m_sourceIDsProp,
64 "ROB fragment source identifiers");
65 declareProperty("ROBSourceIDsRoIB", m_sourceIDsRoIBProp,
66 "ROB fragment source identifiers");
67
68 // Properties for writing bytestream only
69 declareProperty("DataVersion", m_version = 2, //<<== CHECK
70 "Format version number in sub-block header");
71 declareProperty("DataFormat", m_dataFormat = 1,
72 "Format identifier (0-1) in sub-block header");
73 declareProperty("SlinksPerCrate", m_slinks = 1,
74 "The number of S-Links per crate");
75 declareProperty("CrateMin", m_crateMin = 0,
76 "Minimum crate number, allows partial output");
77 declareProperty("CrateMax", m_crateMax = m_crates - 1,
78 "Maximum crate number, allows partial output");
79
80}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
int m_crateOffsetHw
Property: Hardware crate number offset.
const int m_crates
Number of crates.
int m_crateMax
Property: Maximum crate number when writing out bytestream.
int m_version
Property: Sub_block header version.
const int m_modules
Number of JEM modules per crate.
const int m_maxRoiWords
Number of CMX energy RoI words.
const eformat::SubDetector m_subDetector
Sub-detector type.
int m_dataFormat
Property: Data compression format.
const int m_frames
Number of RoI frames.
int m_crateMin
Property: Minimum crate number when writing out bytestream.
int m_slinks
Property: Number of slinks per crate when writing out bytestream.
std::vector< uint32_t > m_sourceIDsRoIBProp
Property: ROB source IDs for RoIB.
int m_crateOffsetSw
Property: Software crate number offset.
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
ToolHandle< LVL1BS::L1CaloErrorByteStreamTool > m_errorTool
Property: Error collection tool.
std::vector< uint32_t > m_sourceIDsProp
Property: ROB source IDs.

◆ ~JepRoiByteStreamV2Tool()

LVL1BS::JepRoiByteStreamV2Tool::~JepRoiByteStreamV2Tool ( )
virtual

Definition at line 84 of file JepRoiByteStreamV2Tool.cxx.

85{
86}

Member Function Documentation

◆ convert() [1/5]

StatusCode LVL1BS::JepRoiByteStreamV2Tool::convert ( const EventContext & ctx,
const std::string & name,
DataVector< LVL1::JEMTobRoI > * jeCollection ) const

Convert ROB fragments to JEM RoIs.

Definition at line 110 of file JepRoiByteStreamV2Tool.cxx.

114{
115 const std::vector<uint32_t>& vID(sourceIDs(sgKey));
116 // // get ROB fragments
118 m_robDataProvider->getROBData(ctx, vID, robFrags, "JepRoiByteStreamV2Tool");
119 ATH_MSG_DEBUG("Number of ROB fragments:" << robFrags.size());
120 return convert(robFrags, collection);
121}
#define ATH_MSG_DEBUG(x)
std::vector< const ROBF * > VROBFRAG
StatusCode convert(const EventContext &ctx, const std::string &name, DataVector< LVL1::JEMTobRoI > *jeCollection) const
Convert ROB fragments to JEM RoIs.
const std::vector< uint32_t > & sourceIDs(const std::string &sgKey) const
Return reference to vector with all possible Source Identifiers.

◆ convert() [2/5]

StatusCode LVL1BS::JepRoiByteStreamV2Tool::convert ( const EventContext & ctx,
const std::string & name,
LVL1::CMXRoI * cmCollection ) const

Convert ROB fragments to CMX RoIs.

Definition at line 132 of file JepRoiByteStreamV2Tool.cxx.

136{
137 const std::vector<uint32_t>& vID(sourceIDs(sgKey));
138 // // get ROB fragments
140 m_robDataProvider->getROBData(ctx, vID, robFrags, "JepRoiByteStreamV2Tool");
141 ATH_MSG_DEBUG("Number of ROB fragments:" << robFrags.size());
142 return convert(robFrags, cmCollection);
143}

◆ convert() [3/5]

StatusCode LVL1BS::JepRoiByteStreamV2Tool::convert ( const IROBDataProviderSvc::VROBFRAG & robFrags,
DataVector< LVL1::JEMTobRoI > * jeCollection ) const

Definition at line 123 of file JepRoiByteStreamV2Tool.cxx.

126{
127 return convertBs(robFrags, jeCollection, nullptr);
128}
StatusCode convertBs(const IROBDataProviderSvc::VROBFRAG &robFrags, DataVector< LVL1::JEMTobRoI > *jeCollection, LVL1::CMXRoI *cmCollection) const
Convert bytestream to given container type.

◆ convert() [4/5]

StatusCode LVL1BS::JepRoiByteStreamV2Tool::convert ( const IROBDataProviderSvc::VROBFRAG & robFrags,
LVL1::CMXRoI * cmCollection ) const

Definition at line 145 of file JepRoiByteStreamV2Tool.cxx.

148{
149 return convertBs(robFrags, nullptr, cmCollection);
150}

◆ convert() [5/5]

StatusCode LVL1BS::JepRoiByteStreamV2Tool::convert ( const LVL1::JEPRoIBSCollectionV2 * jep) const

Convert JEP RoI Container to bytestream.

Definition at line 154 of file JepRoiByteStreamV2Tool.cxx.

156{
157 const bool debug = msgLvl(MSG::DEBUG);
158 if (debug) msg(MSG::DEBUG);
159
160 // Get the event assembler
161 FullEventAssembler<L1CaloSrcIdMap>* fea = nullptr;
162 ATH_CHECK( m_byteStreamCnvSvc->getFullEventAssembler (fea,
163 "JepRoiByteStreamV2") );
164 const uint16_t minorVersion = m_srcIdMap.minorVersion();
165 fea->setRodMinorVersion(minorVersion);
166
167 // Pointer to ROD data vector
168
170
171 // Sub-block for neutral format
172 JemRoiSubBlockV2 subBlock;
173
174 // Set up the container maps
175
176 const bool neutralFormat = m_dataFormat == L1CaloSubBlock::NEUTRAL;
177
178 // JEM RoI map
179 JemRoiMap roiMap;
180 setupJemRoiMap(jep->JemRoi(), roiMap);
181 JemRoiMap::const_iterator mapIter = roiMap.begin();
182 JemRoiMap::const_iterator mapIterEnd = roiMap.end();
183
184 // CMX energy sums map
185 CmxSumsMap cmxEtMap;
186 if (neutralFormat) {
187 setupCmxEtMap(jep->CmxSums(), cmxEtMap);
188 }
189
190 // Loop over JEM RoI data
191
192 const int modulesPerSlink = m_modules / m_slinks;
193 for (int crate = m_crateMin; crate <= m_crateMax; ++crate) {
194 const int hwCrate = crate + m_crateOffsetHw;
195
196 for (int module = 0; module < m_modules; ++module) {
197
198 // Pack required number of modules per slink
199
200 if (module % modulesPerSlink == 0) {
201 const int daqOrRoi = 1;
202 const int slink = module / modulesPerSlink;
203 if (debug) {
204 msg() << "Treating crate " << hwCrate
205 << " slink " << slink << endmsg
206 << "Data Version/Format: " << m_version
207 << " " << m_dataFormat << endmsg;
208 }
209 const uint32_t rodIdJem = m_srcIdMap.getRodID(hwCrate, slink, daqOrRoi,
211 theROD = fea->getRodData(rodIdJem);
212 if (neutralFormat) {
213 const L1CaloUserHeader userHeader;
214 theROD->push_back(userHeader.header());
215 }
216 }
217 if (debug) msg() << "JEM Module " << module << endmsg;
218 if (!theROD) break; // for coverity, shouldn't happen
219
220 // Create a sub-block (Neutral format only)
221
222 if (neutralFormat) {
223 subBlock.clear();
224 subBlock.setRoiHeader(m_version, hwCrate, module);
225 }
226
227 // Find JEM RoIs for this module
228
229 for (; mapIter != mapIterEnd; ++mapIter) {
230 const LVL1::JEMTobRoI* const roi = mapIter->second;
231 if (roi->crate() < crate) continue;
232 if (roi->crate() > crate) break;
233 if (roi->jem() < module) continue;
234 if (roi->jem() > module) break;
235 if (roi->energyLarge() || roi->energySmall()) {
236 if (neutralFormat) subBlock.fillRoi(*roi);
237 else theROD->push_back(roi->roiWord());
238 }
239 }
240
241 // Pack and write the sub-block
242
243 if (neutralFormat) {
244 if ( !subBlock.pack()) {
245 msg(MSG::ERROR) << "JEM RoI sub-block packing failed" << endmsg;
246 return StatusCode::FAILURE;
247 }
248 if (debug) {
249 msg() << "JEM RoI sub-block data words: "
250 << subBlock.dataWords() << endmsg;
251 }
252 subBlock.write(theROD);
253 }
254 }
255 if (!theROD) break; // for coverity, shouldn't happen
256
257 // Append CMX RoIs to last S-Link of the system crate
258
259 if (crate != m_crates - 1) continue;
260
261 // Create sub-blocks for Neutral format
262
263 if (neutralFormat) {
264 const int timeslices = 1;
265 const int slice = 0;
266
267 // CMX-Energy
268
269 CmxEnergySubBlock subBlock;
270 const int cmxEnergyVersion = 3; //<<== CHECK
271 subBlock.setCmxHeader(cmxEnergyVersion, m_dataFormat, slice, hwCrate,
273 CmxSubBlock::LEFT, timeslices);
274 int maxSource = static_cast<int>(LVL1::CMXEtSums::MAX_SOURCE);
275 for (int source = 0; source < maxSource; ++source) {
276 const LVL1::CMXEtSums* const sums = findCmxSums(crate, source, cmxEtMap);
277 if ( sums ) {
278 const unsigned int ex = sums->Ex();
279 const unsigned int ey = sums->Ey();
280 const unsigned int et = sums->Et();
281 const int exErr = sums->ExError();
282 const int eyErr = sums->EyError();
283 const int etErr = sums->EtError();
284 if (source < m_modules) {
285 subBlock.setSubsums(slice, source, ex, ey, et, exErr, eyErr, etErr);
286 } else {
290 energySubBlockTypes(source, srcType, sumType, hitType);
291 if (srcType != CmxEnergySubBlock::MAX_SOURCE_TYPE) {
292 subBlock.setSubsums(slice, srcType, sumType, ex, ey, et,
293 exErr, eyErr, etErr);
294 } else if (hitType != CmxEnergySubBlock::MAX_HITS_TYPE) {
295 subBlock.setEtHits(slice, hitType, sumType, et);
296 }
297 }
298 }
299 }
300 if ( !subBlock.pack()) {
301 msg(MSG::ERROR) << "CMX-Energy sub-block packing failed" << endmsg;
302 return StatusCode::FAILURE;
303 }
304 if (debug) {
305 msg() << "CMX-Energy sub-block data words: "
306 << subBlock.dataWords() << endmsg;
307 }
308 subBlock.write(theROD);
309
310 } else {
311
312 // Standard format
313
314 const LVL1::CMXRoI* const roi = jep->CmxRoi();
315 if ( roi ) {
316 // CMX-Energy RoIs are not zero-supressed unless all are zero
317 for (int word = 0; word < m_maxRoiWords; ++word) {
318 theROD->push_back(roi->roiWord(word));
319 }
320 }
321 }
322 }
323
324 return StatusCode::SUCCESS;
325}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
float et(const xAOD::jFexSRJetRoI *j)
const bool debug
bool msgLvl(const MSG::Level lvl) const
MsgStream & msg() const
void setRodMinorVersion(uint16_t m)
change the ROD minor version
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
RODDATA * getRodData(uint32_t id)
get a block of ROD data
void setupJemRoiMap(const JemRoiCollection *jeCollection, JemRoiMap &roiMap) const
Set up JEM RoIs map.
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
void energySubBlockTypes(int source, CmxEnergySubBlock::SourceType &srcType, CmxEnergySubBlock::SumType &sumType, CmxEnergySubBlock::HitsType &hitType) const
Get energy subBlock types from CMXEtSums source type.
void setupCmxEtMap(const CmxSumsCollection *enCollection, CmxSumsMap &cmxEtMap) const
Set up CMX energy sums map.
const LVL1::CMXEtSums * findCmxSums(int crate, int source, const CmxSumsMap &cmxEtMap) const
Find CMX energy sums for given crate, source.
std::map< int, const LVL1::CMXEtSums * > CmxSumsMap
const L1CaloSrcIdMap m_srcIdMap
Source ID converter.
std::map< uint32_t, const LVL1::JEMTobRoI * > JemRoiMap
unsigned int Ey() const
returns module Ey sum for peak sample
unsigned int Ex() const
returns module Ex sum for peak sample
unsigned int Et() const
For triggered time slice.
int ExError() const
returns module Ex sum error for peak sample
int EyError() const
returns module Ey sum error for peak sample
int EtError() const
returns module ET sum error for peak sample
uint32_t roiWord(int word) const
Return packed Energy RoI word (0-5).
uint32_t roiWord() const
Return packed RoI word.
int energyLarge() const
Return energy large window size.
int energySmall() const
Return energy small window size.
const CMXRoI * CmxRoi() const
Return pointer to CMX RoIs.
const DataVector< CMXEtSums > * CmxSums() const
Return pointer to CMX energy sums collection.
const DataVector< JEMTobRoI > * JemRoi() const
Return pointer to JEM RoI collection.
setWord1 uint16_t
setEventNumber uint32_t

◆ convertBs()

StatusCode LVL1BS::JepRoiByteStreamV2Tool::convertBs ( const IROBDataProviderSvc::VROBFRAG & robFrags,
DataVector< LVL1::JEMTobRoI > * jeCollection,
LVL1::CMXRoI * cmCollection ) const
private

Convert bytestream to given container type.

Definition at line 383 of file JepRoiByteStreamV2Tool.cxx.

387{
388 const bool debug = msgLvl(MSG::DEBUG);
389 if (debug) msg(MSG::DEBUG);
390
391 // Loop over ROB fragments
392
393 int robCount = 0;
394 std::set<uint32_t> dupCheck;
395 std::set<uint32_t> dupRoiCheck;
396 ROBIterator rob = robFrags.begin();
397 ROBIterator robEnd = robFrags.end();
398 for (; rob != robEnd; ++rob) {
399
400 if (debug) {
401 ++robCount;
402 msg() << "Treating ROB fragment " << robCount << endmsg;
403 }
404
405 // Skip fragments with ROB status errors
406
407 uint32_t robid = (*rob)->source_id();
408 if ((*rob)->nstatus() > 0) {
409 ROBPointer robData;
410 (*rob)->status(robData);
411 if (*robData != 0) {
412 m_errorTool->robError(robid, *robData);
413 if (debug) msg() << "ROB status error - skipping fragment" << endmsg;
414 continue;
415 }
416 }
417
418 // Skip duplicate fragments
419
420 if (!dupCheck.insert(robid).second) {
422 if (debug) msg() << "Skipping duplicate ROB fragment" << endmsg;
423 continue;
424 }
425
426 // Unpack ROD data (slinks)
427
428 RODPointer payloadBeg;
430 RODPointer payloadEnd;
431 (*rob)->rod_data(payloadBeg);
432 payloadEnd = payloadBeg + (*rob)->rod_ndata();
433 payload = payloadBeg;
434 if (payload == payloadEnd) {
435 if (debug) msg() << "ROB fragment empty" << endmsg;
436 continue;
437 }
438
439 // Check identifier
440 const uint32_t sourceID = (*rob)->rod_source_id();
441 if (m_srcIdMap.getRobID(sourceID) != robid ||
442 m_srcIdMap.subDet(sourceID) != m_subDetector ||
443 m_srcIdMap.daqOrRoi(sourceID) != 1 ||
444 (m_srcIdMap.slink(sourceID) != 0 && m_srcIdMap.slink(sourceID) != 2) ||
445 m_srcIdMap.crate(sourceID) < m_crateOffsetHw ||
446 m_srcIdMap.crate(sourceID) >= m_crateOffsetHw + m_crates) {
448 if (debug) {
449 msg() << "Wrong source identifier in data: "
450 << MSG::hex << sourceID << MSG::dec << endmsg;
451 }
452 continue;
453 }
454
455 // Check minor version
456 const int minorVersion = (*rob)->rod_version() & 0xffff;
457 if (minorVersion <= m_srcIdMap.minorVersionPreLS1()) {
458 if (debug) msg() << "Skipping pre-LS1 data" << endmsg;
459 continue;
460 }
461 const int rodCrate = m_srcIdMap.crate(sourceID);
462 if (debug) {
463 msg() << "Treating crate " << rodCrate
464 << " slink " << m_srcIdMap.slink(sourceID) << endmsg;
465 }
466
467 // First word may be User Header
468 if (L1CaloUserHeader::isValid(*payload)) {
469 L1CaloUserHeader userHeader(*payload);
470 userHeader.setVersion(minorVersion);
471 const int headerWords = userHeader.words();
472 if (headerWords != 1) {
474 if (debug) msg() << "Unexpected number of user header words: "
475 << headerWords << endmsg;
476 continue;
477 }
478 for (int i = 0; i < headerWords; ++i) ++payload;
479 }
480
481 // Loop over sub-blocks if there are any
482
483 unsigned int rodErr = L1CaloSubBlock::ERROR_NONE;
484 while (payload != payloadEnd) {
485
487 const int slice = 0;
488 if (CmxSubBlock::cmxBlock(*payload)) {
489 // CMXs
491 CmxEnergySubBlock subBlock;
492 payload = subBlock.read(payload, payloadEnd);
493 if (cmCollection != nullptr) {
494 if (subBlock.dataWords() && !subBlock.unpack()) {
495 if (debug) {
496 std::string errMsg(subBlock.unpackErrorMsg());
497 msg() << "CMX-Energy sub-block unpacking failed: "
498 << errMsg << endmsg;
499 }
500 rodErr = subBlock.unpackErrorCode();
501 break;
502 }
503 const LVL1::CMXRoI roi(
504 subBlock.energy(slice, CmxEnergySubBlock::TOTAL,
507 subBlock.energy(slice, CmxEnergySubBlock::TOTAL,
510 subBlock.energy(slice, CmxEnergySubBlock::TOTAL,
513 subBlock.error(slice, CmxEnergySubBlock::TOTAL,
516 subBlock.error(slice, CmxEnergySubBlock::TOTAL,
519 subBlock.error(slice, CmxEnergySubBlock::TOTAL,
522 subBlock.hits(slice, CmxEnergySubBlock::SUM_ET,
524 subBlock.hits(slice, CmxEnergySubBlock::MISSING_ET,
526 subBlock.hits(slice, CmxEnergySubBlock::MISSING_ET_SIG,
528 subBlock.energy(slice, CmxEnergySubBlock::TOTAL,
531 subBlock.energy(slice, CmxEnergySubBlock::TOTAL,
534 subBlock.energy(slice, CmxEnergySubBlock::TOTAL,
537 subBlock.error(slice, CmxEnergySubBlock::TOTAL,
540 subBlock.error(slice, CmxEnergySubBlock::TOTAL,
543 subBlock.error(slice, CmxEnergySubBlock::TOTAL,
546 subBlock.hits(slice, CmxEnergySubBlock::SUM_ET,
548 subBlock.hits(slice, CmxEnergySubBlock::MISSING_ET,
550 for (int word = 0; word < m_maxRoiWords; ++word) {
551 cmCollection->setRoiWord(roi.roiWord(word));
552 }
553 }
554 }
555 } else {
556 // JEM RoI
557 JemRoiSubBlockV2 subBlock;
558 payload = subBlock.read(payload, payloadEnd);
559 if (jeCollection != nullptr) {
560 if (subBlock.dataWords() && !subBlock.unpack()) {
561 if (debug) {
562 std::string errMsg(subBlock.unpackErrorMsg());
563 msg() << "JEM RoI sub-block unpacking failed: "
564 << errMsg << endmsg;
565 }
566 rodErr = subBlock.unpackErrorCode();
567 break;
568 }
569 for (int frame = 0; frame < m_frames; ++frame) {
570 const LVL1::JEMTobRoI roi = subBlock.roi(frame);
571 if (roi.energyLarge() || roi.energySmall()) {
572 jeCollection->push_back(new LVL1::JEMTobRoI(roi));
573 }
574 }
575 }
576 }
577 } else {
578 // Just RoI word
579 LVL1::JEMTobRoI jroi;
580 LVL1::CMXRoI croi;
581 if (jroi.setRoiWord(*payload)) {
582 if (jeCollection != nullptr) {
583 if (jroi.crate() != rodCrate - m_crateOffsetHw) {
584 if (debug) msg() << "Inconsistent RoI crate number: "
585 << jroi.crate() << endmsg;
587 break;
588 }
589 const uint32_t location = (*payload) & 0xfff80000;
590 if (dupRoiCheck.insert(location).second) {
591 if (jroi.energyLarge() || jroi.energySmall()) {
592 jeCollection->push_back(new LVL1::JEMTobRoI(*payload));
593 }
594 } else {
595 if (debug) msg() << "Duplicate RoI word "
596 << MSG::hex << *payload << MSG::dec << endmsg;
598 break;
599 }
600 }
601 } else if (croi.setRoiWord(*payload)) {
602 if (cmCollection != nullptr) {
603 const uint32_t roiType = (*payload) & 0xfc000000;
604
605 if (dupRoiCheck.insert(roiType).second) {
606 cmCollection->setRoiWord(*payload);
607 } else {
608 if (debug) msg() << "Duplicate RoI word "
609 << MSG::hex << *payload << MSG::dec << endmsg;
611 break;
612 }
613 }
614 } else {
615 if (debug) msg() << "Invalid RoI word "
616 << MSG::hex << *payload << MSG::dec << endmsg;
618 break;
619 }
620 ++payload;
621 }
622 }
623 if (rodErr != L1CaloSubBlock::ERROR_NONE)
624 m_errorTool->rodError(robid, rodErr);
625 }
626
627 return StatusCode::SUCCESS;
628}
value_type push_back(value_type pElem)
Add an element to the end of the collection.
static bool cmxBlock(uint32_t word)
Determine if header word corresponds to CMX.
static CmxFirmwareCode cmxType(uint32_t word)
CMX differentiation (CMX_CP, CMX_JET, or CMX_ENERGY).
OFFLINE_FRAGMENTS_NAMESPACE::PointerType ROBPointer
OFFLINE_FRAGMENTS_NAMESPACE::PointerType RODPointer
IROBDataProviderSvc::VROBFRAG::const_iterator ROBIterator
static SubBlockWordType wordType(uint32_t word)
Word identification.
static bool isValid(uint32_t word)
Test for valid header word.
bool setRoiWord(uint32_t roiWord)
Set RoI word with ID check.
Definition CMXRoI.cxx:115
bool setRoiWord(uint32_t roiWord)
Set RoI word with ID check.
Definition JEMTobRoI.cxx:55

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

◆ energySubBlockTypes()

void LVL1BS::JepRoiByteStreamV2Tool::energySubBlockTypes ( int source,
CmxEnergySubBlock::SourceType & srcType,
CmxEnergySubBlock::SumType & sumType,
CmxEnergySubBlock::HitsType & hitType ) const
private

Get energy subBlock types from CMXEtSums source type.

Definition at line 682 of file JepRoiByteStreamV2Tool.cxx.

686{
687 switch (source) {
691 break;
695 break;
697 srcType = CmxEnergySubBlock::LOCAL;
699 break;
701 srcType = CmxEnergySubBlock::LOCAL;
703 break;
705 srcType = CmxEnergySubBlock::TOTAL;
707 break;
709 srcType = CmxEnergySubBlock::TOTAL;
711 break;
715 break;
719 break;
723 break;
727 break;
731 break;
732 default:
733 break;
734 }
735}

◆ 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 LVL1BS::JepRoiByteStreamV2Tool::finalize ( )
overridevirtual

Definition at line 103 of file JepRoiByteStreamV2Tool.cxx.

104{
105 return StatusCode::SUCCESS;
106}

◆ findCmxSums()

const LVL1::CMXEtSums * LVL1BS::JepRoiByteStreamV2Tool::findCmxSums ( int crate,
int source,
const CmxSumsMap & cmxEtMap ) const
private

Find CMX energy sums for given crate, source.

Definition at line 632 of file JepRoiByteStreamV2Tool.cxx.

635{
636 const LVL1::CMXEtSums* sums = 0;
637 CmxSumsMap::const_iterator mapIter;
638 mapIter = cmxEtMap.find(crate * 100 + source);
639 if (mapIter != cmxEtMap.end()) sums = mapIter->second;
640 return sums;
641}

◆ initialize()

StatusCode LVL1BS::JepRoiByteStreamV2Tool::initialize ( )
overridevirtual

Definition at line 91 of file JepRoiByteStreamV2Tool.cxx.

92{
93 ATH_MSG_INFO ("Initializing " << name());
94
95 ATH_CHECK( m_errorTool.retrieve() );
96 ATH_CHECK( m_byteStreamCnvSvc.retrieve() );
97
98 return StatusCode::SUCCESS;
99}
#define ATH_MSG_INFO(x)

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

◆ interfaceID()

const InterfaceID & LVL1BS::JepRoiByteStreamV2Tool::interfaceID ( )
static

AlgTool InterfaceID.

Definition at line 37 of file JepRoiByteStreamV2Tool.cxx.

38{
40}
static const InterfaceID IID_IJepRoiByteStreamV2Tool("JepRoiByteStreamV2Tool", 1, 1)

◆ makeSourceIDs()

std::vector< uint32_t > LVL1BS::JepRoiByteStreamV2Tool::makeSourceIDs ( bool roiDaq) const
private

Definition at line 329 of file JepRoiByteStreamV2Tool.cxx.

330{
331 std::vector<uint32_t> sourceIDs;
332
333 if (roiDaq) {
335 }
336 else {
338 }
339
340 if (sourceIDs.empty()) {
341 const int maxCrates = m_crates + m_crateOffsetHw;
342 const int maxSlinks = m_srcIdMap.maxSlinks();
343 for (int hwCrate = m_crateOffsetHw; hwCrate < maxCrates; ++hwCrate)
344 {
345 for (int slink = 0; slink < maxSlinks; ++slink)
346 {
347 const int daqOrRoi = 1;
348 const uint32_t rodId = m_srcIdMap.getRodID(hwCrate, slink, daqOrRoi,
350 const uint32_t robId = m_srcIdMap.getRobID(rodId);
351 if (roiDaq)
352 {
353 if (slink < 2) sourceIDs.push_back(robId);
354 }
355 else if (slink >= 2) sourceIDs.push_back(robId);
356 }
357 }
358
359 }
360 return sourceIDs;
361}

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

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

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

◆ setupCmxEtMap()

void LVL1BS::JepRoiByteStreamV2Tool::setupCmxEtMap ( const CmxSumsCollection * enCollection,
CmxSumsMap & cmxEtMap ) const
private

Set up CMX energy sums map.

Definition at line 663 of file JepRoiByteStreamV2Tool.cxx.

666{
667 cmxEtMap.clear();
668 if (etCollection) {
669 CmxSumsCollection::const_iterator pos = etCollection->begin();
670 CmxSumsCollection::const_iterator pose = etCollection->end();
671 for (; pos != pose; ++pos) {
672 const LVL1::CMXEtSums* const sums = *pos;
673 const int crate = sums->crate() - m_crateOffsetSw;
674 const int key = crate * 100 + sums->source();
675 cmxEtMap.insert(std::make_pair(key, sums));
676 }
677 }
678}
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838

◆ setupJemRoiMap()

void LVL1BS::JepRoiByteStreamV2Tool::setupJemRoiMap ( const JemRoiCollection * jeCollection,
JemRoiMap & roiMap ) const
private

Set up JEM RoIs map.

Definition at line 645 of file JepRoiByteStreamV2Tool.cxx.

648{
649 roiMap.clear();
650 if (jeCollection) {
651 JemRoiCollection::const_iterator pos = jeCollection->begin();
652 JemRoiCollection::const_iterator pose = jeCollection->end();
653 for (; pos != pose; ++pos) {
654 const LVL1::JEMTobRoI* const roi = *pos;
655 const uint32_t key = roi->roiWord();
656 roiMap.insert(std::make_pair(key, roi));
657 }
658 }
659}

◆ sourceIDs()

const std::vector< uint32_t > & LVL1BS::JepRoiByteStreamV2Tool::sourceIDs ( const std::string & sgKey) const

Return reference to vector with all possible Source Identifiers.

Definition at line 363 of file JepRoiByteStreamV2Tool.cxx.

365{
366 const std::string flag("RoIB");
367 const std::string::size_type pos = sgKey.find(flag);
368 const bool roiDaq =
369 (pos == std::string::npos || pos != sgKey.length() - flag.length());
370
371 if (roiDaq) {
372 static const std::vector<uint32_t> sourceIDs = makeSourceIDs(roiDaq);
373 return sourceIDs;
374 }
375 else {
376 static const std::vector<uint32_t> sourceIDsRoIB = makeSourceIDs(roiDaq);
377 return sourceIDsRoIB;
378 }
379}
std::vector< uint32_t > makeSourceIDs(bool roiDaq) const
bool flag
Definition master.py:29

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

ServiceHandle<IByteStreamCnvSvc> LVL1BS::JepRoiByteStreamV2Tool::m_byteStreamCnvSvc { this, "ByteStreamCnvSvc", "ByteStreamCnvSvc" }
private

Definition at line 84 of file JepRoiByteStreamV2Tool.h.

85{ this, "ByteStreamCnvSvc", "ByteStreamCnvSvc" };

◆ m_crateMax

int LVL1BS::JepRoiByteStreamV2Tool::m_crateMax
private

Property: Maximum crate number when writing out bytestream.

Definition at line 144 of file JepRoiByteStreamV2Tool.h.

◆ m_crateMin

int LVL1BS::JepRoiByteStreamV2Tool::m_crateMin
private

Property: Minimum crate number when writing out bytestream.

Definition at line 142 of file JepRoiByteStreamV2Tool.h.

◆ m_crateOffsetHw

int LVL1BS::JepRoiByteStreamV2Tool::m_crateOffsetHw
private

Property: Hardware crate number offset.

Definition at line 124 of file JepRoiByteStreamV2Tool.h.

◆ m_crateOffsetSw

int LVL1BS::JepRoiByteStreamV2Tool::m_crateOffsetSw
private

Property: Software crate number offset.

Definition at line 126 of file JepRoiByteStreamV2Tool.h.

◆ m_crates

const int LVL1BS::JepRoiByteStreamV2Tool::m_crates
private

Number of crates.

Definition at line 132 of file JepRoiByteStreamV2Tool.h.

◆ m_dataFormat

int LVL1BS::JepRoiByteStreamV2Tool::m_dataFormat
private

Property: Data compression format.

Definition at line 130 of file JepRoiByteStreamV2Tool.h.

◆ 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<LVL1BS::L1CaloErrorByteStreamTool> LVL1BS::JepRoiByteStreamV2Tool::m_errorTool
private

Property: Error collection tool.

Definition at line 102 of file JepRoiByteStreamV2Tool.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_frames

const int LVL1BS::JepRoiByteStreamV2Tool::m_frames
private

Number of RoI frames.

Definition at line 136 of file JepRoiByteStreamV2Tool.h.

◆ m_maxRoiWords

const int LVL1BS::JepRoiByteStreamV2Tool::m_maxRoiWords
private

Number of CMX energy RoI words.

Definition at line 138 of file JepRoiByteStreamV2Tool.h.

◆ m_modules

const int LVL1BS::JepRoiByteStreamV2Tool::m_modules
private

Number of JEM modules per crate.

Definition at line 134 of file JepRoiByteStreamV2Tool.h.

◆ m_robDataProvider

ServiceHandle<IROBDataProviderSvc> LVL1BS::JepRoiByteStreamV2Tool::m_robDataProvider
private

Definition at line 100 of file JepRoiByteStreamV2Tool.h.

◆ m_slinks

int LVL1BS::JepRoiByteStreamV2Tool::m_slinks
private

Property: Number of slinks per crate when writing out bytestream.

Definition at line 140 of file JepRoiByteStreamV2Tool.h.

◆ m_sourceIDsProp

std::vector<uint32_t> LVL1BS::JepRoiByteStreamV2Tool::m_sourceIDsProp
private

Property: ROB source IDs.

Definition at line 146 of file JepRoiByteStreamV2Tool.h.

◆ m_sourceIDsRoIBProp

std::vector<uint32_t> LVL1BS::JepRoiByteStreamV2Tool::m_sourceIDsRoIBProp
private

Property: ROB source IDs for RoIB.

Definition at line 148 of file JepRoiByteStreamV2Tool.h.

◆ m_srcIdMap

const L1CaloSrcIdMap LVL1BS::JepRoiByteStreamV2Tool::m_srcIdMap
private

Source ID converter.

Definition at line 152 of file JepRoiByteStreamV2Tool.h.

◆ m_subDetector

const eformat::SubDetector LVL1BS::JepRoiByteStreamV2Tool::m_subDetector
private

Sub-detector type.

Definition at line 150 of file JepRoiByteStreamV2Tool.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_version

int LVL1BS::JepRoiByteStreamV2Tool::m_version
private

Property: Sub_block header version.

Definition at line 128 of file JepRoiByteStreamV2Tool.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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