9 #include <top/modules/collectors/TOPChannelMaskCollectorModule.h>
31 TOPChannelMaskCollectorModule::TOPChannelMaskCollectorModule()
34 setDescription(
"A collector for preparing masks of dead and hot channels");
35 setPropertyFlags(c_ParallelProcessingCertified);
39 void TOPChannelMaskCollectorModule::prepare()
42 m_digits.isRequired();
44 auto nhits =
new TH1F(
"nhits",
"Number of good hits per event; hits per event; entries per bin", 200, 0, 2000);
45 registerObject<TH1F>(
"nhits", nhits);
47 for (
int slot = 1; slot <= 16; slot++) {
48 string name =
"hits_" + to_string(slot);
49 string title =
"Channel occupancies for slot " + to_string(slot);
50 auto h =
new TH1F(name.c_str(), title.c_str(), 512, 0, 512);
51 h->SetXTitle(
"channel number");
52 h->SetYTitle(
"number of hits per channel");
53 registerObject<TH1F>(name, h);
54 m_names.push_back(name);
57 for (
int slot = 1; slot <= 16; slot++) {
58 string name =
"window_vs_asic_" + to_string(slot);
59 string title =
"Window vs. asic for slot " + to_string(slot);
60 auto h =
new TH2F(name.c_str(), title.c_str(), 64, 0, 64, 512, 0, 512);
61 h->SetXTitle(
"ASIC number");
62 h->SetYTitle(
"window number w.r.t reference window");
63 registerObject<TH2F>(name, h);
64 m_asicNames.push_back(name);
70 void TOPChannelMaskCollectorModule::collect()
73 std::vector<TH1F*> slots;
74 for (
const auto& name : m_names) {
75 auto h = getObjectPtr<TH1F>(name);
79 std::vector<TH2F*> asics;
80 for (
const auto& name : m_asicNames) {
81 auto h = getObjectPtr<TH2F>(name);
86 for (
const auto& digit : m_digits) {
87 if (digit.getHitQuality() == TOPDigit::c_Junk)
continue;
89 unsigned m = digit.getModuleID() - 1;
90 if (m < slots.size()) slots[m]->Fill(digit.getChannel());
91 if (m < asics.size()) asics[m]->Fill(digit.getChannel() / 8, digit.getRawTime() / 64 + 220);
94 auto h = getObjectPtr<TH1F>(
"nhits");
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.