9#include <beast/pindiode/modules/PindiodeStudyModule.h>
10#include <beast/pindiode/dataobjects/PindiodeSimHit.h>
11#include <beast/pindiode/dataobjects/PindiodeHit.h>
12#include <generators/SAD/dataobjects/SADMetaHit.h>
13#include <framework/datastore/StoreArray.h>
14#include <framework/logging/Logger.h>
15#include <framework/gearbox/GearDir.h>
26using namespace pindiode;
56 for (
int i = 0; i < 4; i++) {
57 h_pin_rate[i] =
new TH1F(TString::Format(
"pin_rate_%d", i),
"Count", 64, 0., 64.);
60 for (
int i = 0; i < 2; i++) {
61 h_pin_rs_rate[i] =
new TH2F(TString::Format(
"pin_rs_rate_%d", i),
"Count vs. ring section", 64, 0., 64., 12, 0., 12.);
64 for (
int i = 0; i < 64; i++) {
65 h_pin_dose1[i] =
new TH1F(TString::Format(
"pin_dose1_%d", i),
"", 10000, 0., 10000.);
66 h_pin_dose2[i] =
new TH1F(TString::Format(
"pin_dose2_%d", i),
"", 10000, 0., 10000.);
67 h_pin_dose1Weight[i] =
new TH1F(TString::Format(
"pin_dose1Weight_%d", i),
"", 10000, 0., 10000.);
68 h_pin_dose2Weight[i] =
new TH1F(TString::Format(
"pin_dose2Weight_%d", i),
"", 10000, 0., 10000.);
69 h_pin_volt[i] =
new TH1F(TString::Format(
"pin_volt_%d", i),
"", 10000, 0., 100.);
70 h_pin_time[i] =
new TH1F(TString::Format(
"pin_time_%d", i),
"", 1000, 0., 100.);
71 h_pin_vtime[i] =
new TH1F(TString::Format(
"pin_vtime_%d", i),
"", 1000, 0., 100.);
73 h_pin_idose[i] =
new TH1F(TString::Format(
"pin_idose_%d", i),
"", 10000, 0., 10000.);
74 h_pin_idoseWeight[i] =
new TH1F(TString::Format(
"pin_idoseWeight_%d", i),
"", 10000, 0., 10000.);
76 h_pin_rs_idose[i] =
new TH2F(TString::Format(
"pin_rs_idose_%d", i),
"", 10000, 0., 10000., 12, 0., 12.);
77 h_pin_rs_idoseWeight[i] =
new TH2F(TString::Format(
"pin_rs_idoseWeight_%d", i),
"", 10000, 0., 10000., 12, 0., 12.);
79 h_pin_ivolt[i] =
new TH1F(TString::Format(
"pin_ivolt_%d", i),
"", 10000, 0., 100.);
80 h_pin_itime[i] =
new TH1F(TString::Format(
"pin_itime_%d", i),
"", 1000, 0., 100.);
81 h_pin_ivtime[i] =
new TH1F(TString::Format(
"pin_ivtime_%d", i),
"", 1000, 0., 100.);
98 B2INFO(
"PindiodeStudyModule: Initialize");
121 int ring_section = -1;
122 const int section_ordering[12] = {1, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2};
123 for (
const auto& MetaHit : MetaHits) {
124 rate = MetaHit.getrate();
125 double sad_ssraw = MetaHit.getssraw();
127 if (sad_ssraw >= 0) ssraw = sad_ssraw / 100.;
128 else ssraw = 3000. + sad_ssraw / 100.;
130 ring_section = section_ordering[(int)((ssraw) / 250.)] - 1;
139 for (
const auto& SimHit : SimHits) {
140 int detNb = SimHit.getCellId();
142 double edep = SimHit.getEnergyDep();
143 double time = SimHit.getFlightTime();
147 const int NbEle = (int)gRandom->Gaus(meanEl, sigma);
148 double volt = NbEle * 1.602176565e-19 *
m_CrematGain * 1e12;
163 for (
const auto&
Hit : Hits) {
164 int detNb =
Hit.getdetNb();
166 double edep =
Hit.getedep();
167 double volt =
Hit.getV();
168 double time =
Hit.gettime();
189 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name=\"PINDIODE\"]/Content/");
204 B2INFO(
"PinDigitizer");
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.
double m_FanoFactor
Fano Factor.
TH1F * h_pin_dose2[100]
histo dose
TH2F * h_pin_rs_rate[10]
Rate.
virtual void initialize() override
Initialize the Module.
TH1F * h_pin_vtime[100]
histo time weighted by volt
TH1F * h_pin_idoseWeight[100]
histo dose
TH1F * h_pin_idose[100]
histo dose
virtual void event() override
Event processor.
TH2F * h_pin_rs_idose[100]
histo dose
virtual void endRun() override
End-of-run action.
virtual ~PindiodeStudyModule()
Destructor.
virtual void getXMLData()
reads data from PINDIODE.xml: tube location, drift data filename, sigma of impulse response function
TH1F * h_pin_time[100]
histo time
virtual void terminate() override
Termination action.
TH1F * h_pin_itime[100]
histo time
PindiodeStudyModule()
Constructor: Sets the description, the properties and the parameters of the module.
TH1F * h_pin_ivolt[100]
histo volt
TH1F * h_pin_rate[10]
Rate.
virtual void beginRun() override
Called when entering a new run.
TH1F * h_pin_dose1Weight[100]
histo dose
TH1F * h_pin_volt[100]
histo volt
double m_CrematGain
number of detectors.
TH1F * h_pin_dose1[100]
histo dose
TH1F * h_pin_dose2Weight[100]
histo dose
TH1F * h_pin_ivtime[100]
histo time weighted by volt
double m_WorkFunction
Work function.
TH2F * h_pin_rs_idoseWeight[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.