9#include <beast/fangs/modules/FANGSDigitizerModule.h>
10#include <beast/fangs/dataobjects/FANGSSimHit.h>
12#include <mdst/dataobjects/MCParticle.h>
13#include <framework/logging/Logger.h>
14#include <framework/gearbox/GearDir.h>
15#include <framework/core/RandomNumbers.h>
44FANGSDigitizerModule::~FANGSDigitizerModule()
50 B2INFO(
"FANGSDigitizer: Initializing");
57 fctToT_Calib1 =
new TF1(
"fctToT_Calib1",
"[0]*(x/[3]+[1])/(x/[3]+[2])", 0., 100000.);
60 fctToT_Calib2 =
new TF1(
"fctToT_Calib2",
"[0]*(x/[3]+[1])/(x/[3]+[2])", 0., 100000.);
79 const int detNb = (lad - 1) * 5 + sen - 1;
87 for (
auto& val : T0) {
100 const int detNb = (lad - 1) * 5 + sen - 1;
104 const ROOT::Math::XYZVector chipPosition(
135 const int NbEle = (int)gRandom->Gaus(meanEl, sigma);
140 int quT = gRandom->Uniform(-1, 1);
148 (0 <= bci && bci < MAXtSIZE)) {
154 m_dchip[std::tuple<int, int, int>(col, row, bci)] += (int)(NbEle);
171 std::vector<int> col;
172 std::vector<int> row;
173 std::vector<int> ToT;
174 std::vector<int> bci;
179 const auto& key = keyValuePair.first;
181 int i = std::get<0>(key);
183 int j = std::get<1>(key);
185 if (
m_dchip_map[std::tuple<int, int>(i, j)] == 1) {
188 const int quE = gRandom->Uniform(0, 2);
192 for (
auto& keyValuePair2 :
m_dchip) {
193 const auto& key2 = keyValuePair2.first;
194 int k = std::get<2>(key2);
195 if (
m_dchip[std::tuple<int, int, int>(i, j, k)] > thresEl) {
205 for (
auto& keyValuePair2 :
m_dchip) {
206 const auto& key2 = keyValuePair2.first;
207 int k = std::get<2>(key2);
210 NbOfEl +=
m_dchip[std::tuple<int, int, int>(i, j, k)];
214 if (NbOfEl > thresEl && NbOfEl <= 45.*
m_TOTQ1) {
218 }
else if (NbOfEl > 800.*
m_TOTQ1) {
240 if (NbOfEl > thresEl && NbOfEl <= 45.*
m_TOTQ1) {
244 }
else if (NbOfEl > 800.*
m_TOTQ1) {
265 if (bci.size() > 0) {
268 sort(t0.begin(), t0.end());
271 for (
int j = 0; j < (int)bci.size(); j++) {
288 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name=\"FANGS\"]/Content/");
300 m_TOTA1 = content.getDouble(
"TOTA1");
301 m_TOTB1 = content.getDouble(
"TOTB1");
302 m_TOTC1 = content.getDouble(
"TOTC1");
303 m_TOTQ1 = content.getDouble(
"TOTQ1");
304 m_TOTA2 = content.getDouble(
"TOTA2");
305 m_TOTB2 = content.getDouble(
"TOTB2");
306 m_TOTC2 = content.getDouble(
"TOTC2");
307 m_TOTQ2 = content.getDouble(
"TOTQ2");
310 m_Workfct = content.getDouble(
"Workfct");
311 m_Fanofac = content.getDouble(
"Fanofac");
313 B2INFO(
"FANGSDigitizer: Aquired FANGS locations and gas parameters");
314 B2INFO(
" from FANGS.xml. There are " <<
m_nFANGS <<
" FANGSs implemented");
ClassFANGSHit - digitization simulated hit for the FANGS detector.
Class FANGSSimHit - Geant4 simulated hit for the FANGS detector.
float getEnergyDep() const
Return the energy deposition in electrons.
int getLadder() const
Return the Ladder number (starting at 1, increasing with phi)
int getSensor() const
Return the Sensor number (starting at 1, increasing with decreasing z)
int getPDG() const
Return the PDG number of the track.
ROOT::Math::XYZVector getLocalPosEntry() const
Return the local entry track position.
int gettrkID() const
Return track ID.
GearDir is the basic class used for accessing the parameter store.
void setDescription(const std::string &description)
Sets the description of the module.
Accessor to arrays stored in the data store.
T * appendNew()
Construct a new T object at the end of the array.
double m_TOTC1
TOT factor C1.
double m_lowerTimingCut
Lower timing cut.
double m_ChipRowY
Chip row y dimension.
std::map< std::tuple< int, int >, int > m_dchip_pdg_map
chip pdg map arrays
double m_TOTA1
TOT factor A1.
std::map< std::tuple< int, int >, int > m_dchip_trkID_map
chip track ID map arrays
double m_PixelTimeBin
Pixel time bin.
virtual void initialize() override
Initialize the Module.
TF1 * fctToT_Calib1
Define ToT calib 1.
StoreArray< FANGSHit > m_fangsHit
array for FANGSHit
virtual void event() override
This method is the core of the module.
double m_TOTB1
TOT factor B1.
virtual void endRun() override
This method is called if the current run ends.
double m_ChipColumnX
Chip column x dimension.
void getXMLData()
reads data from MICROFANGS.xml: tube location, drift data filename, sigma of impulse response functio...
virtual void terminate() override
This method is called at the end of the event processing.
double m_TOTQ2
TOT factor Q2.
double m_v_sensor
Drift velocity in sensor.
double m_upperTimingCut
Upper timing cut.
std::map< std::tuple< int, int, int >, int > m_dchip
chip store arrays
double m_sensor_width
sensor width
TF1 * fctToT_Calib2
Define ToT calib 2.
std::map< std::tuple< int, int >, int > m_dchip_detNb_map
chip Nb map arrays
virtual void beginRun() override
Called when entering a new run.
double m_TOTC2
TOT factor C2.
int m_ChipRowNb
Chip row number.
std::map< std::tuple< int, int >, int > m_dchip_map
chip map arrays
int m_PixelTimeBinNb
Pixel time number of bin.
int olddetNb
Old detector counter.
int m_ChipColumnNb
Chip column number.
void Pixelization()
Produces the pixelization.
double m_Workfct
Work function.
double m_TOTA2
TOT factor A2.
int m_PixelThresholdRMS
Pixel threshold RMS.
int m_PixelThreshold
Pixel threshold.
FANGSDigitizerModule()
Constructor: Sets the description, the properties and the parameters of the module.
double m_Fanofac
Fano factor.
int m_nFANGS
number of detectors.
double m_TOTB2
TOT factor B2.
double m_TOTQ1
TOT factor Q1.
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.