9 #include <top/calibration/TOPChannelMaskAlgorithm.h>
10 #include <framework/logging/Logger.h>
26 TOPChannelMaskAlgorithm::TOPChannelMaskAlgorithm():
29 setDescription(
"Calibration algorithm for masking of dead and hot channels");
38 auto nhits = getObjectPtr<TH1F>(
"nhits");
40 double averageChannelHits = nhits->GetEntries() * nhits->GetMean() / 16 / 512;
41 B2INFO(
"Average number of good hits per channel: " << averageChannelHits);
47 string expNo = to_string(expRun[0].first);
48 while (expNo.length() < 4) expNo.insert(0,
"0");
49 string runNo = to_string(expRun[0].second);
50 while (runNo.length() < 5) runNo.insert(0,
"0");
51 string outputFileName =
"channelMask-e" + expNo +
"-r" + runNo +
".root";
52 m_file = TFile::Open(outputFileName.c_str(),
"recreate");
62 auto meanHits =
new TH1F(
"meanHits",
"Average number of hits per channel; slot number; average", 16, 0.5, 16.5);
63 for (
int slot = 1; slot <= 16; slot++) {
64 string name =
"hits_" + to_string(slot);
65 auto h = getObjectPtr<TH1F>(name);
70 for (
int chan = 0; chan < h->GetNbinsX(); chan++) {
71 double y = h->GetBinContent(chan + 1);
78 meanHits->SetBinContent(slot, mean);
79 double deadCut = mean / 10;
80 double hotCut = mean * 10;
81 for (
int chan = 0; chan < h->GetNbinsX(); chan++) {
82 double y = h->GetBinContent(chan + 1);
85 }
else if (y > hotCut) {
93 for (
int slot = 1; slot <= 16; slot++) {
94 string name =
"window_vs_asic_" + to_string(slot);
95 auto h = getObjectPtr<TH2F>(name);
98 auto h0 = h->ProjectionX();
100 for (
int asic = 0; asic < h->GetNbinsX(); asic++) {
101 double r = 1 - h1->GetBinContent(asic + 1) / h0->GetBinContent(asic + 1);
112 auto dead =
new TH1F(
"numDead",
"Number of dead channels; slot number; dead channels", 16, 0.5, 16.5);
113 auto hot =
new TH1F(
"numHot",
"Number of noisy channels; slot number; noisy channels", 16, 0.5, 16.5);
114 auto active =
new TH1F(
"activeFract",
"Fraction of active channels; slot number; active fraction", 16, 0.5, 16.5);
115 for (
int slot = 1; slot <= 16; slot++) {
Base class for calibration algorithms.
void saveCalibration(TClonesArray *data, const std::string &name)
Store DBArray payload with given name with default IOV.
void setDescription(const std::string &description)
Set algorithm description (in constructor)
EResult
The result of calibration.
@ c_OK
Finished successfuly =0 in Python.
@ c_NotEnoughData
Needs more data =2 in Python.
const std::vector< Calibration::ExpRun > & getRunList() const
Get the list of runs for which calibration is called.
Channel status for all 512 channels of 16 modules.
int getNumOfDeadChannels() const
Returns number of dead channels.
int getNumOfNoisyChannels() const
Returns number of noisy channels.
double getActiveFraction() const
Returns fraction of active channels.
double m_minHits
minimal number of hits per channel needed for calibration
virtual EResult calibrate() final
algorithm implementation
int m_maxWindow
band upper limit in window_vs_asic
TOPCalChannelMask * m_channelMask
masks of dead and hot channels
int m_minWindow
band lower limit in window_vs_asic
void setNoisy(int moduleID, unsigned channel)
Sets a specific channel as noisy.
void setDead(int moduleID, unsigned channel)
Sets a specific channel as dead.
Abstract base class for different kinds of events.