ATLAS Offline Software
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
TrigMuonRoITool Class Reference

#include <TrigMuonRoITool.h>

Inheritance diagram for TrigMuonRoITool:
Collaboration diagram for TrigMuonRoITool:

Public Member Functions

 TrigMuonRoITool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual StatusCode initialize () override
 
virtual std::unique_ptr< TrigMuonRoITool::MuonRois > decodeMuCTPi (const EventContext &ctx) const override
 Decoding the muCTPi RoIB and DAQ ROB and return in and out of time RoIs. More...
 

Private Types

typedef ServiceHandle< IROBDataProviderSvcIIROBDataProviderSvc_t
 

Private Member Functions

uint32_t mirodToRoIBDataWord (uint32_t data_word) const
 Helper for converting a mirod DAQ data word to a muCTPi RoIB data word. More...
 
void dumpRoIBDataWord (uint32_t data_word) const
 Helper to print contents of a muCTPi RoIB data word. More...
 

Private Attributes

SG::ReadHandleKey< MuCTPI_RDOm_muCTPIKey {this, "MUCTPILocation", "MUCTPI_RDO", "Location of MUCTPI RDO"}
 
IIROBDataProviderSvc_t m_robDataProviderSvc
 Reference to the ROBDataProviderSvc service. More...
 
IntegerProperty m_daqMuCTPiROBid
 Source identifiers for ROB fragments. More...
 
std::vector< uint32_t > m_muCTPiRobIds
 vectors with muCTPi ROB Ids to retrieve More...
 
bool m_decodeMuCTPiFromROB
 Configurable to decide how to decode muCTPi. More...
 

Static Private Attributes

static const uint32_t NUMBER_OF_PT_THRESHOLDS = 6
 Number of pt Thresholds. More...
 

Detailed Description

Definition at line 16 of file TrigMuonRoITool.h.

Member Typedef Documentation

◆ IIROBDataProviderSvc_t

Definition at line 34 of file TrigMuonRoITool.h.

Constructor & Destructor Documentation

◆ TrigMuonRoITool()

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

Definition at line 12 of file TrigMuonRoITool.cxx.

14  :
15  base_class(type,name,parent),
16  m_robDataProviderSvc( "ROBDataProviderSvc", name ),
18 {
19  // Declare the properties
20  declareProperty("DaqMuCTPiROBid",m_daqMuCTPiROBid=0x760000);
21  declareProperty("DecodeMuCTPiFromROB",m_decodeMuCTPiFromROB=false);
22 }

Member Function Documentation

◆ decodeMuCTPi()

std::unique_ptr< TrigMuonRoITool::MuonRois > TrigMuonRoITool::decodeMuCTPi ( const EventContext &  ctx) const
overridevirtual

Decoding the muCTPi RoIB and DAQ ROB and return in and out of time RoIs.

helper to decode MuCTPi information

Definition at line 45 of file TrigMuonRoITool.cxx.

45  {
46 
47  // save input stream flags
48  char log_fill_char_save = (msg().stream()).fill();
49 
50 
52  // decode MUCTPI
54 
55  // MuCTPi pointer
56  const MuCTPI_RDO* daqmuCTPIResult = 0;
57 
58  // Build muCTPi from DAQ ROB
61 
62  // in L2 the DAQ muCTPi ROB needs to be retreived first from the ROS
63  m_robDataProviderSvc->addROBData(ctx, m_muCTPiRobIds);
64 
65  // get the muCTPi ROB fragment
66  std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> muCTPiRobFragmentVec;
67  muCTPiRobFragmentVec.reserve(m_muCTPiRobIds.size());
68  m_robDataProviderSvc->getROBData(ctx, m_muCTPiRobIds,muCTPiRobFragmentVec);
69 
70  if (muCTPiRobFragmentVec.size()==0) {
71  ATH_MSG_DEBUG(" decodeMuCTPi: No muCTPi ROB found.");
72  return nullptr;
73  }
74 
75  // check for received ROB id and return if it doesn't match the DAQ MuCTPI ROB
76  ATH_MSG_DEBUG(" decodeMuCTPi: ROB id = 0x" << std::setw(6) << MSG::hex << muCTPiRobFragmentVec[0]->source_id() << MSG::dec);
77 
78  if (muCTPiRobFragmentVec[0]->source_id() != (uint32_t)m_daqMuCTPiROBid.value()) {
79  ATH_MSG_DEBUG(" decodeMuCTPi: received ROB id = 0x" << std::setw(6) << MSG::hex << muCTPiRobFragmentVec[0]->source_id() << MSG::dec
80  << " does not match requested ROB id = 0x"
81  << std::setw(6) << MSG::hex << m_daqMuCTPiROBid.value() << MSG::dec);
82  return nullptr;
83  }
84 
85  // decode now the ROB
86  uint32_t formatVersion = muCTPiRobFragmentVec[0]->rod_version();
87  uint32_t evtNum = muCTPiRobFragmentVec[0]->rod_lvl1_id();
88  uint32_t robFragSize = muCTPiRobFragmentVec[0]->fragment_size_word();
89  uint32_t rodFragSize = muCTPiRobFragmentVec[0]->rod_fragment_size_word();
90  uint32_t robId = muCTPiRobFragmentVec[0]->source_id();
91  uint32_t rodId = muCTPiRobFragmentVec[0]->rod_source_id();
92  const uint32_t bcId = muCTPiRobFragmentVec[0]->rod_bc_id();
93 
94  const uint32_t* status;
95  muCTPiRobFragmentVec[0]->rod_status( status );
96  // nstatus, errorStat not used, cause compilation warning
97  //uint32_t nstatus = muCTPiRobFragmentVec[0]->rod_nstatus();
98  //uint32_t errorStat( 0 );
99  //if( nstatus > 0 ) errorStat = static_cast< uint32_t >( *status );
100  //
101 
102  ATH_MSG_DEBUG("ROB ID 0x" << MSG::hex << robId << " ROD ID 0x"
103  << rodId << MSG::dec << " ROB fragment size "
104  << robFragSize << " ROD fragment size " << rodFragSize);
105 
106  ATH_MSG_DEBUG(" ROD Header L1 ID " << evtNum
107  << " ROD Header BCID " << bcId
108  << " ROD Header Format version " << formatVersion);
109 
111  muCTPiRobFragmentVec[0]->rod_data( it_data );
112  const uint32_t ndata = muCTPiRobFragmentVec[0]->rod_ndata();
113  ATH_MSG_DEBUG( " Dumping RoI Words:");
114  ATH_MSG_DEBUG( " number of data words: " << ndata);
115  // candidate multiplicity
116  std::vector< uint32_t > candidateMultiplicity;
117  // data words
118  std::vector< uint32_t > dataWord;
119  for( uint32_t i = 0; i < ndata; ++i, ++it_data ) {
120  if( *it_data >> LVL1::MuCTPIBits::MULT_WORD_FLAG_SHIFT ) {
121  candidateMultiplicity.push_back( static_cast< uint32_t >( *it_data ) );
122  ATH_MSG_DEBUG(" 0x" << MSG::hex << std::setw( 8 ) << std::setfill( '0' )
123  << ( *it_data ) << " (candidate multiplicity)" << std::setfill( log_fill_char_save ));
124  } else {
125  dataWord.push_back( static_cast< uint32_t >( *it_data ) );
126  ATH_MSG_DEBUG(" 0x" << MSG::hex << std::setw( 8 ) << std::setfill( '0' )
127  << ( *it_data ) << " (candidate word)"
128  << " (--> RoI word = 0x" << MSG::hex << std::setw( 8 ) << std::setfill( '0' )
129  << mirodToRoIBDataWord( *it_data ) << ")"
130  << std::setfill( log_fill_char_save ));
131  }
132  }
133 
134  // create MuCTPi RDO (DAQ muCTPi Result)
135  daqmuCTPIResult = new MuCTPI_RDO( std::move(candidateMultiplicity), std::move(dataWord) );
136  }
137 
138  // Retrieve the MuCTPi RDO via data handle
140  else{
141  SG::ReadHandle<MuCTPI_RDO> rdoHandle(m_muCTPIKey, ctx);
142  if(rdoHandle.isValid()){
143  daqmuCTPIResult = rdoHandle.cptr();
144  }
145  else{
146  ATH_MSG_WARNING("Can't get MUCTPI_RDO object");
147  return nullptr;
148  }
149  }
150 
151  // print contents
152  if (msgLvl(MSG::DEBUG)) {
154  for(std::vector< uint32_t >::const_iterator it = daqmuCTPIResult->dataWord().begin();
155  it != daqmuCTPIResult->dataWord().end(); ++it) {
158  }
159  }
160 
161  // now select out the RoI candidates for the BCID which triggered the event and save them in
162  // a special list indexed by RoI ID
163  uint16_t roiEventBCID = MuCTPI_MultiplicityWord_Decoder(daqmuCTPIResult->candidateMultiplicity()).getBCID();
165 
166  // reset the containers and fill them with new data
167  auto inTime_muCTPIRoIs= std::vector<ROIB::MuCTPIRoI>();
168  auto outOfTime_muCTPIRoIs= std::vector< std::pair<ROIB::MuCTPIRoI,int> >();
169 
170  inTime_muCTPIRoIs.reserve( roiEventNCan );
171  outOfTime_muCTPIRoIs.reserve( roiEventNCan );
172 
173  for(std::vector< uint32_t >::const_iterator it = daqmuCTPIResult->dataWord().begin();
174  it != daqmuCTPIResult->dataWord().end(); ++it) {
175 
176  // decode the RDO data word
177  MuCTPI_DataWord_Decoder daqRoI(*it);
178 
179  // create a L1 RoI
181 
182  if (roiEventBCID == daqRoI.getBCID()) { // RoI matches event BCID
183  inTime_muCTPIRoIs.push_back(roI);
184  } else {
185  outOfTime_muCTPIRoIs.push_back( std::pair<ROIB::MuCTPIRoI,int>(roI,(int(daqRoI.getBCID())-int(roiEventBCID))) );
186  }
187  } // end loop over data words
188 
189  // print contents of RoI arrays
190  if (msgLvl(MSG::DEBUG)) {
191  ATH_MSG_DEBUG(" RoIs in time with event BCID: Number of RoIs = " << inTime_muCTPIRoIs.size());
192  for (std::vector< ROIB::MuCTPIRoI >::iterator it = inTime_muCTPIRoIs.begin(); it != inTime_muCTPIRoIs.end(); ++it) {
193  dumpRoIBDataWord((*it).roIWord());
194  }
195 
196  ATH_MSG_DEBUG(" RoIs out of time with event BCID: Number of RoIs = " << outOfTime_muCTPIRoIs.size());
197  for (std::vector< std::pair<ROIB::MuCTPIRoI,int> >::iterator it = outOfTime_muCTPIRoIs.begin(); it != outOfTime_muCTPIRoIs.end(); ++it) {
198  ATH_MSG_DEBUG( " Difference(RoI(BCID) - Event(BCID)) = " << (*it).second);
199  dumpRoIBDataWord(((*it).first).roIWord());
200  }
201  }
202 
203  std::unique_ptr<TrigMuonRoITool::MuonRois> rois(new TrigMuonRoITool::MuonRois(std::move(inTime_muCTPIRoIs), std::move(outOfTime_muCTPIRoIs)));
204 
205 
207  delete daqmuCTPIResult;
208 
209  return rois;
210 }

◆ dumpRoIBDataWord()

void TrigMuonRoITool::dumpRoIBDataWord ( uint32_t  data_word) const
private

Helper to print contents of a muCTPi RoIB data word.

Definition at line 219 of file TrigMuonRoITool.cxx.

219  {
220 
221  ROIB::MuCTPIRoI roI(data_word);
222 
223  std::string loc = "UNDEFINED";
224  if( roI.getSectorLocation() == MuCTPI_RDO::ENDCAP )
225  loc = "ENDCAP";
226  else if( roI.getSectorLocation() == MuCTPI_RDO::FORWARD )
227  loc = "FORWARD";
228  else if( roI.getSectorLocation() == MuCTPI_RDO::BARREL )
229  loc = "BARREL";
230 
231  ATH_MSG_DEBUG( "RoIB word : 0x" << MSG::hex << roI.roIWord() );
232  ATH_MSG_DEBUG( "Threshold : pt" << roI.pt() );
233  ATH_MSG_DEBUG( "Sector location : " << loc );
234  std::string sectorOffset("");
235  if ((roI.getSectorAddress() & LVL1::MuCTPIBits::SECTOR_HEMISPHERE_MASK) &&
236  (roI.getSectorLocation() == MuCTPI_RDO::BARREL)) sectorOffset = " + 32 for Hemisphere = 1 ";
237  ATH_MSG_DEBUG( "Sector ID : " << roI.getSectorID() << sectorOffset );
238  ATH_MSG_DEBUG( "Sector addr : 0x" << MSG::hex << roI.getSectorAddress());
239  ATH_MSG_DEBUG( "Sector overflow : " << roI.getSectorOverflow() );
240  ATH_MSG_DEBUG( "RoI overflow : " << roI.getRoiOverflow() );
241  ATH_MSG_DEBUG( "RoI number : " << roI.getRoiNumber() );
242  ATH_MSG_DEBUG( "IsHighestPt : " << roI.getCandidateIsHighestPt() );
243  ATH_MSG_DEBUG( "Overlap : " << roI.getOverlapBits() );
244  ATH_MSG_DEBUG( "Hemisphere : " << (roI.getSectorAddress() & LVL1::MuCTPIBits::SECTOR_HEMISPHERE_MASK) );
245  return;
246 }

◆ initialize()

StatusCode TrigMuonRoITool::initialize ( )
overridevirtual

Definition at line 25 of file TrigMuonRoITool.cxx.

26 {
28  ATH_CHECK( m_robDataProviderSvc.retrieve() );
29 
30  // Print the property values
31  ATH_MSG_DEBUG(" ROB ID: DAQ muCTPi = " << m_daqMuCTPiROBid
32  << std::setw(6) << " (=0x" << MSG::hex << m_daqMuCTPiROBid.value() << MSG::dec << ")");
33 
34  // Build the vector with ROB Ids to retrieve
35  m_muCTPiRobIds.push_back(m_daqMuCTPiROBid.value());
36 
37  //Retrieve the MuCTPi RDO is we aren't decoding them ourselves
39 
40  return StatusCode::SUCCESS;
41 }

◆ mirodToRoIBDataWord()

uint32_t TrigMuonRoITool::mirodToRoIBDataWord ( uint32_t  data_word) const
private

Helper for converting a mirod DAQ data word to a muCTPi RoIB data word.

Definition at line 213 of file TrigMuonRoITool.cxx.

213  {
214  return ( ( ( data_word & 0x8000000 ) >> 4 ) | ( ( data_word & 0x3fe0000 ) >> 3 ) |
215  ( data_word & 0x3fff ) );
216 }

Member Data Documentation

◆ m_daqMuCTPiROBid

IntegerProperty TrigMuonRoITool::m_daqMuCTPiROBid
private

Source identifiers for ROB fragments.

Definition at line 39 of file TrigMuonRoITool.h.

◆ m_decodeMuCTPiFromROB

bool TrigMuonRoITool::m_decodeMuCTPiFromROB
private

Configurable to decide how to decode muCTPi.

Definition at line 54 of file TrigMuonRoITool.h.

◆ m_muCTPIKey

SG::ReadHandleKey<MuCTPI_RDO> TrigMuonRoITool::m_muCTPIKey {this, "MUCTPILocation", "MUCTPI_RDO", "Location of MUCTPI RDO"}
private

Definition at line 32 of file TrigMuonRoITool.h.

◆ m_muCTPiRobIds

std::vector<uint32_t> TrigMuonRoITool::m_muCTPiRobIds
private

vectors with muCTPi ROB Ids to retrieve

Definition at line 42 of file TrigMuonRoITool.h.

◆ m_robDataProviderSvc

IIROBDataProviderSvc_t TrigMuonRoITool::m_robDataProviderSvc
private

Reference to the ROBDataProviderSvc service.

Definition at line 36 of file TrigMuonRoITool.h.

◆ NUMBER_OF_PT_THRESHOLDS

const uint32_t TrigMuonRoITool::NUMBER_OF_PT_THRESHOLDS = 6
staticprivate

Number of pt Thresholds.

Definition at line 45 of file TrigMuonRoITool.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
initialize
void initialize()
Definition: run_EoverP.cxx:894
skel.it
it
Definition: skel.GENtoEVGEN.py:423
MuCTPI_RDO::BARREL
@ BARREL
Definition: MuCTPI_RDO.h:45
MuCTPI_RDO::FORWARD
@ FORWARD
Definition: MuCTPI_RDO.h:45
TrigMuonRoITool::m_muCTPIKey
SG::ReadHandleKey< MuCTPI_RDO > m_muCTPIKey
Definition: TrigMuonRoITool.h:32
ROIB::MuCTPIRoI
Class for storing the 32-bit muon RoI word.
Definition: MuCTPIRoI.h:39
TrigMuonRoITool::m_muCTPiRobIds
std::vector< uint32_t > m_muCTPiRobIds
vectors with muCTPi ROB Ids to retrieve
Definition: TrigMuonRoITool.h:42
TrigMuonRoITool::m_daqMuCTPiROBid
IntegerProperty m_daqMuCTPiROBid
Source identifiers for ROB fragments.
Definition: TrigMuonRoITool.h:39
MuCTPI_DataWord_Decoder::dumpData
void dumpData() const
Function dumping the stored information to the message stream.
Definition: MuCTPI_DataWord_Decoder.cxx:204
MuCTPI_RDO::ENDCAP
@ ENDCAP
Definition: MuCTPI_RDO.h:45
OFFLINE_FRAGMENTS_NAMESPACE::PointerType
const DataType * PointerType
Definition: RawEvent.h:25
MuCTPI_RDO::candidateMultiplicity
uint32_t candidateMultiplicity() const
Function returning the candidate multiplicity for the triggered bunch crossing.
Definition: MuCTPI_RDO.h:106
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
lumiFormat.i
int i
Definition: lumiFormat.py:92
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TrigMuonRoITool::mirodToRoIBDataWord
uint32_t mirodToRoIBDataWord(uint32_t data_word) const
Helper for converting a mirod DAQ data word to a muCTPi RoIB data word.
Definition: TrigMuonRoITool.cxx:213
TrigMuonRoITool::m_robDataProviderSvc
IIROBDataProviderSvc_t m_robDataProviderSvc
Reference to the ROBDataProviderSvc service.
Definition: TrigMuonRoITool.h:36
MuCTPI_MultiplicityWord_Decoder
Class helping to decode the MuCTPI multiplicity words.
Definition: MuCTPI_MultiplicityWord_Decoder.h:32
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
MuCTPI_MultiplicityWord_Decoder::getNCandidates
uint16_t getNCandidates() const
Function returning the total number of muon candidates.
Definition: MuCTPI_MultiplicityWord_Decoder.cxx:42
bcId
uint16_t bcId(uint32_t data)
Definition: TgcByteStreamData.h:329
MuCTPI_MultiplicityWord_Decoder::dumpData
void dumpData() const
Function dumping the stored information to the message stream.
Definition: MuCTPI_MultiplicityWord_Decoder.cxx:88
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
MuCTPI_DataWord_Decoder
Class helping to decode the MuCTPI data words.
Definition: MuCTPI_DataWord_Decoder.h:37
MuCTPI_RDO
Class representing the readout data of the MuCTPI hardware and simulation.
Definition: MuCTPI_RDO.h:41
TrigMuonRoITool::m_decodeMuCTPiFromROB
bool m_decodeMuCTPiFromROB
Configurable to decide how to decode muCTPi.
Definition: TrigMuonRoITool.h:54
lumiFormat.fill
fill
Definition: lumiFormat.py:111
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DEBUG
#define DEBUG
Definition: page_access.h:11
TriggerTest.rois
rois
Definition: TriggerTest.py:23
MuCTPI_MultiplicityWord_Decoder::getBCID
uint16_t getBCID() const
Function returning the 3-bit BCID fragment in the multiplicity word.
Definition: MuCTPI_MultiplicityWord_Decoder.cxx:78
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
merge.status
status
Definition: merge.py:17
TrigMuonRoITool::dumpRoIBDataWord
void dumpRoIBDataWord(uint32_t data_word) const
Helper to print contents of a muCTPi RoIB data word.
Definition: TrigMuonRoITool.cxx:219
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
MuCTPI_RDO::dataWord
const std::vector< uint32_t > & dataWord() const
Function returning the muon candidate data words.
Definition: MuCTPI_RDO.h:141