ATLAS Offline Software
TileRawChannelToL2.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //*****************************************************************************
6 // Filename : TileRawChannelToL2.cxx
7 // Author : Aranzazu Ruiz
8 // Created : February, 2007
9 //
10 // DESCRIPTION:
11 // Created to emulate the algorithms processed at the TileCal ROD DSP level
12 // to contribute to the LVL2 trigger: a low Pt muon tagging algorithm based
13 // on the typical muon energy deposition in each cell of TileCal following
14 // projective patterns and the Et calculation per superdrawer.
15 // It takes as input the TileRawChannelContainer. The resulting TileL2 objects
16 // store the information about the number of muons tagged, their coordinates
17 // eta and phi, the energy deposited in Tile, a quality factor and the Et
18 // per superdrawer. There is a TileL2 object per superdrawer, stored in a
19 // TileL2Container in StoreGate.
20 //
21 // HISTORY:
22 //
23 // BUGS:
24 //
25 //*****************************************************************************
26 
27 // Tile includes
29 #include "TileEvent/TileL2.h"
31 
32 // Athena includes
34 #include "StoreGate/WriteHandle.h"
35 
36 
37 #include <memory>
38 
39 TileRawChannelToL2::TileRawChannelToL2(const std::string& name, ISvcLocator* pSvcLocator)
40  : AthReentrantAlgorithm(name, pSvcLocator)
41 {
42 }
43 
45 }
46 
48 
49  CHECK( m_tileL2Builder.retrieve() );
50 
51  ATH_CHECK( m_l2ContainerKey.initialize() );
52 
53  ATH_MSG_DEBUG( "TileRawChannelToL2 initialization completed" );
54 
55  return StatusCode::SUCCESS;
56 }
57 
58 StatusCode TileRawChannelToL2::execute(const EventContext& ctx) const {
59 
61  ATH_CHECK( l2Container.record(std::make_unique<TileL2Container>()) );
62 
63  ATH_MSG_VERBOSE( "TileL2 container registered to the TES with name " << m_l2ContainerKey.key() );
64 
65  l2Container->reserve(256);
66  for (int i = 0; i < 256; i++) {
67  int collId = m_tileL2Builder->indexToId(i);
68  std::unique_ptr<TileL2> l2 = std::make_unique<TileL2>(collId);
69  l2Container->push_back(l2.release());
70  }
71 
72  // TileL2Builder is called
73  ATH_CHECK( m_tileL2Builder->process(0, 0xFFFF, l2Container.ptr(), ctx) );
74 
75  // Debug
76  if (msgLvl(MSG::VERBOSE)) {
77 
78  for (const TileL2* l2 : *l2Container) {
79 
80  msg(MSG::VERBOSE) << "frag ID = 0x" << MSG::hex << l2->identify() << MSG::dec
81  << " phi = " << l2->phi(0)
82  << " Et = " << l2->Et() << endmsg;
83 
84  for (unsigned int i = 0; i < l2->NMuons(); ++i) {
85  msg(MSG::VERBOSE) << "Muon found:"
86  << " frag ID = 0x" << MSG::hex << l2->identify()
87  << " word1 = 0x" << l2->val(2 * i)
88  << " word2 = 0x" << l2->val(2 * i + 1) << MSG::dec
89  << " eta = " << l2->eta(i)
90  << " phi = " << l2->phi(i) << endmsg;
91 
92  msg(MSG::VERBOSE) << "Muon found:"
93  << " E[0] = " << l2->enemu0(i) << " MeV"
94  << " E[1] = " << l2->enemu1(i) << " MeV"
95  << " E[2] = " << l2->enemu2(i) << " MeV"
96  << " QF = " << l2->qual(i) << endmsg;
97 
98  }
99  }
100  }
101 
102 
103 
104  // Execution completed
105  ATH_MSG_DEBUG( "TileRawChannelToL2 execution completed" );
106 
107  return StatusCode::SUCCESS;
108 }
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
TileRawChannelToL2::TileRawChannelToL2
TileRawChannelToL2(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: TileRawChannelToL2.cxx:39
TileRawChannelToL2::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: TileRawChannelToL2.cxx:58
TileRawChannelToL2::m_l2ContainerKey
SG::WriteHandleKey< TileL2Container > m_l2ContainerKey
TileL2Container in detector store.
Definition: TileRawChannelToL2.h:69
AthCommonMsg< Gaudi::Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
TileL2Builder.h
WriteHandle.h
Handle class for recording to StoreGate.
skel.l2
l2
Definition: skel.GENtoEVGEN.py:399
lumiFormat.i
int i
Definition: lumiFormat.py:85
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TileL2.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
errorcheck.h
Helpers for checking error return status codes and reporting errors.
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
AthCommonMsg< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
TileRawChannelToL2::~TileRawChannelToL2
virtual ~TileRawChannelToL2()
Destructor.
Definition: TileRawChannelToL2.cxx:44
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
TileL2
Class to store TileMuId and Et quantities computed at the TileCal ROD DSPs.
Definition: TileL2.h:33
TileRawChannelToL2.h
TileRawChannelToL2::initialize
virtual StatusCode initialize() override
Definition: TileRawChannelToL2.cxx:47
TileRawChannelToL2::m_tileL2Builder
ToolHandle< TileL2Builder > m_tileL2Builder
Pointer to TileL2Builder.
Definition: TileRawChannelToL2.h:66