LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
TrackMomentumCalculator.h
Go to the documentation of this file.
1 // \author sowjanyag@phys.ksu.edu
3 
4 #ifndef TrackMomentumCalculator_H
5 #define TrackMomentumCalculator_H
6 
9 
10 #include "TGraph.h"
11 #include "TVector3.h"
12 
13 #include <optional>
14 #include <tuple>
15 #include <vector>
16 
17 class TPolyLine3D;
18 
19 namespace trkf {
20 
22  public:
32  TrackMomentumCalculator(double minLength = 100.0,
33  double maxLength = 1350.0,
34  double steps_size = 10.);
35 
36  double GetTrackMomentum(double trkrange, int pdg) const;
49  const bool checkValidPoints = false,
50  const int maxMomentum_MeV = 7500);
65  const bool checkValidPoints = false,
66  const int maxMomentum_MeV = 7500,
67  const int MomentumStep_MeV = 10,
68  const int max_resolution = 0);
69  double GetMuMultiScatterLLHD3(art::Ptr<recob::Track> const& trk, bool dir);
71 
72  private:
73  bool plotRecoTracks_(std::vector<float> const& xxx,
74  std::vector<float> const& yyy,
75  std::vector<float> const& zzz);
76 
84  void compute_max_fluctuation_vector(const std::vector<float> segx,
85  const std::vector<float> segy,
86  const std::vector<float> segz,
87  std::vector<float>& segnx,
88  std::vector<float>& segny,
89  std::vector<float>& segnz,
90  std::vector<float>& vx,
91  std::vector<float>& vy,
92  std::vector<float>& vz);
101  struct Segments {
102  std::vector<float> x, nx;
103  std::vector<float> y, ny;
104  std::vector<float> z, nz;
105  std::vector<float> L;
106  };
107 
120  std::optional<Segments> getSegTracks_(std::vector<float> const& xxx,
121  std::vector<float> const& yyy,
122  std::vector<float> const& zzz,
123  double seg_size);
124 
135  std::tuple<double, double, double> getDeltaThetaRMS_(Segments const& segments,
136  double thick) const;
137 
149  int getDeltaThetaij_(std::vector<float>& ei,
150  std::vector<float>& ej,
151  std::vector<float>& th,
152  std::vector<float>& ind,
153  Segments const& segments,
154  double thick) const;
155 
165  double my_g(double xx, double Q, double s) const;
166 
181  double my_mcs_llhd(std::vector<float> const& dEi,
182  std::vector<float> const& dEj,
183  std::vector<float> const& dthij,
184  std::vector<float> const& ind,
185  double x0,
186  double x1) const;
187 
188  float seg_stop{-1.};
189  int n_seg{};
190 
191  float x_seg[50000];
192  float y_seg[50000];
193  float z_seg[50000];
194 
203  double find_angle(double vz, double vy) const;
204 
205  int n_steps{6};
206  std::vector<float> steps;
207 
208  double minLength;
209  double maxLength;
210  double steps_size;
211  double rad_length{14.0};
212 
213  // The following are objects that are created but not drawn or
214  // saved. This class should consider accepting a "debug"
215  // parameter where if it is specified, then the graphs will be
216  // created; otherwise, their creation is unnecessary and impedes
217  // efficiency.
218  //
219  // N.B. TPolyLine3D objects are owned by ROOT, and we thus refer
220  // to them by pointer. It is important that 'delete' is not
221  // called on the TPolyLine3D pointers during destruction of a
222  // TrackMomentumCalculator object.
223  TPolyLine3D* gr_reco_xyz{nullptr};
224  TGraph gr_reco_xy{};
225  TGraph gr_reco_yz{};
226  TGraph gr_reco_xz{};
227 
228  TPolyLine3D* gr_seg_xyz{nullptr};
229  TGraph gr_seg_xy{};
230  TGraph gr_seg_yz{};
231  TGraph gr_seg_xz{};
232  };
233 
234 } // namespace trkf
235 
236 #endif // TrackMomentumCalculator_H
Double_t xx
Definition: macro.C:12
double my_g(double xx, double Q, double s) const
chi square minizer using Minuit2, it will minize (xx-Q)/s
int getDeltaThetaij_(std::vector< float > &ei, std::vector< float > &ej, std::vector< float > &th, std::vector< float > &ind, Segments const &segments, double thick) const
Gets the scatterd angle for all the segments.
Float_t x1[n_points_granero]
Definition: compare.C:5
void compute_max_fluctuation_vector(const std::vector< float > segx, const std::vector< float > segy, const std::vector< float > segz, std::vector< float > &segnx, std::vector< float > &segny, std::vector< float > &segnz, std::vector< float > &vx, std::vector< float > &vy, std::vector< float > &vz)
Computes the vector with most scattering inside a segment with size steps_size.
double GetMomentumMultiScatterLLHD(art::Ptr< recob::Track > const &trk, const bool checkValidPoints=false, const int maxMomentum_MeV=7500, const int MomentumStep_MeV=10, const int max_resolution=0)
Calculate muon momentum (GeV) using multiple coulomb scattering by log likelihood.
TrackMomentumCalculator(double minLength=100.0, double maxLength=1350.0, double steps_size=10.)
Constructor.
std::optional< Segments > getSegTracks_(std::vector< float > const &xxx, std::vector< float > const &yyy, std::vector< float > const &zzz, double seg_size)
Split tracks into segments to calculate the scattered angle later. Check DOI 10.1088/1748-0221/12/10/...
double GetMomentumMultiScatterChi2(art::Ptr< recob::Track > const &trk, const bool checkValidPoints=false, const int maxMomentum_MeV=7500)
Calculate muon momentum (GeV) using multiple coulomb scattering. Chi2 minimization of the Highland fo...
double find_angle(double vz, double vy) const
Gets angle between two vy and vz.
Float_t thick
Definition: plot.C:23
Struct to store segments. x, y and z are the 3D points of the segment nx, ny, nz forms the vector tha...
Provides recob::Track data product.
std::tuple< double, double, double > getDeltaThetaRMS_(Segments const &segments, double thick) const
Gets the scattered angle RMS for a all segments.
double GetMuMultiScatterLLHD3(art::Ptr< recob::Track > const &trk, bool dir)
TDirectory * dir
Definition: macro.C:5
double my_mcs_llhd(std::vector< float > const &dEi, std::vector< float > const &dEj, std::vector< float > const &dthij, std::vector< float > const &ind, double x0, double x1) const
Minimizer of log likelihood for scattered angle.
TVector3 GetMultiScatterStartingPoint(art::Ptr< recob::Track > const &trk)
double GetTrackMomentum(double trkrange, int pdg) const
bool plotRecoTracks_(std::vector< float > const &xxx, std::vector< float > const &yyy, std::vector< float > const &zzz)