Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:18:14

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 ////// Dead Pixels /////////////
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   //! module initialization
0042   int InitRun(PHCompositeNode* topNode) override;
0043 
0044   //! event processing
0045   int process_event(PHCompositeNode* topNode) override;
0046 
0047   void Detector(const std::string& d) { m_detector = d; }
0048 
0049   //! TODO keep it for backward compatibily. remove after PR merged
0050   // In the future use the relevant set parameter function
0051   void set_timing_window(const int detid, const double tmin, const double tmax);
0052 
0053   //! parameters
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);
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 = false;
0076 
0077   class Deleter
0078   {
0079    public:
0080     //! delection operation
0081     void operator()(gsl_rng* rng) const { gsl_rng_free(rng); }
0082   };
0083 
0084   std::unique_ptr<gsl_rng, Deleter> m_rng;
0085 
0086   // needed for clustering truth tracks
0087  private:
0088   TrkrTruthTrackContainer* m_truthtracks{nullptr};  // output truth tracks
0089   TrkrClusterContainer* m_truthclusters{nullptr};   // output clusters indexed to TrkrDefs::cluskeys in m_truthtracks
0090   PHG4TruthInfoContainer* m_truthinfo{nullptr};
0091   int m_trkid{-1};
0092   bool m_is_emb{false};
0093   TrkrTruthTrack* m_current_track{nullptr};
0094   const int m_cluster_version{4};
0095   TrkrHitSetContainer* m_truth_hits;                              // generate and delete a container for each truth track
0096   std::map<TrkrDefs::hitsetkey, unsigned int> m_hitsetkey_cnt{};  // counter for making ckeys form hitsetkeys
0097 
0098   hitMask m_deadPixelMap;
0099   hitMask m_hotPixelMap;
0100 
0101   PHG4Hit* prior_g4hit{nullptr};  // used to check for jumps in g4hits for loopers;
0102   void addtruthhitset(TrkrDefs::hitsetkey, TrkrDefs::hitkey, float neffelectrons);
0103   void truthcheck_g4hit(PHG4Hit*, PHCompositeNode* topNode);
0104   void cluster_truthhits(PHCompositeNode* topNode);
0105   void end_event_truthcluster(PHCompositeNode* topNode);
0106 
0107   double m_pixel_thresholdrat{0.01};
0108   float max_g4hitstep{3.5};
0109   bool record_ClusHitsVerbose{false};
0110 
0111  public:
0112   void set_pixel_thresholdrat(double val) { m_pixel_thresholdrat = val; };
0113 
0114   void set_ClusHitsVerbose(bool set = true) { record_ClusHitsVerbose = set; };
0115   ClusHitsVerbosev1* mClusHitsVerbose{nullptr};
0116 };
0117 
0118 #endif