Jpp  19.1.0-rc.1
the software that should make you happy
JFit/JModel.hh
Go to the documentation of this file.
1 #ifndef __JFIT__JMODEL__
2 #define __JFIT__JMODEL__
3 
4 #include "JFit/JLine1Z.hh"
5 #include "JFit/JEnergy.hh"
6 #include "JFit/JPoint4D.hh"
7 #include "JFit/JNPE.hh"
8 #include "JFit/JTimeRange.hh"
9 #include "JTools/JRange.hh"
10 #include "JPhysics/JConstants.hh"
11 
12 /**
13  * \author mdejong
14  */
15 
16 namespace JFIT {}
17 namespace JPP { using namespace JFIT; }
18 
19 namespace JFIT {
20 
22 
23  /**
24  * Auxiliary class to match data points with given model.
25  */
26  template<class JModel_t>
27  struct JModel;
28 
29 
30  /**
31  * Template specialisation of class JModel to match hit with muon trajectory along z-axis.
32  */
33  template<>
34  struct JModel<JLine1Z> :
35  public JLine1Z
36  {
37  /**
38  * Constructor.
39  *
40  * \param tz muon along z-axis
41  * \param Rmax_m maximal distance of approach [m]
42  * \param compare time window [ns]
43  * \param z_m z-range of muon [m]
44  */
45  JModel(const JLine1Z& tz,
46  const double Rmax_m,
47  const JTimeRange& compare,
48  const JZRange& z_m = JZRange()) :
49  JLine1Z(tz)
50  {
51  this->Rmax_m = Rmax_m;
52  this->compare = compare;
53  this->z_m = z_m;
54  }
55 
56 
57  /**
58  * Test compatibility of given hit with track.
59  *
60  * \param hit hit
61  * \return true if compatible; else false
62  */
63  template<class JHit_t>
64  bool operator()(const JHit_t& hit) const
65  {
66  using namespace std;
67  using namespace JPP;
68 
69  if (this->getDistance(hit) <= Rmax_m) {
70  if (hit.getZ() - this->getZ() >= z_m.getLowerLimit() &&
71  hit.getZ() - this->getDistance(hit)/getTanThetaC() - this->getZ() <= z_m.getUpperLimit()) {
72  return compare(hit.getT() - this->getT(hit));
73  } else {
74  return false;
75  }
76  }
77  return false;
78  }
79 
80  protected:
81  double Rmax_m;
84  };
85 
86 
87  /**
88  * Template specialisation of class JModel to match hit with muon energy.
89  */
90  template<>
91  struct JModel<JEnergy> :
92  public JEnergy
93  {
94  /**
95  * Constructor.
96  *
97  * \param X x-value [log(E)]
98  */
99  JModel(const JEnergy& X) :
100  JEnergy(X)
101  {}
102 
103 
104  /**
105  * Test compatibility of given light yields with muon energy.
106  *
107  * \param npe npe
108  * \return true if total light yield due to muon is larger than that due to random background; else false
109  */
110  bool operator()(const JNPE& npe) const
111  {
112  return npe.getYA() + this->getE() * npe.getYB() > npe.getY0();
113  }
114  };
115 
116 
117  /**
118  * Template specialisation of class JModel to match hit with bright point.
119  */
120  template<>
121  struct JModel<JPoint4D> :
122  public JPoint4D
123  {
124  /**
125  * Constructor.
126  *
127  * \param point bright point
128  * \param Dmax_m maximal distance of approach [m]
129  * \param compare time window [ns]
130  */
131  JModel(const JPoint4D& point,
132  const double Dmax_m,
133  const JTimeRange& compare) :
134  JPoint4D(point)
135  {
136  this->Dmax_m = Dmax_m;
137  this->compare = compare;
138  }
139 
140 
141  /**
142  * Test compatibility of given hit with bright point.
143  *
144  * \param hit hit
145  * \return true if compatible; else false
146  */
147  template<class JHit_t>
148  bool operator()(const JHit_t& hit) const
149  {
150  if (this->getDistance(hit) <= Dmax_m) {
151  return compare(hit.getT() - this->getT(hit));
152  }
153 
154  return false;
155  }
156 
157  protected:
158  double Dmax_m;
160  };
161 }
162 
163 #endif
Physics constants.
Auxiliary class to define a range between two values.
Data structure for fit of energy.
Definition: JEnergy.hh:31
Data structure for fit of straight line paralel to z-axis.
Definition: JLine1Z.hh:29
Data structure for vertex fit.
Definition: JPoint4D.hh:24
JTOOLS::JRange< double > JTimeRange
Type definition for time range (unit [s]).
Auxiliary classes and methods for linear and iterative data regression.
Definition: JEnergy.hh:15
JTOOLS::JRange< double > JZRange
Definition: JFit/JModel.hh:21
double getDistance(const JFirst_t &first, const JSecond_t &second)
Get distance between objects.
double getTanThetaC()
Get average tangent of Cherenkov angle of water corresponding to group velocity.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
double getY0() const
Get light yield due to random background.
Definition: JK40.hh:49
bool operator()(const JNPE &npe) const
Test compatibility of given light yields with muon energy.
Definition: JFit/JModel.hh:110
JModel(const JEnergy &X)
Constructor.
Definition: JFit/JModel.hh:99
bool operator()(const JHit_t &hit) const
Test compatibility of given hit with track.
Definition: JFit/JModel.hh:64
JModel(const JLine1Z &tz, const double Rmax_m, const JTimeRange &compare, const JZRange &z_m=JZRange())
Constructor.
Definition: JFit/JModel.hh:45
JModel(const JPoint4D &point, const double Dmax_m, const JTimeRange &compare)
Constructor.
Definition: JFit/JModel.hh:131
bool operator()(const JHit_t &hit) const
Test compatibility of given hit with bright point.
Definition: JFit/JModel.hh:148
Auxiliary class to match data points with given model.
Definition: JFit/JModel.hh:27
Auxiliary class for handling various light yields.
Definition: JNPE.hh:32
double getYB() const
Get light yield due to bremsstrahlung.
Definition: JNPE.hh:94
double getYA() const
Get light yield due to delta-rays.
Definition: JNPE.hh:83
Auxiliary class to set-up Hit.
Definition: JSirene.hh:58