|
ATLAS Offline Software
|
Tool to perform ROB fragments to CPM RoI and CPM RoI to raw data conversions.
More...
#include <CpmRoiByteStreamTool.h>
|
| CpmRoiByteStreamTool (const std::string &type, const std::string &name, const IInterface *parent) |
|
virtual | ~CpmRoiByteStreamTool () |
|
virtual StatusCode | initialize () override |
|
StatusCode | convert (const IROBDataProviderSvc::VROBFRAG &robFrags, DataVector< LVL1::CPMRoI > *roiCollection) const |
| Convert ROB fragments to CPM RoIs. More...
|
|
StatusCode | convert (const DataVector< LVL1::CPMRoI > *roiCollection) const |
| Convert CPM RoI to bytestream. More...
|
|
const std::vector< uint32_t > & | sourceIDs (const std::string &sgKey) const |
| 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 CPM RoI and CPM RoI to raw data conversions.
Based on ROD document version 1_09h.
- Author
- Peter Faulkner
Definition at line 47 of file CpmRoiByteStreamTool.h.
◆ CpmRoiCollection
◆ CpmRoiMap
◆ ROBIterator
◆ ROBPointer
◆ RODPointer
◆ StoreGateSvc_t
◆ CpmRoiByteStreamTool()
LVL1BS::CpmRoiByteStreamTool::CpmRoiByteStreamTool |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
Definition at line 38 of file CpmRoiByteStreamTool.cxx.
42 m_errorTool(
"LVL1BS::L1CaloErrorByteStreamTool/L1CaloErrorByteStreamTool"),
46 declareInterface<CpmRoiByteStreamTool>(
this);
49 "Offset of CP crate numbers in bytestream");
51 "Offset of CP crate numbers in RDOs");
55 "ROB fragment source identifiers");
57 "ROB fragment source identifiers for RoIBs");
61 "Format version number in sub-block header");
63 "Format identifier (0-1) in sub-block header");
65 "The number of S-Links per crate");
◆ ~CpmRoiByteStreamTool()
LVL1BS::CpmRoiByteStreamTool::~CpmRoiByteStreamTool |
( |
| ) |
|
|
virtual |
◆ convert() [1/2]
Convert CPM RoI to bytestream.
Definition at line 260 of file CpmRoiByteStreamTool.cxx.
270 "CpmRoiByteStream") );
279 CpmRoiSubBlock subBlock;
286 CpmRoiMap::const_iterator mapIter = roiMap.begin();
287 CpmRoiMap::const_iterator mapIterEnd = roiMap.end();
293 for (
int crate=0; crate <
m_crates; ++crate) {
302 if (
mod%modulesPerSlink == 0) {
303 const int daqOrRoi = 1;
304 const int slink = (
m_slinks == 2) ? 2*(
mod/modulesPerSlink)
305 :
mod/modulesPerSlink;
307 msg() <<
"Treating crate " << hwCrate
308 <<
" slink " << slink <<
endmsg
316 const L1CaloUserHeader userHeader;
317 theROD->push_back(userHeader.header());
331 for (; mapIter != mapIterEnd; ++mapIter) {
333 if (roi->
crate() < crate)
continue;
334 if (roi->
crate() > crate)
break;
338 if (neutralFormat) subBlock.fillRoi(*roi);
339 else theROD->push_back(roi->
roiWord());
346 if ( !subBlock.pack()) {
347 msg(MSG::ERROR) <<
"CPMRoI sub-block packing failed" <<
endmsg;
348 return StatusCode::FAILURE;
351 msg() <<
"CPMRoI sub-block data words: "
352 << subBlock.dataWords() <<
endmsg;
354 subBlock.write(theROD);
359 return StatusCode::SUCCESS;
◆ convert() [2/2]
Convert ROB fragments to CPM RoIs.
Definition at line 90 of file CpmRoiByteStreamTool.cxx.
98 CpmRoiSubBlock subBlock;
103 std::set<uint32_t> dupCheck;
104 std::set<uint32_t> dupRoiCheck;
107 for (; rob != robEnd; ++rob) {
111 msg() <<
"Treating ROB fragment " << robCount <<
endmsg;
116 uint32_t robid = (*rob)->source_id();
117 if ((*rob)->nstatus() > 0) {
119 (*rob)->status(robData);
122 if (
debug)
msg() <<
"ROB status error - skipping fragment" <<
endmsg;
129 if (!dupCheck.insert(robid).second) {
140 (*rob)->rod_data(payloadBeg);
141 payloadEnd = payloadBeg + (*rob)->rod_ndata();
149 const uint32_t sourceID = (*rob)->rod_source_id();
158 msg() <<
"Wrong source identifier in data: "
159 << MSG::hex << sourceID << MSG::dec <<
endmsg;
165 msg() <<
"Treating crate " << rodCrate
171 L1CaloUserHeader userHeader(*
payload);
172 const int minorVersion = (*rob)->rod_version() & 0xffff;
173 userHeader.setVersion(minorVersion);
174 const int headerWords = userHeader.words();
175 if (headerWords != 1 ) {
177 if (
debug)
msg() <<
"Unexpected number of user header words: "
181 for (
int i = 0;
i < headerWords; ++
i) ++
payload;
187 while (
payload != payloadEnd) {
193 msg() <<
"CPM RoI sub-block: Crate " << subBlock.crate()
194 <<
" Module " << subBlock.module() <<
endmsg;
197 if (subBlock.dataWords() && !subBlock.unpack()) {
199 std::string errMsg(subBlock.unpackErrorMsg());
200 msg() <<
"CPM RoI sub-block unpacking failed: " << errMsg <<
endmsg;
202 rodErr = subBlock.unpackErrorCode();
205 const int numChips = 8;
206 const int numLocs = 2;
207 for (
int chip = 0; chip < numChips; ++chip) {
208 for (
int loc = 0; loc < numLocs; ++loc) {
220 if (
debug)
msg() <<
"Inconsistent RoI crate number: "
226 if (
debug)
msg() <<
"Invalid CPM number: "
231 const uint32_t location = (*payload) & 0xfffc0000;
232 if (dupRoiCheck.insert(location).second) {
237 if (
debug)
msg() <<
"Duplicate RoI word "
243 if (
debug)
msg() <<
"Invalid RoI word "
255 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
◆ initialize()
StatusCode LVL1BS::CpmRoiByteStreamTool::initialize |
( |
| ) |
|
|
overridevirtual |
◆ 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 & LVL1BS::CpmRoiByteStreamTool::interfaceID |
( |
| ) |
|
|
static |
◆ makeSourceIDs()
std::vector< uint32_t > LVL1BS::CpmRoiByteStreamTool::makeSourceIDs |
( |
bool |
roiDaq | ) |
const |
|
private |
Definition at line 364 of file CpmRoiByteStreamTool.cxx.
380 for (
int slink = 0; slink < maxSlinks; ++slink)
382 const int daqOrRoi = 1;
388 if (slink < 2)
sourceIDs.push_back(robId);
390 else if (slink >= 2)
sourceIDs.push_back(robId);
◆ 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.
◆ renounce()
◆ renounceArray()
◆ setupCpmRoiMap()
◆ sourceIDs()
const std::vector< uint32_t > & LVL1BS::CpmRoiByteStreamTool::sourceIDs |
( |
const std::string & |
sgKey | ) |
const |
Return reference to vector with all possible Source Identifiers.
Definition at line 398 of file CpmRoiByteStreamTool.cxx.
401 const std::string
flag(
"RoIB");
402 const std::string::size_type
pos = sgKey.find(
flag);
404 (
pos == std::string::npos ||
pos != sgKey.length() -
flag.length());
411 static const std::vector<uint32_t> sourceIDsRoIB =
makeSourceIDs(roiDaq);
412 return sourceIDsRoIB;
◆ 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_byteStreamCnvSvc
◆ m_crateOffsetHw
int LVL1BS::CpmRoiByteStreamTool::m_crateOffsetHw |
|
private |
◆ m_crateOffsetSw
int LVL1BS::CpmRoiByteStreamTool::m_crateOffsetSw |
|
private |
◆ m_crates
const int LVL1BS::CpmRoiByteStreamTool::m_crates |
|
private |
◆ m_dataFormat
int LVL1BS::CpmRoiByteStreamTool::m_dataFormat |
|
private |
◆ m_detStore
◆ m_errorTool
◆ m_evtStore
◆ m_modules
const int LVL1BS::CpmRoiByteStreamTool::m_modules |
|
private |
◆ m_slinks
int LVL1BS::CpmRoiByteStreamTool::m_slinks |
|
private |
◆ m_sourceIDsProp
std::vector<uint32_t> LVL1BS::CpmRoiByteStreamTool::m_sourceIDsProp |
|
private |
◆ m_sourceIDsRoIBProp
std::vector<uint32_t> LVL1BS::CpmRoiByteStreamTool::m_sourceIDsRoIBProp |
|
private |
◆ m_srcIdMap
◆ m_subDetector
const eformat::SubDetector LVL1BS::CpmRoiByteStreamTool::m_subDetector |
|
private |
◆ m_varHandleArraysDeclared
◆ m_version
int LVL1BS::CpmRoiByteStreamTool::m_version |
|
private |
◆ m_vhka
The documentation for this class was generated from the following files:
int slink(uint32_t code) const
Return slink from unpacked moduleID.
Template class for assembling a full atlas raw event from subfragments.
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool msgLvl(const MSG::Level lvl) const
uint32_t getRobID(uint32_t rod_id) const
Make a ROB Source ID from a ROD source ID.
int hits() const
Return hit thresholds map.
virtual void setOwner(IDataHandleHolder *o)=0
int cpm() const
Return CPM number (1-14)
int crate(uint32_t code) const
Return crate from unpacked moduleID.
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
int error() const
Return error flags (bit 0 Saturation, bit 1 Parity)
static SubBlockWordType wordType(uint32_t word)
Word identification.
virtual void renounce()=0
uint32_t roiWord() const
Return packed RoI word.
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
uint16_t minorVersion() const
Return ROD header minor version to use when writing BS.
bool setRoiWord(uint32_t roiWord)
Set RoI word with ID check.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
eformat::SubDetector subDet(uint32_t code) const
Return sub-detector for given ID.
void setRodMinorVersion(uint16_t m)
change the ROD minor version
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
uint32_t getRodID(int crate, int slink, int daqOrRoi, eformat::SubDetector subdet) const
Make a ROD Source ID.
std::vector< uint32_t > RODDATA
ROD data as a vector of unsigned int.
int maxSlinks() const
Return the maximum possible number of slinks.
int crate() const
Return crate number (0-1)
int daqOrRoi(uint32_t code) const
Return daqOrRoi from unpacked moduleID.
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
RODDATA * getRodData(uint32_t id)
get a block of ROD data