9 #include <beast/csi/modules/CsiStudy_v2Module.h>
10 #include <framework/logging/Logger.h>
11 #include <framework/gearbox/GearDir.h>
12 #include <framework/gearbox/Const.h>
39 setDescription(
"Study_v2 module for Csis (BEAST)");
41 addParam(
"Ethres", m_Ethres,
"Energy threshold in MeV", 0.0);
44 CsiStudy_v2Module::~CsiStudy_v2Module()
49 void CsiStudy_v2Module::defineHisto()
51 for (
int i = 0; i < 153; i++) {
52 h_csi_drate[i] =
new TH1F(TString::Format(
"csi_rate_%d", i),
"count", 18, 0., 18.);
53 h_csi_drate[i]->Sumw2();
55 h_csi_rs_drate[i] =
new TH2F(TString::Format(
"csi_rs_drate_%d", i),
"count v. ring section", 18, 0., 18., 12, 0., 12.);
56 h_csi_rs_drate[i]->Sumw2();
58 for (
int j = 0; j < 18; j++) {
60 h_csi_dedep[j][i] =
new TH1F(TString::Format(
"csi_dedep_%d_%d", j, i),
"Energy deposited [MeV]", 5000, 0., 400.);
61 h_csi_rs_dedep[j][i] =
new TH2F(TString::Format(
"csi_rs_dedep_%d_%d", j, i),
"Energy deposited [MeV]", 5000, 0., 400., 12, 0., 12.);
63 h_csi_denergy[j][i] =
new TH1F(TString::Format(
"csi_denergy_%d_%d", j, i),
"Energy deposited [MeV]", 200, 0.1, 3.);
64 h_csi_rs_denergy[j][i] =
new TH2F(TString::Format(
"csi_rs_denergy_%d_%d", j, i),
"Energy deposited [MeV] per section", 200, 0.1, 3.,
68 h_csi_dedep[j][i]->Sumw2();
69 h_csi_rs_dedep[j][i]->Sumw2();
70 h_csi_denergy[j][i]->Sumw2();
71 h_csi_rs_denergy[j][i]->Sumw2();
156 void CsiStudy_v2Module::initialize()
158 B2INFO(
"CsiStudy_v2Module: Initialize");
161 MetaHits.isRequired();
162 SimHits.isOptional();
172 void CsiStudy_v2Module::beginRun()
176 void CsiStudy_v2Module::event()
179 if (SimHits.getEntries() == 0) {
185 int ring_section = -1;
186 int section_ordering[12] = {1, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2};
187 for (
const auto& MetaHit : MetaHits) {
189 double sad_ssraw = MetaHit.getssraw();
191 if (sad_ssraw >= 0) ssraw = sad_ssraw / 100.;
192 else ssraw = 3000. + sad_ssraw / 100.;
194 ring_section = section_ordering[(int)((ssraw) / 250.)] - 1;
216 for (
const auto&
Hit : Hits) {
217 int detNB =
Hit.getCellId();
218 double Edep =
Hit.getEnergyDep() * 1e3;
219 double RecEdep = Edep;
244 for (
int i = 0; i < 153; i ++) {
248 if (RecEdep >= m_Thres_hitRate[detNB][i] && m_Thres_hitRate[detNB][i] > 0) {
249 h_csi_drate[i]->Fill(detNB);
250 h_csi_rs_drate[i]->Fill(detNB, ring_section);
252 if (RecEdep >= m_Thres_sumE[detNB][i] && m_Thres_sumE[detNB][i] > 0) {
253 h_csi_dedep[detNB][i]->Fill(RecEdep);
254 h_csi_rs_dedep[detNB][i]->Fill(RecEdep, ring_section);
256 h_csi_denergy[detNB][i]->Fill(log10(RecEdep));
257 h_csi_rs_denergy[detNB][i]->Fill(log10(RecEdep), ring_section);
263 void CsiStudy_v2Module::getXMLData()
265 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name=\"CSI\"]/Content/");
266 m_Ethres = content.getDouble(
"Ethres");
269 for (
int i = 0; i < 18; i ++) {
270 int iThres_hitRate = 0;
271 for (
double Thres : content.getArray(TString::Format(
"thres_hitRate_det%d", i).Data(), {0})) {
272 m_Thres_hitRate[i][iThres_hitRate] = Thres;
276 for (
double Thres : content.getArray(TString::Format(
"thres_sumE_det%d", i).Data(), {0})) {
277 m_Thres_sumE[i][iThres_sumE] = Thres;
282 B2INFO(
"CsiStudy_v2");
285 void CsiStudy_v2Module::endRun()
291 void CsiStudy_v2Module::terminate()
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...
Study module for Csis (BEAST)
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.
Structure to hold some of the calpulse data.