Project
Loading...
Searching...
No Matches
BadChannelsMap.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#include "PHOSBase/Geometry.h"
14
15#include <fairlogger/Logger.h>
16
17#include <TH2.h>
18
19#include <iostream>
20
21using namespace o2::phos;
22
24{
25
26 // Mark few channels as bad for test peurposes
27 for (short i = 0; i < 56; i++) {
28 // module 2
29 short channelID = 3584 + i * 57;
30 mBadCells.set(channelID - OFFSET);
31 channelID = 3640 + i * 55;
32 mBadCells.set(channelID - OFFSET);
33 }
34
35 for (short i = 0; i < 16; i++) {
36 // module 3
37 int channelID = 8972 + i * 57;
38 mBadCells.set(channelID - OFFSET);
39 channelID = 8092 + i * 57;
40 mBadCells.set(channelID - OFFSET);
41 channelID = 8147 + i * 55;
42 mBadCells.set(channelID - OFFSET);
43 channelID = 9059 + i * 55;
44 mBadCells.set(channelID - OFFSET);
45 }
46}
47
48void BadChannelsMap::getHistogramRepresentation(char module, TH2* h) const
49{
50 const char MAXX = 64,
51 MAXZ = 56;
52 if (module < 1 || module > 4) {
53 LOG(error) << "module " << module << "does not exist";
54 return;
55 }
56 if (!h) {
57 LOG(error) << "provide histogram to be filled";
58 }
59 if (h->GetNbinsX() != MAXX || h->GetNbinsY() != MAXZ) {
60 LOG(error) << "Wrong dimentions of input histogram:" << h->GetNbinsX() << "," << h->GetNbinsY() << " instead of " << MAXX << "," << MAXZ;
61 return;
62 }
63
64 h->Reset();
65 char relid[3] = {module, 1, 1};
66 short absId;
67 char xmin = 1;
68 if (module == 1) {
69 xmin = 33;
70 }
71 for (char ix = xmin; ix <= MAXX; ix++) {
72 relid[1] = ix;
73 for (char iz = 1; iz <= MAXZ; iz++) {
74 relid[2] = iz;
75 if (o2::phos::Geometry::relToAbsNumbering(relid, absId)) {
76 if (!isChannelGood(absId)) {
77 h->SetBinContent(ix, iz, 1);
78 }
79 }
80 }
81 }
82}
83
84void BadChannelsMap::PrintStream(std::ostream& stream) const
85{
86 // first sort bad channel IDs
87 stream << "Number of bad cells: " << mBadCells.count() << "\n";
88 for (std::size_t cellID = 0; cellID < mBadCells.size(); cellID++) {
89 if (mBadCells.test(cellID)) {
90 stream << cellID + OFFSET << "\n";
91 }
92 }
93}
94
95std::ostream& o2::phos::operator<<(std::ostream& stream, const BadChannelsMap& bcm)
96{
98 return stream;
99}
uint8_t channelID
Definition RawEventData.h:8
int32_t i
Class for time synchronization of RawReader instances.
CCDB container for bad (masked) channels in PHOS.
void getHistogramRepresentation(char mod, TH2 *h) const
Convert map into 2D histogram representation.
bool isChannelGood(short channelID) const
Get the status of a certain cell.
void PrintStream(std::ostream &stream) const
Print bad channels on a given stream.
BadChannelsMap()=default
Constructor.
static bool relToAbsNumbering(const char *RelId, short &AbsId)
Definition Geometry.cxx:207
GLuint GLuint stream
Definition glcorearb.h:1806
std::ostream & operator<<(std::ostream &in, const BadChannelsMap &bcm)
Printing bad channel map on the stream.
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"