ATLAS Offline Software
Loading...
Searching...
No Matches
TileExpertDump.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Athena includes
9
10// Tile includes
11#include "TileExpertDump.h"
19
20
21#include <iomanip>
22
23
25
26TileExpertDump::TileExpertDump(const std::string& name, ISvcLocator* pSvcLocator)
27 : AthAlgorithm(name, pSvcLocator)
29 , m_tileHWID(nullptr)
30 , m_tileInfo(nullptr)
31{
32 declareProperty("PrintExpertEmscale" , m_printExpertEmscale=false ,"Switch on expert calibration chain printout");
33 declareProperty("PrintExpertEmscaleOnl" , m_printExpertEmscaleOnl=false ,"Switch on expert onl calibration chain printout");
34
35 declareProperty("useOflCisFitLin" , m_OflCisFitLin = false, "Use calibration of OflCisFitLin");
36 declareProperty("useOflCisFitNln" , m_OflCisFitNln = false, "Use calibration of OflCisFitNln");
37 declareProperty("useOflLasLin" , m_OflLasLin = false, "Use calibration of OflLasLin");
38 declareProperty("useOflLasNln" , m_OflLasNln = false, "Use calibration of OflLasNln");
39 declareProperty("useOflLasPart" , m_OflLasPart = false, "Use calibration of OflLasPart");
40 declareProperty("useOflCes" , m_OflCes = false, "Use calibration of OflCes");
41 declareProperty("useOflEms" , m_OflEms = false, "Use calibration of OflEms");
42 declareProperty("useOflLasLinPisa", m_OflLasLinPisa = false, "Use calibration of OflLasLinPisa");
43 declareProperty("useOflLasNlnPisa", m_OflLasNlnPisa = false, "Use calibration of OflLasNlnPisa");
44 declareProperty("useOflMinbias" , m_OflMinbias = false, "Use calibration of OflMinbias");
45 declareProperty("useOnlCisLin" , m_OnlCisLin = false, "Use calibration of OnlCisLin");
46 declareProperty("useOnlLasLin" , m_OnlLasLin = false, "Use calibration of OnlLasLin");
47 declareProperty("useOnlCes" , m_OnlCes = false, "Use calibration of OnlCes");
48 declareProperty("useOnlEms" , m_OnlEms = false, "Use calibration of OnlEms");
49 declareProperty("TileInfoName", m_infoName = "TileInfo");
50}
51
52// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
53
56
57// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
59
60 ATH_MSG_DEBUG( "in initialize()" );
61
62 //=== EventInfo key
63 ATH_CHECK( m_eventInfoKey.initialize() );
64
65 //=== Get TileHWID
66 CHECK( detStore()->retrieve(m_tileHWID, "TileHWID") );
67
68 //=== Get Emscale Calib Options for TileExpertToolEmscale
70
71 //=== Get TileExpertToolEmscale and set the options
72 CHECK( m_tileExpertToolEmscale.retrieve() );
73
75
76 //=== Get TileInfo and set max ADC counts
77 CHECK( detStore()->retrieve(m_tileInfo, m_infoName) );
78 m_i_ADCmax = m_tileInfo->ADCmax();
79
80 return StatusCode::SUCCESS;
81}
82
83//
84//___________________________________________________________________________________________
86
92 if(m_OflCes ) m_emExpertOptions.setEmscaleCalibBit(TileEmscaleCalibOptions::OflCes , true );
93 if(m_OflEms ) m_emExpertOptions.setEmscaleCalibBit(TileEmscaleCalibOptions::OflEms , true );
99 if(m_OnlCes ) m_emExpertOptions.setEmscaleCalibBit(TileEmscaleCalibOptions::OnlCes , true );
100 if(m_OnlEms ) m_emExpertOptions.setEmscaleCalibBit(TileEmscaleCalibOptions::OnlEms , true );
101
102 return StatusCode::SUCCESS;
103}
104
105
106//
107//___________________________________________________________________________________________
109
110 ATH_MSG_DEBUG( " in execute()" );
111
113 ATH_CHECK( eventInfo.isValid() );
114
115 ATH_MSG_DEBUG( "Event: ["
116 << eventInfo->runNumber() << ", "
117 << eventInfo->eventNumber() << ", "
118 << eventInfo->lumiBlock() << ": "
119 << eventInfo->timeStamp() << "]" );
120
121
122 //=== print out stuff
125
126 return StatusCode::SUCCESS;
127}
128
129//
130//___________________________________________________________________________________________
132
133 ATH_MSG_DEBUG( "In printExpertEmscale()" );
134
135 for (unsigned int ros = 0; ros < TileCalibUtils::MAX_ROS; ++ros) {
136 unsigned int drawerMax = TileCalibUtils::getMaxDrawer(ros);
137 for (unsigned int drawer = 0; drawer < drawerMax; ++drawer) {
138 unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
139 for (unsigned int channel = 0; channel < TileCalibUtils::MAX_CHAN; ++channel) {
140 for (unsigned int adc = 0; adc < TileCalibUtils::MAX_GAIN; ++adc) {
141
142 msg(MSG::INFO) << ros << "/" << std::setw(2)
143 << drawer << "/" << std::setw(2)
144 << channel << "/"
145 << adc << " : "
146 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
147 << m_tileExpertToolEmscale->doCalibCis(drawerIdx, channel, adc, 1.) << " (CIS) | "
148 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
149 << m_tileExpertToolEmscale->doCalibLas(drawerIdx, channel, 1.) << " (LAS) | "
150 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
151 << m_tileExpertToolEmscale->doCalibCes(drawerIdx, channel, 1.) << " (CES) | "
152 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
153 << m_tileExpertToolEmscale->doCalibEms(drawerIdx, channel, 1.) << " (EMS) | ";
154
155 float chanCalMeV = m_tileExpertToolEmscale->channelCalib(drawerIdx, channel, adc, 1.
158
159 msg(MSG::INFO) << std::fixed << std::right << std::setw(9) << std::setprecision(5)
160 << chanCalMeV << " (total)";
161
162 //=== "Undo" online calibration only if this functionality is available
163 if (m_tileExpertToolEmscale->getOnlCacheUnit() != TileRawChannelUnit::Invalid) {
164 msg(MSG::INFO) << std::fixed << std::right << std::setw(9) << std::setprecision(5)
165 << m_tileExpertToolEmscale->channelCalib(drawerIdx, channel, adc, chanCalMeV
168 << " (onlMev->oflADC)";
169 }
170
171 msg(MSG::INFO) << endmsg;
172
173 } //end adc
174 } //end channel
175 } //end drawer
176 } //end ros
177
178 //===================================================================
179 //=== Perform a CIS energy scan to test CIS LUT
180 //===================================================================
181 ATH_MSG_INFO( "Performing an energy scan to test CIS LUT" );
182
183 unsigned int ros = 1;
184 unsigned int drawer = 0;
185 unsigned int channel = 0;
186 for (unsigned int adc = 0; adc < TileCalibUtils::MAX_GAIN; ++adc) {
187 for (int adcCounts = 0; adcCounts < m_i_ADCmax; ++adcCounts) {
188 double energy = static_cast<float>(adcCounts);
189 ATH_MSG_INFO( ros << "/" << drawer << "/" << channel << "/" << adc << " : "
190 << "ADC counts = " << adcCounts
191 << "\t---> " << m_tileExpertToolEmscale->doCalibCis(20, 0, adc, energy) );
192
193 } //end adcCounts
194 } //end adc
195
196}
197
198//
199//___________________________________________________________________________________________
201
202 ATH_MSG_DEBUG( "In printExpertEmscaleOnl()" );
203
204 for (unsigned int ros = 0; ros < TileCalibUtils::MAX_ROS; ++ros) {
205 unsigned int drawerMax = TileCalibUtils::getMaxDrawer(ros);
206 for (unsigned int drawer = 0; drawer < drawerMax; ++drawer) {
207 unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
208 for (unsigned int channel = 0; channel < TileCalibUtils::MAX_CHAN; ++channel) {
209 for (unsigned int adc = 0; adc < TileCalibUtils::MAX_GAIN; ++adc) {
210
211 msg(MSG::INFO) << ros << "/" << std::setw(2)
212 << drawer << "/" << std::setw(2)
213 << channel << "/"
214 << adc << " : "
215 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
216 << m_tileExpertToolEmscale->doCalibCisOnl(drawerIdx, channel, adc, 1.) << " (ONL_CIS) | "
217 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
218 << m_tileExpertToolEmscale->doCalibLasOnl(drawerIdx, channel, 1.) << " (ONL_LAS) | "
219 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
220 << m_tileExpertToolEmscale->doCalibCesOnl(drawerIdx, channel, 1.) << " (ONL_CES) | "
221 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
222 << m_tileExpertToolEmscale->doCalibEmsOnl(drawerIdx, channel, 1.) << " (ONL_EMS) | ";
223
224 float chanCalMeV = m_tileExpertToolEmscale->channelCalibOnl(drawerIdx, channel, adc, 1.
226
227 msg(MSG::INFO) << std::fixed << std::right << std::setw(9) << std::setprecision(5)
228 << chanCalMeV << " (total)";
229
230 msg(MSG::INFO) << endmsg;
231
232 } //end adc
233 } //end channel
234 } //end drawer
235 } //end ros
236
237}
238
239// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
240
242
243 ATH_MSG_DEBUG( "in finalize()" );
244
245 //=== Dump the emExpertOptions for cross-check
247 ATH_MSG_INFO( "Dumping m_emExpertOptions = " << m_emExpertOptions.getEmscaleCalibOptions() );
248
249 std::ostringstream sout;
250 m_emExpertOptions.dumpEmscaleCalibOptions(sout);
251 ATH_MSG_INFO( sout.str() );
252 }
253
254 return StatusCode::SUCCESS;
255}
#define endmsg
#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.
Handle class for reading from StoreGate.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
MsgStream & msg() const
virtual bool isValid() override final
Can the handle be successfully dereferenced?
static const unsigned int MAX_ROS
Number of ROSs.
static const unsigned int MAX_GAIN
Number of gains per channel.
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
static unsigned int getMaxDrawer(unsigned int ros)
Returns the maximal channel number for a given drawer.
static const unsigned int MAX_CHAN
Number of channels in drawer.
StatusCode finalize()
ToolHandle< TileExpertToolEmscale > m_tileExpertToolEmscale
const TileInfo * m_tileInfo
bool m_printExpertEmscaleOnl
TileEmscaleCalibOptions m_emExpertOptions
std::string m_infoName
const TileHWID * m_tileHWID
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
StatusCode execute()
StatusCode initialize()
TileExpertDump(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode setEmExpertOptions()