ATLAS Offline Software
Loading...
Searching...
No Matches
TileInfoDump.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Athena includes
10
11// Calo includes
13#include "CaloDetDescr/CaloDetDescrElement.h"
14
15// Tile includes
16#include "TileInfoDump.h"
23
24#include "TH2.h"
25
26#include <iomanip>
27#include <sstream>
28#include <fstream>
29
31
32TileInfoDump::TileInfoDump(const std::string& name, ISvcLocator* pSvcLocator)
33 : AthAlgorithm(name, pSvcLocator)
34 , m_thistSvc("THistSvc", name)
35 , m_tileHWID(nullptr)
36 , m_tileID(nullptr)
37 , m_h_badCellA(nullptr)
38 , m_h_badCellBC(nullptr)
39 , m_h_badCellD(nullptr)
40 , m_h_badCellGap(nullptr)
41 , m_h_badCell(nullptr)
42 , m_tileInfo(nullptr)
43
44{
45 declareProperty("AthenaIsOnline", m_isOnline = false, "Availability of COOL folders depends on Athena mode");
46 declareProperty("PrintEmscale", m_printEmscale = false, "Switch on calibration chain printout");
47 declareProperty("PrintEmscaleOnl", m_printEmscaleOnl = false, "Switch on online calibration chain printout");
48 declareProperty("PrintLaser", m_printLaser = false, "Switch on all laser constants printout");
49 declareProperty("PrintIntegrator", m_printIntegrator = false, "Switch on integrator printout");
50 declareProperty("PrintPedestals", m_printPedestals = false, "Switch on Pedstals print out");
51 declareProperty("PrintTimingCorrections", m_printTimingCorrections = false, "Switch on Timing Corrections print out");
52 declareProperty("PrintPulseShapes", m_printPulseShapes = false, "Switch on Pulse Shape print out");
53 declareProperty("PrintOfcsCool", m_printOfcsCool = false, "Switch on OFC print out");
54 declareProperty("PrintPulseShapesStep", m_printPulseShapesStep = 0.5, "Time step (ns) of PulseShapes print out");
55 declareProperty("PrintBadChannels", m_printBadChannels = false, "Switch on Bad Channels print out");
56 declareProperty("PrintBadCells", m_printBadCells = false, "Switch on Bad Cells print out");
57 declareProperty("PrintMuID", m_printMuID = false, "Switch on MuID threshold print out");
58 declareProperty("Print1gNoise", m_print1gNoise = false, "Switch on 1g noise print out");
59 declareProperty("PrintOfcRos", m_printOfcRos = 0, "Print OFC for this ros (0 by default)");
60 declareProperty("PrintOfcDrawer", m_printOfcDrawer = 0, "Print OFC for this drawer (0 by default)");
61 declareProperty("PrintOfcChannel", m_printOfcChannel = 0, "Print OFC for this channel (0 by default)");
62 declareProperty("TileInfoName", m_infoName = "TileInfo");
63}
64
65// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
66
69
70// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
72
73 ATH_MSG_DEBUG( "in initialize()" );
74
75 //=== EventInfo key
76 ATH_CHECK( m_eventInfoKey.initialize() );
77
78 //=== Get TileHWID
79 CHECK( detStore()->retrieve(m_tileHWID, "TileHWID") );
80
81 //=== CaloDetDescrManager
82 ATH_CHECK(m_caloMgrKey.initialize());
83
84 //=== Get TileBadChanTool
85 CHECK( m_tileBadChanTool.retrieve() );
86
87 //=== Get TileCondToolEmscale
88 CHECK( m_tileToolEmscale.retrieve() );
89
90 //=== Get TileCondToolIntegrator
91 CHECK( m_tileToolIntegrator.retrieve() );
92
93 //=== Get TileCondToolTiming
94 CHECK( m_tileToolTiming.retrieve() );
95
96 //=== Get TileCondToolPulseShape
97 CHECK( m_tileToolPulseShape.retrieve() );
98
99 //=== Get TileCondToolOfcCool
100 CHECK( m_tileToolOfcCool.retrieve() );
101
102 //=== Get TileCondToolNoiseSample
103 CHECK( m_tileToolNoiseSample.retrieve() );
104
105 //=== Get TileCondToolAutoCr
106 CHECK( m_tileToolAutoCr.retrieve() );
107
108 //=== Get TileCondToolMuID
109 CHECK( m_tileToolMuID.retrieve() );
110
111 //=== Get TileCondToolNoiseRawChn
113 CHECK( m_tileToolNoiseRawChn.retrieve() );
114 }
115
116 //=== Retrieve TileID helpers from det store
117 CHECK( detStore()->retrieve(m_tileID, "TileID") );
118
119 //--- Get a handle on the NTuple and histogramming service
120 CHECK( m_thistSvc.retrieve() );
121
122 //=== Get TileInfo and set max ADC counts
123 CHECK( detStore()->retrieve(m_tileInfo, m_infoName) );
124 m_i_ADCmax = m_tileInfo->ADCmax();
125
126 //--- Histogram initialization
127 m_h_badCellA = new TH2F("m_h_badCellA", "Etaphi_maskedCell A", 34, -1.7, 1.7, 64, -3.2, 3.2);
128 m_h_badCellBC = new TH2F("m_h_badCellBC", "Etaphi_maskedCell BC", 34, -1.7, 1.7, 64, -3.2, 3.2);
129 m_h_badCellD = new TH2F("m_h_badCellD", "Etaphi_maskedCell D", 34, -1.7, 1.7, 64, -3.2, 3.2);
130 m_h_badCellGap = new TH2F("m_h_badCellGap", "Etaphi_maskedCell Gap", 34, -1.7, 1.7, 64, -3.2, 3.2);
131 m_h_badCell = new TH2F("m_h_badCell", "Etaphi_maskedCell All", 34, -1.7, 1.7, 64, -3.2, 3.2);
132
133 CHECK( m_thistSvc->regHist("/AANT/m_h_badCellA", m_h_badCellA) );
134 CHECK( m_thistSvc->regHist("/AANT/m_h_badCellBC", m_h_badCellBC) );
135 CHECK( m_thistSvc->regHist("/AANT/m_h_badCellD", m_h_badCellD) );
136 CHECK( m_thistSvc->regHist("/AANT/m_h_badCellGap", m_h_badCellGap) );
137 CHECK( m_thistSvc->regHist("/AANT/m_h_badCell", m_h_badCell) );
138
139 return StatusCode::SUCCESS;
140
141}
142//
143//___________________________________________________________________________________________
145
146 ATH_MSG_DEBUG( " in execute()" );
147
149 ATH_CHECK( eventInfo.isValid() );
150
151 ATH_MSG_DEBUG( "Event: ["
152 << eventInfo->runNumber() << ", "
153 << eventInfo->eventNumber() << ", "
154 << eventInfo->lumiBlock() << ": "
155 << eventInfo->timeStamp() << "]" );
156
157
158
159
160 m_h_badCell->Fill(1., 1.5, 1.);
161
162 //=== Print out stuff
171 if (m_printMuID) printMuID();
173
174 //=== Print Bad Channels
177
178 return StatusCode::SUCCESS;
179}
180
181//
182//___________________________________________________________________________________________
184 ATH_MSG_DEBUG( "In printEmscale()" );
185
186 for (unsigned int ros = 0; ros < TileCalibUtils::MAX_ROS; ++ros) {
187 unsigned int drawerMax = TileCalibUtils::getMaxDrawer(ros);
188 for (unsigned int drawer = 0; drawer < drawerMax; ++drawer) {
189 unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
190 for (unsigned int channel = 0; channel < TileCalibUtils::MAX_CHAN; ++channel) {
191 for (unsigned int adc = 0; adc < TileCalibUtils::MAX_GAIN; ++adc) {
192
193 msg(MSG::INFO) << ros << "/" << std::setw(2)
194 << drawer << "/" << std::setw(2)
195 << channel << "/"
196 << adc << " : " << std::fixed << std::right << std::setw(9) << std::setprecision(5)
197 << m_tileToolEmscale->doCalibCis(drawerIdx, channel, adc, 1.) << " (CIS) | "
198 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
199 << m_tileToolEmscale->doCalibLas(drawerIdx, channel, 1.) << " (LAS) | "
200 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
201 << m_tileToolEmscale->doCalibCes(drawerIdx, channel, 1.) << " (CES) | "
202 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
203 << m_tileToolEmscale->doCalibEms(drawerIdx, channel, 1.) << " (EMS) | ";
204
205 float chanCalMeV = m_tileToolEmscale->channelCalib(drawerIdx, channel, adc, 1.
207
208 msg(MSG::INFO) << std::fixed << std::right << std::setw(9) << std::setprecision(5)
209 << chanCalMeV << " (total)";
210
211 //=== "undo" online calibration only if this functionality is available
212 if (m_tileToolEmscale->getOnlCacheUnit() != TileRawChannelUnit::Invalid) {
213 msg(MSG::INFO) << std::fixed << std::right << std::setw(9) << std::setprecision(5)
214 << m_tileToolEmscale->channelCalib(drawerIdx, channel, adc, chanCalMeV
216 << " (onlMev->oflADC)";
217 }
218
219 msg(MSG::INFO) << endmsg;
220
221 } //end adc
222 } //end channel
223 } //end drawer
224 } //end ros
225
226 //===================================================================
227 //=== Perform a CIS energy scan to test CIS LUT
228 //===================================================================
229 ATH_MSG_INFO( "Performing an energy scan to test CIS LUT" );
230
231 unsigned int ros = 1;
232 unsigned int drawer = 0;
233 unsigned int channel = 0;
234 for (unsigned int adc = 0; adc < TileCalibUtils::MAX_GAIN; ++adc) {
235 for (int adcCounts = 0; adcCounts <= m_i_ADCmax; ++adcCounts) {
236 double energy = static_cast<float>(adcCounts);
237 ATH_MSG_INFO( ros << "/" << drawer << "/" << channel << "/" << adc << " : "
238 << "ADC counts = " << adcCounts
239 << "\t---> " << m_tileToolEmscale->doCalibCis(20, 0, adc, energy) );
240
241 } //end adcCounts
242 } //end adc
243
244}
245
246//
247//___________________________________________________________________________________________
249
250 ATH_MSG_DEBUG( "In printEmscaleOnl()" );
251
252 for (unsigned int ros = 0; ros < TileCalibUtils::MAX_ROS; ++ros) {
253 unsigned int drawerMax = TileCalibUtils::getMaxDrawer(ros);
254 for (unsigned int drawer = 0; drawer < drawerMax; ++drawer) {
255 unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
256 for (unsigned int channel = 0; channel < TileCalibUtils::MAX_CHAN; ++channel) {
257 for (unsigned int adc = 0; adc < TileCalibUtils::MAX_GAIN; ++adc) {
258
259 msg(MSG::INFO) << ros << "/" << std::setw(2) << drawer << "/" << std::setw(2) << channel << "/" << adc << " : "
260 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
261 << m_tileToolEmscale->doCalibCisOnl(drawerIdx, channel, adc, 1.) << " (ONL_CIS) | "
262 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
263 << m_tileToolEmscale->doCalibLasOnl(drawerIdx, channel, 1.) << " (ONL_LAS) | "
264 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
265 << m_tileToolEmscale->doCalibCesOnl(drawerIdx, channel, 1.) << " (ONL_CES) | "
266 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
267 << m_tileToolEmscale->doCalibEmsOnl(drawerIdx, channel, 1.) << " (ONL_EMS) | ";
268
269 float chanCalMeV = m_tileToolEmscale->channelCalibOnl(drawerIdx, channel, adc, 1., TileRawChannelUnit::OnlineMegaElectronVolts);
270
271 msg(MSG::INFO) << std::fixed << std::right << std::setw(9) << std::setprecision(5)
272 << chanCalMeV << " (total)";
273
274 msg(MSG::INFO) << endmsg;
275
276 } //end adc
277 } //end channel
278 } //end drawer
279 } //end ros
280
281}
282
283//
284//___________________________________________________________________________________________
286 ATH_MSG_DEBUG( "In printLaser()" );
287
288 for (unsigned int ros = 0; ros < TileCalibUtils::MAX_ROS; ++ros) {
289 unsigned int drawerMax = TileCalibUtils::getMaxDrawer(ros);
290 for (unsigned int drawer = 0; drawer < drawerMax; ++drawer) {
291 unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
292 for (unsigned int channel = 0; channel < TileCalibUtils::MAX_CHAN; ++channel) {
293 for (unsigned int adc = 0; adc < TileCalibUtils::MAX_GAIN; ++adc) {
294
295 msg(MSG::INFO) << ros << "/" << std::setw(2)
296 << drawer << "/" << std::setw(2)
297 << channel << "/"
298 << adc << " : "
299 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
300 << m_tileToolEmscale->getCesRefLas(drawerIdx, channel, adc) << " (absolute) | "
301 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
302 << m_tileToolEmscale->doCalibLas(drawerIdx, channel, 1.) << " (channel) | "
303 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
304 << m_tileToolEmscale->getLasFiber(drawerIdx, channel) << " (fiber) | "
305 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
306 << m_tileToolEmscale->getLasPartition(drawerIdx) << " (partition)";
307
308 msg(MSG::INFO) << endmsg;
309
310 } //end adc
311 } //end channel
312 } //end drawer
313 } //end ros
314
315}
316
317//
318//___________________________________________________________________________________________
320
321 for (unsigned int ros = 0; ros < TileCalibUtils::MAX_ROS; ++ros) {
322 unsigned int drawerMax = TileCalibUtils::getMaxDrawer(ros);
323 for (unsigned int drawer = 0; drawer < drawerMax; ++drawer) {
324 unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
325 for (unsigned int channel = 0; channel < TileCalibUtils::MAX_CHAN; ++channel) {
326 for (unsigned int adc = 0; adc < 6; ++adc) {
327
328 //=== Output from the tool
329 ATH_MSG_INFO( ros << "/"
330 << drawer << "/"
331 << channel<< "/"
332 << adc << " : "
333 << "Gain=" << m_tileToolIntegrator->getGain(drawerIdx, channel, adc) << "\t"
334 << m_tileToolIntegrator->getGainError(drawerIdx, channel, adc) << "\t"
335 << m_tileToolIntegrator->getChi2(drawerIdx, channel, adc) << "\t"
336 << "Ped=" << m_tileToolIntegrator->getPedestal(drawerIdx, channel, adc) << "\t"
337 << m_tileToolIntegrator->getDACForPed(drawerIdx, channel, adc) << "\t"
338 << m_tileToolIntegrator->getSigmaOfPed(drawerIdx, channel, adc) << "\t"
339 << m_tileToolIntegrator->getRMSOfPed(drawerIdx, channel, adc) << "\t"
340 << m_tileToolIntegrator->getSigmaOfRMS(drawerIdx, channel, adc) << "\t" );
341
342 } //end adc
343 } //end channel
344 } //end drawer
345 } //end ros
346
347}
348
349//
350//___________________________________________________________________________________________
352
353 const EventContext &ctx = Gaudi::Hive::currentContext();
354
355 std::vector<float> vecAutoCr;
356
357 for (unsigned int ros = 0; ros < TileCalibUtils::MAX_ROS; ++ros) {
358 unsigned int drawerMax = TileCalibUtils::getMaxDrawer(ros);
359 for (unsigned int drawer = 0; drawer < drawerMax; ++drawer) {
360 unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
361 for (unsigned int channel = 0; channel < TileCalibUtils::MAX_CHAN; ++channel) {
362 for (unsigned int adc = 0; adc < TileCalibUtils::MAX_GAIN; ++adc) {
363
364 //=== Retrieve autocorrelations
365 m_tileToolAutoCr->getAutoCorr(drawerIdx, channel, adc, vecAutoCr);
366
367 //=== Output from the tool
368 msg(MSG::INFO) << ros << "/"
369 << drawer << "/"
370 << channel << "/"
371 << adc << " : "
372 << "Pedestal level=" << m_tileToolNoiseSample->getPed(drawerIdx, channel, adc, TileRawChannelUnit::ADCcounts, ctx) << "\t"
373 << "HFN=" << m_tileToolNoiseSample->getHfn(drawerIdx, channel, adc, TileRawChannelUnit::ADCcounts, ctx) << "\t"
374 << "LFN=" << m_tileToolNoiseSample->getLfn(drawerIdx, channel, adc, TileRawChannelUnit::ADCcounts, ctx) << "\t"
375 << "OF=" << m_tileToolNoiseRawChn->getNoise(drawerIdx, channel, adc, TileRawChannelUnit::ADCcounts, ctx) << "\t"
376 << "ACR = ";
377 for (unsigned int i = 0; i < vecAutoCr.size(); ++i) {
378 msg(MSG::INFO) << vecAutoCr[i] << " ";
379 }
380
381 msg(MSG::INFO) << endmsg;
382
383 } //end adc
384 } //end channel
385 } //end drawer
386 } //end ros
387
388}
389
390//
391//___________________________________________________________________________________________
393
394 const EventContext &ctx = Gaudi::Hive::currentContext();
395
396 std::vector<float> vecAutoCr;
397
398 for (unsigned int ros = 0; ros < TileCalibUtils::MAX_ROS; ++ros) {
399 unsigned int drawerMax = TileCalibUtils::getMaxDrawer(ros);
400 for (unsigned int drawer = 0; drawer < drawerMax; ++drawer) {
401 unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
402 for (unsigned int channel = 0; channel < TileCalibUtils::MAX_CHAN; ++channel) {
403 for (unsigned int adc = 0; adc < TileCalibUtils::MAX_GAIN; ++adc) {
404
405 //=== Output from the tool
406 ATH_MSG_INFO( "1g Noise (ros/dr/ch/gain) "
407 << ros << "/"
408 << drawer << "/"
409 << channel << "/"
410 << adc << " : "
411 << "Electronic (ADC counts) " << m_tileToolNoiseRawChn->getElectronicNoise(drawerIdx, channel, adc, TileRawChannelUnit::ADCcounts, ctx) << "\t"
412 << "PileUp (MeV) " << m_tileToolNoiseRawChn->getPileUpNoise(drawerIdx, channel, adc, ctx) );
413
414 } //end adc
415 } //end channel
416 } //end drawer
417 } //end ros
418
419}
420
421//
422//___________________________________________________________________________________________
424
425 //=== In Athena online mode only channel offset is available
426 //=== In offline mode everything is available
427 if (m_isOnline) {
428 ATH_MSG_INFO( "Athena Online mode detected: only channel offset available." );
429 for (unsigned int ros = 0; ros < TileCalibUtils::MAX_ROS; ++ros) {
430 unsigned int drawerMax = TileCalibUtils::getMaxDrawer(ros);
431 for (unsigned int drawer = 0; drawer < drawerMax; ++drawer) {
432 unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
433 for (unsigned int channel = 0; channel < TileCalibUtils::MAX_CHAN; ++channel) {
434 for (unsigned int adc = 0; adc < TileCalibUtils::MAX_GAIN; ++adc) {
435
436 ATH_MSG_INFO( ros << "/"
437 << drawer << "/"
438 << channel << "/"
439 << adc << " : "
440 << "Time correction: " << m_tileToolTiming->getSignalPhase(drawerIdx, channel, adc)
441 << "\tchannel: " << m_tileToolTiming->getChannelOffset(drawerIdx, channel, adc) );
442
443 } //end adc
444 } //end channel
445 } //end drawer
446 } //end ros
447 } else { // offline mode
448 for (unsigned int ros = 0; ros < TileCalibUtils::MAX_ROS; ++ros) {
449 unsigned int drawerMax = TileCalibUtils::getMaxDrawer(ros);
450 for (unsigned int drawer = 0; drawer < drawerMax; ++drawer) {
451 unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
452 for (unsigned int channel = 0; channel < TileCalibUtils::MAX_CHAN; ++channel) {
453 for (unsigned int adc = 0; adc < TileCalibUtils::MAX_GAIN; ++adc) {
454
455 //.. GL 130429: remove references to obsolete condDB folders.
456 ATH_MSG_INFO( ros << "/"
457 << drawer << "/"
458 << channel << "/"
459 << adc << " : "
460 << "Time correction: " << m_tileToolTiming->getSignalPhase(drawerIdx, channel, adc)
461 << "\tchannel: " << m_tileToolTiming->getChannelOffset(drawerIdx, channel, adc) );
462
463 } //end adc
464 } //end channel
465 } //end drawer
466 } //end ros
467 } //offline mode
468}
469
470//
471//___________________________________________________________________________________________
473
474 //=== dump default channel only
475 unsigned int ros = 0;
476 unsigned int drawer = 0;
477 unsigned int channel = 0;
478 unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
479
480 float y = 0;
481 float dy = 0;
482 float time = 0;
483
484 float startpoint = -100.0;
485 float endpoint = 150.0;
486
487 const EventContext &ctx = Gaudi::Hive::currentContext();
488
489 //=== force m_printPulseShapesStep to have positive value
491 unsigned int npoint = static_cast<unsigned int>((endpoint - startpoint) / m_printPulseShapesStep);
492
493 for (unsigned int adc = 0; adc < TileCalibUtils::MAX_GAIN; ++adc) {
494 for (unsigned int point = 0; point < npoint; ++point) {
495 time = startpoint + point * m_printPulseShapesStep;
496 //if(m_tileToolPulseShape->getPulseShapeYDY(drawerIdx,channel,adc,time,y,dy)) {
497 m_tileToolPulseShape->getPulseShapeYDY(drawerIdx, channel, adc, time, y, dy, ctx);
498 ATH_MSG_INFO( ros << "/" << std::setw(2)
499 << drawer << "/" << std::setw(2)
500 << channel << "/"
501 << adc << " : "
502 << "Time, Y, DY: " << std::fixed << std::right << std::setw(9) << std::setprecision(6) << time
503 << " " << std::fixed << std::right << std::setw(11) << std::setprecision(8) << y
504 << " " << std::fixed << std::right << std::setw(11) << std::setprecision(8) << dy );
505
506 //}
507 } // end point
508 } //end adc
509
510}
511
512//
513//___________________________________________________________________________________________
515
516 ATH_MSG_DEBUG( "in printBadChannels()" );
517
518 std::vector<std::string> vmod;
519
520 std::ostringstream sSum;
521 std::ostringstream sDet;
522
523 //=== Tile partitions counters
524 const unsigned int npar = 4;
525 unsigned int bchn[npar];
526 unsigned int badc[npar];
527 for (unsigned int ros = 0; ros < npar; ++ros) {
528 bchn[ros] = 0;
529 badc[ros] = 0;
530 }
531
532 sDet << std::endl;
533 sDet << ">>>>>>>>>>>>>>> Detailed list of BAD Channels/ADCs <<<<<<<<<<<<<<<<" << std::endl;
534 for (unsigned int ros = 0; ros < TileCalibUtils::MAX_ROS; ++ros) {
535 unsigned int drawerMax = TileCalibUtils::getMaxDrawer(ros);
536 for (unsigned int drawer = 0; drawer < drawerMax; ++drawer) {
537 unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
538
539 unsigned int badadc = 0; //... counter of bad ADCs per drawer
540 unsigned int badchn = 0; //... counter of bad channels per drawer
541
542 for (unsigned int channel = 0; channel < TileCalibUtils::MAX_CHAN; ++channel) {
543
544 //=== check channel status
545 TileBchStatus status = m_tileBadChanTool->getChannelStatus(drawerIdx, channel);
546 if (status.isAffected()) {
547 if (status.isBad()) {
548 sDet << TileCalibUtils::getDrawerString(ros, drawer)
549 << "/ch" << channel << " :B: "
550 << "has at least one problem: " << status.getString() << std::endl;
551
552 if (ros > 0) {
553 badchn++;
554 bchn[ros - 1]++;
555 }
556 } else
557 sDet << TileCalibUtils::getDrawerString(ros, drawer)
558 << "/ch" << channel << " :-: "
559 << "has at least one problem: " << status.getString() << std::endl;
560
561 //==== check connected adc status
562 for (unsigned int adc = 0; adc < TileCalibUtils::MAX_GAIN; ++adc) {
563 status = m_tileBadChanTool->getAdcStatus(drawerIdx, channel, adc);
564 if (status.isBad()) {
565 sDet << "-B-> " << TileCalibUtils::getDrawerString(ros, drawer)
566 << "/ch" << channel << "/" << adc << " : " << status.getString() << std::endl;
567
568 if (ros > 0) {
569 badadc++;
570 badc[ros - 1]++;
571 }
572 } else
573 sDet << "---> " << TileCalibUtils::getDrawerString(ros, drawer)
574 << "/ch" << channel << "/" << adc << " : " << status.getString() << std::endl;
575
576 } //end adc
577 } //end status!=0
578
579 } //end channel
580
581 if (badadc) {
582 std::ostringstream myStream;
583 myStream << TileCalibUtils::getDrawerString(ros, drawer) << ": " << badchn << "/" << badadc;
584 vmod.push_back(myStream.str());
585 }
586
587 } //end drawer
588 } //end ros
589
590 ATH_MSG_INFO( sDet.str() );
591
592 //=== Print summary
593 sSum << std::endl;
594 sSum << ">>> Summary of BAD channels/ADCs per drawer (in LBA, LBC, EBA, EBC) <<<<" << std::endl;
595 if (vmod.empty())
596 sSum << "There are no bad ADCs in LBA, LBC, EBA and EBC" << std::endl;
597 else {
598 unsigned int totchn = 0;
599 unsigned int totadc = 0;
600
601 for (unsigned int ros = 0; ros < npar; ++ros) {
602 totchn += bchn[ros];
603 totadc += badc[ros];
604 }
605
606 sSum << "Total number of bad channels/ADC: " << totchn << "/" << totadc << std::endl;
607 sSum << "Bad channels/ADC in LBA : " << bchn[0] << "/" << badc[0] << std::endl;
608 sSum << "Bad channels/ADC in LBC : " << bchn[1] << "/" << badc[1] << std::endl;
609 sSum << "Bad channels/ADC in EBA : " << bchn[2] << "/" << badc[2] << std::endl;
610 sSum << "Bad channels/ADC in EBC : " << bchn[3] << "/" << badc[3] << std::endl;
611 sSum << std::endl;
612
613 for (const std::string& s : vmod)
614 sSum << s << std::endl;
615 }
616
617 ATH_MSG_INFO( sSum.str() );
618
619 //--- Output file: dump first the summary, then the details
620 std::ofstream fcout("tileBadChannelsAdcs.txt");
621 fcout << sSum.str() << std::endl;
622 fcout << sDet.str() << std::endl;
623 fcout.close();
624
625}
626
627//
628//____________________________________________________________________________
629void FillCell(TH2F *hist, const CaloDetDescrElement* elem) {
630 //--- auxiliary function for filling of larger cells into histograms in printBadCells
631 float step = 0.1;
632 int nstep = elem->deta() / step;
633 float seta = elem->eta() - 0.5 * (elem->deta() - step);
634 for (int e = 0; e < nstep; e++)
635 hist->Fill(seta + e * step, elem->phi(), 1.);
636}
637
638//
639//____________________________________________________________________________
641
642 ATH_MSG_DEBUG( "in printBadCells()" );
643
644 Identifier cell_id;
645 IdContext cell_context = m_tileID->cell_context();
646 int ncells = m_tileID->cell_hash_max();
647
649 bool run2 = cabling->isRun2PlusCabling();
650
651 std::ostringstream sSum;
652 std::ostringstream sDet;
653
654 sDet << std::endl;
655 sDet << ">>>>>>>>>>>>>>> Detailed list of BAD Cells <<<<<<<<<<<<<<<<" << std::endl;
656 sDet << "tower 0-15: numbered by pseudorapidity from 0 with 0.1 increment in eta" << std::endl;
657
658 int badcell_N = (run2) ? 0 : 4;
659 int badcell_EBA = 0;
660 int badcell_EBC = 0;
661 int badcell_LBA = 0;
662 int badcell_LBC = 0;
663 int badcell_GapA = 0;
664 int badcell_GapC = (run2) ? 0 : 4;
665
666 HWIdentifier ch1_id, ch2_id;
667 TileBchStatus ch1_status, ch2_status;
668
669 const EventContext &ctx = Gaudi::Hive::currentContext();
671 const CaloDetDescrManager* caloMgr = *caloMgrHandle;
672
673 for (int i = 0; i < ncells; ++i) {
674 m_tileID->get_id((IdentifierHash) i, cell_id, &cell_context);
675
676 //=== get calo detector description to obtain cell coordinates
677 const CaloDetDescrElement* elem = caloMgr->get_element(cell_id);
678 if (!elem) {
679 //=== this should never happen
680 ATH_MSG_ERROR( "CaloMgr returns NULL CaloDetDescrElement" );
681 std::abort();
682 }
683
684 ch1_id = cabling->s2h_channel_id(m_tileID->pmt_id(cell_id, 0));
685 ch1_status = m_tileBadChanTool->getChannelStatus(ch1_id);
686
687 if (m_tileID->is_tile_gapscin(cell_id)) ch2_id = ch1_id;
688 else ch2_id = cabling->s2h_channel_id(m_tileID->pmt_id(cell_id, 1));
689
690 ch2_status = m_tileBadChanTool->getChannelStatus(ch2_id);
691
692 //--- get channel
693 int ich1 = m_tileHWID->channel(ch1_id);
694 int ich2 = m_tileHWID->channel(ch2_id);
695
696 if (ch1_status.isBad() && ch2_status.isBad()) {
697 badcell_N++;
698 if (m_tileID->section(cell_id) == 1) {
699 if (m_tileID->is_positive(cell_id) || m_tileID->is_twosides(cell_id)) {
700 badcell_LBA++;
701 sDet << "LBA";
702 }
703
704 if (m_tileID->is_negative(cell_id)) {
705 badcell_LBC++;
706 sDet << "LBC";
707 }
708 }
709 if (m_tileID->section(cell_id) == 2) {
710 if (m_tileID->is_positive(cell_id)) {
711 badcell_EBA++;
712 sDet << "EBA";
713 }
714
715 if (m_tileID->is_negative(cell_id)) {
716 badcell_EBC++;
717 sDet << "EBC";
718 }
719 }
720 if (m_tileID->section(cell_id) == 3) {
721 if (m_tileID->is_positive(cell_id)) {
722 badcell_GapA++;
723 sDet << "GapA";
724 }
725
726 if (m_tileID->is_negative(cell_id)) {
727 badcell_GapC++;
728 sDet << "GapC";
729 }
730 }
731
732 if (m_tileID->module(cell_id) < 9)
733 sDet << "0" << m_tileID->module(cell_id) + 1;
734 else
735 sDet << m_tileID->module(cell_id) + 1;
736
737 sDet << ", tower " << m_tileID->tower(cell_id) << ", ";
738
739 switch (m_tileID->sample(cell_id)) {
740 case 0: {
741 sDet << "sampling A";
742 FillCell(m_h_badCellA, elem);
743 };
744 break;
745 case 1: {
746 if (m_tileID->section(cell_id) == 1)
747 sDet << "sampling BC";
748 else
749 sDet << "sampling B";
750 FillCell(m_h_badCellBC, elem);
751 };
752 break;
753 case 2: {
754 sDet << "sampling D";
755 FillCell(m_h_badCellD, elem);
756 };
757 break;
758 case 3: {
759 sDet << "gap and crack scintillators";
761 };
762 break;
763 default:
764 sDet << "individual tiles, used for Cesium calibration";
765 break;
766 }
767
768 FillCell(m_h_badCell, elem);
769
770 sDet << ", eta x phi = " << elem->eta()
771 << " x " << elem->phi()
772 << ", channels: " << ich1 << ", " << ich2 << std::endl;
773
774 } // bad cell
775
776 } // i, ncells
777
778 if (!run2)
779 sDet << "!!! Four cells in GapC are also bad but not listed above: EBC04 ch 1, EBC35 ch 0, EBC54 ch 1, and EBC61 ch 1 " << std::endl;
780
781 ATH_MSG_INFO( sDet.str() );
782
783 //=== bad cells summary
784 float fncells = static_cast<float>(ncells);
785 if (run2)
786 fncells += 16 - 2; // adding 16 MBTS connected to PMT5 of special C10 and removing D4 in EBA15/EBC18
787 else
788 fncells = fncells - 2; // removing D4 in EBA15/EBC18
789
790 sSum << std::endl;
791
792 sSum << ">>>>>>>>>>>>>>> Tilecal BAD Cells Summary <<<<<<<<<<<<<<<<" << std::endl;
793 sSum << "Total number of cells including MBTS: " << fncells << std::endl;
794 sSum << "Total number of bad cells: " << badcell_N
795 << " (" << std::setprecision(4) << 100 * static_cast<float>(badcell_N) / fncells << " %)" << std::endl;
796
797 sSum << "Bad cells in LBA(+cell D0): " << badcell_LBA
798 << " (" << std::setprecision(4) << 100 * static_cast<float>(badcell_LBA) / fncells << " %)" << std::endl;
799
800 sSum << "Bad cells in LBC: " << badcell_LBC
801 << " (" << std::setprecision(4) << 100 * static_cast<float>(badcell_LBC) / fncells << " %)" << std::endl;
802
803 sSum << "Bad cells in EBA: " << badcell_EBA
804 << " (" << std::setprecision(4) << 100 * static_cast<float>(badcell_EBA) / fncells << " %)" << std::endl;
805
806 sSum << "Bad cells in EBC: " << badcell_EBC
807 << " (" << std::setprecision(4) << 100 * static_cast<float>(badcell_EBC) / fncells << " %)" << std::endl;
808
809 sSum << "Bad cells in Gap A(ITC+E1-4): " << badcell_GapA
810 << " (" << std::setprecision(4) << 100 * static_cast<float>(badcell_GapA) / fncells << " %)" << std::endl;
811
812 sSum << "Bad cells in Gap C(ITC+E1-4): " << badcell_GapC
813 << " (" << std::setprecision(4) << 100 * static_cast<float>(badcell_GapC) / fncells << " %)" << std::endl;
814
815 ATH_MSG_INFO( sSum.str() );
816
817 //--- Output file: dump first the summary, then the details
818 std::ofstream fcout("tileBadCells.txt");
819 fcout << sSum.str() << std::endl;
820 fcout << sDet.str() << std::endl;
821 fcout.close();
822
823}
824
825//
826//___________________________________________________________________________________________
828
829 float thr_low_value = -999.;
830 float thr_high_value = -999.;
831 Identifier id;
832 // loop over all TileCal cells
833 IdContext cell_context = m_tileID->cell_context();
834 int ncells = m_tileID->cell_hash_max();
835
836 ATH_MSG_INFO( " printMuID: ncells " << ncells );
837 ATH_MSG_INFO( " Cell_ID, Threshold detector(TileCal=5)/section/side/module/tower/sampling" );
838
839 for (int i = 0; i < ncells; ++i) {
840 {
841 m_tileID->get_id((IdentifierHash) i, id, &cell_context);
842
843 thr_low_value = m_tileToolMuID->getLowThresholdValue(id);
844 thr_high_value = m_tileToolMuID->getHighThresholdValue(id);
845
846 //=== Output from the tool
847 ATH_MSG_INFO( " Cell_ID " << id
848 << " Threshold low/high " << thr_low_value << " " << thr_high_value
849 << ", " << m_tileID->to_string(id, -2) );
850 }
851 }
852}
853
854//
855//____________________________________________________________________________
857 MsgStream log(msgSvc(), name());
858
859 ATH_MSG_INFO("OFC will be printed for ros " << m_printOfcRos << ", drawer " << m_printOfcDrawer << ", channel " << m_printOfcChannel);
860
861 //=== dump default channel only
862 unsigned int gain = 0;
864 int NPhases;
865 int NFields;
866 int Phamin;
867 int Phamax;
868 int NSamples;
869
870 const EventContext &ctx = Gaudi::Hive::currentContext();
871 m_tileToolOfcCool->getOfcParams(drawerIdx, NPhases, NFields, Phamin, Phamax, NSamples, ctx);
872
873 int phase_step = round(static_cast<double>(Phamax - Phamin) / (std::abs(NPhases) - 1));
874
875 ATH_MSG_INFO( "-------- OFC parameters ----->"
876 << " nPhases " << NPhases
877 << " nFields " << NFields
878 << " minimum phase " << Phamin * PHASE_PRECISION << " ns "
879 << " maximum phase " << Phamax * PHASE_PRECISION << " ns "
880 << " nSamples " << NSamples
881 << " phase step " << phase_step * PHASE_PRECISION << " ns");
882
883
884
885 for (gain = 0; gain < 2; gain++) {
886 ATH_MSG_INFO( "----------------- Gain " << gain << "-----------------" );
887
888 for (int phase = Phamin; phase <= Phamax; phase += phase_step ) {
889 float real_phase = float(phase) * PHASE_PRECISION;
891 m_tileToolOfcCool->getOfcWeights(drawerIdx, m_printOfcChannel, gain, real_phase, true, weights, ctx).ignore();
892
893 ATH_MSG_INFO( "OFC phase " << real_phase << " ns");
894
895 msg(MSG::INFO) << "OFC A";
896 for (int i = 0; i < weights.n_samples; i++)
897 msg(MSG::INFO) << " " << weights.w_a[i];
898 msg(MSG::INFO) << endmsg;
899
900 msg(MSG::INFO) << "OFC B";
901 for (int i = 0; i < weights.n_samples; i++)
902 msg(MSG::INFO) << " " << weights.w_b[i];
903 msg(MSG::INFO) << endmsg;
904
905 msg(MSG::INFO) << "OFC C";
906 for (int i = 0; i < weights.n_samples; i++)
907 msg(MSG::INFO) << " " << weights.w_c[i];
908 msg(MSG::INFO) << endmsg;
909
910 msg(MSG::INFO) << "OFC G";
911 for (int i = 0; i < weights.n_samples; i++)
912 msg(MSG::INFO) << " " << weights.g[i];
913 msg(MSG::INFO) << endmsg;
914
915 if (NFields >= 5) {
916 msg(MSG::INFO) << "OFC DG";
917 for (int i = 0; i < weights.n_samples; i++)
918 msg(MSG::INFO) << " " << weights.dg[i];
919 msg(MSG::INFO) << endmsg;
920 }
921
922 }
923 }
924
925}
926
927// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
928
930
931 ATH_MSG_DEBUG( "in finalize()" );
932
933 return StatusCode::SUCCESS;
934}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#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.
#define PHASE_PRECISION
Class for storing Optimal Filtering Coefficients (OFCs) in a coral::Blob.
void FillCell(TH2F *hist, const CaloDetDescrElement *elem)
#define y
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
This class groups all DetDescr information related to a CaloCell.
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
This class provides the client interface for accessing the detector description information common to...
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition IdContext.h:26
This is a "hash" representation of an Identifier.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Class holding bad channel problems.
bool isBad() const
static const TileCablingService * getInstance()
get pointer to service instance
static const unsigned int MAX_ROS
Number of ROSs.
static std::string getDrawerString(unsigned int ros, unsigned int drawer)
Return the drawer name, e.g.
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.
std::string m_infoName
bool m_printTimingCorrections
StatusCode initialize()
ToolHandle< TileCondToolPulseShape > m_tileToolPulseShape
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
bool m_printIntegrator
ToolHandle< TileCondToolAutoCr > m_tileToolAutoCr
bool m_printEmscaleOnl
float m_printPulseShapesStep
bool m_printEmscale
void printTimingCorrections()
StatusCode execute()
ServiceHandle< ITHistSvc > m_thistSvc
void printPedestals()
TileInfoDump(const std::string &name, ISvcLocator *pSvcLocator)
void printIntegrator()
ToolHandle< TileCondToolMuID > m_tileToolMuID
ToolHandle< TileCondToolOfcCool > m_tileToolOfcCool
const TileHWID * m_tileHWID
unsigned int m_printOfcRos
ToolHandle< ITileBadChanTool > m_tileBadChanTool
TH2F * m_h_badCellD
ToolHandle< TileCondToolNoiseRawChn > m_tileToolNoiseRawChn
ToolHandle< TileCondToolEmscale > m_tileToolEmscale
bool m_printPulseShapes
unsigned int m_printOfcChannel
TH2F * m_h_badCellGap
unsigned int m_printOfcDrawer
void printPulseShapes()
TH2F * m_h_badCellA
bool m_printPedestals
TH2F * m_h_badCellBC
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
const TileID * m_tileID
void printEmscaleOnl()
ToolHandle< TileCondToolTiming > m_tileToolTiming
StatusCode finalize()
const TileInfo * m_tileInfo
bool m_printBadCells
bool m_printBadChannels
bool m_printOfcsCool
ToolHandle< TileCondToolNoiseSample > m_tileToolNoiseSample
bool m_print1gNoise
ToolHandle< TileCondToolIntegrator > m_tileToolIntegrator
void printBadChannels()
TH2F * m_h_badCell