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>
29using namespace pindiode;
59 for (
int i = 0; i < 4; i++) {
60 h_pin_rate[i] =
new TH1F(TString::Format(
"pin_rate_%d", i),
"Count", 64, 0., 64.);
63 for (
int i = 0; i < 2; i++) {
64 h_pin_rs_rate[i] =
new TH2F(TString::Format(
"pin_rs_rate_%d", i),
"Count vs. ring section", 64, 0., 64., 12, 0., 12.);
67 for (
int i = 0; i < 64; i++) {
68 h_pin_dose1[i] =
new TH1F(TString::Format(
"pin_dose1_%d", i),
"", 10000, 0., 10000.);
69 h_pin_dose2[i] =
new TH1F(TString::Format(
"pin_dose2_%d", i),
"", 10000, 0., 10000.);
70 h_pin_dose1Weight[i] =
new TH1F(TString::Format(
"pin_dose1Weight_%d", i),
"", 10000, 0., 10000.);
71 h_pin_dose2Weight[i] =
new TH1F(TString::Format(
"pin_dose2Weight_%d", i),
"", 10000, 0., 10000.);
72 h_pin_volt[i] =
new TH1F(TString::Format(
"pin_volt_%d", i),
"", 10000, 0., 100.);
73 h_pin_time[i] =
new TH1F(TString::Format(
"pin_time_%d", i),
"", 1000, 0., 100.);
74 h_pin_vtime[i] =
new TH1F(TString::Format(
"pin_vtime_%d", i),
"", 1000, 0., 100.);
76 h_pin_idose[i] =
new TH1F(TString::Format(
"pin_idose_%d", i),
"", 10000, 0., 10000.);
77 h_pin_idoseWeight[i] =
new TH1F(TString::Format(
"pin_idoseWeight_%d", i),
"", 10000, 0., 10000.);
79 h_pin_rs_idose[i] =
new TH2F(TString::Format(
"pin_rs_idose_%d", i),
"", 10000, 0., 10000., 12, 0., 12.);
80 h_pin_rs_idoseWeight[i] =
new TH2F(TString::Format(
"pin_rs_idoseWeight_%d", i),
"", 10000, 0., 10000., 12, 0., 12.);
82 h_pin_ivolt[i] =
new TH1F(TString::Format(
"pin_ivolt_%d", i),
"", 10000, 0., 100.);
83 h_pin_itime[i] =
new TH1F(TString::Format(
"pin_itime_%d", i),
"", 1000, 0., 100.);
84 h_pin_ivtime[i] =
new TH1F(TString::Format(
"pin_ivtime_%d", i),
"", 1000, 0., 100.);
101 B2INFO(
"PindiodeStudyModule: Initialize");
124 int ring_section = -1;
125 const int section_ordering[12] = {1, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2};
126 for (
const auto& MetaHit : MetaHits) {
127 rate = MetaHit.getrate();
128 double sad_ssraw = MetaHit.getssraw();
130 if (sad_ssraw >= 0) ssraw = sad_ssraw / 100.;
131 else ssraw = 3000. + sad_ssraw / 100.;
133 ring_section = section_ordering[(int)((ssraw) / 250.)] - 1;
142 for (
const auto& SimHit : SimHits) {
143 int detNb = SimHit.getCellId();
145 double edep = SimHit.getEnergyDep();
146 double time = SimHit.getFlightTime();
150 const int NbEle = (int)gRandom->Gaus(meanEl, sigma);
151 double volt = NbEle * 1.602176565e-19 *
m_CrematGain * 1e12;
166 for (
const auto&
Hit : Hits) {
167 int detNb =
Hit.getdetNb();
169 double edep =
Hit.getedep();
170 double volt =
Hit.getV();
171 double time =
Hit.gettime();
192 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name=\"PINDIODE\"]/Content/");
207 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.