11 #include <top/modules/collectors/TOPChannelMaskCollectorModule.h>
36 setDescription(
"A collector for preparing masks of dead and hot channels");
37 setPropertyFlags(c_ParallelProcessingCertified);
41 void TOPChannelMaskCollectorModule::prepare()
44 m_digits.isRequired();
46 auto nhits =
new TH1F(
"nhits",
"Number of good hits per event; hits per event; entries per bin", 200, 0, 2000);
47 registerObject<TH1F>(
"nhits", nhits);
49 for (
int slot = 1; slot <= 16; slot++) {
50 string name =
"hits_" + to_string(slot);
51 string title =
"Channel occupancies for slot " + to_string(slot);
52 auto h =
new TH1F(name.c_str(), title.c_str(), 512, 0, 512);
53 h->SetXTitle(
"channel number");
54 h->SetYTitle(
"number of hits per channel");
55 registerObject<TH1F>(name, h);
56 m_names.push_back(name);
59 for (
int slot = 1; slot <= 16; slot++) {
60 string name =
"window_vs_asic_" + to_string(slot);
61 string title =
"Window vs. asic for slot " + to_string(slot);
62 auto h =
new TH2F(name.c_str(), title.c_str(), 64, 0, 64, 512, 0, 512);
63 h->SetXTitle(
"ASIC number");
64 h->SetYTitle(
"window number w.r.t reference window");
65 registerObject<TH2F>(name, h);
66 m_asicNames.push_back(name);
72 void TOPChannelMaskCollectorModule::collect()
75 std::vector<TH1F*> slots;
76 for (
const auto& name : m_names) {
77 auto h = getObjectPtr<TH1F>(name);
81 std::vector<TH2F*> asics;
82 for (
const auto& name : m_asicNames) {
83 auto h = getObjectPtr<TH2F>(name);
88 for (
const auto& digit : m_digits) {
89 if (digit.getHitQuality() == TOPDigit::c_Junk)
continue;
91 unsigned m = digit.getModuleID() - 1;
92 if (m < slots.size()) slots[m]->Fill(digit.getChannel());
93 if (m < asics.size()) asics[m]->Fill(digit.getChannel() / 8, digit.getRawTime() / 64 + 220);
96 auto h = getObjectPtr<TH1F>(
"nhits");