File indexing completed on 2025-12-16 09:22:04
0001 #ifndef G4MVTX_PHG4MVTXHITRECO_H
0002 #define G4MVTX_PHG4MVTXHITRECO_H
0003
0004 #include <phparameter/PHParameterInterface.h>
0005 #include <trackbase/TrkrDefs.h>
0006
0007 #include <fun4all/SubsysReco.h>
0008
0009 #include <gsl/gsl_rng.h>
0010
0011 #include <map>
0012 #include <memory> // for unique_ptr
0013 #include <string>
0014 #include <vector>
0015
0016 typedef std::vector<std::pair<TrkrDefs::hitsetkey, TrkrDefs::hitkey>> hitMask;
0017
0018 class ClusHitsVerbosev1;
0019 class PHCompositeNode;
0020 class PHG4Hit;
0021 class PHG4TruthInfoContainer;
0022 class TrkrClusterContainer;
0023 class TrkrHitSetContainer;
0024 class TrkrTruthTrack;
0025 class TrkrTruthTrackContainer;
0026
0027
0028 class MvtxRawEvtHeader;
0029
0030
0031
0032 class PHG4MvtxHitReco : public SubsysReco, public PHParameterInterface
0033 {
0034 public:
0035 explicit PHG4MvtxHitReco(
0036 const std::string& name = "PHG4MvtxHitReco",
0037 const std::string& detector = "MVTX");
0038
0039 ~PHG4MvtxHitReco() override;
0040
0041
0042 int InitRun(PHCompositeNode* topNode) override;
0043
0044
0045 int process_event(PHCompositeNode* topNode) override;
0046
0047 void Detector(const std::string& d) { m_detector = d; }
0048
0049
0050
0051 void set_timing_window(const int detid, const double tmin, const double tmax);
0052
0053
0054 void SetDefaultParameters() override;
0055
0056 private:
0057 void makePixelMask(hitMask& aMask, const std::string& dbName, const std::string& totalPixelsToMask);
0058
0059 std::pair<double, double> generate_alpide_pulse(const double energy_deposited);
0060
0061 double generate_strobe_zero_tm_start();
0062
0063 int get_strobe_frame(double alpide_time, double strobe_zero_tm_start) const;
0064
0065 TrkrDefs::hitsetkey zero_strobe_bits(TrkrDefs::hitsetkey hitsetkey);
0066
0067 std::string m_detector;
0068
0069 double m_tmin;
0070 double m_tmax;
0071 double m_strobe_width;
0072 double m_strobe_separation;
0073 double m_extended_readout_time = 0.0;
0074
0075 bool m_in_sphenix_srdo = true;
0076 double m_trigger_latency = 3.7;
0077
0078 class Deleter
0079 {
0080 public:
0081
0082 void operator()(gsl_rng* rng) const { gsl_rng_free(rng); }
0083 };
0084
0085 std::unique_ptr<gsl_rng, Deleter> m_rng;
0086
0087
0088 private:
0089 TrkrTruthTrackContainer* m_truthtracks{nullptr};
0090 TrkrClusterContainer* m_truthclusters{nullptr};
0091 PHG4TruthInfoContainer* m_truthinfo{nullptr};
0092 int m_trkid{-1};
0093 bool m_is_emb{false};
0094 TrkrTruthTrack* m_current_track{nullptr};
0095 const int m_cluster_version{4};
0096 TrkrHitSetContainer* m_truth_hits;
0097 std::map<TrkrDefs::hitsetkey, unsigned int> m_hitsetkey_cnt{};
0098
0099 hitMask m_deadPixelMap;
0100 hitMask m_hotPixelMap;
0101
0102 PHG4Hit* prior_g4hit{nullptr};
0103 void addtruthhitset(TrkrDefs::hitsetkey, TrkrDefs::hitkey, float neffelectrons);
0104 void truthcheck_g4hit(PHG4Hit*, PHCompositeNode* topNode);
0105 void cluster_truthhits(PHCompositeNode* topNode);
0106 void end_event_truthcluster(PHCompositeNode* topNode);
0107
0108 double m_pixel_thresholdrat{0.01};
0109 float max_g4hitstep{3.5};
0110 bool record_ClusHitsVerbose{false};
0111
0112 public:
0113 void set_pixel_thresholdrat(double val) { m_pixel_thresholdrat = val; };
0114
0115 void set_ClusHitsVerbose(bool set = true) { record_ClusHitsVerbose = set; };
0116 ClusHitsVerbosev1* mClusHitsVerbose{nullptr};
0117 };
0118
0119 #endif