13#include "CaloDetDescr/CaloDetDescrElement.h"
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);
139 return StatusCode::SUCCESS;
152 << eventInfo->runNumber() <<
", "
153 << eventInfo->eventNumber() <<
", "
154 << eventInfo->lumiBlock() <<
": "
155 << eventInfo->timeStamp() <<
"]" );
178 return StatusCode::SUCCESS;
188 for (
unsigned int drawer = 0; drawer < drawerMax; ++drawer) {
193 msg(MSG::INFO) << ros <<
"/" << std::setw(2)
194 << drawer <<
"/" << std::setw(2)
196 << adc <<
" : " << std::fixed << std::right << std::setw(9) << std::setprecision(5)
198 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
200 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
202 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
208 msg(MSG::INFO) << std::fixed << std::right << std::setw(9) << std::setprecision(5)
209 << chanCalMeV <<
" (total)";
213 msg(MSG::INFO) << std::fixed << std::right << std::setw(9) << std::setprecision(5)
216 <<
" (onlMev->oflADC)";
229 ATH_MSG_INFO(
"Performing an energy scan to test CIS LUT" );
231 unsigned int ros = 1;
232 unsigned int drawer = 0;
233 unsigned int channel = 0;
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
254 for (
unsigned int drawer = 0; drawer < drawerMax; ++drawer) {
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)
264 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
266 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
271 msg(MSG::INFO) << std::fixed << std::right << std::setw(9) << std::setprecision(5)
272 << chanCalMeV <<
" (total)";
290 for (
unsigned int drawer = 0; drawer < drawerMax; ++drawer) {
295 msg(MSG::INFO) << ros <<
"/" << std::setw(2)
296 << drawer <<
"/" << std::setw(2)
299 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
301 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
303 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
305 << std::fixed << std::right << std::setw(9) << std::setprecision(5)
323 for (
unsigned int drawer = 0; drawer < drawerMax; ++drawer) {
326 for (
unsigned int adc = 0; adc < 6; ++adc) {
353 const EventContext &ctx = Gaudi::Hive::currentContext();
355 std::vector<float> vecAutoCr;
359 for (
unsigned int drawer = 0; drawer < drawerMax; ++drawer) {
368 msg(MSG::INFO) << ros <<
"/"
377 for (
unsigned int i = 0; i < vecAutoCr.size(); ++i) {
378 msg(MSG::INFO) << vecAutoCr[i] <<
" ";
394 const EventContext &ctx = Gaudi::Hive::currentContext();
396 std::vector<float> vecAutoCr;
400 for (
unsigned int drawer = 0; drawer < drawerMax; ++drawer) {
428 ATH_MSG_INFO(
"Athena Online mode detected: only channel offset available." );
431 for (
unsigned int drawer = 0; drawer < drawerMax; ++drawer) {
440 <<
"Time correction: " <<
m_tileToolTiming->getSignalPhase(drawerIdx, channel, adc)
441 <<
"\tchannel: " <<
m_tileToolTiming->getChannelOffset(drawerIdx, channel, adc) );
450 for (
unsigned int drawer = 0; drawer < drawerMax; ++drawer) {
460 <<
"Time correction: " <<
m_tileToolTiming->getSignalPhase(drawerIdx, channel, adc)
461 <<
"\tchannel: " <<
m_tileToolTiming->getChannelOffset(drawerIdx, channel, adc) );
475 unsigned int ros = 0;
476 unsigned int drawer = 0;
477 unsigned int channel = 0;
484 float startpoint = -100.0;
485 float endpoint = 150.0;
487 const EventContext &ctx = Gaudi::Hive::currentContext();
494 for (
unsigned int point = 0; point < npoint; ++point) {
499 << drawer <<
"/" << std::setw(2)
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 );
518 std::vector<std::string> vmod;
520 std::ostringstream sSum;
521 std::ostringstream sDet;
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) {
533 sDet <<
">>>>>>>>>>>>>>> Detailed list of BAD Channels/ADCs <<<<<<<<<<<<<<<<" << std::endl;
536 for (
unsigned int drawer = 0; drawer < drawerMax; ++drawer) {
539 unsigned int badadc = 0;
540 unsigned int badchn = 0;
546 if (status.isAffected()) {
547 if (status.isBad()) {
549 <<
"/ch" << channel <<
" :B: "
550 <<
"has at least one problem: " << status.getString() << std::endl;
558 <<
"/ch" << channel <<
" :-: "
559 <<
"has at least one problem: " << status.getString() << std::endl;
564 if (status.isBad()) {
566 <<
"/ch" << channel <<
"/" << adc <<
" : " << status.getString() << std::endl;
574 <<
"/ch" << channel <<
"/" << adc <<
" : " << status.getString() << std::endl;
582 std::ostringstream myStream;
584 vmod.push_back(myStream.str());
594 sSum <<
">>> Summary of BAD channels/ADCs per drawer (in LBA, LBC, EBA, EBC) <<<<" << std::endl;
596 sSum <<
"There are no bad ADCs in LBA, LBC, EBA and EBC" << std::endl;
598 unsigned int totchn = 0;
599 unsigned int totadc = 0;
601 for (
unsigned int ros = 0; ros < npar; ++ros) {
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;
613 for (
const std::string& s : vmod)
614 sSum << s << std::endl;
620 std::ofstream fcout(
"tileBadChannelsAdcs.txt");
621 fcout << sSum.str() << std::endl;
622 fcout << sDet.str() << std::endl;
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.);
646 int ncells =
m_tileID->cell_hash_max();
649 bool run2 = cabling->isRun2PlusCabling();
651 std::ostringstream sSum;
652 std::ostringstream sDet;
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;
658 int badcell_N = (run2) ? 0 : 4;
663 int badcell_GapA = 0;
664 int badcell_GapC = (run2) ? 0 : 4;
672 for (
int i = 0; i < ncells; ++i) {
683 ch1_id = cabling->s2h_channel_id(
m_tileID->pmt_id(cell_id, 0));
686 if (
m_tileID->is_tile_gapscin(cell_id)) ch2_id = ch1_id;
687 else ch2_id = cabling->s2h_channel_id(
m_tileID->pmt_id(cell_id, 1));
695 if (ch1_status.
isBad() && ch2_status.
isBad()) {
697 if (
m_tileID->section(cell_id) == 1) {
703 if (
m_tileID->is_negative(cell_id)) {
708 if (
m_tileID->section(cell_id) == 2) {
709 if (
m_tileID->is_positive(cell_id)) {
714 if (
m_tileID->is_negative(cell_id)) {
719 if (
m_tileID->section(cell_id) == 3) {
720 if (
m_tileID->is_positive(cell_id)) {
725 if (
m_tileID->is_negative(cell_id)) {
732 sDet <<
"0" <<
m_tileID->module(cell_id) + 1;
734 sDet <<
m_tileID->module(cell_id) + 1;
736 sDet <<
", tower " <<
m_tileID->tower(cell_id) <<
", ";
738 switch (
m_tileID->sample(cell_id)) {
740 sDet <<
"sampling A";
745 if (
m_tileID->section(cell_id) == 1)
746 sDet <<
"sampling BC";
748 sDet <<
"sampling B";
753 sDet <<
"sampling D";
758 sDet <<
"gap and crack scintillators";
763 sDet <<
"individual tiles, used for Cesium calibration";
769 sDet <<
", eta x phi = " << elem->eta()
770 <<
" x " << elem->phi()
771 <<
", channels: " << ich1 <<
", " << ich2 << std::endl;
778 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;
783 float fncells =
static_cast<float>(ncells);
787 fncells = fncells - 2;
791 sSum <<
">>>>>>>>>>>>>>> Tilecal BAD Cells Summary <<<<<<<<<<<<<<<<" << std::endl;
792 sSum <<
"Total number of cells including MBTS: " << fncells << std::endl;
793 sSum <<
"Total number of bad cells: " << badcell_N
794 <<
" (" << std::setprecision(4) << 100 *
static_cast<float>(badcell_N) / fncells <<
" %)" << std::endl;
796 sSum <<
"Bad cells in LBA(+cell D0): " << badcell_LBA
797 <<
" (" << std::setprecision(4) << 100 *
static_cast<float>(badcell_LBA) / fncells <<
" %)" << std::endl;
799 sSum <<
"Bad cells in LBC: " << badcell_LBC
800 <<
" (" << std::setprecision(4) << 100 *
static_cast<float>(badcell_LBC) / fncells <<
" %)" << std::endl;
802 sSum <<
"Bad cells in EBA: " << badcell_EBA
803 <<
" (" << std::setprecision(4) << 100 *
static_cast<float>(badcell_EBA) / fncells <<
" %)" << std::endl;
805 sSum <<
"Bad cells in EBC: " << badcell_EBC
806 <<
" (" << std::setprecision(4) << 100 *
static_cast<float>(badcell_EBC) / fncells <<
" %)" << std::endl;
808 sSum <<
"Bad cells in Gap A(ITC+E1-4): " << badcell_GapA
809 <<
" (" << std::setprecision(4) << 100 *
static_cast<float>(badcell_GapA) / fncells <<
" %)" << std::endl;
811 sSum <<
"Bad cells in Gap C(ITC+E1-4): " << badcell_GapC
812 <<
" (" << std::setprecision(4) << 100 *
static_cast<float>(badcell_GapC) / fncells <<
" %)" << std::endl;
817 std::ofstream fcout(
"tileBadCells.txt");
818 fcout << sSum.str() << std::endl;
819 fcout << sDet.str() << std::endl;
828 float thr_low_value = -999.;
829 float thr_high_value = -999.;
833 int ncells =
m_tileID->cell_hash_max();
836 ATH_MSG_INFO(
" Cell_ID, Threshold detector(TileCal=5)/section/side/module/tower/sampling" );
838 for (
int i = 0; i < ncells; ++i) {
847 <<
" Threshold low/high " << thr_low_value <<
" " << thr_high_value
848 <<
", " <<
m_tileID->to_string(
id, -2) );
856 MsgStream log(msgSvc(), name());
861 unsigned int gain = 0;
869 const EventContext &ctx = Gaudi::Hive::currentContext();
870 m_tileToolOfcCool->getOfcParams(drawerIdx, NPhases, NFields, Phamin, Phamax, NSamples, ctx);
872 int phase_step = round(
static_cast<double>(Phamax - Phamin) / (std::abs(NPhases) - 1));
875 <<
" nPhases " << NPhases
876 <<
" nFields " << NFields
879 <<
" nSamples " << NSamples
884 for (gain = 0; gain < 2; gain++) {
885 ATH_MSG_INFO(
"----------------- Gain " << gain <<
"-----------------" );
887 for (
int phase = Phamin; phase <= Phamax; phase += phase_step ) {
894 msg(MSG::INFO) <<
"OFC A";
895 for (
int i = 0; i <
weights.n_samples; i++)
899 msg(MSG::INFO) <<
"OFC B";
900 for (
int i = 0; i <
weights.n_samples; i++)
904 msg(MSG::INFO) <<
"OFC C";
905 for (
int i = 0; i <
weights.n_samples; i++)
909 msg(MSG::INFO) <<
"OFC G";
910 for (
int i = 0; i <
weights.n_samples; i++)
915 msg(MSG::INFO) <<
"OFC DG";
916 for (
int i = 0; i <
weights.n_samples; i++)
932 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
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)
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() 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...
This is a "hash" representation of an Identifier.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Class holding bad channel problems.
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.
bool m_printTimingCorrections
void printBadCells(const EventContext &ctx)
ToolHandle< TileCondToolPulseShape > m_tileToolPulseShape
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
ToolHandle< TileCondToolAutoCr > m_tileToolAutoCr
float m_printPulseShapesStep
void printTimingCorrections()
ServiceHandle< ITHistSvc > m_thistSvc
TileInfoDump(const std::string &name, ISvcLocator *pSvcLocator)
ToolHandle< TileCondToolMuID > m_tileToolMuID
StatusCode execute(const EventContext &ctx)
Execute method.
ToolHandle< TileCondToolOfcCool > m_tileToolOfcCool
const TileHWID * m_tileHWID
unsigned int m_printOfcRos
ToolHandle< ITileBadChanTool > m_tileBadChanTool
ToolHandle< TileCondToolNoiseRawChn > m_tileToolNoiseRawChn
ToolHandle< TileCondToolEmscale > m_tileToolEmscale
unsigned int m_printOfcChannel
unsigned int m_printOfcDrawer
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
ToolHandle< TileCondToolTiming > m_tileToolTiming
void printBadChannels(const EventContext &ctx)
const TileInfo * m_tileInfo
ToolHandle< TileCondToolNoiseSample > m_tileToolNoiseSample
ToolHandle< TileCondToolIntegrator > m_tileToolIntegrator
@ OnlineMegaElectronVolts