9#include <beast/beamabort/modules/BeamabortStudyModule.h>
10#include <beast/beamabort/dataobjects/BeamabortSimHit.h>
11#include <beast/beamabort/dataobjects/BeamabortHit.h>
12#include <framework/datastore/StoreArray.h>
13#include <framework/logging/Logger.h>
14#include <framework/gearbox/GearDir.h>
25#include <generators/SAD/dataobjects/SADMetaHit.h>
30using namespace beamabort;
57 B2INFO(
"BeamabortStudyModule: Initialize");
59 for (
int i = 0; i < 8; i++) {
60 h_dia_dose[i] =
new TH1F(TString::Format(
"dia_dose_%d", i),
"", 10000, 0., 10000.);
76 for (
int i = 0; i < 4; i++) {
77 h_dia_rate[i] =
new TH1F(TString::Format(
"dia_rate_%d", i),
"Count", 8, 0., 8.);
80 for (
int i = 0; i < 2; i++) {
81 h_dia_rs_rate[i] =
new TH2F(TString::Format(
"dia_rs_rate_%d", i),
"Count vs ring section", 8, 0., 8., 12, 0., 12.);
85 for (
int i = 0; i < 8; i++) {
86 h_dia_doseWeight[i] =
new TH1F(TString::Format(
"dia_doseWeight_%d", i),
"", 10000, 0., 10000.);
87 h_dia_amp[i] =
new TH1F(TString::Format(
"dia_amp_%d", i),
"", 10000, 0., 10000.);
88 h_dia_time[i] =
new TH1F(TString::Format(
"dia_time_%d", i),
"", 1000, 0., 100.);
89 h_dia_vtime[i] =
new TH1F(TString::Format(
"dia_vtime_%d", i),
"", 1000, 0., 100.);
90 h_dia_idose[i] =
new TH1F(TString::Format(
"dia_idose_%d", i),
"", 10000, 0., 10000.);
91 h_dia_idoseWeight[i] =
new TH1F(TString::Format(
"dia_idoseWeight_%d", i),
"", 10000, 0., 10000.);
92 h_dia_rs_idose[i] =
new TH2F(TString::Format(
"dia_rs_idose_%d", i),
"", 10000, 0., 10000., 12, 0., 12.);
93 h_dia_rs_idoseWeight[i] =
new TH2F(TString::Format(
"dia_rs_idoseWeight_%d", i),
"", 10000, 0., 10000., 12, 0., 12.);
94 h_dia_iamp[i] =
new TH1F(TString::Format(
"dia_iamp_%d", i),
"", 10000, 0., 10000.);
95 h_dia_itime[i] =
new TH1F(TString::Format(
"dia_itime_%d", i),
"", 1000, 0., 100.);
96 h_dia_ivtime[i] =
new TH1F(TString::Format(
"dia_ivtime_%d", i),
"", 1000, 0., 100.);
97 h_dia_Amp[i] =
new TH1F(TString::Format(
"dia_Amp_%d", i),
"", 100000, 0., 100000.);
98 h_dia_edep[i] =
new TH1F(TString::Format(
"dia_edep_%d", i),
"", 4000, 0., 4000.);
120 for (
int i = 0; i < 8; i++) {
135 int ring_section = -1;
136 const int section_ordering[12] = {1, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2};
137 for (
const auto& MetaHit : MetaHits) {
138 rate = MetaHit.getrate();
139 double sad_ssraw = MetaHit.getssraw();
141 if (sad_ssraw >= 0) ssraw = sad_ssraw / 100.;
142 else ssraw = 3000. + sad_ssraw / 100.;
144 ring_section = section_ordering[(int)((ssraw) / 250.)] - 1;
148 for (
const auto& SimHit : SimHits) {
149 int detNb = SimHit.getCellId();
151 double edep = SimHit.getEnergyDep();
152 double time = SimHit.getFlightTime();
155 int NbEle = (int)gRandom->Gaus(meanEl, sigma);
156 double Amp = NbEle / (6.25 * 1e18);
169 for (
int i = 0; i < 4; i++) {
170 if (curr[i] > 0 && Edep[i] > 0) {
176 for (
const auto&
Hit : Hits) {
177 int detNb =
Hit.getdetNb();
178 double edep =
Hit.getedep();
179 double current =
Hit.getI();
180 double time =
Hit.gettime();
200 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name=\"BEAMABORT\"]/Content/");
205 B2INFO(
"BeamabortStudy");
GearDir is the basic class used for accessing the parameter store.
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
void setDescription(const std::string &description)
Sets the description of the module.
Accessor to arrays stored in the data store.
int getEntries() const
Get the number of objects in the array.
TH1F * h_dia_doseWeight[100]
histo dose
TH2F * h_dia_rs_idoseWeight[100]
histo dose
double m_FanoFactor
Fano Factor.
TH1F * h_dia_time[100]
histo time
TH1F * h_dia_ivtime[100]
histo time weighted by volt
TH1F * h_dia_edep[100]
histo edep sum
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
TH2F * h_dia_rs_idose[100]
histo dose
TH1F * h_dia_rate[10]
Rate.
virtual void endRun() override
End-of-run action.
virtual void getXMLData()
reads data from BEAMABORT.xml: tube location, drift data filename, sigma of impulse response function
virtual void terminate() override
Termination action.
BeamabortStudyModule()
Constructor: Sets the description, the properties and the parameters of the module.
TH1F * h_dia_dose[100]
histo dose
virtual void beginRun() override
Called when entering a new run.
TH1F * h_dia_vtime[100]
histo time weighted by volt
TH1F * h_dia_iamp[100]
histo amp
TH2F * h_dia_rs_rate[10]
Rate.
TH1F * h_dia_amp[100]
histo amp
TH1F * h_dia_itime[100]
histo time
double m_WorkFunction
number of detectors.
virtual ~BeamabortStudyModule()
Destructor.
TH1F * h_dia_Amp[100]
histo amp sum
TH1F * h_dia_idoseWeight[100]
histo dose
TH1F * h_dia_idose[100]
histo dose
virtual void defineHisto() override
Defines the histograms.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.
Structure to hold some of the calpulse data.