9 #include <beast/bgo/modules/BgoStudyModule.h>
10 #include <beast/bgo/dataobjects/BgoSimHit.h>
11 #include <beast/bgo/dataobjects/BgoHit.h>
12 #include <framework/datastore/StoreArray.h>
13 #include <framework/logging/Logger.h>
14 #include <framework/gearbox/Const.h>
24 #include <generators/SAD/dataobjects/SADMetaHit.h>
43 setDescription(
"Study module for Bgos (BEAST)");
45 addParam(
"Ethres", m_Ethres,
"Energy threshold in MeV");
48 BgoStudyModule::~BgoStudyModule()
53 void BgoStudyModule::defineHisto()
55 for (
int i = 0; i < 2; i++) {
56 h_bgo_rate[i] =
new TH1F(TString::Format(
"bgo_rate_%d", i),
"count", 18, 0., 18.);
57 h_bgo_rate[i]->Sumw2();
59 h_bgo_rs_rate[i] =
new TH2F(TString::Format(
"bgo_rs_rate_%d", i),
"count v. ring section", 18, 0., 18., 12, 0., 12.);
60 h_bgo_rs_rate[i]->Sumw2();
62 for (
int i = 0; i < 18; i++) {
63 h_bgo_Evtof[i] =
new TH2F(TString::Format(
"bgo_Evtof_%d", i),
"Energy deposited [MeV] vs TOF [ns] - all", 5000, 0., 1000.,
65 h_bgo_Evtof1[i] =
new TH2F(TString::Format(
"bgo_Evtof1_%d", i),
"Energy deposited [MeV] vs TOF [ns] - all", 5000, 0., 1000.,
67 h_bgo_Evtof2[i] =
new TH2F(TString::Format(
"bgo_Evtof2_%d", i),
"Energy deposited [MeV] vs TOF [ns] - only photons", 5000, 0.,
68 1000., 1000, 0., 400.);
69 h_bgo_Evtof3[i] =
new TH2F(TString::Format(
"bgo_Evtof3_%d", i),
"Energy deposited [MeV] vs TOF [ns] - only e+/e-", 5000, 0.,
70 1000., 1000, 0., 400.);
72 h_bgo_edep[i] =
new TH1F(TString::Format(
"bgo_edep_%d", i),
"Energy deposited [MeV]", 5000, 0., 400.);
73 h_bgo_edep1[i] =
new TH1F(TString::Format(
"bgo_edep1_%d", i),
"Energy deposited [MeV]", 5000, 0., 400.);
74 h_bgo_edep2[i] =
new TH1F(TString::Format(
"bgo_edep2_%d", i),
"Energy deposited [MeV]", 5000, 0., 400.);
75 h_bgo_edep1Weight[i] =
new TH1F(TString::Format(
"bgo_edep1Weight_%d", i),
"Energy deposited [MeV]", 5000, 0., 400.);
76 h_bgo_edep2Weight[i] =
new TH1F(TString::Format(
"bgo_edep2Weight_%d", i),
"Energy deposited [MeV]", 5000, 0., 400.);
78 h_bgo_rs_edep1[i] =
new TH2F(TString::Format(
"bgo_rs_edep1_%d", i),
"Energy deposited [MeV]", 5000, 0., 400., 12, 0., 12.);
79 h_bgo_rs_edep2[i] =
new TH2F(TString::Format(
"bgo_rs_edep2_%d", i),
"Energy deposited [MeV]", 5000, 0., 400., 12, 0., 12.);
80 h_bgo_rs_edep1Weight[i] =
new TH2F(TString::Format(
"bgo_rs_edep1Weight_%d", i),
"Energy deposited [MeV]", 5000, 0., 400., 12, 0.,
82 h_bgo_rs_edep2Weight[i] =
new TH2F(TString::Format(
"bgo_rs_edep2Weight_%d", i),
"Energy deposited [MeV]", 5000, 0., 400., 12, 0.,
85 h_bgo_edep[i]->Sumw2();
86 h_bgo_edep1[i]->Sumw2();
87 h_bgo_edep2[i]->Sumw2();
88 h_bgo_edep1Weight[i]->Sumw2();
89 h_bgo_edep2Weight[i]->Sumw2();
90 h_bgo_rs_edep1[i]->Sumw2();
91 h_bgo_rs_edep2[i]->Sumw2();
92 h_bgo_rs_edep1Weight[i]->Sumw2();
93 h_bgo_rs_edep2Weight[i]->Sumw2();
99 void BgoStudyModule::initialize()
101 B2INFO(
"BgoStudyModule: Initialize");
110 void BgoStudyModule::beginRun()
114 void BgoStudyModule::event()
128 int ring_section = -1;
129 int section_ordering[12] = {1, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2};
130 for (
const auto& MetaHit : MetaHits) {
131 rate = MetaHit.getrate();
132 double sad_ssraw = MetaHit.getssraw();
134 if (sad_ssraw >= 0) ssraw = sad_ssraw / 100.;
135 else ssraw = 3000. + sad_ssraw / 100.;
137 ring_section = section_ordering[(int)((ssraw) / 250.)] - 1;
141 for (
const auto& SimHit : SimHits) {
142 int detNB = SimHit.getCellId();
143 int pdg = SimHit.getPDGCode();
144 double Edep = SimHit.getEnergyDep() * 1e3;
145 double tof = SimHit.getFlightTime();
147 h_bgo_edep[detNB]->Fill(Edep);
148 h_bgo_Evtof[detNB]->Fill(tof, Edep);
149 if (pdg == Const::photon.getPDGCode()) h_bgo_Evtof1[detNB]->Fill(tof, Edep);
150 else if (fabs(pdg) == Const::electron.getPDGCode()) h_bgo_Evtof2[detNB]->Fill(tof, Edep);
151 double RecEdep = Edep;
152 h_bgo_rate[0]->Fill(detNB);
153 h_bgo_rate[1]->Fill(detNB, rate);
154 h_bgo_edep1[detNB]->Fill(Edep);
155 h_bgo_edep2[detNB]->Fill(RecEdep);
156 h_bgo_edep1Weight[detNB]->Fill(Edep, rate);
157 h_bgo_edep2Weight[detNB]->Fill(RecEdep, rate);
158 h_bgo_Evtof3[detNB]->Fill(tof, RecEdep);
159 h_bgo_rs_rate[0]->Fill(detNB, ring_section);
160 h_bgo_rs_rate[1]->Fill(detNB, ring_section, rate);
161 h_bgo_rs_edep1[detNB]->Fill(Edep, ring_section);
162 h_bgo_rs_edep2[detNB]->Fill(RecEdep, ring_section);
163 h_bgo_rs_edep1Weight[detNB]->Fill(Edep, ring_section, rate);
164 h_bgo_rs_edep2Weight[detNB]->Fill(RecEdep, ring_section, rate);
200 void BgoStudyModule::endRun()
206 void BgoStudyModule::terminate()
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Accessor to arrays stored in the data store.
int getEntries() const
Get the number of objects in the array.
Study module for Bgos (BEAST)
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.