ATLAS Offline Software
Loading...
Searching...
No Matches
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"
26
27// Calo includes
30
31// Atlas includes
34
35// Gaudi includes
36#include "GaudiKernel/ISvcLocator.h"
37
38//C++ STL includes
39#include <vector>
40#include <algorithm>
41
42using namespace std;
43
44//==========================================================================
45// TileMuonReceiverReadCnt's implementations
46//==========================================================================
47
48// Constructor
49TileMuonReceiverReadCnt::TileMuonReceiverReadCnt(const std::string& name, ISvcLocator* pSvcLocator)
50 : AthAlgorithm(name, pSvcLocator)
51{
52}
53
56
57// Alg standard interfacw function
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() );
67
68 ATH_MSG_INFO( "TileMuonReceiverReadCnt initialization completed" );
69
70 return StatusCode::SUCCESS;
71}
72
73StatusCode TileMuonReceiverReadCnt::execute(const EventContext& ctx) {
74
75 // step1: read the tile muon receiver container from TES
76 //
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
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
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
188
189 ATH_MSG_INFO( "TileMuonReceiverReadCnt::finalize()" );
190
191 return StatusCode::SUCCESS;
192}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_INFO(x,...)
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
unsigned int uint
Handle class for reading from StoreGate.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
const ServiceHandle< StoreGateSvc > & detStore() const
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::ReadHandleKey< TileMuonReceiverContainer > m_muonReceiverContainerKey
SG::ReadHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
StatusCode execute(const EventContext &ctx)
Execute method.
SG::ReadHandleKey< TileDigitsContainer > m_digitsContainerKey
TileMuonReceiverReadCnt(const std::string &name, ISvcLocator *pSvcLocator)
STL namespace.