File indexing completed on 2025-08-05 08:18:18
0001 #ifndef G4TPC_PHG4TPCPADPLANEREADOUT_H
0002 #define G4TPC_PHG4TPCPADPLANEREADOUT_H
0003
0004 #include "PHG4TpcPadPlane.h"
0005 #include "TpcClusterBuilder.h"
0006
0007 #include <g4main/PHG4HitContainer.h>
0008
0009 #include <gsl/gsl_rng.h>
0010
0011 #include <array>
0012 #include <climits>
0013 #include <cmath>
0014 #include <string> // for string
0015 #include <vector>
0016
0017 class PHCompositeNode;
0018 class PHG4TpcCylinderGeomContainer;
0019 class PHG4TpcCylinderGeom;
0020 class TH2;
0021 class TF1;
0022 class TNtuple;
0023 class TrkrHitSetContainer;
0024 class TrkrHitTruthAssoc;
0025
0026 class PHG4TpcPadPlaneReadout : public PHG4TpcPadPlane
0027 {
0028 public:
0029 PHG4TpcPadPlaneReadout(const std::string &name = "PHG4TpcPadPlaneReadout");
0030
0031 ~PHG4TpcPadPlaneReadout() override;
0032
0033 int InitRun(PHCompositeNode *topNode) override;
0034
0035 void UseGain(const int flagToUseGain);
0036 void SetUseModuleGainWeights(const int flag) {m_use_module_gain_weights = flag;}
0037 void SetModuleGainWeightsFileName(const std::string &name) {m_tpc_module_gain_weights_file = name;}
0038 void ReadGain();
0039 void SetUsePolyaGEMGain(const int flagPolya) {m_usePolya = flagPolya;}
0040 void SetUseLangauGEMGain(const int flagLangau) {m_useLangau = flagLangau;}
0041 void SetLangauParsFileName(const std::string &name) {m_tpc_langau_pars_file = name;}
0042
0043 void SetDriftVelocity(double vd) override { drift_velocity = vd; }
0044 void SetReadoutTime(float t) override { extended_readout_time = t; }
0045
0046 using PHG4TpcPadPlane::MapToPadPlane;
0047
0048 void MapToPadPlane(TpcClusterBuilder &tpc_clustbuilder, TrkrHitSetContainer *single_hitsetcontainer, TrkrHitSetContainer *hitsetcontainer, TrkrHitTruthAssoc * , const double x_gem, const double y_gem, const double t_gem, const unsigned int side, PHG4HitContainer::ConstIterator hiter, TNtuple * , TNtuple * ) override;
0049
0050 void SetDefaultParameters() override;
0051 void UpdateInternalParameters() override;
0052
0053 private:
0054
0055 void populate_zigzag_phibins(const unsigned int side, const unsigned int layernum, const double phi, const double cloud_sig_rp, std::vector<int> &pad_phibin, std::vector<double> &pad_phibin_share);
0056 void populate_tbins(const double t, const std::array<double, 2> &cloud_sig_tt, std::vector<int> &adc_tbin, std::vector<double> &adc_tbin_share);
0057
0058 double check_phi(const unsigned int side, const double phi, const double radius);
0059
0060 PHG4TpcCylinderGeomContainer *GeomContainer = nullptr;
0061 PHG4TpcCylinderGeom *LayerGeom = nullptr;
0062
0063 double neffelectrons_threshold = std::numeric_limits<double>::signaling_NaN();
0064
0065 std::array<double, 3> MinRadius{};
0066 std::array<double, 3> MaxRadius{};
0067
0068 static constexpr int NSides = 2;
0069 static constexpr int NSectors = 12;
0070 static const int NRSectors = 3;
0071
0072 double sigmaT = std::numeric_limits<double>::signaling_NaN();
0073 std::array<double, 2> sigmaL{};
0074 double phi_bin_width{};
0075 double drift_velocity = 8.0e-03;
0076 float extended_readout_time = 0;
0077 int NTBins = std::numeric_limits<int>::max();
0078 int m_NHits = 0;
0079
0080 int m_flagToUseGain = 0;
0081
0082
0083
0084 bool m_use_module_gain_weights = false;
0085 std::string m_tpc_module_gain_weights_file = "";
0086
0087
0088 static constexpr double _nsigmas = 5;
0089
0090 double averageGEMGain = std::numeric_limits<double>::signaling_NaN();
0091 double polyaTheta = std::numeric_limits<double>::signaling_NaN();
0092
0093 std::array<std::vector<double>, NSides> sector_min_Phi;
0094 std::array<std::vector<double>, NSides> sector_max_Phi;
0095
0096
0097 double getSingleEGEMAmplification();
0098 double getSingleEGEMAmplification(double weight);
0099 double getSingleEGEMAmplification(TF1 *f);
0100 bool m_usePolya = false;
0101
0102 bool m_useLangau = false;
0103 std::string m_tpc_langau_pars_file = "";
0104
0105 gsl_rng *RandomGenerator = nullptr;
0106
0107 std::array<TH2 *, 2> h_gain{nullptr};
0108
0109 double m_module_gain_weight[2][3][12] = {
0110 { {1,1,1,1,1,1,1,1,1,1,1,1},
0111 {1,1,1,1,1,1,1,1,1,1,1,1},
0112 {1,1,1,1,1,1,1,1,1,1,1,1} },
0113 { {1,1,1,1,1,1,1,1,1,1,1,1},
0114 {1,1,1,1,1,1,1,1,1,1,1,1},
0115 {1,1,1,1,1,1,1,1,1,1,1,1} }
0116 };
0117
0118 TF1 *flangau[2][3][12] = {{{nullptr}}};
0119
0120
0121 };
0122
0123 #endif