Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /*!
0002  *  \file PrelimDistortionCorrection.h
0003  *  \brief      Makes preliminary distortion corrections when crossing is unknown
0004  *  \author Tony Frawley
0005  */
0006 
0007 #ifndef TRACKRECO_PRELIMDISTORTIONCORRECTION_H
0008 #define TRACKRECO_PRELIMDISTORTIONCORRECTION_H
0009 
0010 #include "ALICEKF.h"
0011 #include "nanoflann.hpp"
0012 
0013 // PHENIX includes
0014 #include <fun4all/SubsysReco.h>
0015 #include <tpc/TpcDistortionCorrection.h>
0016 #include <trackbase/TrkrDefs.h>
0017 
0018 #include <Eigen/Core>
0019 
0020 // STL includes
0021 #include <memory>
0022 #include <string>
0023 #include <vector>
0024 
0025 class ActsGeometry;
0026 class PHCompositeNode;
0027 class TpcDistortionCorrectionContainer;
0028 class TrkrClusterContainer;
0029 class SvtxTrackMap;
0030 class TrackSeedContainer;
0031 class TrackSeed_v2;
0032 
0033 class PrelimDistortionCorrection : public SubsysReco
0034 {
0035   public:
0036 
0037   PrelimDistortionCorrection(const std::string &name = "PrelimDistortionCorrection");
0038 
0039   //! default destructor
0040   ~PrelimDistortionCorrection() override = default;
0041 
0042   int InitRun(PHCompositeNode *topNode) override;
0043   int process_event(PHCompositeNode *topNode) override;
0044   int End(PHCompositeNode *topNode) override;
0045 
0046   //! noop
0047   void set_field_dir(double)
0048   {}
0049 
0050   //! noop
0051   void useConstBField(bool)
0052   {}
0053 
0054   //! noop
0055   void setConstBField(float)
0056   {}
0057 
0058   void useFixedClusterError(bool opt){_use_fixed_clus_err = opt;}
0059   void setFixedClusterError(int i, double val){_fixed_clus_err.at(i) = val;}
0060   void use_truth_clusters(bool truth) { _use_truth_clusters = truth; }
0061   void set_pp_mode(bool mode) {_pp_mode = mode;}
0062 
0063   void setNeonFraction(double frac) { Ne_frac = frac; };
0064   void setArgonFraction(double frac) { Ar_frac = frac; };
0065   void setCF4Fraction(double frac) { CF4_frac = frac; };
0066   void setNitrogenFraction(double frac) { N2_frac = frac; };
0067   void setIsobutaneFraction(double frac) { isobutane_frac = frac; };
0068 
0069  private:
0070 
0071   //! put refitted seeds on map
0072   using PositionMap = std::map<TrkrDefs::cluskey, Acts::Vector3>;
0073   void publishSeeds(std::vector<TrackSeed_v2>& seeds, const PositionMap &positions) const;
0074 
0075   /// tpc distortion correction utility class
0076   TpcDistortionCorrection m_distortionCorrection;
0077 
0078   bool _use_truth_clusters = false;
0079 
0080   /// fetch node pointers
0081   int get_nodes(PHCompositeNode *topNode);
0082 
0083   size_t _min_clusters_per_track = 3;
0084   double _max_sin_phi = 1.;
0085   bool _pp_mode = false;
0086 
0087   TrkrClusterContainer *_cluster_map = nullptr;
0088 
0089   TrackSeedContainer *_track_map = nullptr;
0090 
0091   /// acts geometry
0092   ActsGeometry *_tgeometry = nullptr;
0093 
0094   //!@name distortion correction containers
0095   //@{
0096   /** used in input to correct CM clusters before calculating residuals */
0097   TpcDistortionCorrectionContainer *m_dcc_module_edge{nullptr};
0098   TpcDistortionCorrectionContainer *m_dcc_static{nullptr};
0099   TpcDistortionCorrectionContainer *m_dcc_average{nullptr};
0100   //@}
0101 
0102   std::unique_ptr<ALICEKF> fitter;
0103 
0104   bool _use_fixed_clus_err = false;
0105   std::array<double,3> _fixed_clus_err = {.1,.1,.1};
0106 
0107   double Ne_frac = 0.00;
0108   double Ar_frac = 0.75;
0109   double CF4_frac = 0.20;
0110   double N2_frac = 0.00;
0111   double isobutane_frac = 0.05;
0112 
0113 };
0114 
0115 #endif