ATLAS Offline Software
Loading...
Searching...
No Matches
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"
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 , m_tileID(0)
52 , m_tileHWID(0)
53{
54}
55
58
59// Alg standard interfacw function
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() );
69
70 ATH_MSG_INFO( "TileMuonReceiverReadCnt initialization completed" );
71
72 return StatusCode::SUCCESS;
73}
74
76
77 // step1: read the tile muon receiver container from TES
78 //
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
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
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
190
191 ATH_MSG_INFO( "TileMuonReceiverReadCnt::finalize()" );
192
193 return StatusCode::SUCCESS;
194}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(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 with parameters:
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
SG::ReadHandleKey< TileDigitsContainer > m_digitsContainerKey
TileMuonReceiverReadCnt(const std::string &name, ISvcLocator *pSvcLocator)
STL namespace.