File indexing completed on 2025-08-05 08:15:39
0001 #include <string>
0002
0003 class TH3;
0004 class TH2;
0005 template <class T>
0006 class MultiArray;
0007
0008
0009 class ChargeMapReader
0010 {
0011 public:
0012 ChargeMapReader();
0013 ChargeMapReader(int _n0, float _rmin, float _rmax, int _n1, float _phimin, float _phimax, int _n2, float _zmin, float _zmax);
0014 ~ChargeMapReader() = default;
0015
0016 private:
0017 MultiArray<float>* charge = nullptr;
0018 TH3* hSourceCharge = nullptr;
0019 TH3* hChargeDensity = nullptr;
0020 float inputAxisScale = 1;
0021 float inputChargeScale = 1;
0022 int nBins[3] = {1, 1, 1};
0023 float lowerBound[3] = {0, 0, 0};
0024 float upperBound[3] = {999, 999, 999};
0025 float binWidth[3] = {999, 999, 999};
0026
0027 bool CanInterpolateAt(float r, float phi, float z);
0028
0029 void RegenerateCharge();
0030 void RegenerateDensity();
0031
0032 public:
0033 static bool CanInterpolateAt(float x, float y, float z, TH3* h);
0034
0035 void FillChargeHistogram(TH3* h);
0036
0037 void AddChargeInBin(int r, int phi, int z, float q);
0038 void AddChargeAtPosition(float r, float phi, float z, float q);
0039
0040 float GetChargeInBin(int r, int phi, int z);
0041 float GetChargeAtPosition(float r, float phi, float z);
0042 TH3* GetDensityHistogram() { return hChargeDensity; }
0043
0044 bool ReadSourceCharge(const std::string& filename, const std::string& histname, float axisScale = 1., float contentScale = 1.);
0045 bool ReadSourceCharge(TH3* sourceHist, float axisScale = 1., float contentScale = 1.);
0046
0047 bool ReadSourceAdc(const std::string& adcfilename, const std::string& adchistname, const std::string& ibfgainfilename, const std::string& ibfgainhistname, float axisScale = 1., float contentScale = 1.);
0048 bool ReadSourceAdc(TH3* adcHist, TH2* gainHist, float axisScale = 1., float contentScale = 1.);
0049
0050 void SetChargeInBin(int r, int phi, int z, float q);
0051 void SetChargeAtPosition(float r, float phi, float z, float q);
0052
0053 bool SetOutputParameters(int _nr, float _rmin, float _rmax, int _nphi, float _phimin, float _phimax, int _nz, float _zmin, float _zmax);
0054 bool SetOutputBounds(float _rmin, float _rmax, float _phimin, float _phimax, float _zmin, float _zmax);
0055 bool SetOutputBins(int _nr, int _nphi, int _nz);
0056 };