12 #include <top/calibration/TOPChannelMaskAlgorithm.h>
13 #include <framework/logging/Logger.h>
29 TOPChannelMaskAlgorithm::TOPChannelMaskAlgorithm():
32 setDescription(
"Calibration algorithm for masking of dead and hot channels");
41 auto nhits = getObjectPtr<TH1F>(
"nhits");
43 double averageChannelHits = nhits->GetEntries() * nhits->GetMean() / 16 / 512;
44 B2INFO(
"Average number of good hits per channel: " << averageChannelHits);
50 string expNo = to_string(expRun[0].first);
51 while (expNo.length() < 4) expNo.insert(0,
"0");
52 string runNo = to_string(expRun[0].second);
53 while (runNo.length() < 5) runNo.insert(0,
"0");
54 string outputFileName =
"channelMask-e" + expNo +
"-r" + runNo +
".root";
55 m_file = TFile::Open(outputFileName.c_str(),
"recreate");
65 auto meanHits =
new TH1F(
"meanHits",
"Average number of hits per channel; slot number; average", 16, 0.5, 16.5);
66 for (
int slot = 1; slot <= 16; slot++) {
67 string name =
"hits_" + to_string(slot);
68 auto h = getObjectPtr<TH1F>(name);
73 for (
int chan = 0; chan < h->GetNbinsX(); chan++) {
74 double y = h->GetBinContent(chan + 1);
81 meanHits->SetBinContent(slot, mean);
82 double deadCut = mean / 10;
83 double hotCut = mean * 10;
84 for (
int chan = 0; chan < h->GetNbinsX(); chan++) {
85 double y = h->GetBinContent(chan + 1);
88 }
else if (y > hotCut) {
96 for (
int slot = 1; slot <= 16; slot++) {
97 string name =
"window_vs_asic_" + to_string(slot);
98 auto h = getObjectPtr<TH2F>(name);
101 auto h0 = h->ProjectionX();
103 for (
int asic = 0; asic < h->GetNbinsX(); asic++) {
104 double r = 1 - h1->GetBinContent(asic + 1) / h0->GetBinContent(asic + 1);
115 auto dead =
new TH1F(
"numDead",
"Number of dead channels; slot number; dead channels", 16, 0.5, 16.5);
116 auto hot =
new TH1F(
"numHot",
"Number of noisy channels; slot number; noisy channels", 16, 0.5, 16.5);
117 auto active =
new TH1F(
"activeFract",
"Fraction of active channels; slot number; active fraction", 16, 0.5, 16.5);
118 for (
int slot = 1; slot <= 16; slot++) {