ATLAS Offline Software
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
28 #include "CaloIdentifier/TileID.h"
30 
31 // Atlas includes
32 #include "StoreGate/ReadHandle.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 
57 }
58 
59 // Alg standard interfacw function
61 
62  // retrieve TileID helper from det store
65 
68  ATH_CHECK( m_muonReceiverContainerKey.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 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
TileMuonReceiverReadCnt::finalize
StatusCode finalize()
Definition: TileMuonReceiverReadCnt.cxx:189
TileMuonReceiverReadCnt::initialize
StatusCode initialize()
Definition: TileMuonReceiverReadCnt.cxx:60
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:28
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
physval_make_web_display.thresh
thresh
Definition: physval_make_web_display.py:35
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
TileMuonReceiverReadCnt::TileMuonReceiverReadCnt
TileMuonReceiverReadCnt(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TileMuonReceiverReadCnt.cxx:49
TileMuonReceiverReadCnt::m_tileHWID
const TileHWID * m_tileHWID
Definition: TileMuonReceiverReadCnt.h:70
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
TileMuonReceiverReadCnt::execute
StatusCode execute()
Definition: TileMuonReceiverReadCnt.cxx:75
Example_ReadSampleNoise.drawer
drawer
Definition: Example_ReadSampleNoise.py:39
TileHWID::channel
int channel(const HWIdentifier &id) const
extract channel field from HW identifier
Definition: TileHWID.h:189
TileID.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
TileMuonReceiverReadCnt::m_digitsContainerKey
SG::ReadHandleKey< TileDigitsContainer > m_digitsContainerKey
Definition: TileMuonReceiverReadCnt.h:56
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
PlotCalibFromCool.nentries
nentries
Definition: PlotCalibFromCool.py:798
TileHWID.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TileRawChannel
Definition: TileRawChannel.h:35
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
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
maskDeadModules.ros
ros
Definition: maskDeadModules.py:35
AthAlgorithm
Definition: AthAlgorithm.h:47
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TileMuonReceiverReadCnt::m_rawChannelContainerKey
SG::ReadHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
Definition: TileMuonReceiverReadCnt.h:59
TileMuonReceiverReadCnt::m_tileID
const TileID * m_tileID
Definition: TileMuonReceiverReadCnt.h:69
TileDigitsCollection
Definition: TileDigitsCollection.h:18
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TileDigits
Definition: TileDigits.h:30
errorcheck.h
Helpers for checking error return status codes and reporting errors.
TileRawChannelCollection
Definition: TileRawChannelCollection.h:12
TileMuonReceiverReadCnt.h
TileMuonReceiverReadCnt::m_muonReceiverContainerKey
SG::ReadHandleKey< TileMuonReceiverContainer > m_muonReceiverContainerKey
Definition: TileMuonReceiverReadCnt.h:63
TileMuonReceiverObj
Definition: TileMuonReceiverObj.h:28
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
TileMuonReceiverReadCnt::~TileMuonReceiverReadCnt
virtual ~TileMuonReceiverReadCnt()
Definition: TileMuonReceiverReadCnt.cxx:56
TileAANtupleConfig.rawChannelContainer
rawChannelContainer
Definition: TileAANtupleConfig.py:120
TileHWID::to_string
std::string to_string(const HWIdentifier &id, int level=0) const
extract all fields from HW identifier HWIdentifier get_all_fields ( const HWIdentifier & id,...
Definition: TileHWID.cxx:49
ReadHandle.h
Handle class for reading from StoreGate.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.