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-2021 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
,
m_tileID
(0)
52
,
m_tileHWID
(0)
53
{
54
}
55
56
TileMuonReceiverReadCnt::~TileMuonReceiverReadCnt
() {
57
}
58
59
// Alg standard interfacw function
60
StatusCode
TileMuonReceiverReadCnt::initialize
() {
61
62
// retrieve TileID helper from det store
63
CHECK
(
detStore
()->retrieve(
m_tileID
) );
64
CHECK
(
detStore
()->retrieve(
m_tileHWID
) );
65
66
ATH_CHECK
(
m_digitsContainerKey
.initialize() );
67
ATH_CHECK
(
m_rawChannelContainerKey
.initialize() );
68
ATH_CHECK
(
m_muonReceiverContainerKey
.initialize() );
69
70
ATH_MSG_INFO
(
"TileMuonReceiverReadCnt initialization completed"
);
71
72
return
StatusCode::SUCCESS;
73
}
74
75
StatusCode
TileMuonReceiverReadCnt::execute
(
const
EventContext& ctx) {
76
77
// step1: read the tile muon receiver container from TES
78
//
79
SG::ReadHandle<TileMuonReceiverContainer>
muonReceiverContainer(
m_muonReceiverContainerKey
, ctx);
80
if
(muonReceiverContainer.
isValid
()) {
81
82
ATH_MSG_INFO
(
"Reading the TileMuRcvContainer: "
<<
m_muonReceiverContainerKey
.key());
83
84
// step2: check the number of entries that should be 128 per event
85
//
86
int
nentries = muonReceiverContainer->size();
87
ATH_MSG_INFO
(
"--- The number of container elements in "
<<
m_muonReceiverContainerKey
.key() <<
" is "
<< nentries );
88
89
// step3: check container contents
90
//
91
92
for
(
const
TileMuonReceiverObj
* muonReceiverObj : *muonReceiverContainer) {
93
94
int
id
= muonReceiverObj->GetID() & 0xFFF;
95
ATH_MSG_INFO
(
"+-- Identifier of module: 0x"
<<MSG::hex<<
id
<<MSG::dec<<
" ros:"
<< (
id
>>8) <<
" module:"
<< (
id
&0xFF));
96
97
// -- read thresholds
98
const
std::vector<float> & thresh = muonReceiverObj->GetThresholds();
99
if
(thresh.size()>=4)
100
ATH_MSG_INFO
(
"--- thresholds' vector size : "
<< thresh.size() <<
" value: "
<< thresh[0] <<
" "
<< thresh[1] <<
" "
<< thresh[2] <<
" "
<< thresh[3] );
101
else
102
ATH_MSG_DEBUG
(
"--- thresholds' vector size : "
<< thresh.size() );
103
104
// -- read energy
105
const
std::vector<float> & ene = muonReceiverObj->GetEne();
106
if
(ene.size()==2)
107
ATH_MSG_INFO
(
"--- energy vector size : "
<< ene.size() <<
" value: "
<< ene[0] <<
" "
<< ene[1] );
108
else
109
ATH_MSG_DEBUG
(
"--- energy vector size : "
<< ene.size() );
110
111
// -- read time
112
const
std::vector<float> & time = muonReceiverObj->GetTime();
113
if
(time.size()>=2)
114
ATH_MSG_INFO
(
"--- time vector size : "
<< time.size() <<
" value: "
<< time[0] <<
" "
<< time[1] );
115
else
116
ATH_MSG_DEBUG
(
"--- time vector size : "
<< time.size() );
117
118
// -- read decision
119
const
std::vector<bool> & decision = muonReceiverObj->GetDecision();
120
if
(decision.size()>=4)
121
ATH_MSG_INFO
(
"--- decision vector size : "
<< decision.size()
122
<<
" value: "
<< decision[0] <<
" "
<< decision[1] <<
" "
<< decision[2] <<
" "
<< decision[3] );
123
else
124
ATH_MSG_DEBUG
(
"--- decision vector size : "
<< decision.size() );
125
}
126
}
else
{
127
ATH_MSG_INFO
(
"Container "
<<
m_muonReceiverContainerKey
.key() <<
" not found"
) ;
128
}
129
130
SG::ReadHandle<TileRawChannelContainer>
rawChannelContainer(
m_rawChannelContainerKey
, ctx);
131
if
(rawChannelContainer.isValid()) {
132
133
const
float
TMDB_AMPLITUDE_FACTOR = 1.0;
134
135
ATH_MSG_INFO
(
"Reading the TileRawChannelContainer: "
<<
m_rawChannelContainerKey
.key());
136
137
for
(
const
TileRawChannelCollection
* rawChannelCollection : *rawChannelContainer) {
138
139
for
(
const
TileRawChannel
* rawChannel : *rawChannelCollection) {
140
int
frag_id = rawChannelCollection->identify();
141
int
ros=frag_id>>8;
142
int
drawer=(frag_id&0xFF);
143
144
HWIdentifier
hwid = rawChannel->adc_HWID() ;
145
int
channel =
m_tileHWID
->channel(hwid) ;
146
ATH_MSG_INFO
(
"+-- hwid : "
<<
m_tileHWID
->to_string(hwid,-1)) ;
147
ATH_MSG_INFO
(
"---- channel: "
<< channel
148
<<
" ros: "
<< ros
149
<<
" drawer: "
<< drawer
150
<<
" E[MeV]: "
<< lround(rawChannel->amplitude()*TMDB_AMPLITUDE_FACTOR));
151
}
152
}
153
}
else
{
154
ATH_MSG_INFO
(
"Container "
<<
m_rawChannelContainerKey
.key() <<
" not found"
) ;
155
}
156
157
SG::ReadHandle<TileDigitsContainer>
digitsContainer(
m_digitsContainerKey
, ctx);
158
if
(digitsContainer.
isValid
()) {
159
160
ATH_MSG_INFO
(
"Reading the TileDigitsContainer: "
<<
m_digitsContainerKey
.key());
161
162
for
(
const
TileDigitsCollection
* digitsCollection : *digitsContainer) {
163
164
for
(
const
TileDigits
* tile_digits : *digitsCollection) {
165
166
int
frag_id = digitsCollection->identify();
167
int
ros=frag_id>>8;
168
int
drawer=(frag_id&0xFF);
169
170
HWIdentifier
hwid = tile_digits->adc_HWID() ;
171
int
channel =
m_tileHWID
->channel(hwid) ;
172
ATH_MSG_INFO
(
"+-- hwid : "
<<
m_tileHWID
->to_string(hwid,-1)) ;
173
ATH_MSG_INFO
(
"---- channel : "
<< channel <<
" ros: "
<< ros <<
" drawer: "
<< drawer);
174
const
std::vector<float> digits = tile_digits->samples();
175
for
(
uint
ismp=0;ismp<digits.size();ismp++)
176
ATH_MSG_INFO
(
"----- sample "
<< ismp <<
": "
<< digits.at(ismp));
177
}
178
}
179
}
else
{
180
ATH_MSG_INFO
(
"Container "
<<
m_digitsContainerKey
.key() <<
" not found"
) ;
181
}
182
183
// Execution completed.
184
ATH_MSG_INFO
(
"TileMuonReceiverReadCnt execution completed successfully"
);
185
186
return
StatusCode::SUCCESS;
187
}
188
189
StatusCode
TileMuonReceiverReadCnt::finalize
() {
190
191
ATH_MSG_INFO
(
"TileMuonReceiverReadCnt::finalize()"
);
192
193
return
StatusCode::SUCCESS;
194
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
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:67
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:56
TileMuonReceiverReadCnt::m_tileHWID
const TileHWID * m_tileHWID
Definition
TileMuonReceiverReadCnt.h:70
TileMuonReceiverReadCnt::finalize
StatusCode finalize()
Definition
TileMuonReceiverReadCnt.cxx:189
TileMuonReceiverReadCnt::m_rawChannelContainerKey
SG::ReadHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
Definition
TileMuonReceiverReadCnt.h:59
TileMuonReceiverReadCnt::execute
StatusCode execute(const EventContext &ctx)
Execute method.
Definition
TileMuonReceiverReadCnt.cxx:75
TileMuonReceiverReadCnt::m_digitsContainerKey
SG::ReadHandleKey< TileDigitsContainer > m_digitsContainerKey
Definition
TileMuonReceiverReadCnt.h:56
TileMuonReceiverReadCnt::initialize
StatusCode initialize()
Definition
TileMuonReceiverReadCnt.cxx:60
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