ScintillatorLDFFinder.h
Go to the documentation of this file.
1 
9 #ifndef _ScintillatorLDFFinderKG_ScintillatorLDFFinder_h_
10 #define _ScintillatorLDFFinderKG_ScintillatorLDFFinder_h_
11 
12 #include <fwk/VModule.h>
13 #include <utl/Point.h>
14 #include <utl/Vector.h>
15 #include <utl/TimeStamp.h>
16 #include <utl/CovarianceMatrix.h>
17 
18 #include <cmath>
19 #include <sstream>
20 
21 #include "LDF.h"
22 #include "LikelihoodFunctions.h"
23 
24 namespace evt {
25  class Event;
26 }
27 
28 namespace sevt {
29  class SEvent;
30 }
31 
32 namespace ScintillatorLDFFinderKG {
33 
34  utl::CoordinateSystemPtr gBaryCS; // is used by LikelihoodFunctions, too
35 
36 
46  public:
50 
51  enum InfoLevel {
52  eNone = 0,
53  eFinal = 1,
55  eObscure = 3,
56  eMinuit = 4
57  };
58 
59  enum LDFParameter {
61  eCoreX = 1,
62  eCoreY = 2,
64  };
65 
66  struct LDFFitResult {
67 
68  LDFFitResult(const LDFFitConfig& config) :
69  fPar(eShapeParameters + config.fLDF.GetNShapeParameters()),
70  fCov(fPar.size()),
71  fChi2(0),
72  fNdof(0),
73  fLogLikelihood(0),
74  fRecStage(0)
75  { }
76 
77  std::vector<double> fPar;
79 
80  double fChi2;
81  int fNdof;
83  double fRecStage;
84 
85  // for convenience
86 
88  { return utl::Point(fPar[eCoreX], fPar[eCoreY], 0, gBaryCS); }
89 
90  std::vector<double> GetLDFShapeParameters() const
91  { return std::vector<double>(fPar.begin() + eShapeParameters, fPar.end()); }
92 
93  };
94 
95  private:
96  // LDF part
97  bool FixBeta(const LDFFitResult& result,
98  const utl::Vector& showerAxis,
99  const std::vector<StationFitData>& data) const;
100 
101  bool FixGamma(const LDFFitResult& result,
102  const utl::Vector& showerAxis,
103  const std::vector<StationFitData>& data) const;
104 
105  void FitLDFSimplified(LDFFitResult& result,
106  LDFFitConfig& config,
107  const utl::Vector& showerAxis,
108  const std::vector<StationFitData>& data) const;
109 
110  bool FitLDF(LDFFitResult& result,
111  LDFFitConfig& config,
112  const utl::Vector& showerAxis,
113  const std::vector<StationFitData>& data) const;
114  // other
115  std::vector<StationFitData> MakeStationFitData(const sevt::SEvent& sEvent,
116  const utl::Point core,
117  const double showerSize,
118  const utl::Vector& showerAxis) const;
119 
120  void SetRecData(evt::Event& event,
121  const LDFFitResult& lresult) const;
122 
123  void OutputResults(const evt::Event& event) const;
124 
125  // vars
128  double fMaxChi2;
132 
136 
137  struct Stage0 {
139  } fStage0;
140 
141  struct Stage1 {
143  } fStage1;
144 
145  struct Stage2 {
148  } fStage2;
149 
150  REGISTER_MODULE("ScintillatorLDFFinderKG", ScintillatorLDFFinder);
151 
152  };
153 
154 }
155 
156 
157 #endif
Point object.
Definition: Point.h:32
void SetRecData(evt::Event &event, const LDFFitResult &lresult) const
Interface class to access to the SD part of an event.
Definition: SEvent.h:39
REGISTER_MODULE("ScintillatorLDFFinderKG", ScintillatorLDFFinder)
bool FitLDF(LDFFitResult &result, LDFFitConfig &config, const utl::Vector &showerAxis, const std::vector< StationFitData > &data) const
fwk::VModule::ResultFlag Init()
Initialize: invoked at beginning of run (NOT beginning of event)
A TimeStamp holds GPS second and nanosecond for some event.
Definition: TimeStamp.h:110
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
const Data result[]
void OutputResults(const evt::Event &event) const
Module interface.
Definition: VModule.h:53
struct ScintillatorLDFFinderKG::ScintillatorLDFFinder::Stage1 fStage1
void FitLDFSimplified(LDFFitResult &result, LDFFitConfig &config, const utl::Vector &showerAxis, const std::vector< StationFitData > &data) const
Early estimate of shower size.
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
utl::CoordinateSystemPtr gBaryCS
struct ScintillatorLDFFinderKG::ScintillatorLDFFinder::Stage2 fStage2
uint16_t * data
Definition: dump1090.h:228
struct ScintillatorLDFFinderKG::ScintillatorLDFFinder::Stage0 fStage0
Vector object.
Definition: Vector.h:30
fwk::VModule::ResultFlag Finish()
Finish: invoked at end of the run (NOT end of the event)
bool FixBeta(const LDFFitResult &result, const utl::Vector &showerAxis, const std::vector< StationFitData > &data) const
fwk::VModule::ResultFlag Run(evt::Event &event)
Run: invoked once per event.
bool FixGamma(const LDFFitResult &result, const utl::Vector &showerAxis, const std::vector< StationFitData > &data) const
Criterion if gamma can be fitted analogue to beta must be checked/updated.
std::vector< StationFitData > MakeStationFitData(const sevt::SEvent &sEvent, const utl::Point core, const double showerSize, const utl::Vector &showerAxis) const
Init station data used by LDF fit.

, generated on Tue Sep 26 2023.