File indexing completed on 2026-08-31 08:21:17
0001 #ifndef TPCCALIB_MICROMEGASDRIFTEVALUATOR_H
0002 #define TPCCALIB_MICROMEGASDRIFTEVALUATOR_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include <fun4all/SubsysReco.h>
0014 #include <micromegas/MicromegasDefs.h>
0015 #include <phool/PHObject.h>
0016 #include <tpc/TpcGlobalPositionWrapper.h>
0017 #include <trackbase/TrkrDefs.h>
0018
0019 #include <array>
0020 #include <string>
0021 #include <vector>
0022
0023 class ActsGeometry;
0024 class PHG4CylinderGeomContainer;
0025 class TH3;
0026 class TrkrCluster;
0027 class TrkrClusterContainer;
0028 class SvtxTrackMap;
0029
0030 class MicromegasDriftEvaluator : public SubsysReco
0031 {
0032 public:
0033 explicit MicromegasDriftEvaluator(const std::string& name = "MicromegasDriftEvaluator");
0034
0035 int Init(PHCompositeNode*) override;
0036 int InitRun(PHCompositeNode*) override;
0037 int process_event(PHCompositeNode*) override;
0038 int End(PHCompositeNode*) override;
0039
0040 struct TrackStateStruct
0041 {
0042 unsigned short _layer {0};
0043 unsigned short _tile {0};
0044 double _z {0};
0045 double _y_local {0};
0046 };
0047
0048 struct ClusterStruct
0049 {
0050 unsigned short _layer {0};
0051 unsigned short _tile {0};
0052 double _z {0};
0053 };
0054
0055 struct TrackStruct
0056 {
0057 float _chisquare {0};
0058 int _ndf {0};
0059
0060 unsigned int _nclusters_tpc {0};
0061 unsigned int _nclusters_mvtx {0};
0062 unsigned int _nclusters_intt {0};
0063 unsigned int _nclusters_micromegas {0};
0064
0065 TrackStateStruct _trk_state_z;
0066 ClusterStruct _found_cluster_z;
0067
0068 using List = std::vector<TrackStruct>;
0069 };
0070
0071 class Container : public PHObject
0072 {
0073 public:
0074 explicit Container() = default;
0075 Container(const Container&) = delete;
0076 Container& operator=(const Container&) = delete;
0077
0078 void Reset() override { _tracks.clear(); }
0079
0080 const TrackStruct::List& tracks() const { return _tracks; }
0081 void add_track(const TrackStruct& t) { _tracks.push_back(t); }
0082 void clear_tracks() { _tracks.clear(); }
0083
0084 private:
0085 TrackStruct::List _tracks;
0086
0087 TrackStateStruct _unused_state;
0088 ClusterStruct _unused_cluster;
0089
0090 ClassDefOverride(Container, 1)
0091 };
0092
0093 void set_trackmapname(const std::string& value) { m_trackmapname = value; }
0094
0095
0096 void set_drift_velocity(double value) { m_drift_velocity = value; }
0097
0098
0099 void set_min_tpc_layer(unsigned int value) { m_min_tpc_layer = value; }
0100 void set_max_tpc_layer(unsigned int value) { m_max_tpc_layer = value; }
0101
0102
0103 void set_y_local_cut(double value) { m_y_local_cut = value; }
0104
0105
0106 void set_z_search_window(double value) { m_z_search_win = value; }
0107
0108
0109 void set_plot_filename(const std::string& value) { m_plot_filename = value; }
0110
0111
0112 void set_root_filename(const std::string& value) { m_root_filename = value; }
0113
0114
0115 void set_add_run_segment(bool value) { m_add_run_segment = value; }
0116
0117
0118 void set_segment(int value) { m_segment = value; }
0119
0120 private:
0121 int load_nodes(PHCompositeNode*);
0122 std::string make_output_filename(const std::string&) const;
0123 void evaluate_tracks();
0124
0125 Container* m_container {nullptr};
0126 ActsGeometry* m_tGeometry {nullptr};
0127 TpcGlobalPositionWrapper m_globalPositionWrapper;
0128 PHG4CylinderGeomContainer* m_micromegas_geomcontainer {nullptr};
0129 TrkrClusterContainer* m_cluster_map {nullptr};
0130 SvtxTrackMap* m_track_map {nullptr};
0131
0132 std::string m_trackmapname {"SvtxTrackMap"};
0133
0134
0135 double m_drift_velocity {0.00747};
0136 unsigned int m_min_tpc_layer {39};
0137 unsigned int m_max_tpc_layer {55};
0138 double m_y_local_cut {22.0};
0139 double m_z_search_win {3.0};
0140 std::string m_plot_filename {"micromegas_drift_calib.png"};
0141 std::string m_root_filename {"micromegas_drift_calib.root"};
0142 bool m_add_run_segment {true};
0143 int m_segment {-1};
0144
0145 TH3* m_hist3D {nullptr};
0146 };
0147
0148 #endif