ATLAS Offline Software
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
8 #include "StoreGate/ReadHandle.h"
9 
10 // Tile includes
11 #include "TileExpertDump.h"
19 
20 
21 #include <iomanip>
22 
23 
25 
26 TileExpertDump::TileExpertDump(const std::string& name, ISvcLocator* pSvcLocator)
27  : AthAlgorithm(name, pSvcLocator)
28  , m_emExpertOptions(0)
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 
55 }
56 
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
59 
60  ATH_MSG_DEBUG( "in initialize()" );
61 
62  //=== EventInfo key
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
79 
80  return StatusCode::SUCCESS;
81 }
82 
83 //
84 //___________________________________________________________________________________________
86 
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;
251  ATH_MSG_INFO( sout.str() );
252  }
253 
254  return StatusCode::SUCCESS;
255 }
TileExpertDump::m_OflCes
bool m_OflCes
Definition: TileExpertDump.h:55
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
TileExpertDump::m_OflLasPart
bool m_OflLasPart
Definition: TileExpertDump.h:54
TileExpertDump::m_OflCisFitLin
bool m_OflCisFitLin
Definition: TileExpertDump.h:50
TileExpertDump::m_OflLasLinPisa
bool m_OflLasLinPisa
Definition: TileExpertDump.h:57
TileCalibUtils::getMaxDrawer
static unsigned int getMaxDrawer(unsigned int ros)
Returns the maximal channel number for a given drawer.
Definition: TileCalibUtils.cxx:136
TileExpertDump::execute
StatusCode execute()
Definition: TileExpertDump.cxx:108
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:28
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
TileExpertDump::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition: TileExpertDump.h:69
xAOD::EventInfo_v1::eventNumber
uint64_t eventNumber() const
The current event's event number.
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
TileExpertDump::m_OflLasNln
bool m_OflLasNln
Definition: TileExpertDump.h:53
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
TileEmscaleCalibOptions::OnlCes
@ OnlCes
Definition: TileEmscaleCalibOptions.h:40
TileExpertDump::initialize
StatusCode initialize()
Definition: TileExpertDump.cxx:58
TileEmscaleCalibOptions::OnlCisLin
@ OnlCisLin
Definition: TileEmscaleCalibOptions.h:38
TileEmscaleCalibOptions::OflLasLinPisa
@ OflLasLinPisa
Definition: TileEmscaleCalibOptions.h:35
TileExpertDump.h
TileFragHash.h
TileInfo.h
TileCalibUtils.h
TileExpertDump::m_tileExpertToolEmscale
ToolHandle< TileExpertToolEmscale > m_tileExpertToolEmscale
Definition: TileExpertDump.h:73
TileEmscaleCalibOptions::OflCes
@ OflCes
Definition: TileEmscaleCalibOptions.h:33
TileEmscaleCalibOptions::setEmscaleCalibBit
void setEmscaleCalibBit(CalBitPos idx, bool turnOn)
Sets a given EM scale calibration option to the value given by turnOn.
Definition: TileEmscaleCalibOptions.cxx:11
TileExpertDump::m_OflCisFitNln
bool m_OflCisFitNln
Definition: TileExpertDump.h:51
Example_ReadSampleNoise.drawer
drawer
Definition: Example_ReadSampleNoise.py:39
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
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
TileEmscaleCalibOptions::OflEms
@ OflEms
Definition: TileEmscaleCalibOptions.h:34
TileEmscaleCalibOptions::OflLasLin
@ OflLasLin
Definition: TileEmscaleCalibOptions.h:30
TileExpertDump::m_OnlCes
bool m_OnlCes
Definition: TileExpertDump.h:62
TileExpertDump::m_OnlLasLin
bool m_OnlLasLin
Definition: TileExpertDump.h:61
TileEmscaleCalibOptions::dumpEmscaleCalibOptions
void dumpEmscaleCalibOptions(std::ostringstream &stream) const
Dumps the member EM scale calibration options in a human readable form.
Definition: TileEmscaleCalibOptions.cxx:58
TileHWID.h
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
TileExpertDump::setEmExpertOptions
StatusCode setEmExpertOptions()
Definition: TileExpertDump.cxx:85
TileEmscaleCalibOptions::OflCisFitNln
@ OflCisFitNln
Definition: TileEmscaleCalibOptions.h:29
TileExpertDump::TileExpertDump
TileExpertDump(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TileExpertDump.cxx:26
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
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
TileRawChannelUnit::Invalid
@ Invalid
Definition: TileRawChannelUnit.h:26
TileRawChannelUnit::MegaElectronVolts
@ MegaElectronVolts
Definition: TileRawChannelUnit.h:20
TileExpertDump::m_OflMinbias
bool m_OflMinbias
Definition: TileExpertDump.h:59
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TileExpertDump::m_i_ADCmax
int m_i_ADCmax
Definition: TileExpertDump.h:81
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
TileExpertDump::m_emExpertOptions
TileEmscaleCalibOptions m_emExpertOptions
Definition: TileExpertDump.h:49
TileExpertDump::m_printExpertEmscaleOnl
bool m_printExpertEmscaleOnl
Definition: TileExpertDump.h:67
TileEmscaleCalibOptions::OflMinbias
@ OflMinbias
Definition: TileEmscaleCalibOptions.h:37
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
TileCalibUtils::MAX_ROS
static const unsigned int MAX_ROS
Number of ROSs
Definition: TileCalibUtils.h:138
TileExpertDump::m_OnlCisLin
bool m_OnlCisLin
Definition: TileExpertDump.h:60
maskDeadModules.ros
ros
Definition: maskDeadModules.py:35
TileEmscaleCalibOptions::OnlLasLin
@ OnlLasLin
Definition: TileEmscaleCalibOptions.h:39
TileExpertDump::m_OflEms
bool m_OflEms
Definition: TileExpertDump.h:56
xAOD::EventInfo_v1::lumiBlock
uint32_t lumiBlock() const
The current event's luminosity block number.
AthAlgorithm
Definition: AthAlgorithm.h:47
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TileExpertDump::printExpertEmscaleOnl
void printExpertEmscaleOnl()
Definition: TileExpertDump.cxx:200
TileEmscaleCalibOptions::OnlEms
@ OnlEms
Definition: TileEmscaleCalibOptions.h:41
TileEmscaleCalibOptions::OflCisFitLin
@ OflCisFitLin
Definition: TileEmscaleCalibOptions.h:28
TileExpertDump::m_OflLasNlnPisa
bool m_OflLasNlnPisa
Definition: TileExpertDump.h:58
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TileTrigType.h
IdentifierHash.h
errorcheck.h
Helpers for checking error return status codes and reporting errors.
TileExpertDump::m_printExpertEmscale
bool m_printExpertEmscale
Definition: TileExpertDump.h:66
TileExpertDump::m_OflLasLin
bool m_OflLasLin
Definition: TileExpertDump.h:52
TileExpertDump::m_tileInfo
const TileInfo * m_tileInfo
Definition: TileExpertDump.h:80
EventInfo.h
TileEmscaleCalibOptions::OflLasNlnPisa
@ OflLasNlnPisa
Definition: TileEmscaleCalibOptions.h:36
TileEmscaleCalibOptions::OflLasNln
@ OflLasNln
Definition: TileEmscaleCalibOptions.h:31
TileExpertDump::~TileExpertDump
~TileExpertDump()
Definition: TileExpertDump.cxx:54
ReadFloatFromCool.adc
adc
Definition: ReadFloatFromCool.py:48
AthCommonMsg< Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
xAOD::EventInfo_v1::timeStamp
uint32_t timeStamp() const
POSIX time in seconds from 1970. January 1st.
TileExpertDump::m_OnlEms
bool m_OnlEms
Definition: TileExpertDump.h:63
TileEmscaleCalibOptions::getEmscaleCalibOptions
uint32_t getEmscaleCalibOptions() const
Returns the complete bitmap with all EM scale calibration options.
Definition: TileEmscaleCalibOptions.h:80
TileCalibUtils::getDrawerIdx
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
Definition: TileCalibUtils.cxx:60
TileExpertDump::finalize
StatusCode finalize()
Definition: TileExpertDump.cxx:241
ReadHandle.h
Handle class for reading from StoreGate.
TileExpertDump::printExpertEmscale
void printExpertEmscale()
Definition: TileExpertDump.cxx:131
TileCalibUtils::MAX_CHAN
static const unsigned int MAX_CHAN
Number of channels in drawer.
Definition: TileCalibUtils.h:141
TileInfoLoader.h
TileExpertDump::m_tileHWID
const TileHWID * m_tileHWID
Definition: TileExpertDump.h:76
TileInfo::ADCmax
int ADCmax() const
Returns the maximum ADC output (10 bits --> 1023)
Definition: TileInfo.h:71
TileRawChannelUnit::ADCcounts
@ ADCcounts
Definition: TileRawChannelUnit.h:17
TileRawChannelUnit::OnlineMegaElectronVolts
@ OnlineMegaElectronVolts
Definition: TileRawChannelUnit.h:24
TileEmscaleCalibOptions::OflLasPart
@ OflLasPart
Definition: TileEmscaleCalibOptions.h:32
TileExpertDump::m_infoName
std::string m_infoName
Definition: TileExpertDump.h:79
TileCalibUtils::MAX_GAIN
static const unsigned int MAX_GAIN
Number of gains per channel
Definition: TileCalibUtils.h:142