Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
10 
11 /**
12  * \author mdejong
13  */
14 
15 namespace JFIT {}
16 namespace JPP { using namespace JFIT; }
17 
18 namespace JFIT {
19 
20  /**
21  * Auxiliary class to match data points with given model.
22  */
23  template<class JModel_t>
24  struct JModel;
25 
26 
27  /**
28  * Template specialisation of class JModel to match hit with muon trajectory along z-axis.
29  */
30  template<>
31  struct JModel<JLine1Z> :
32  public JLine1Z
33  {
34  /**
35  * Constructor.
36  *
37  * \param tz muon along z-axis
38  * \param Rmax_m maximal distance of approach [m]
39  * \param compare time window [ns]
40  */
41  JModel(const JLine1Z& tz,
42  const double Rmax_m,
43  const JTimeRange& compare) :
44  JLine1Z(tz)
45  {
46  this->Rmax_m = Rmax_m;
47  this->compare = compare;
48  }
49 
50 
51  /**
52  * Test compatibility of given hit with track.
53  *
54  * \param hit hit
55  * \return true if compatible; else false
56  */
57  template<class JHit_t>
58  bool operator()(const JHit_t& hit) const
59  {
60  if (this->getDistance(hit) <= Rmax_m) {
61  return compare(hit.getT() - this->getT(hit));
62  }
63 
64  return false;
65  }
66 
67  protected:
68  double Rmax_m;
70  };
71 
72 
73  /**
74  * Template specialisation of class JModel to match hit with muon energy.
75  */
76  template<>
77  struct JModel<JEnergy> :
78  public JEnergy
79  {
80  /**
81  * Constructor.
82  *
83  * \param X x-value [log(E)]
84  */
85  JModel(const JEnergy& X) :
86  JEnergy(X)
87  {}
88 
89 
90  /**
91  * Test compatibility of given light yields with muon energy.
92  *
93  * \param npe npe
94  * \return true if total light yield due to muon is larger than that due to random background; else false
95  */
96  bool operator()(const JNPE& npe) const
97  {
98  return npe.getYA() + this->getE() * npe.getYB() > npe.getY0();
99  }
100  };
101 
102 
103  /**
104  * Template specialisation of class JModel to match hit with bright point.
105  */
106  template<>
107  struct JModel<JPoint4D> :
108  public JPoint4D
109  {
110  /**
111  * Constructor.
112  *
113  * \param point bright point
114  * \param Dmax_m maximal distance of approach [m]
115  * \param compare time window [ns]
116  */
117  JModel(const JPoint4D& point,
118  const double Dmax_m,
119  const JTimeRange& compare) :
120  JPoint4D(point)
121  {
122  this->Dmax_m = Dmax_m;
123  this->compare = compare;
124  }
125 
126 
127  /**
128  * Test compatibility of given hit with bright point.
129  *
130  * \param hit hit
131  * \return true if compatible; else false
132  */
133  template<class JHit_t>
134  bool operator()(const JHit_t& hit) const
135  {
136  if (this->getDistance(hit) <= Dmax_m) {
137  return compare(hit.getT() - this->getT(hit));
138  }
139 
140  return false;
141  }
142 
143  protected:
144  double Dmax_m;
146  };
147 }
148 
149 #endif
JModel(const JLine1Z &tz, const double Rmax_m, const JTimeRange &compare)
Constructor.
Definition: JModel.hh:41
double getY0() const
Get expectation value for number of single hits.
Definition: JK40.hh:101
Data structure for vertex fit.
Definition: JPoint4D.hh:22
JTimeRange compare
Definition: JModel.hh:69
double getYB() const
Get light yield due to bremsstrahlung.
Definition: JNPE.hh:80
bool operator()(const JNPE &npe) const
Test compatibility of given light yields with muon energy.
Definition: JModel.hh:96
bool operator()(const JHit_t &hit) const
Test compatibility of given hit with bright point.
Definition: JModel.hh:134
double getDistance(const JFirst_t &first, const JSecond_t &second)
Get distance between objects.
Definition: JMathToolkit.hh:98
JRange< double > JTimeRange
Type definition for time range.
double getYA() const
Get light yield due to muon itself.
Definition: JNPE.hh:69
Auxiliary class for handling various light yields.
Definition: JNPE.hh:27
Auxiliary class to match data points with given model.
Definition: JModel.hh:24
bool operator()(const JHit_t &hit) const
Test compatibility of given hit with track.
Definition: JModel.hh:58
JModel(const JPoint4D &point, const double Dmax_m, const JTimeRange &compare)
Constructor.
Definition: JModel.hh:117
Data structure for fit of straight line paralel to z-axis.
Definition: JLine1Z.hh:27
JModel(const JEnergy &X)
Constructor.
Definition: JModel.hh:85
Data structure for fit of energy.
Definition: JEnergy.hh:24