All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sbncode/sbncode/LArRecoProducer/LArReco/TrackMomentumCalculator.h
Go to the documentation of this file.
1 /// \file TrackMomentumCalculator.h
2 // \author sowjanyag@phys.ksu.edu
3 
4 #ifndef TrackMomentumCalculator_H
5 #define TrackMomentumCalculator_H
6 
7 #include "canvas/Persistency/Common/Ptr.h"
10 
11 #include "TAxis.h"
12 #include "TGraph.h"
13 #include "TGraphErrors.h"
14 #include "TMath.h"
15 #include "TMatrixD.h"
16 #include "TMatrixDSym.h"
17 #include "TMatrixDSymEigen.h"
18 #include "TPolyLine3D.h"
19 #include "TSpline.h"
20 #include "TVector3.h"
21 
22 #include "Math/Factory.h"
23 #include "Math/Minimizer.h"
24 #include "Minuit2/FCNBase.h"
25 #include "Minuit2/FunctionMinimum.h"
26 #include "Minuit2/Minuit2Minimizer.h"
27 #include "Minuit2/MnMigrad.h"
28 #include "Minuit2/MnPrint.h"
29 #include "Minuit2/MnUserParameterState.h"
30 #include "Minuit2/MnUserParameters.h"
31 
32 #include <cmath>
33 #include <iostream>
34 #include <optional>
35 #include <vector>
36 #include <tuple>
37 
38 namespace trkf {
39 
40  class TrackMomentumCalculator {
41  public:
42  TrackMomentumCalculator(double minLength = 100.0,
43  double maxLength = 1350.0);
44 
45  double GetTrackMomentum(double trkrange, int pdg) const;
46  double GetMomentumMultiScatterChi2(art::Ptr<recob::Track> const& trk);
47  double GetMomentumMultiScatterLLHD(art::Ptr<recob::Track> const& trk);
48  double GetMuMultiScatterLLHD3(art::Ptr<recob::Track> const& trk, bool dir);
49  TVector3 GetMultiScatterStartingPoint(art::Ptr<recob::Track> const& trk);
50 
51  private:
52  bool plotRecoTracks_(std::vector<float> const& xxx,
53  std::vector<float> const& yyy,
54  std::vector<float> const& zzz);
55 
56  struct Segments {
57  std::vector<float> x, nx;
58  std::vector<float> y, ny;
59  std::vector<float> z, nz;
60  std::vector<float> L;
61  };
62 
63  std::optional<Segments> getSegTracks_(std::vector<float> const& xxx,
64  std::vector<float> const& yyy,
65  std::vector<float> const& zzz,
66  double seg_size);
67 
68  std::tuple<double, double, double> getDeltaThetaRMS_(Segments const& segments,
69  double thick) const;
70 
71  int getDeltaThetaij_(std::vector<float>& ei,
72  std::vector<float>& ej,
73  std::vector<float>& th,
74  std::vector<float>& ind,
75  Segments const& segments,
76  double thick) const;
77 
78  double my_g(double xx, double Q, double s) const;
79 
80  double my_mcs_llhd(std::vector<float> const& dEi,
81  std::vector<float> const& dEj,
82  std::vector<float> const& dthij,
83  std::vector<float> const& ind,
84  double x0, double x1) const;
85 
86  float seg_stop{-1.};
87  int n_seg{};
88 
89  float x_seg[50000];
90  float y_seg[50000];
91  float z_seg[50000];
92 
93  double find_angle(double vz, double vy) const;
94 
95  float steps_size{10.};
96  int n_steps{6};
97  std::vector<float> steps;
98 
99  double minLength;
100  double maxLength;
101 
102  // The following are objects that are created but not drawn or
103  // saved. This class should consider accepting a "debug"
104  // parameter where if it is specified, then the graphs will be
105  // created; otherwise, their creation is unnecessary and impedes
106  // efficiency.
107  //
108  // N.B. TPolyLine3D objects are owned by ROOT, and we thus refer
109  // to them by pointer. It is important that 'delete' is not
110  // called on the TPolyLine3D pointers during destruction of a
111  // TrackMomentumCalculator object.
112  TPolyLine3D* gr_reco_xyz{nullptr};
113  TGraph gr_reco_xy{};
114  TGraph gr_reco_yz{};
115  TGraph gr_reco_xz{};
116 
117  TPolyLine3D* gr_seg_xyz{nullptr};
118  TGraph gr_seg_xy{};
119  TGraph gr_seg_yz{};
120  TGraph gr_seg_xz{};
121 
122  };
123 
124 } // namespace trkf
125 
126 #endif // TrackMomentumCalculator_H
var pdg
Definition: selectors.fcl:14
double GetMomentumMultiScatterChi2(art::Ptr< recob::Track > const &trk, const bool checkValidPoints=false)
double my_g(double xx, double Q, double s) const
int getDeltaThetaij_(std::vector< float > &ei, std::vector< float > &ej, std::vector< float > &th, std::vector< float > &ind, Segments const &segments, double thick) const
std::optional< Segments > getSegTracks_(std::vector< float > const &xxx, std::vector< float > const &yyy, std::vector< float > const &zzz, double seg_size)
std::tuple< double, double, double > getDeltaThetaRMS_(Segments const &segments, double thick) const
Provides recob::Track data product.
tuple dir
Definition: dropbox.py:28
double GetMuMultiScatterLLHD3(art::Ptr< recob::Track > const &trk, bool dir)
TrackMomentumCalculator(double minLength=100.0, double maxLength=1350.0)
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
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
TVector3 GetMultiScatterStartingPoint(art::Ptr< recob::Track > const &trk)
double GetMomentumMultiScatterLLHD(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)