11 #include <beast/fangs/modules/FANGSDigitizerModule.h>
12 #include <beast/fangs/dataobjects/FANGSSimHit.h>
14 #include <mdst/dataobjects/MCParticle.h>
15 #include <framework/logging/Logger.h>
16 #include <framework/gearbox/GearDir.h>
17 #include <framework/core/RandomNumbers.h>
24 using namespace fangs;
39 setDescription(
"FANGS digitizer module");
42 addParam(
"LowerTimingCut", m_lowerTimingCut,
"Lower timing cut", 0.);
43 addParam(
"UpperTimingCut", m_upperTimingCut,
"Upper timing cut", 1000000.);
46 FANGSDigitizerModule::~FANGSDigitizerModule()
52 B2INFO(
"FANGSDigitizer: Initializing");
53 m_fangsHit.registerInDataStore();
59 fctToT_Calib1 =
new TF1(
"fctToT_Calib1",
"[0]*(x/[3]+[1])/(x/[3]+[2])", 0., 100000.);
62 fctToT_Calib2 =
new TF1(
"fctToT_Calib2",
"[0]*(x/[3]+[1])/(x/[3]+[2])", 0., 100000.);
82 const int detNb = (lad - 1) * 5 + sen - 1;
90 for (
auto& val : T0) {
103 const int detNb = (lad - 1) * 5 + sen - 1;
107 const TVector3 chipPosition(
137 const double sigma = sqrt(
m_Fanofac * meanEl);
138 const int NbEle = (int)gRandom->Gaus(meanEl, sigma);
143 int quT = gRandom->Uniform(-1, 1);
151 (0 <= bci && bci < MAXtSIZE)) {
157 m_dchip[std::tuple<int, int, int>(col, row, bci)] += (int)(NbEle);
174 std::vector<int> col;
175 std::vector<int> row;
176 std::vector<int> ToT;
177 std::vector<int> bci;
182 const auto& key = keyValuePair.first;
184 int i = std::get<0>(key);
186 int j = std::get<1>(key);
188 if (
m_dchip_map[std::tuple<int, int>(i, j)] == 1) {
191 const int quE = gRandom->Uniform(0, 2);
195 for (
auto& keyValuePair2 :
m_dchip) {
196 const auto& key2 = keyValuePair2.first;
197 int k = std::get<2>(key2);
198 if (
m_dchip[std::tuple<int, int, int>(i, j, k)] > thresEl) {
208 for (
auto& keyValuePair2 :
m_dchip) {
209 const auto& key2 = keyValuePair2.first;
210 int k = std::get<2>(key2);
213 NbOfEl +=
m_dchip[std::tuple<int, int, int>(i, j, k)];
217 if (NbOfEl > thresEl && NbOfEl <= 45.*
m_TOTQ1) {
221 }
else if (NbOfEl > 800.*
m_TOTQ1) {
243 if (NbOfEl > thresEl && NbOfEl <= 45.*
m_TOTQ1) {
247 }
else if (NbOfEl > 800.*
m_TOTQ1) {
268 if (bci.size() > 0) {
271 sort(t0.begin(), t0.end());
274 for (
int j = 0; j < (int)bci.size(); j++) {
291 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name=\"FANGS\"]/Content/");
303 m_TOTA1 = content.getDouble(
"TOTA1");
304 m_TOTB1 = content.getDouble(
"TOTB1");
305 m_TOTC1 = content.getDouble(
"TOTC1");
306 m_TOTQ1 = content.getDouble(
"TOTQ1");
307 m_TOTA2 = content.getDouble(
"TOTA2");
308 m_TOTB2 = content.getDouble(
"TOTB2");
309 m_TOTC2 = content.getDouble(
"TOTC2");
310 m_TOTQ2 = content.getDouble(
"TOTQ2");
313 m_Workfct = content.getDouble(
"Workfct");
314 m_Fanofac = content.getDouble(
"Fanofac");
316 B2INFO(
"FANGSDigitizer: Aquired FANGS locations and gas parameters");
317 B2INFO(
" from FANGS.xml. There are " <<
m_nFANGS <<
" FANGSs implemented");