Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-08-31 08:21:25

0001 // Tell emacs that this is a C++ source
0002 // -*- C++ -*-.
0003 #ifndef TPCTRACKRECO_TPCTRACKFIT_H
0004 #define TPCTRACKRECO_TPCTRACKFIT_H
0005 
0006 #include <array>
0007 #include <string>
0008 #include <vector>
0009 
0010 class PHField;
0011 
0012 struct TpcTrackVec3
0013 {
0014   double x{0.0};
0015   double y{0.0};
0016   double z{0.0};
0017 };
0018 
0019 struct TpcTrackPoint
0020 {
0021   int track_id{0};
0022   int shower_id{0};
0023   int layer{0};
0024   TpcTrackVec3 position;
0025   TpcTrackVec3 momentum;
0026   double t{0.0};
0027   double path{0.0};
0028 };
0029 
0030 struct TpcTrackHelix
0031 {
0032   double cx{0.0};
0033   double cy{0.0};
0034   double radius{0.0};
0035   double z0{0.0};
0036   double pitch{0.0};
0037   double theta_first{0.0};
0038   double theta_last{0.0};
0039   double theta_min{0.0};
0040   double theta_max{0.0};
0041   double direction{1.0};
0042   double bfield_t{1.4};
0043 };
0044 
0045 struct TpcTrackLinePca
0046 {
0047   TpcTrackVec3 pca1;
0048   TpcTrackVec3 pca2;
0049   double dca{0.0};
0050   double step1{0.0};
0051   double step2{0.0};
0052 };
0053 
0054 struct TpcTrackHelixPca
0055 {
0056   TpcTrackVec3 pca1;
0057   TpcTrackVec3 pca2;
0058   double dca{0.0};
0059   double theta1{0.0};
0060   double theta2{0.0};
0061 };
0062 
0063 struct TpcTrackHelixSearchRange
0064 {
0065   bool valid{false};
0066   int anchor_point_index{-1};
0067   double anchor_theta{0.0};
0068   double anchor_path_cm{0.0};
0069   double anchor_residual_cm{0.0};
0070   double theta_min{0.0};
0071   double theta_max{0.0};
0072   double upstream_cm{0.0};
0073   double downstream_cm{0.0};
0074 };
0075 
0076 enum class TpcTrackPointOrder
0077 {
0078   Path,
0079   Input,
0080   Radius,
0081   ThetaZ,
0082   Auto
0083 };
0084 
0085 struct TpcTrackState
0086 {
0087   TpcTrackVec3 position;
0088   TpcTrackVec3 momentum;
0089   int charge{0};
0090   double chi2{0.0};
0091   int ndof{0};
0092   bool valid{false};
0093 };
0094 
0095 struct TpcKalmanConfig
0096 {
0097   double bfield_t{1.4};
0098   const PHField *magnetic_field{nullptr};
0099   bool analytic_uniform_propagation{false};
0100   double rkn_max_step_cm{5.0};
0101   double rkn_step_tolerance{1.0e-4};
0102   int rkn_max_step_trials{12};
0103   int rkn_max_total_steps{2000};
0104   bool rkn_fast_field_jacobian{true};
0105   bool rkn_fast_field_pca{true};
0106   int rkn_field_pca_refine_iterations{6};
0107   TpcTrackPointOrder point_order{TpcTrackPointOrder::Radius};
0108   double meas_sigma_rphi_cm{0.03};
0109   double meas_sigma_r_cm{0.03};
0110   double meas_sigma_z_cm{0.05};
0111   double min_measurement_sigma_cm{1.0e-6};
0112   double initial_sigma_pos_cm{0.1};
0113   double initial_sigma_phi{0.2};
0114   double initial_sigma_qop_t{0.2};
0115   double initial_sigma_tanl{0.2};
0116   double process_sigma_pos_cm{1.0e-4};
0117   double process_sigma_phi{1.0e-5};
0118   double process_sigma_qop_t{1.0e-6};
0119   double process_sigma_tanl{1.0e-6};
0120   bool collect_innovation_components{false};
0121   double material_x0_per_cm{0.0};
0122   double multiple_scattering_scale{1.0};
0123   double energy_loss_gev_per_cm{0.0};
0124   double energy_loss_sigma_fraction{0.0};
0125   double min_pt_gev{0.05};
0126 };
0127 
0128 struct TpcKalmanResult
0129 {
0130   bool success{false};
0131   std::string message;
0132   int charge{0};
0133   double bfield_t{1.4};
0134   const PHField *magnetic_field{nullptr};
0135   bool analytic_uniform_propagation{false};
0136   TpcTrackHelix seed;
0137   std::vector<double> path_s;
0138   std::vector<std::array<double, 6>> states_filtered;
0139   std::vector<std::array<double, 36>> covs_filtered;
0140   std::vector<std::array<double, 6>> states_smoothed;
0141   std::vector<std::array<double, 36>> covs_smoothed;
0142   std::vector<double> measurement_chi2;
0143   std::vector<unsigned char> measurement_used;
0144   std::vector<unsigned char> measurement_in_seed;
0145   std::vector<double> innovation_residual_r;
0146   std::vector<double> innovation_residual_rphi;
0147   std::vector<double> innovation_residual_z;
0148   std::vector<double> prediction_sigma_r;
0149   std::vector<double> prediction_sigma_rphi;
0150   std::vector<double> prediction_sigma_z;
0151   std::vector<double> innovation_sigma_r;
0152   std::vector<double> innovation_sigma_rphi;
0153   std::vector<double> innovation_sigma_z;
0154   std::vector<double> innovation_rho_r_rphi;
0155   std::vector<double> innovation_rho_r_z;
0156   std::vector<double> innovation_rho_rphi_z;
0157   std::vector<double> innovation_whitened_0;
0158   std::vector<double> innovation_whitened_1;
0159   std::vector<double> innovation_whitened_2;
0160   std::size_t naccepted{0};
0161   std::size_t nrejected{0};
0162   double chi2{0.0};
0163   int ndof{0};
0164   double mass_gev{0.13957039};
0165   std::size_t rkn_propagations{0};
0166   std::size_t rkn_accepted_steps{0};
0167   std::size_t rkn_rejected_trials{0};
0168   std::size_t rkn_max_trial_accepts{0};
0169   std::size_t rkn_failures{0};
0170   double rkn_seconds{0.0};
0171 };
0172 
0173 #endif