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>
22#include <generators/SAD/dataobjects/SADMetaHit.h>
27using namespace beamabort;
54 B2INFO(
"BeamabortStudyModule: Initialize");
56 for (
int i = 0; i < 8; i++) {
57 h_dia_dose[i] =
new TH1F(TString::Format(
"dia_dose_%d", i),
"", 10000, 0., 10000.);
73 for (
int i = 0; i < 4; i++) {
74 h_dia_rate[i] =
new TH1F(TString::Format(
"dia_rate_%d", i),
"Count", 8, 0., 8.);
77 for (
int i = 0; i < 2; i++) {
78 h_dia_rs_rate[i] =
new TH2F(TString::Format(
"dia_rs_rate_%d", i),
"Count vs ring section", 8, 0., 8., 12, 0., 12.);
82 for (
int i = 0; i < 8; i++) {
83 h_dia_doseWeight[i] =
new TH1F(TString::Format(
"dia_doseWeight_%d", i),
"", 10000, 0., 10000.);
84 h_dia_amp[i] =
new TH1F(TString::Format(
"dia_amp_%d", i),
"", 10000, 0., 10000.);
85 h_dia_time[i] =
new TH1F(TString::Format(
"dia_time_%d", i),
"", 1000, 0., 100.);
86 h_dia_vtime[i] =
new TH1F(TString::Format(
"dia_vtime_%d", i),
"", 1000, 0., 100.);
87 h_dia_idose[i] =
new TH1F(TString::Format(
"dia_idose_%d", i),
"", 10000, 0., 10000.);
88 h_dia_idoseWeight[i] =
new TH1F(TString::Format(
"dia_idoseWeight_%d", i),
"", 10000, 0., 10000.);
89 h_dia_rs_idose[i] =
new TH2F(TString::Format(
"dia_rs_idose_%d", i),
"", 10000, 0., 10000., 12, 0., 12.);
90 h_dia_rs_idoseWeight[i] =
new TH2F(TString::Format(
"dia_rs_idoseWeight_%d", i),
"", 10000, 0., 10000., 12, 0., 12.);
91 h_dia_iamp[i] =
new TH1F(TString::Format(
"dia_iamp_%d", i),
"", 10000, 0., 10000.);
92 h_dia_itime[i] =
new TH1F(TString::Format(
"dia_itime_%d", i),
"", 1000, 0., 100.);
93 h_dia_ivtime[i] =
new TH1F(TString::Format(
"dia_ivtime_%d", i),
"", 1000, 0., 100.);
94 h_dia_Amp[i] =
new TH1F(TString::Format(
"dia_Amp_%d", i),
"", 100000, 0., 100000.);
95 h_dia_edep[i] =
new TH1F(TString::Format(
"dia_edep_%d", i),
"", 4000, 0., 4000.);
117 for (
int i = 0; i < 8; i++) {
132 int ring_section = -1;
133 const int section_ordering[12] = {1, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2};
134 for (
const auto& MetaHit : MetaHits) {
135 rate = MetaHit.getrate();
136 double sad_ssraw = MetaHit.getssraw();
138 if (sad_ssraw >= 0) ssraw = sad_ssraw / 100.;
139 else ssraw = 3000. + sad_ssraw / 100.;
141 ring_section = section_ordering[(int)((ssraw) / 250.)] - 1;
145 for (
const auto& SimHit : SimHits) {
146 int detNb = SimHit.getCellId();
148 double edep = SimHit.getEnergyDep();
149 double time = SimHit.getFlightTime();
152 int NbEle = (int)gRandom->Gaus(meanEl, sigma);
153 double Amp = NbEle / (6.25 * 1e18);
166 for (
int i = 0; i < 4; i++) {
167 if (curr[i] > 0 && Edep[i] > 0) {
173 for (
const auto&
Hit : Hits) {
174 int detNb =
Hit.getdetNb();
175 double edep =
Hit.getedep();
176 double current =
Hit.getI();
177 double time =
Hit.gettime();
197 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name=\"BEAMABORT\"]/Content/");
202 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.