File indexing completed on 2025-08-05 08:16:57
0001 #ifndef TPCCALIB_TPCSPACECHARGERECONSTRUCTION_H
0002 #define TPCCALIB_TPCSPACECHARGERECONSTRUCTION_H
0003
0004
0005
0006
0007
0008 #include <fun4all/SubsysReco.h>
0009 #include <phparameter/PHParameterInterface.h>
0010 #include <tpc/TpcGlobalPositionWrapper.h>
0011
0012
0013 #include <Acts/Definitions/Algebra.hpp>
0014 #include <Acts/Utilities/BinnedArray.hpp>
0015 #include <Acts/Utilities/Logger.hpp>
0016
0017 #include <memory>
0018 #include <vector>
0019
0020
0021 class SvtxTrack;
0022 class SvtxTrackMap;
0023 class TpcSpaceChargeMatrixContainer;
0024 class TrkrCluster;
0025 class TrkrClusterContainer;
0026
0027 class TFile;
0028 class TH1;
0029 class TH2;
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 class TpcSpaceChargeReconstruction : public SubsysReco, public PHParameterInterface
0046 {
0047 public:
0048
0049 TpcSpaceChargeReconstruction(const std::string& = "TPCSPACECHARGERECONSTRUCTION");
0050
0051
0052
0053
0054
0055 void set_use_micromegas(bool value)
0056 {
0057 m_use_micromegas = value;
0058 }
0059
0060
0061 void set_min_pt(double value)
0062 {
0063 m_min_pt = value;
0064 }
0065
0066
0067
0068
0069
0070
0071 void set_grid_dimensions(int phibins, int rbins, int zbins);
0072
0073
0074 void set_save_histograms(bool value) { m_savehistograms = value; }
0075
0076
0077 void set_histogram_outputfile(const std::string& outputfile) { m_histogramfilename = outputfile; }
0078
0079
0080
0081
0082
0083 void set_outputfile(const std::string& filename)
0084 {
0085 m_outputfile = filename;
0086 }
0087
0088
0089
0090
0091 int Init(PHCompositeNode*) override;
0092
0093
0094 int InitRun(PHCompositeNode*) override;
0095
0096
0097 int process_event(PHCompositeNode*) override;
0098
0099
0100 int End(PHCompositeNode*) override;
0101
0102
0103 void SetDefaultParameters() override;
0104
0105 private:
0106
0107 int load_nodes(PHCompositeNode*);
0108
0109
0110 void create_histograms();
0111
0112
0113 void process_tracks();
0114
0115
0116 bool accept_track(SvtxTrack*) const;
0117
0118
0119 void process_track(SvtxTrack*);
0120
0121
0122 int get_cell_index(const Acts::Vector3&);
0123
0124
0125 std::string m_outputfile = "TpcSpaceChargeMatrices.root";
0126
0127
0128 bool m_use_micromegas = true;
0129
0130
0131 double m_min_pt = 0.5;
0132
0133
0134
0135
0136 float m_max_talpha = 0.6;
0137 float m_max_drphi = 0.5;
0138
0139
0140 float m_max_tbeta = 1.5;
0141 float m_max_dz = 0.5;
0142
0143
0144
0145 std::unique_ptr<TpcSpaceChargeMatrixContainer> m_matrix_container;
0146
0147
0148
0149 int m_total_tracks = 0;
0150 int m_accepted_tracks = 0;
0151
0152 int m_total_clusters = 0;
0153 int m_accepted_clusters = 0;
0154
0155
0156
0157
0158
0159 bool m_savehistograms = false;
0160
0161
0162 std::string m_histogramfilename = "TpcSpaceChargeReconstruction.root";
0163 std::unique_ptr<TFile> m_histogramfile;
0164
0165 using TH1_map_t = std::map<int, TH1*>;
0166 using TH2_map_t = std::map<int, TH2*>;
0167
0168 TH1_map_t m_h_drphi;
0169 TH1_map_t m_h_dz;
0170 TH2_map_t m_h_drphi_alpha;
0171 TH2_map_t m_h_dz_beta;
0172
0173
0174
0175 SvtxTrackMap* m_track_map = nullptr;
0176
0177
0178 TrkrClusterContainer* m_cluster_map = nullptr;
0179
0180
0181 TpcGlobalPositionWrapper m_globalPositionWrapper;
0182 };
0183
0184 #endif