File indexing completed on 2025-08-06 08:18:01
0001 #ifndef TPC_TPC3DCLUSTERIZER_H
0002 #define TPC_TPC3DCLUSTERIZER_H
0003
0004 #include <fun4all/SubsysReco.h>
0005 #include <g4detectors/PHG4TpcCylinderGeomContainer.h>
0006 #include <trackbase/ActsGeometry.h>
0007 #include <trackbase/TrkrCluster.h>
0008
0009 #include <phool/PHTimer.h>
0010
0011 #include <TFile.h>
0012 #include <TH1I.h>
0013 #include <TTree.h>
0014 #include <TNtuple.h>
0015
0016
0017 #include <boost/geometry.hpp>
0018 #include <boost/geometry/geometries/box.hpp>
0019 #include <boost/geometry/geometries/point.hpp>
0020 #include <boost/geometry/index/rtree.hpp>
0021
0022 #include <map>
0023 #include <string>
0024 #include <vector>
0025
0026 class LaserClusterContainer;
0027 class LaserCluster;
0028 class PHCompositeNode;
0029 class TrkrHitSet;
0030 class TrkrHitSetContainer;
0031 class PHG4TpcCylinderGeom;
0032 class PHG4TpcCylinderGeomContainer;
0033
0034 class Tpc3DClusterizer : public SubsysReco
0035 {
0036 public:
0037 typedef boost::geometry::model::point<float, 3, boost::geometry::cs::cartesian> point;
0038 typedef boost::geometry::model::box<point> box;
0039 typedef std::pair<TrkrDefs::hitkey, TrkrDefs::hitsetkey> specHitKey;
0040 typedef std::pair<point, specHitKey> pointKeyLaser;
0041
0042 Tpc3DClusterizer(const std::string &name = "Tpc3DClusterizer");
0043 ~Tpc3DClusterizer() override = default;
0044
0045 int InitRun(PHCompositeNode *topNode) override;
0046 int process_event(PHCompositeNode *topNode) override;
0047 int ResetEvent(PHCompositeNode *topNode) override;
0048 int End(PHCompositeNode *topNode) override;
0049
0050
0051 void calc_cluster_parameter(std::vector<pointKeyLaser> &clusHits, std::multimap<unsigned int, std::pair<std::pair<TrkrDefs::hitkey, TrkrDefs::hitsetkey>, std::array<int, 3>>> &adcMap);
0052
0053 void remove_hits(std::vector<pointKeyLaser> &clusHits, boost::geometry::index::rtree<pointKeyLaser, boost::geometry::index::quadratic<16>> &rtree, std::multimap<unsigned int, std::pair<std::pair<TrkrDefs::hitkey, TrkrDefs::hitsetkey>, std::array<int, 3>>> &adcMap);
0054
0055 void set_debug(bool debug) { m_debug = debug; }
0056 void set_debug_name(const std::string &name) { m_debugFileName = name; }
0057 void set_output(bool output) { m_output = output; }
0058 void set_output_name(const std::string &name) { m_outputFileName = name; }
0059
0060 void set_pedestal(float val) { pedestal = val; }
0061 void set_min_clus_size(float val) { min_clus_size = val; }
0062 void set_min_adc_sum(float val) { min_adc_sum = val; }
0063
0064 private:
0065 int m_event {-1};
0066 int m_seed {-1};
0067
0068 TrkrHitSetContainer *m_hits {nullptr};
0069 LaserClusterContainer *m_clusterlist {nullptr};
0070 ActsGeometry *m_tGeometry {nullptr};
0071 PHG4TpcCylinderGeomContainer *m_geom_container {nullptr};
0072 double pedestal {74.4};
0073 double min_clus_size {1};
0074 double min_adc_sum {10};
0075
0076
0077 double m_tdriftmax {0};
0078 double AdcClockPeriod {53.0};
0079 double NZBinsSide {360-76};
0080
0081
0082
0083
0084
0085
0086 bool m_debug {false};
0087 bool m_output {false};
0088 std::string m_debugFileName {"Tpc3DClusterizer_debug.root"};
0089 std::string m_outputFileName {"Tpc3DClusterizer_output.root"};
0090 TFile *m_debugFile {nullptr};
0091 TFile *m_outputFile {nullptr};
0092 TTree *m_clusterTree {nullptr};
0093 TNtuple *m_clusterNT {nullptr};
0094
0095 TH1I *m_itHist_0 {nullptr};
0096 TH1I *m_itHist_1 {nullptr};
0097
0098 TH1D *m_tHist_0 {nullptr};
0099 TH1D *m_tHist_1 {nullptr};
0100
0101 int m_nClus {0};
0102 double time_search {0};
0103 double time_clus {0};
0104 double time_erase {0};
0105 double time_all {0};
0106
0107 LaserCluster *m_currentCluster {nullptr};
0108 std::vector<LaserCluster *> m_eventClusters;
0109 std::vector<float> m_currentHit;
0110 std::vector<float> m_currentHit_hardware;
0111
0112 std::unique_ptr<PHTimer> t_all;
0113 std::unique_ptr<PHTimer> t_search;
0114 std::unique_ptr<PHTimer> t_clus;
0115 std::unique_ptr<PHTimer> t_erase;
0116 };
0117
0118 #endif