Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #ifndef G4TPC_TPCCLUSTERBUILDER_H
0002 #define G4TPC_TPCCLUSTERBUILDER_H
0003 
0004 // Revised 04-Dec-2022, David Stewart
0005 // basic use:
0006 //  (a) optionally used set_current_track() (pointless to not set the track though,
0007 //      otherwise the new TrkrClsuters won't be assigned to the proper location)
0008 //  (b) fill with TrkrHits in addhitset() (in the MapToPadPlane module)
0009 //  (c) after all TrkrHit's have been added for a given truth track,
0010 //      call cluster_and_reset(false) to generate the TrkrClusters from the
0011 //      TrkrHit's, fill in the clusterkeys in the truth_track, and reset
0012 //      the TrkrHit container.
0013 //  (d) at the end of the event, run cluster_and_reset(true) which will check
0014 //      if there are clusters to make, and also clear out the counter for the
0015 //      hitsetkeys
0016 //
0017 //  Note:
0018 //  - the algorithm to get the local surface will probably be updated in
0019 //    TpcClusterizer, when that happens update here as well
0020 
0021 #include <trackbase/ActsGeometry.h>
0022 #include <trackbase/TpcDefs.h>
0023 #include <trackbase/TrkrDefs.h>
0024 #include <trackbase/TrkrHitSetContainerv1.h>
0025 
0026 #include <phool/PHObject.h>
0027 
0028 #include <climits>
0029 #include <iostream>
0030 #include <map>
0031 
0032 class ClusHitsVerbosev1;
0033 class PHG4TpcCylinderGeom;
0034 class PHG4TpcCylinderGeomContainer;
0035 class TrkrCluster;
0036 class TrkrClusterContainer;
0037 class TrkrHitSetContainer;
0038 class TrkrTruthTrack;
0039 class TrkrTruthTrackContainer;
0040 
0041 // This is the basic data for each set of TrkrHits from each TrkrHitsSet
0042 // to be used in tpc/TpcClusterizer.cc
0043 class TpcClusterBuilder
0044 {
0045  public:
0046   TpcClusterBuilder(){};
0047   ~TpcClusterBuilder()
0048   {
0049     delete m_hits;
0050   };
0051 
0052   void fixme_check();
0053   void fixme_short_check();
0054 
0055   bool b_collect_hits{false};
0056   bool needs_input_nodes() { return m_needs_input_nodes; }
0057   void cluster_hits(TrkrTruthTrack* track);
0058   void addhitset(TrkrDefs::hitsetkey, TrkrDefs::hitkey, float neffelectrons);
0059   void set_current_track(TrkrTruthTrack* _trkrtruthtrack);
0060   void print(TrkrTruthTrackContainer*, int nclusprint = -1);
0061   void print_file(TrkrTruthTrackContainer*, const std::string&);
0062   void set_verbosity(int verbosity_level) { verbosity = verbosity_level; }
0063 
0064   void clear_hitsetkey_cnt();
0065   void set_pixel_thresholdrat(double val) { m_pixel_thresholdrat = val; };
0066   void set_input_nodes(TrkrClusterContainer* _truth_cluster_container, ActsGeometry* _ActsGeometry, PHG4TpcCylinderGeomContainer* _geom_container, ClusHitsVerbosev1* _clushitsverbose);
0067 
0068  private:
0069   ActsGeometry* m_tGeometry{nullptr};  // used to generate clusters
0070   ClusHitsVerbosev1* mClusHitsVerbose{nullptr};
0071   PHG4TpcCylinderGeomContainer* geom_container{nullptr};
0072   TrkrClusterContainer* m_clusterlist{nullptr};  // fill for output
0073 
0074   // internal containers to fill and consume hits and fill with tracks
0075   TrkrHitSetContainer* m_hits{new TrkrHitSetContainerv1()};
0076   /* TrkrTruthTrack*      current_track { nullptr }; */
0077   std::map<TrkrDefs::hitsetkey, unsigned int> hitsetkey_cnt{};
0078 
0079   int n_tracks{0};
0080   int verbosity{0};
0081 
0082   double AdcClockPeriod{53.0};  // ns
0083 
0084   // TPC shaping offset correction parameter
0085   // From Tony Frawley July 5, 2022
0086   double m_sampa_tbias{39.6};  // ns
0087 
0088   // for pixel thresholds
0089   double m_pixel_thresholdrat{0.01};
0090 
0091   bool m_needs_input_nodes{true};
0092 };
0093 
0094 #endif  // TRACKBASE_PADPLANEREADOUTSTRUCT_H