ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TileCalorimeter
TileRecAlgs
src
TileMuonReceiverReadCnt.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
//*****************************************************************************
6
// Filename : TileMuonReceiverReadCnt.cxx
7
// Author : Joao Gentil Saraiva <jmendes@cern.ch>
8
// Created : April 2014
9
//
10
// DESCRIPTION:
11
// To read three containers of the TileContainer type used for Tile-d project
12
//
13
// TileMuonReceiverContainer "TileMuRcvCnt"
14
// TileRawChannelContainer "MuRcvRawChannel"
15
// TileDigitsContainer "MuRcvDigits"
16
//
17
// HISTORY:
18
//
19
// BUGS:
20
//
21
//*****************************************************************************
22
23
// Tile includes
24
//#include "TileEvent/TileContainer.h"
25
#include "
TileMuonReceiverReadCnt.h
"
26
27
// Calo includes
28
#include "
CaloIdentifier/TileID.h
"
29
#include "
TileIdentifier/TileHWID.h
"
30
31
// Atlas includes
32
#include "
StoreGate/ReadHandle.h
"
33
#include "
AthenaKernel/errorcheck.h
"
34
35
// Gaudi includes
36
#include "GaudiKernel/ISvcLocator.h"
37
38
//C++ STL includes
39
#include <vector>
40
#include <algorithm>
41
42
using namespace
std
;
43
44
//==========================================================================
45
// TileMuonReceiverReadCnt's implementations
46
//==========================================================================
47
48
// Constructor
49
TileMuonReceiverReadCnt::TileMuonReceiverReadCnt
(
const
std::string& name, ISvcLocator* pSvcLocator)
50
:
AthAlgorithm
(name, pSvcLocator)
51
{
52
}
53
54
TileMuonReceiverReadCnt::~TileMuonReceiverReadCnt
() {
55
}
56
57
// Alg standard interfacw function
58
StatusCode
TileMuonReceiverReadCnt::initialize
() {
59
60
// retrieve TileID helper from det store
61
CHECK
(
detStore
()->retrieve(
m_tileID
) );
62
CHECK
(
detStore
()->retrieve(
m_tileHWID
) );
63
64
ATH_CHECK
(
m_digitsContainerKey
.initialize() );
65
ATH_CHECK
(
m_rawChannelContainerKey
.initialize() );
66
ATH_CHECK
(
m_muonReceiverContainerKey
.initialize() );
67
68
ATH_MSG_INFO
(
"TileMuonReceiverReadCnt initialization completed"
);
69
70
return
StatusCode::SUCCESS;
71
}
72
73
StatusCode
TileMuonReceiverReadCnt::execute
(
const
EventContext& ctx) {
74
75
// step1: read the tile muon receiver container from TES
76
//
77
SG::ReadHandle<TileMuonReceiverContainer>
muonReceiverContainer(
m_muonReceiverContainerKey
, ctx);
78
if
(muonReceiverContainer.
isValid
()) {
79
80
ATH_MSG_INFO
(
"Reading the TileMuRcvContainer: "
<<
m_muonReceiverContainerKey
.key());
81
82
// step2: check the number of entries that should be 128 per event
83
//
84
int
nentries = muonReceiverContainer->size();
85
ATH_MSG_INFO
(
"--- The number of container elements in "
<<
m_muonReceiverContainerKey
.key() <<
" is "
<< nentries );
86
87
// step3: check container contents
88
//
89
90
for
(
const
TileMuonReceiverObj
* muonReceiverObj : *muonReceiverContainer) {
91
92
int
id
= muonReceiverObj->GetID() & 0xFFF;
93
ATH_MSG_INFO
(
"+-- Identifier of module: 0x"
<<MSG::hex<<
id
<<MSG::dec<<
" ros:"
<< (
id
>>8) <<
" module:"
<< (
id
&0xFF));
94
95
// -- read thresholds
96
const
std::vector<float> & thresh = muonReceiverObj->GetThresholds();
97
if
(thresh.size()>=4)
98
ATH_MSG_INFO
(
"--- thresholds' vector size : "
<< thresh.size() <<
" value: "
<< thresh[0] <<
" "
<< thresh[1] <<
" "
<< thresh[2] <<
" "
<< thresh[3] );
99
else
100
ATH_MSG_DEBUG
(
"--- thresholds' vector size : "
<< thresh.size() );
101
102
// -- read energy
103
const
std::vector<float> & ene = muonReceiverObj->GetEne();
104
if
(ene.size()==2)
105
ATH_MSG_INFO
(
"--- energy vector size : "
<< ene.size() <<
" value: "
<< ene[0] <<
" "
<< ene[1] );
106
else
107
ATH_MSG_DEBUG
(
"--- energy vector size : "
<< ene.size() );
108
109
// -- read time
110
const
std::vector<float> & time = muonReceiverObj->GetTime();
111
if
(time.size()>=2)
112
ATH_MSG_INFO
(
"--- time vector size : "
<< time.size() <<
" value: "
<< time[0] <<
" "
<< time[1] );
113
else
114
ATH_MSG_DEBUG
(
"--- time vector size : "
<< time.size() );
115
116
// -- read decision
117
const
std::vector<bool> & decision = muonReceiverObj->GetDecision();
118
if
(decision.size()>=4)
119
ATH_MSG_INFO
(
"--- decision vector size : "
<< decision.size()
120
<<
" value: "
<< decision[0] <<
" "
<< decision[1] <<
" "
<< decision[2] <<
" "
<< decision[3] );
121
else
122
ATH_MSG_DEBUG
(
"--- decision vector size : "
<< decision.size() );
123
}
124
}
else
{
125
ATH_MSG_INFO
(
"Container "
<<
m_muonReceiverContainerKey
.key() <<
" not found"
) ;
126
}
127
128
SG::ReadHandle<TileRawChannelContainer>
rawChannelContainer(
m_rawChannelContainerKey
, ctx);
129
if
(rawChannelContainer.isValid()) {
130
131
const
float
TMDB_AMPLITUDE_FACTOR = 1.0;
132
133
ATH_MSG_INFO
(
"Reading the TileRawChannelContainer: "
<<
m_rawChannelContainerKey
.key());
134
135
for
(
const
TileRawChannelCollection
* rawChannelCollection : *rawChannelContainer) {
136
137
for
(
const
TileRawChannel
* rawChannel : *rawChannelCollection) {
138
int
frag_id = rawChannelCollection->identify();
139
int
ros=frag_id>>8;
140
int
drawer=(frag_id&0xFF);
141
142
HWIdentifier
hwid = rawChannel->adc_HWID() ;
143
int
channel =
m_tileHWID
->channel(hwid) ;
144
ATH_MSG_INFO
(
"+-- hwid : "
<<
m_tileHWID
->to_string(hwid,-1)) ;
145
ATH_MSG_INFO
(
"---- channel: "
<< channel
146
<<
" ros: "
<< ros
147
<<
" drawer: "
<< drawer
148
<<
" E[MeV]: "
<< lround(rawChannel->amplitude()*TMDB_AMPLITUDE_FACTOR));
149
}
150
}
151
}
else
{
152
ATH_MSG_INFO
(
"Container "
<<
m_rawChannelContainerKey
.key() <<
" not found"
) ;
153
}
154
155
SG::ReadHandle<TileDigitsContainer>
digitsContainer(
m_digitsContainerKey
, ctx);
156
if
(digitsContainer.
isValid
()) {
157
158
ATH_MSG_INFO
(
"Reading the TileDigitsContainer: "
<<
m_digitsContainerKey
.key());
159
160
for
(
const
TileDigitsCollection
* digitsCollection : *digitsContainer) {
161
162
for
(
const
TileDigits
* tile_digits : *digitsCollection) {
163
164
int
frag_id = digitsCollection->identify();
165
int
ros=frag_id>>8;
166
int
drawer=(frag_id&0xFF);
167
168
HWIdentifier
hwid = tile_digits->adc_HWID() ;
169
int
channel =
m_tileHWID
->channel(hwid) ;
170
ATH_MSG_INFO
(
"+-- hwid : "
<<
m_tileHWID
->to_string(hwid,-1)) ;
171
ATH_MSG_INFO
(
"---- channel : "
<< channel <<
" ros: "
<< ros <<
" drawer: "
<< drawer);
172
const
std::vector<float> digits = tile_digits->samples();
173
for
(
uint
ismp=0;ismp<digits.size();ismp++)
174
ATH_MSG_INFO
(
"----- sample "
<< ismp <<
": "
<< digits.at(ismp));
175
}
176
}
177
}
else
{
178
ATH_MSG_INFO
(
"Container "
<<
m_digitsContainerKey
.key() <<
" not found"
) ;
179
}
180
181
// Execution completed.
182
ATH_MSG_INFO
(
"TileMuonReceiverReadCnt execution completed successfully"
);
183
184
return
StatusCode::SUCCESS;
185
}
186
187
StatusCode
TileMuonReceiverReadCnt::finalize
() {
188
189
ATH_MSG_INFO
(
"TileMuonReceiverReadCnt::finalize()"
);
190
191
return
StatusCode::SUCCESS;
192
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
uint
unsigned int uint
Definition
LArOFPhaseFill.cxx:19
ReadHandle.h
Handle class for reading from StoreGate.
TileHWID.h
TileID.h
TileMuonReceiverReadCnt.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
HWIdentifier
Definition
HWIdentifier.h:13
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:66
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TileDigitsCollection
Definition
TileDigitsCollection.h:18
TileDigits
Definition
TileDigits.h:30
TileMuonReceiverObj
Definition
TileMuonReceiverObj.h:28
TileMuonReceiverReadCnt::m_tileID
const TileID * m_tileID
Definition
TileMuonReceiverReadCnt.h:69
TileMuonReceiverReadCnt::m_muonReceiverContainerKey
SG::ReadHandleKey< TileMuonReceiverContainer > m_muonReceiverContainerKey
Definition
TileMuonReceiverReadCnt.h:63
TileMuonReceiverReadCnt::~TileMuonReceiverReadCnt
virtual ~TileMuonReceiverReadCnt()
Definition
TileMuonReceiverReadCnt.cxx:54
TileMuonReceiverReadCnt::m_tileHWID
const TileHWID * m_tileHWID
Definition
TileMuonReceiverReadCnt.h:70
TileMuonReceiverReadCnt::finalize
StatusCode finalize()
Definition
TileMuonReceiverReadCnt.cxx:187
TileMuonReceiverReadCnt::m_rawChannelContainerKey
SG::ReadHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
Definition
TileMuonReceiverReadCnt.h:59
TileMuonReceiverReadCnt::execute
StatusCode execute(const EventContext &ctx)
Execute method.
Definition
TileMuonReceiverReadCnt.cxx:73
TileMuonReceiverReadCnt::m_digitsContainerKey
SG::ReadHandleKey< TileDigitsContainer > m_digitsContainerKey
Definition
TileMuonReceiverReadCnt.h:56
TileMuonReceiverReadCnt::initialize
StatusCode initialize()
Definition
TileMuonReceiverReadCnt.cxx:58
TileMuonReceiverReadCnt::TileMuonReceiverReadCnt
TileMuonReceiverReadCnt(const std::string &name, ISvcLocator *pSvcLocator)
Definition
TileMuonReceiverReadCnt.cxx:49
TileRawChannelCollection
Definition
TileRawChannelCollection.h:12
TileRawChannel
Definition
TileRawChannel.h:35
std
STL namespace.
Generated on
for ATLAS Offline Software by
1.17.0