Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:21:04

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef TRACKRECO_PHMICROMEGASTPCTRACKMATCHING_H
0004 #define TRACKRECO_PHMICROMEGASTPCTRACKMATCHING_H
0005 
0006 #include <tpc/TpcGlobalPositionWrapper.h>
0007 
0008 #include <trackbase/TrkrDefs.h>
0009 
0010 #include <fun4all/SubsysReco.h>
0011 
0012 #include <array>
0013 #include <string>
0014 #include <vector>
0015 
0016 class ActsGeometry;
0017 class TrkrClusterContainer;
0018 class TrkrClusterIterationMapv1;
0019 class TrackSeedContainer;
0020 class PHCompositeNode;
0021 class PHG4CylinderGeomContainer;
0022 class TrackSeed;
0023 class TrkrCluster;
0024 class TF1;
0025 class TH1;
0026 
0027 class PHMicromegasTpcTrackMatching : public SubsysReco
0028 {
0029  public:
0030   PHMicromegasTpcTrackMatching(const std::string& name = "PHMicromegasTpcTrackMatching");
0031   ~PHMicromegasTpcTrackMatching() override = default;
0032 
0033   void set_rphi_search_window_lyr1(const double win) { _rphi_search_win[0] = win; }
0034   void set_z_search_window_lyr1(const double win) { _z_search_win[0] = win; }
0035   void set_rphi_search_window_lyr2(const double win) { _rphi_search_win[1] = win; }
0036   void set_z_search_window_lyr2(const double win) { _z_search_win[1] = win; }
0037   void set_min_tpc_layer(const unsigned int layer) { _min_tpc_layer = layer; }
0038   void set_max_tpc_layer(const unsigned int layer) { _max_tpc_layer = layer; }
0039   void set_test_windows_printout(const bool test) { _test_windows = test; }
0040   void set_pp_mode(const bool mode) { _pp_mode = mode; }
0041   void set_use_silicon( const bool value ) { _use_silicon = value; }
0042   void set_pt_cut( const float pt) { _pt_cut = pt; }
0043   void set_dphi_cut( const float dphi) { _dphi_cut = dphi; }
0044   void SetIteration(int iter) { _n_iteration = iter; }
0045 
0046   void zeroField(const bool flag) { _zero_field = flag; }
0047   int Init(PHCompositeNode* topNode) override;
0048   int InitRun(PHCompositeNode* topNode) override;
0049   int process_event(PHCompositeNode*) override;
0050   int End(PHCompositeNode*) override;
0051 
0052   // deprecated calls
0053   inline void set_sc_calib_mode(const bool) {}
0054   inline void set_collision_rate(const double) {}
0055 
0056  private:
0057   //! load nodes relevant for the analysis
0058   int GetNodes(PHCompositeNode* topNode);
0059 
0060   void copyMicromegasClustersToCorrectedMap();
0061 
0062   //! number of layers in the micromegas
0063   static constexpr unsigned int _n_mm_layers{2};
0064 
0065   bool _use_truth_clusters = false;
0066 
0067   //! if true, use straight fit instead of helical to extrapolate to TPOT
0068   bool _zero_field = false;
0069 
0070   //! if true, use silicon clusters instead of TPC to extrapolate to TPOT
0071   bool _use_silicon = false;
0072 
0073   // range of TPC layers to use in projection to micromegas
0074   unsigned int _min_tpc_layer = 39;
0075 
0076   // range of TPC layers to use in projection to micromegas
0077   unsigned int _max_tpc_layer = 55;
0078 
0079   // pt cut for field-on data
0080   float _pt_cut = 0.5;
0081 
0082   // delta_phi window between the last cluster in the tracklet and the projection
0083   float _dphi_cut = 0.9;
0084 
0085   TrkrClusterContainer* _cluster_map{nullptr};
0086   TrkrClusterContainer* _corrected_cluster_map{nullptr};
0087 
0088   TrackSeedContainer* _svtx_seed_map{nullptr};
0089   TrackSeedContainer* _tpc_track_map{nullptr};
0090   TrackSeedContainer* _si_track_map{nullptr};
0091 
0092   //! default rphi search window for each layer
0093   std::array<double, _n_mm_layers> _rphi_search_win{0.25, 13.0};
0094 
0095   //! default z search window for each layer
0096   std::array<double, _n_mm_layers> _z_search_win{26.0, 0.25};
0097 
0098   // get the cluster list for zeroField
0099   std::vector<TrkrDefs::cluskey> getTrackletClusterList(TrackSeed* tracklet);
0100 
0101   /// first micromegas layer
0102   /** it is reset in ::Setup using actual micromegas geometry */
0103   unsigned int _min_mm_layer{55};
0104 
0105   //! internal event number
0106   int _event{-1};
0107 
0108   //! micomegas geometry
0109   PHG4CylinderGeomContainer* _geomContainerMicromegas{nullptr};
0110   TrkrClusterIterationMapv1* _iteration_map{nullptr};
0111   int _n_iteration{0};
0112 
0113   //! acts geometry
0114   ActsGeometry* _tGeometry{nullptr};
0115 
0116   //! tpc global position wrapper
0117   TpcGlobalPositionWrapper m_globalPositionWrapper;
0118 
0119   //! true to printout actual residuals for testing
0120   bool _test_windows{false};
0121 
0122   bool _pp_mode{false};
0123 };
0124 
0125 #endif  // TRACKRECO_PHMICROMEGASTPCTRACKMATCHING_H