Project
Loading...
Searching...
No Matches
BadChannelMap.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 "CPVBase/Geometry.h"
14
15#include <fairlogger/Logger.h>
16
17#include <TH2.h>
18
19#include <iostream>
20
21using namespace o2::cpv;
22
24{
25 // reset all channels to be good
26 mBadCells.reset();
27
28 if (test == 2) {
29 // Mark few channels as bad for test peurposes
30 for (short i = 0; i < 60; i++) {
31 // module 2
32 unsigned short channelID = 3584 + i * 57;
33 mBadCells.set(channelID);
34 channelID = 3640 + i * 55;
35 mBadCells.set(channelID);
36 }
37
38 for (short i = 0; i < 16; i++) {
39 // module 3
40 unsigned short channelID = 8972 + i * 57;
41 mBadCells.set(channelID);
42 channelID = 8092 + i * 57;
43 mBadCells.set(channelID);
44 channelID = 8147 + i * 55;
45 mBadCells.set(channelID);
46 channelID = 9059 + i * 55;
47 mBadCells.set(channelID);
48 }
49 }
50}
51
52void BadChannelMap::getHistogramRepresentation(short module, TH2* h) const
53{
54 if (!h) {
55 LOG(error) << "provide histogram to be filled";
56 }
57
58 const short MAXX = 128,
59 MAXZ = 60;
60 if (h->GetNbinsX() != MAXX || h->GetNbinsY() != MAXZ) {
61 LOG(error) << "Wrong dimentions of input histogram:" << h->GetNbinsX() << "," << h->GetNbinsY() << " instead of " << MAXX << "," << MAXZ;
62 return;
63 }
64
65 h->Reset();
66
67 short relid[3] = {module, 1, 1};
68 unsigned short absId;
69 for (short ix = 1; ix <= MAXX; ix++) {
70 relid[1] = ix;
71 for (short iz = 1; iz <= MAXZ; iz++) {
72 relid[2] = iz;
73 if (Geometry::relToAbsNumbering(relid, absId)) {
74 if (!isChannelGood(absId)) {
75 h->SetBinContent(ix, iz, 1);
76 }
77 }
78 }
79 }
80}
81
82void BadChannelMap::PrintStream(std::ostream& stream) const
83{
84 // first sort bad channel IDs
85 stream << "Number of bad cells: " << mBadCells.count() << "\n";
86 for (unsigned int cellID = 0; cellID < mBadCells.size(); cellID++) {
87 if (mBadCells.test(cellID)) {
88 stream << cellID << "\n";
89 }
90 }
91}
92
93std::ostream& o2::cpv::operator<<(std::ostream& stream, const BadChannelMap& bcm)
94{
96 return stream;
97}
uint8_t channelID
Definition RawEventData.h:8
int32_t i
Class for time synchronization of RawReader instances.
CCDB container for bad (masked) channels in CPV.
void getHistogramRepresentation(short mod, TH2 *h) const
Convert map into 2D histogram representation.
void PrintStream(std::ostream &stream) const
Print bad channels on a given stream.
bool isChannelGood(unsigned short channelID) const
Get the status of a certain cell.
BadChannelMap()=default
Constructor.
static bool relToAbsNumbering(const short *relId, unsigned short &absId)
Definition Geometry.cxx:99
GLuint GLuint stream
Definition glcorearb.h:1806
std::ostream & operator<<(std::ostream &in, const BadChannelMap &bcm)
Printing bad channel map on the stream.
FIXME: do not use data model tables.
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"