ATLAS Offline Software
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):
17 #include "TrigT1Result/MuCTPIRoI.h"
18 
19 // Local include(s):
20 #include "MuCTPI_RDOToRoIBResult.h"
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: "
41  << m_muctpiInputKey );
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 
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 
101 
102  return ( ( multi_word >> 18 ) & 0x7 );
103 }
104 
110 
111  return ( ( ( data_word & 0x8000000 ) >> 4 ) | ( ( data_word & 0x3fe0000 ) >> 3 ) |
112  ( data_word & 0x3fff ) );
113 }
114 
120 
121  return ( ( data_word >> 14 ) & 0x7 );
122 }
123 
130 
131  return ( ( data_word >> 26 ) & 0x1 );
132 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
MuCTPI_RDOToRoIBResult::execute
virtual StatusCode execute() override
Regular algorithm execure function.
Definition: MuCTPI_RDOToRoIBResult.cxx:31
MuCTPI_RDOToRoIBResult::m_roibInputKey
std::string m_roibInputKey
Key of the old (incorrect) RoIBResult object.
Definition: MuCTPI_RDOToRoIBResult.h:47
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
MuCTPI_RDOToRoIBResult::m_muctpiInputKey
std::string m_muctpiInputKey
Key of the MuCTPI_RDO object.
Definition: MuCTPI_RDOToRoIBResult.h:46
MuCTPI_RDOToRoIBResult::toRoIWord
static uint32_t toRoIWord(uint32_t data_word)
Transform a data word into an RoI word.
Definition: MuCTPI_RDOToRoIBResult.cxx:109
MuCTPI_RDOToRoIBResult::roiAccepted
static bool roiAccepted(uint32_t data_word)
Extract whether the candidate was accepted to be sent to LVL2.
Definition: MuCTPI_RDOToRoIBResult.cxx:129
MuCTPIRoI.h
ROIB::RoIBResult
Class holding the LVL1 RoIB result build by the RoIBuilder.
Definition: RoIBResult.h:47
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
RoIBResult.h
ROIB::RoIBResult::jetEnergyResult
const std::vector< JetEnergyResult > & jetEnergyResult() const
Gets the jet/energy part of the L1 RDO.
Definition: RoIBResult.cxx:64
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
MuCTPI_RDOToRoIBResult::m_roibOutputKey
std::string m_roibOutputKey
Key of the new (correct) RoIBResult object.
Definition: MuCTPI_RDOToRoIBResult.h:48
ROIB::RoIBResult::eMTauResult
const std::vector< EMTauResult > & eMTauResult() const
Gets the egamma part of the L1 RDO.
Definition: RoIBResult.cxx:68
ROIB::MuCTPIResult::header
const Header & header() const
Member function returning the header.
Definition: MuCTPIResult.cxx:51
ROIB::MuCTPIRoI
Class for storing the 32-bit muon RoI word.
Definition: MuCTPIRoI.h:39
ROIB::CTPResult
Class holding the LVL1 CTP result used by the RoIBuilder.
Definition: CTPResult.h:52
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
MuCTPI_RDOToRoIBResult::roiBCID
static uint32_t roiBCID(uint32_t data_word)
Extract the BCID stored in the data word.
Definition: MuCTPI_RDOToRoIBResult.cxx:119
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
MuCTPI_RDO::candidateMultiplicity
uint32_t candidateMultiplicity() const
Function returning the candidate multiplicity for the triggered bunch crossing.
Definition: MuCTPI_RDO.h:106
MuCTPI_RDOToRoIBResult::multiplicityBCID
static uint32_t multiplicityBCID(uint32_t multi_word)
Extract the BCID stored in the multiplicity word.
Definition: MuCTPI_RDOToRoIBResult.cxx:100
ROIB::MuCTPIResult::trailer
const Trailer & trailer() const
Member function returning the trailer.
Definition: MuCTPIResult.cxx:60
ROIB::Header
Header models the LVL1 ROD Header.
Definition: TrigT1Result/TrigT1Result/Header.h:37
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
AthAlgorithm
Definition: AthAlgorithm.h:47
ROIB::MuCTPIResult
Class holding the RoIs from the MuCTPI collected by the RoIB.
Definition: MuCTPIResult.h:44
ROIB::RoIBResult::cTPResult
const CTPResult & cTPResult() const
Gets the CTP part of the L1 RDO.
Definition: RoIBResult.cxx:60
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
errorcheck.h
Helpers for checking error return status codes and reporting errors.
ROIB::Trailer
ROIB::Trailer models the LVL1 ROD Trailer.
Definition: Trailer.h:37
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
MuCTPI_RDO.h
MuCTPI_RDO
Class representing the readout data of the MuCTPI hardware and simulation.
Definition: MuCTPI_RDO.h:41
MuCTPIResult.h
MuCTPI_RDOToRoIBResult.h
ROIB::RoIBResult::muCTPIResult
const MuCTPIResult & muCTPIResult() const
Gets the MuCTPI part of the L1 RDO.
Definition: RoIBResult.cxx:56
MuCTPI_RDOToRoIBResult::MuCTPI_RDOToRoIBResult
MuCTPI_RDOToRoIBResult(const std::string &name, ISvcLocator *pSvcLocator)
Regular algorithm constructor.
Definition: MuCTPI_RDOToRoIBResult.cxx:22
MuCTPI_RDO::dataWord
const std::vector< uint32_t > & dataWord() const
Function returning the muon candidate data words.
Definition: MuCTPI_RDO.h:141