ATLAS Offline Software
Loading...
Searching...
No Matches
MuCTPI_RDOToRoIBResult.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5// $Id: MuCTPI_RDOToRoIBResult.cxx 275499 2010-01-27 18:25:00Z krasznaa $
6
7// STL include(s):
8#include <iomanip>
9
10// Gaudi/Athena include(s):
12
13// Trigger include(s):
18
19// Local include(s):
21
23 ISvcLocator* pSvcLocator )
24 : AthAlgorithm( name, pSvcLocator ) {
25
26 declareProperty( "MuCTPIInputKey", m_muctpiInputKey = "MUCTPI_RDO" );
27 declareProperty( "RoIBInputKey", m_roibInputKey = "RoIBResult" );
28 declareProperty( "RoIBOutputKey", m_roibOutputKey = "CorrectRoIBResult" );
29}
30
32
33 ATH_MSG_DEBUG( "Executing the MuCTPI RoI fixer algorithm" );
34
35 //
36 // Retrieve the (hopefully) correct MuCTPI_RDO object:
37 //
38 const MuCTPI_RDO* muctpi_rdo = 0;
39 CHECK( evtStore()->retrieve( muctpi_rdo, m_muctpiInputKey ) );
40 ATH_MSG_VERBOSE( "Retrieved the MuCTPI_RDO object with key: "
42
43 //
44 // Retrieve the (muon-wise) wrong RoIBResult object:
45 //
46 const ROIB::RoIBResult* roibresult = 0;
47 CHECK( evtStore()->retrieve( roibresult, m_roibInputKey ) );
48 ATH_MSG_VERBOSE( "Retrieved the old RoIBResult object with key:"
49 << m_roibInputKey );
50
51 // Create the correct RoI vector from the RDO data:
52 ATH_MSG_VERBOSE( "Now creating the correct RoIs..." );
53 std::vector< ROIB::MuCTPIRoI > roi_vector;
54
55 uint32_t bcid = multiplicityBCID( muctpi_rdo->candidateMultiplicity() );
56
57 //
58 // Loop over all "data words" and select the ones that should've been
59 // sent ot LVL2:
60 //
61 std::vector< uint32_t >::const_iterator dword_itr = muctpi_rdo->dataWord().begin();
62 std::vector< uint32_t >::const_iterator dword_end = muctpi_rdo->dataWord().end();
63 for( ; dword_itr != dword_end; ++dword_itr ) {
64
65 // Select which candidates should've gone to LVL2:
66 if( roiBCID( *dword_itr ) != bcid ) continue;
67 if( ! roiAccepted( *dword_itr ) ) continue;
68
69 // Save the candidate:
70 roi_vector.push_back( ROIB::MuCTPIRoI( toRoIWord( *dword_itr ) ) );
71 ATH_MSG_VERBOSE( " - Processed data word: 0x" << std::hex << std::setw( 8 )
72 << std::setfill( '0' ) << *dword_itr );
73 }
74
75 //
76 // Create the new MuCTPI result:
77 //
78 ROIB::MuCTPIResult newResult( ROIB::Header(roibresult->muCTPIResult().header()),
79 ROIB::Trailer(roibresult->muCTPIResult().trailer()),
80 std::move(roi_vector) );
81
82 //
83 // Create and save the new RoIBResult object:
84 //
85 ROIB::RoIBResult* new_roibresult = new ROIB::RoIBResult( std::move(newResult),
86 ROIB::CTPResult(roibresult->cTPResult()),
87 std::vector< ROIB::JetEnergyResult >(roibresult->jetEnergyResult()),
88 std::vector< ROIB::EMTauResult >(roibresult->eMTauResult()) );
89 CHECK( evtStore()->record( new_roibresult, m_roibOutputKey ) );
90 ATH_MSG_VERBOSE( "Saved the fixed RoIBResult object with key: "
91 << m_roibOutputKey );
92
93 return StatusCode::SUCCESS;
94}
95
100uint32_t MuCTPI_RDOToRoIBResult::multiplicityBCID( uint32_t multi_word ) {
101
102 return ( ( multi_word >> 18 ) & 0x7 );
103}
104
109uint32_t MuCTPI_RDOToRoIBResult::toRoIWord( uint32_t data_word ) {
110
111 return ( ( ( data_word & 0x8000000 ) >> 4 ) | ( ( data_word & 0x3fe0000 ) >> 3 ) |
112 ( data_word & 0x3fff ) );
113}
114
119uint32_t MuCTPI_RDOToRoIBResult::roiBCID( uint32_t data_word ) {
120
121 return ( ( data_word >> 14 ) & 0x7 );
122}
123
129bool MuCTPI_RDOToRoIBResult::roiAccepted( uint32_t data_word ) {
130
131 return ( ( data_word >> 26 ) & 0x1 );
132}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::string m_muctpiInputKey
Key of the MuCTPI_RDO object.
static uint32_t toRoIWord(uint32_t data_word)
Transform a data word into an RoI word.
std::string m_roibOutputKey
Key of the new (correct) RoIBResult object.
static uint32_t roiBCID(uint32_t data_word)
Extract the BCID stored in the data word.
MuCTPI_RDOToRoIBResult(const std::string &name, ISvcLocator *pSvcLocator)
Regular algorithm constructor.
virtual StatusCode execute() override
Regular algorithm execure function.
static bool roiAccepted(uint32_t data_word)
Extract whether the candidate was accepted to be sent to LVL2.
std::string m_roibInputKey
Key of the old (incorrect) RoIBResult object.
static uint32_t multiplicityBCID(uint32_t multi_word)
Extract the BCID stored in the multiplicity word.
Class representing the readout data of the MuCTPI hardware and simulation.
Definition MuCTPI_RDO.h:41
const std::vector< uint32_t > & dataWord() const
Function returning the muon candidate data words.
Definition MuCTPI_RDO.h:141
uint32_t candidateMultiplicity() const
Function returning the candidate multiplicity for the triggered bunch crossing.
Definition MuCTPI_RDO.h:106
Class holding the LVL1 CTP result used by the RoIBuilder.
Header models the LVL1 ROD Header.
Class holding the RoIs from the MuCTPI collected by the RoIB.
const Header & header() const
Member function returning the header.
const Trailer & trailer() const
Member function returning the trailer.
Class for storing the 32-bit muon RoI word.
Definition MuCTPIRoI.h:39
Class holding the LVL1 RoIB result build by the RoIBuilder.
Definition RoIBResult.h:47
const std::vector< JetEnergyResult > & jetEnergyResult() const
Gets the jet/energy part of the L1 RDO.
const CTPResult & cTPResult() const
Gets the CTP part of the L1 RDO.
const std::vector< EMTauResult > & eMTauResult() const
Gets the egamma part of the L1 RDO.
const MuCTPIResult & muCTPIResult() const
Gets the MuCTPI part of the L1 RDO.
ROIB::Trailer models the LVL1 ROD Trailer.
Definition Trailer.h:37