RdStationAssociator.h
Go to the documentation of this file.
1 #ifndef _RdStationAssociator_RdStationAssociator_h_
2 #define _RdStationAssociator_RdStationAssociator_h_
3 
4 #include <fwk/VModule.h>
5 
6 #include <utl/CoordinateSystem.h>
7 #include <utl/AugerUnits.h>
8 #include <utl/Minou.h>
9 
10 #include <vector>
11 
12 
13 namespace utl {
14  class Point;
15 }
16 
17 namespace rdet {
18  class RDetector;
19 }
20 
21 
22 namespace RdStationAssociator {
23 
35  public:
36 
37  fwk::VModule::ResultFlag Init() override;
38  fwk::VModule::ResultFlag Run(evt::Event& theevent) override;
40 
41  private:
42  /* This function is the core of the Module and search the closest RStation for a given point.
43  The function will return the ID of the Closest station, if no station is with in a certain
44  distance (masDistanceFactor) from the point -1 will be returned */
45  int FindClosestStationFromPoint(const utl::Point& pt, const rdet::RDetector& Det, double masDistanceFactor);
46 
47  // Add virtual rdet::stations at the exact positions of the simulated pulses to the detector.
48  void AddVirtualStations(evt::Event& event, utl::CoordinateSystemPtr corsys) const;
49 
53  bool fAddNoSignalStations = false;
56 
57  std::vector<int> fIncludedStationIds;
58  std::vector<int> fExcludedStationIds;
59 
60  bool fAddVirtualStations = false;
61  int fFirstStationId = -1;
64 
65  REGISTER_MODULE("RdStationAssociator", RdStationAssociator);
66  };
67 
68 
69  class ExpoTail : public utl::Minou::Base {
70 
71  /* This class is used to fit the tail of the sim. pulses in order to extrapolate them.
72  This can be nessecary when the simulation was performed within a to short time window. */
73 
74  private:
75  std::vector<std::pair<double, double>> fData;
76 
77  double fxO = 0;
78 
79  public:
80  ExpoTail(std::vector<utl::Minou::ParameterDef> pars) { GetParameterDefs() = pars ; }
81 
82  void SetData(std::vector<std::pair<double, double>> data) { fData = data; }
83  void Setx0(double x0) { fxO = x0; }
84 
85  double GetY(double x, const std::vector<double>& p) const { return p[0] * std::exp(p[1] * (x - fxO) / utl::ns) ; }
86 
87  double operator()(const std::vector<double>& p)
88  const
89  {
90  double chi2 = 0;
91  for (const auto& xy : fData)
92  chi2 += std::pow(xy.second - GetY(xy.first, p), 2);
93  return chi2;
94  }
95  };
96 
97 }
98 
99 #endif
Point object.
Definition: Point.h:32
double GetY(double x, const std::vector< double > &p) const
void AddVirtualStations(evt::Event &event, utl::CoordinateSystemPtr corsys) const
int FindClosestStationFromPoint(const utl::Point &pt, const rdet::RDetector &Det, double masDistanceFactor)
double pow(const double x, const unsigned int i)
double operator()(const std::vector< double > &p) const
Detector description interface for RDetector-related data.
Definition: RDetector.h:46
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
fwk::VModule::ResultFlag Run(evt::Event &theevent) override
Run: invoked once per event.
constexpr double nanosecond
Definition: AugerUnits.h:143
constexpr double meter
Definition: AugerUnits.h:81
REGISTER_MODULE("RdStationAssociator", RdStationAssociator)
Module interface.
Definition: VModule.h:53
std::vector< ParameterDef > & GetParameterDefs()
Definition: Minou.h:97
This class associate simulated pulse with detector station.
fwk::VModule::ResultFlag Finish() override
Finish: invoked at end of the run (NOT end of the event)
void SetData(std::vector< std::pair< double, double >> data)
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
std::vector< std::pair< double, double > > fData
fwk::VModule::ResultFlag Init() override
Initialize: invoked at beginning of run (NOT beginning of event)
uint16_t * data
Definition: dump1090.h:228
ExpoTail(std::vector< utl::Minou::ParameterDef > pars)
constexpr double ns
Definition: AugerUnits.h:162
constexpr double m
Definition: AugerUnits.h:121

, generated on Tue Sep 26 2023.