ATLAS Offline Software
Loading...
Searching...
No Matches
RecMuCTPIByteStreamTool Class Reference

Tool doing the ByteStream -> MuCTPI_RIO conversion. More...

#include <RecMuCTPIByteStreamTool.h>

Inheritance diagram for RecMuCTPIByteStreamTool:
Collaboration diagram for RecMuCTPIByteStreamTool:

Public Member Functions

 RecMuCTPIByteStreamTool (const std::string &type, const std::string &name, const IInterface *parent)
 Default constructor.
virtual StatusCode initialize () override
 Function to initialise the tool.
StatusCode convert (const ROBF *rob, MuCTPI_RIO *&cont)
 Convert ROBFragment to MuCTPI_RIO.
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 OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment ROBF
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

MuCTPISrcIdMap m_srcIdMap
 Object storing the various IDs of the MuCTPI fragment.
ToolHandle< LVL1::ITrigT1MuonRecRoiToolm_rpcRoITool
ToolHandle< LVL1::ITrigT1MuonRecRoiToolm_tgcRoITool
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 doing the ByteStream -> MuCTPI_RIO conversion.

   The actual work of translating the information in a MuCTPI ROB fragment
   into a MuCTPI_RIO object is done with this tool.
See also
CTPByteStreamCnv
Author
Tadashi Maeno
Attila Krasznahorkay
David Berge
Christian Ohm

Definition at line 36 of file RecMuCTPIByteStreamTool.h.

Member Typedef Documentation

◆ ROBF

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ RecMuCTPIByteStreamTool()

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

Default constructor.

The constructor takes care of correctly constructing the base class and declaring the tool's interface to the framework.

Definition at line 32 of file RecMuCTPIByteStreamTool.cxx.

34 : AthAlgTool( type, name, parent )
35
36{
37 declareInterface< RecMuCTPIByteStreamTool >( this );
38}
AthAlgTool()
Default constructor:

Member Function Documentation

◆ convert()

StatusCode RecMuCTPIByteStreamTool::convert ( const ROBF * rob,
MuCTPI_RIO *& result )

Convert ROBFragment to MuCTPI_RIO.

Conversion from eformat::ROBFragment to RIO.

This is called from the RecMuCTPIByteStreamCnv::createObj method.

Definition at line 70 of file RecMuCTPIByteStreamTool.cxx.

70 {
71
72 ATH_MSG_DEBUG("executing convert() from ROBFragment to RIO");
73
74 // L1Menu
75 const TrigConf::L1Menu * l1menu = nullptr;
76 ATH_CHECK( detStore()->retrieve(l1menu) );
77
78 // Source ID of MIROD
79 const uint32_t miRodId = m_srcIdMap.getRodID();
80
81 /* get ROD source ID */
82 uint32_t rodId = rob->rod_source_id();
83
84 if( rodId == miRodId ) {
85
86 // result
87 MuCTPI_RIO* muCTPI_RIO = new MuCTPI_RIO;
88
89 // get the ROD header data and store it
90 const uint32_t bcid = rob->rod_bc_id();
91 const uint32_t ndata = rob->rod_ndata();
92 const uint32_t detev_type = rob->rod_detev_type();
93 const uint32_t lvl1_type = rob->rod_lvl1_trigger_type();
94 const uint32_t lvl1_id = rob->rod_lvl1_id();
95 const uint32_t run_no = rob->rod_run_no();
96 const uint32_t nstatus = rob->rod_nstatus();
98 rob->rod_status( it_statusData );
99
100 ATH_MSG_VERBOSE(" Dumping CTP ROD fragment Header data:");
101 ATH_MSG_VERBOSE("Source ID 0x" << MSG::hex << rodId << MSG::dec);
102 ATH_MSG_VERBOSE("BCID 0x" << MSG::hex << bcid << MSG::dec
103 << " (dec " << bcid << ")");
104 ATH_MSG_VERBOSE("Detector event type 0x" << MSG::hex << detev_type
105 << MSG::dec << " (dec " << detev_type << ")");
106 ATH_MSG_VERBOSE("Level-1 ID 0x" << MSG::hex << lvl1_id << MSG::dec
107 << " (dec " << lvl1_id << ")");
108 ATH_MSG_VERBOSE("Level-1 type 0x" << MSG::hex << lvl1_type << MSG::dec
109 << " (dec " << lvl1_type << ")");
110 ATH_MSG_VERBOSE("Run number " << run_no);
111 ATH_MSG_VERBOSE("Number of data words " << ndata);
112 ATH_MSG_VERBOSE("Number of status words ");
113 for ( uint32_t i = 0; i < nstatus; ++i , ++it_statusData) {
114 ATH_MSG_VERBOSE("Status word # " << i << ": 0x" << MSG::hex << (*it_statusData) << MSG::dec
115 << " (dec " << (*it_statusData) << ")");
116 muCTPI_RIO->headerStatusWords().push_back( static_cast<uint32_t>( *it_statusData ) );
117 }
118 muCTPI_RIO->headerSourceId(rodId);
119 muCTPI_RIO->headerRunNumber(run_no);
120 muCTPI_RIO->headerLVL1ID(lvl1_id);
121 muCTPI_RIO->headerBCID(bcid);
122 muCTPI_RIO->headerLVL1TriggerType(lvl1_type);
123 muCTPI_RIO->headerDetectorEventType(detev_type);
124 muCTPI_RIO->headerNumberDataWords(ndata);
125 muCTPI_RIO->headerNumberStatusWords(nstatus);
126
127 ATH_MSG_DEBUG(" Dumping MuCTPI words:");
128
130 rob->rod_data( it_data );
131
132 //First count mult words
133 int nMultWords = 0;
134 for( uint32_t i = 0; i < ndata; ++i ) {
135 if( ((*it_data) & 0x20000000) != 0 ) nMultWords++;
136 ++it_data;
137 }
138
139 rob->rod_data( it_data );
140
141 it_data+=(nMultWords-1)/2;//Goes to the central BC of the RO window
142
143 ATH_MSG_DEBUG(" 0x" << MSG::hex << std::setw( 8 ) << *it_data
144 << " (candidate multiplicity)");
145
146 // candidate multiplicities
148 for ( int i = 0; i < MuCTPI_RIO::N_SUM; ++i )
149 sum[ i ] = ( *it_data >> ( i * 3 ) ) & 0x1F;
150 muCTPI_RIO->setSum( sum );
151
152 // BCID
153 uint16_t g_bcId = ( (*it_data) & 0x001C0000 ) >> 18;
154 muCTPI_RIO->setBCID( g_bcId );
155
156 it_data+=(nMultWords+1)/2;//Goes to the first candidate word;
157
158 // data words
159 for( uint32_t i = nMultWords; i < ndata; ++i, ++it_data ) {
160
161 ATH_MSG_DEBUG(" 0x" << MSG::hex << std::setw( 8 ) << *it_data);
162
163 // extract BCID
164 const uint32_t tmpWord = static_cast<uint32_t>( *it_data ); // The two types are the same right now, but it might change.
165 uint16_t bcId = ( tmpWord & 0x0001C000 ) >> 14;
166
167 // accepted bit
168 bool accepted = true;
169 if ( ( tmpWord & 0x04000000 ) == 0 )
170 accepted = false;
171
172 // make RoI word
173 uint32_t roiWord = ( tmpWord & 0x00003FFF ) + ( ( tmpWord & 0x03FE0000 ) >> 3 );
174
175 ATH_MSG_DEBUG(MSG::hex << std::setw( 8 ) << *it_data
176 << " : ROI=" << std::setw( 8 ) << roiWord);
177
178 // reconstruct
179 LVL1::RecMuonRoI thisRoI( roiWord, m_rpcRoITool.isSet() ? m_rpcRoITool.get() : 0,
180 m_tgcRoITool.isSet() ? m_tgcRoITool.get() : 0, l1menu );
181
182 uint16_t pTVal = thisRoI.getThresholdValue();
183 uint16_t pTNumber = thisRoI.getThresholdNumber();
184 uint16_t roiNumber = thisRoI.getRoINumber();
185 uint16_t secId = thisRoI.sectorID();
186 uint16_t sysId = thisRoI.sysID();
187 uint16_t hemisphere = thisRoI.subsysID();
188 double eta = thisRoI.eta();
189 double phi = thisRoI.phi();
190 bool first = thisRoI.firstCandidate();
191 bool duplicatedRoI = thisRoI.padOverflow();
192 bool duplicatedSector = thisRoI.sectorOverflow();
193
194 // fill
195 muCTPI_RIO->setRoI( bcId, pTVal,pTNumber, eta, phi, secId, sysId, hemisphere, roiNumber,
196 accepted, first, duplicatedRoI, duplicatedSector );
197 }
198
199 /* set return value */
200 result = muCTPI_RIO;
201
202 return StatusCode::SUCCESS;
203
204 } else {
205
206 ATH_MSG_WARNING("Expected source ID 0x" << MSG::hex << miRodId << " but found 0x"
207 << rodId << MSG::dec);
208 return StatusCode::FAILURE;
209
210 }
211}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
uint16_t bcId(uint32_t data)
const ServiceHandle< StoreGateSvc > & detStore() const
void headerBCID(uint32_t val)
Set the BCID specified in the header.
Definition MuCTPI_RIO.h:101
void headerLVL1ID(uint32_t val)
Set the LVL1 ID specified in the header.
Definition MuCTPI_RIO.h:99
void headerNumberStatusWords(uint32_t val)
Set the number of status words as it was specified in the trailer
Definition MuCTPI_RIO.h:109
void headerRunNumber(uint32_t val)
Set the run number specified in the header.
Definition MuCTPI_RIO.h:97
std::vector< uint32_t > & headerStatusWords()
Get the status words from the payload.
Definition MuCTPI_RIO.h:111
void headerSourceId(uint32_t val)
Set the ROD ID specidied in the header.
Definition MuCTPI_RIO.h:95
void headerDetectorEventType(uint32_t val)
Set the event type specified in the header.
Definition MuCTPI_RIO.h:105
void setSum(const uint16_t *sum)
Set the multiplicity sum.
void setRoI(const uint16_t bcId, const uint16_t pTval, const uint16_t pTnum, const double eta, const double phi, const uint16_t secID, const uint16_t sysId, const uint16_t hemisphere, const uint16_t roiNum, const bool accepted, const bool first, const bool duplicatedRoI, const bool duplicatedSector)
Add a muon RoI to the object
void setBCID(const uint16_t bcId)
Function setting the BCID of the object.
Definition MuCTPI_RIO.h:55
void headerNumberDataWords(uint32_t val)
Set the number of data words as it was specified in the trailer
Definition MuCTPI_RIO.h:107
void headerLVL1TriggerType(uint32_t val)
Set the LVL1 trigger type specified in the header.
Definition MuCTPI_RIO.h:103
ToolHandle< LVL1::ITrigT1MuonRecRoiTool > m_tgcRoITool
ToolHandle< LVL1::ITrigT1MuonRecRoiTool > m_rpcRoITool
MuCTPISrcIdMap m_srcIdMap
Object storing the various IDs of the MuCTPI fragment.
bool first
Definition DeMoScan.py:534
const DataType * PointerType
Definition RawEvent.h:25
retrieve(aClass, aKey=None)
Definition PyKernel.py:110
setTeId setLumiBlock setRoiId setRoiSubsystem roiNumber
setEventNumber setTimeStamp bcid
setWord1 uint16_t
setEventNumber uint32_t

◆ 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

◆ initialize()

StatusCode RecMuCTPIByteStreamTool::initialize ( )
overridevirtual

Function to initialise the tool.

The function connects to all services being used, resets the internally used variables, and initialises the base class.

Definition at line 45 of file RecMuCTPIByteStreamTool.cxx.

45 {
46
47 StatusCode sc = m_rpcRoITool.retrieve();
48 if( sc.isFailure() ) {
49 ATH_MSG_WARNING("Couldn't access RPC RecMuonRoISvc");
50 } else {
51 ATH_MSG_DEBUG("Connected to RPC RecMuonRoISvc");
52 }
53
54 sc = m_tgcRoITool.retrieve();
55 if( sc.isFailure() ) {
56 ATH_MSG_WARNING("Couldn't access TGC RecMuonRoISvc");
57 } else {
58 ATH_MSG_DEBUG("Connected to TGC RecMuonRoISvc");
59 }
60
61 return StatusCode::SUCCESS;
62
63}
static Double_t sc
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ 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 & RecMuCTPIByteStreamTool::interfaceID ( )
static

AlgTool InterfaceID.

This function is needed by the framework to know what kind of tool this is.

Definition at line 22 of file RecMuCTPIByteStreamTool.cxx.

22 {
23
25
26}
static const InterfaceID IID_IRecMuCTPIByteStreamTool("RecMuCTPIByteStreamTool", 1, 1)
Unique interface ID of the tool that identifies it to the framweork.

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

◆ 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_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_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_rpcRoITool

ToolHandle<LVL1::ITrigT1MuonRecRoiTool> RecMuCTPIByteStreamTool::m_rpcRoITool
private
Initial value:
{
this, "RPCRecRoiSvc", "LVL1::TrigT1RPCRecRoiTool/TrigT1RPCRecRoiTool", "RPC RoI reconstruction tool"
}

Definition at line 59 of file RecMuCTPIByteStreamTool.h.

59 {
60 this, "RPCRecRoiSvc", "LVL1::TrigT1RPCRecRoiTool/TrigT1RPCRecRoiTool", "RPC RoI reconstruction tool"
61 };

◆ m_srcIdMap

MuCTPISrcIdMap RecMuCTPIByteStreamTool::m_srcIdMap
private

Object storing the various IDs of the MuCTPI fragment.

Definition at line 57 of file RecMuCTPIByteStreamTool.h.

◆ m_tgcRoITool

ToolHandle<LVL1::ITrigT1MuonRecRoiTool> RecMuCTPIByteStreamTool::m_tgcRoITool
private
Initial value:
{
this, "TGCRecRoiSvc", "LVL1::TrigT1TGCRecRoiTool/TrigT1TGCRecRoiTool", "TGC RoI reconstruction tool"
}

Definition at line 62 of file RecMuCTPIByteStreamTool.h.

62 {
63 this, "TGCRecRoiSvc", "LVL1::TrigT1TGCRecRoiTool/TrigT1TGCRecRoiTool", "TGC RoI reconstruction tool"
64 };

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.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: