/home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/fit/include/RAT/FitPathProc.hh Source File

Ratpac-two: /home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/fit/include/RAT/FitPathProc.hh Source File
Ratpac-two
FitPathProc.hh
1 #ifndef __RAT_FitPathProc__
2 #define __RAT_FitPathProc__
3 
4 #include <Minuit2/FCNBase.h>
5 
6 #include <RAT/Processor.hh>
7 #include <RAT/SimulatedAnnealing.hh>
8 #include <string>
9 #include <vector>
10 
11 namespace RAT {
12 
13 namespace DS {
14 class Root;
15 class EV;
16 } // namespace DS
17 
18 typedef struct {
19  double x, y, z, px, py, pz, t;
20 } hit;
21 
22 class FitPathProc : public Processor, public Minimizable, public ROOT::Minuit2::FCNBase {
23  public:
24  FitPathProc();
25  virtual ~FitPathProc() {}
26 
27  virtual Processor::Result Event(DS::Root *ds, DS::EV *ev);
28 
29  double operator()(double *params); // Minimizable
30  double operator()(const std::vector<double> &lParams) const; // FCNBase
31  double Up() const { return 0.5; } // FCNBase
32  void BeginOfRun(DS::Run *run);
33 
34  protected:
35  // per-event hit data
36  std::vector<hit> fHits;
37  TVector3 fFitPos;
38  double fFitTime;
39  std::vector<double> fSeed;
40 
41  // whole-run constants
42  double fDirectProb, fOtherProb, fPhotocathodeArea;
43  double fLightSpeed, fCherenkovMultiplier;
44  double fDirectTime0, fDirectTimeStep, fOtherTime0, fOtherTimeStep;
45  std::vector<double> fDirectTimeProb, fOtherTimeProb;
46  double fCosAlpha0, fCosAlphaStep;
47  std::vector<double> fCosAlphaProb;
48 
49  // minimization parameters
50  bool fMigrad;
51  int fStage;
52  size_t fNumCycles, fNumEvals;
53  double fPosSigma0, fPosSigma1, fThetaSigma, fPhiSigma, fTimeSigma0, fTimeSigma1;
54  double fTemp0, fTemp1, fAlpha;
55 
56  inline double PDFDirectTime(const double tresid) const {
57  const int i = (int)((tresid - fDirectTime0) / fDirectTimeStep);
58  if (i < 0 || i >= (int)fDirectTimeProb.size()) return 0.0;
59  return fDirectTimeProb[i];
60  }
61 
62  inline double PDFOtherTime(const double tresid) const {
63  const int i = (int)((tresid - fOtherTime0) / fOtherTimeStep);
64  if (i < 0 || i >= (int)fOtherTimeProb.size()) return 0.0;
65  return fOtherTimeProb[i];
66  }
67 
68  inline double PDFCherenkovAngle(const double cosalpha) const {
69  const int i = (int)((cosalpha - fCosAlpha0) / fCosAlphaStep);
70  if (i < 0 || i >= (int)fCosAlphaProb.size()) return 0.0;
71  return fCosAlphaProb[i];
72  }
73 
74  double FTPProbability(const double x, const double y, const double z, const double dx, const double dy,
75  const double dz, const double t) const;
76 
77  double AvgSquareTimeResid(double x, double y, double z, double t);
78 };
79 
80 } // namespace RAT
81 
82 #endif
Definition: EV.hh:33
Definition: Root.hh:39
Definition: Run.hh:22
Definition: FitPathProc.hh:22
virtual Processor::Result Event(DS::Root *ds, DS::EV *ev)
Definition: FitPathProc.cc:199
double FTPProbability(const double x, const double y, const double z, const double dx, const double dy, const double dz, const double t) const
Definition: FitPathProc.cc:99
Definition: SimulatedAnnealing.hh:14
Definition: Processor.hh:36
Result
Definition: Processor.hh:59
Definition: CCCrossSecMessenger.hh:29
Definition: FitPathProc.hh:18