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;
669 const EventContext &ctx = Gaudi::Hive::currentContext();
673 for (
int i = 0; i < ncells; ++i) {
684 ch1_id = cabling->s2h_channel_id(
m_tileID->pmt_id(cell_id, 0));
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));
696 if (ch1_status.
isBad() && ch2_status.
isBad()) {
698 if (
m_tileID->section(cell_id) == 1) {
704 if (
m_tileID->is_negative(cell_id)) {
709 if (
m_tileID->section(cell_id) == 2) {
710 if (
m_tileID->is_positive(cell_id)) {
715 if (
m_tileID->is_negative(cell_id)) {
720 if (
m_tileID->section(cell_id) == 3) {
721 if (
m_tileID->is_positive(cell_id)) {
726 if (
m_tileID->is_negative(cell_id)) {
733 sDet <<
"0" <<
m_tileID->module(cell_id) + 1;
735 sDet <<
m_tileID->module(cell_id) + 1;
737 sDet <<
", tower " <<
m_tileID->tower(cell_id) <<
", ";
739 switch (
m_tileID->sample(cell_id)) {
741 sDet <<
"sampling A";
746 if (
m_tileID->section(cell_id) == 1)
747 sDet <<
"sampling BC";
749 sDet <<
"sampling B";
754 sDet <<
"sampling D";
759 sDet <<
"gap and crack scintillators";
764 sDet <<
"individual tiles, used for Cesium calibration";
770 sDet <<
", eta x phi = " << elem->eta()
771 <<
" x " << elem->phi()
772 <<
", channels: " << ich1 <<
", " << ich2 << std::endl;
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;
784 float fncells =
static_cast<float>(ncells);
788 fncells = fncells - 2;
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;
797 sSum <<
"Bad cells in LBA(+cell D0): " << badcell_LBA
798 <<
" (" << std::setprecision(4) << 100 *
static_cast<float>(badcell_LBA) / fncells <<
" %)" << std::endl;
800 sSum <<
"Bad cells in LBC: " << badcell_LBC
801 <<
" (" << std::setprecision(4) << 100 *
static_cast<float>(badcell_LBC) / fncells <<
" %)" << std::endl;
803 sSum <<
"Bad cells in EBA: " << badcell_EBA
804 <<
" (" << std::setprecision(4) << 100 *
static_cast<float>(badcell_EBA) / fncells <<
" %)" << std::endl;
806 sSum <<
"Bad cells in EBC: " << badcell_EBC
807 <<
" (" << std::setprecision(4) << 100 *
static_cast<float>(badcell_EBC) / fncells <<
" %)" << std::endl;
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;
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;
818 std::ofstream fcout(
"tileBadCells.txt");
819 fcout << sSum.str() << std::endl;
820 fcout << sDet.str() << std::endl;
829 float thr_low_value = -999.;
830 float thr_high_value = -999.;
834 int ncells =
m_tileID->cell_hash_max();
837 ATH_MSG_INFO(
" Cell_ID, Threshold detector(TileCal=5)/section/side/module/tower/sampling" );
839 for (
int i = 0; i < ncells; ++i) {
848 <<
" Threshold low/high " << thr_low_value <<
" " << thr_high_value
849 <<
", " <<
m_tileID->to_string(
id, -2) );
857 MsgStream log(msgSvc(), name());
862 unsigned int gain = 0;
870 const EventContext &ctx = Gaudi::Hive::currentContext();
871 m_tileToolOfcCool->getOfcParams(drawerIdx, NPhases, NFields, Phamin, Phamax, NSamples, ctx);
873 int phase_step = round(
static_cast<double>(Phamax - Phamin) / (std::abs(NPhases) - 1));
876 <<
" nPhases " << NPhases
877 <<
" nFields " << NFields
880 <<
" nSamples " << NSamples
885 for (gain = 0; gain < 2; gain++) {
886 ATH_MSG_INFO(
"----------------- Gain " << gain <<
"-----------------" );
888 for (
int phase = Phamin; phase <= Phamax; phase += phase_step ) {
895 msg(MSG::INFO) <<
"OFC A";
896 for (
int i = 0; i <
weights.n_samples; i++)
900 msg(MSG::INFO) <<
"OFC B";
901 for (
int i = 0; i <
weights.n_samples; i++)
905 msg(MSG::INFO) <<
"OFC C";
906 for (
int i = 0; i <
weights.n_samples; i++)
910 msg(MSG::INFO) <<
"OFC G";
911 for (
int i = 0; i <
weights.n_samples; i++)
916 msg(MSG::INFO) <<
"OFC DG";
917 for (
int i = 0; i <
weights.n_samples; i++)
933 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 with parameters:
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
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
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
const TileInfo * m_tileInfo
ToolHandle< TileCondToolNoiseSample > m_tileToolNoiseSample
ToolHandle< TileCondToolIntegrator > m_tileToolIntegrator
@ OnlineMegaElectronVolts