File indexing completed on 2026-08-31 08:21:22
0001
0002
0003 #ifndef TPCTRACKRECO_TPCMODULETRACKRECO_H
0004 #define TPCTRACKRECO_TPCMODULETRACKRECO_H
0005
0006 #include <fun4all/SubsysReco.h>
0007 #include <trackbase/TrkrDefs.h>
0008
0009 #include <string>
0010 #include <vector>
0011
0012 class PHCompositeNode;
0013
0014 class TFile;
0015 class TTree;
0016
0017 class Tpc_ModuleTrackContainer;
0018
0019 class TrkrHitSetContainer;
0020 class TrkrHitSet;
0021
0022
0023
0024
0025 struct InModuleThreadData
0026 {
0027 InModuleThreadData();
0028
0029 struct LayerHitSet
0030 {
0031 LayerHitSet();
0032
0033 unsigned int layer;
0034 TrkrDefs::hitsetkey hitsetkey;
0035 TrkrHitSet* hitset;
0036 };
0037
0038 struct RawHit
0039 {
0040 RawHit();
0041
0042 unsigned int layer;
0043 TrkrDefs::hitsetkey hitsetkey;
0044 TrkrDefs::hitkey hitkey;
0045
0046 unsigned short pad;
0047 unsigned short tbin;
0048 unsigned short adc;
0049 };
0050
0051 struct Blob
0052 {
0053 Blob();
0054
0055 unsigned int layer;
0056
0057 double pad;
0058 double tbin;
0059 double adc;
0060
0061 unsigned int nhits;
0062 int used;
0063
0064 std::vector<unsigned int> raw_hit_indices;
0065 };
0066
0067 struct Track
0068 {
0069 Track();
0070
0071 unsigned int track_id;
0072
0073 unsigned int first_layer;
0074 unsigned int last_layer;
0075
0076 unsigned int nblobs;
0077 unsigned int nrawhits;
0078
0079
0080
0081
0082 double pad_slope;
0083 double pad_intercept;
0084 double tbin_slope;
0085 double tbin_intercept;
0086
0087 std::vector<unsigned int> blob_indices;
0088 std::vector<unsigned int> raw_hit_indices;
0089 };
0090
0091
0092 unsigned int region;
0093 unsigned int sector;
0094 int side;
0095 TrkrDefs::hitsetkey module_key;
0096
0097
0098 double pedestal;
0099 int verbosity;
0100
0101
0102 int noise_max_consecutive_timebins;
0103 int noise_keep_first_timebins;
0104 int noise_adc_tolerance;
0105
0106
0107 int blob_dt;
0108 int blob_dp;
0109
0110
0111 int search_dt;
0112 int search_dp;
0113 unsigned int min_track_blobs;
0114
0115
0116 unsigned int connect_max_layer_gap;
0117
0118 double connect_dp;
0119 double connect_dt;
0120
0121 double connect_dpad_slope;
0122 double connect_dtbin_slope;
0123
0124
0125 double weight_power;
0126 double adc_weight_floor_frac;
0127
0128
0129 std::vector<LayerHitSet> layer_hitsets;
0130 std::vector<RawHit> raw_hits;
0131 std::vector<Blob> blobs;
0132 std::vector<Track> tracks;
0133 };
0134
0135
0136
0137
0138 class Tpc_ModuleTrackReco : public SubsysReco
0139 {
0140 public:
0141 explicit Tpc_ModuleTrackReco(const std::string& name = "Tpc_ModuleTrackReco",
0142 const std::string& filename = "Tpc_ModuleTrackReco.root");
0143
0144 virtual ~Tpc_ModuleTrackReco();
0145
0146 int Init(PHCompositeNode*);
0147 int InitRun(PHCompositeNode*);
0148 int process_event(PHCompositeNode*);
0149 int End(PHCompositeNode*);
0150
0151 void setMaxThreads(unsigned int n);
0152
0153 void setPedestal(double p)
0154 {
0155 m_pedestal = p;
0156 }
0157
0158 void setBlobWindow(int dt, int dp)
0159 {
0160 m_blob_dt = dt;
0161 m_blob_dp = dp;
0162 }
0163
0164 void setSearchWindow(int dt, int dp)
0165 {
0166 m_search_dt = dt;
0167 m_search_dp = dp;
0168 }
0169
0170
0171 void setNoiseRejection(int max_consecutive_timebins = 10,
0172 int keep_first_timebins = 3,
0173 int adc_tolerance = 5)
0174 {
0175 m_noiseMaxConsecutiveTimebins = max_consecutive_timebins;
0176 m_noiseKeepFirstTimebins = keep_first_timebins;
0177 m_noiseAdcTolerance = adc_tolerance;
0178 }
0179
0180 void setMinTrackBlobs(unsigned int n)
0181 {
0182 m_minTrackBlobs = n;
0183 }
0184
0185 void setConnectMaxLayerGap(unsigned int n)
0186 {
0187 m_connectMaxLayerGap = n;
0188 }
0189
0190 void setConnectWindow(double dt, double dp)
0191 {
0192 m_connect_dt = dt;
0193 m_connect_dp = dp;
0194 }
0195
0196 void setConnectSlopeWindow(double dtbin_slope, double dpad_slope)
0197 {
0198 m_connect_dtbin_slope = dtbin_slope;
0199 m_connect_dpad_slope = dpad_slope;
0200 }
0201
0202 private:
0203 int getNodes(PHCompositeNode*);
0204 void reset_tree_vars();
0205 int createNodes(PHCompositeNode*);
0206
0207 std::string m_outputFileName;
0208
0209 TFile* m_outputFile;
0210 TTree* m_tree;
0211
0212 TrkrHitSetContainer* m_hits;
0213
0214 Tpc_ModuleTrackContainer* m_tpcModuleTrackContainer;
0215 int m_event;
0216 unsigned int m_maxThreads;
0217
0218
0219 double m_pedestal;
0220
0221
0222 int m_noiseMaxConsecutiveTimebins;
0223 int m_noiseKeepFirstTimebins;
0224 int m_noiseAdcTolerance;
0225
0226
0227 int m_blob_dt;
0228 int m_blob_dp;
0229
0230
0231 int m_search_dt;
0232 int m_search_dp;
0233 unsigned int m_minTrackBlobs;
0234
0235
0236 unsigned int m_connectMaxLayerGap;
0237
0238 double m_connect_dp;
0239 double m_connect_dt;
0240
0241 double m_connect_dpad_slope;
0242 double m_connect_dtbin_slope;
0243
0244
0245 int m_tree_event;
0246
0247
0248 std::vector<unsigned int> m_tree_track_id;
0249 std::vector<unsigned int> m_tree_region;
0250 std::vector<unsigned int> m_tree_sector;
0251 std::vector<int> m_tree_side;
0252
0253 std::vector<unsigned int> m_tree_nblobs;
0254 std::vector<unsigned int> m_tree_nrawhits;
0255
0256 std::vector<unsigned int> m_tree_first_layer;
0257 std::vector<unsigned int> m_tree_last_layer;
0258
0259
0260
0261
0262 std::vector<unsigned int> m_tree_hit_event;
0263 std::vector<unsigned int> m_tree_hit_track_id;
0264
0265 std::vector<unsigned int> m_tree_hit_region;
0266 std::vector<unsigned int> m_tree_hit_sector;
0267 std::vector<int> m_tree_hit_side;
0268
0269 std::vector<unsigned int> m_tree_hit_layer;
0270
0271 std::vector<unsigned long long> m_tree_hit_hitsetkey;
0272 std::vector<unsigned long long> m_tree_hit_hitkey;
0273 };
0274 #endif