Jpp  15.0.1-rc.1-highQE
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JMatch1D.hh
Go to the documentation of this file.
1 #ifndef __JTRIGGER__JMATCH1D__
2 #define __JTRIGGER__JMATCH1D__
3 
4 #include "JPhysics/JConstants.hh"
5 
6 #include "JTrigger/JMatch.hh"
7 
8 
9 /**
10  * \file
11  *
12  * Match operator for Cherenkov light from muon with given direction.
13  * \author mdejong
14  */
15 namespace JTRIGGER {}
16 namespace JPP { using namespace JTRIGGER; }
17 
18 namespace JTRIGGER {
19 
23 
24 
25  /**
26  * 1D match criterion.
27  * This match algorithm is intented for muon signals.
28  * It is assumed that the muon direction is along the z-axis.
29  */
30  template<class JHit_t>
31  class JMatch1D :
32  public JClonable< JMatch<JHit_t>, JMatch1D<JHit_t> >
33  {
34  public:
35  /**
36  * Constructor.
37  *
38  * \param roadWidth_m maximal road width [m]
39  * \param Tmax_ns maximal extra time [ns]
40  */
41  JMatch1D(const double roadWidth_m,
42  const double Tmax_ns = 0.0) :
43  RMax_m (roadWidth_m),
44  TMaxExtra_ns(Tmax_ns),
45  x(0.0),
46  y(0.0),
47  z(0.0),
48  d(0.0),
49  t(0.0)
50  {
52  }
53 
54 
55  /**
56  * Match operator.
57  *
58  * \param first hit
59  * \param second hit
60  * \return match result
61  */
62  virtual bool operator()(const JHit_t& first, const JHit_t& second) const override
63  {
64  z = first.getZ() - second.getZ();
65  t = fabs(first.getT() - second.getT() - z * getInverseSpeedOfLight());
66 
67  if (t > TMax_ns) {
68  return false;
69  }
70 
71  x = first.getX() - second.getX();
72  y = first.getY() - second.getY();
73  d = sqrt(x*x + y*y);
74 
75  if (d <= 0.5 * RMax_m)
77  else if (d <= RMax_m)
78  return t <= (RMax_m - d) * getTanThetaC() * getInverseSpeedOfLight() + TMaxExtra_ns;
79 
80  return false;
81  }
82 
83 
84  double RMax_m;
85  double TMax_ns;
86  double TMaxExtra_ns;
87 
88  private:
89  mutable double x;
90  mutable double y;
91  mutable double z;
92  mutable double d;
93  mutable double t;
94  };
95 }
96 
97 #endif
1D match criterion.
Definition: JMatch1D.hh:31
double getIndexOfRefraction()
Get average index of refraction of water corresponding to group velocity.
double TMaxExtra_ns
Definition: JMatch1D.hh:86
JMatch1D(const double roadWidth_m, const double Tmax_ns=0.0)
Constructor.
Definition: JMatch1D.hh:41
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
virtual bool operator()(const JHit_t &first, const JHit_t &second) const override
Match operator.
Definition: JMatch1D.hh:62
Base class for match operations for cluster and hit-preprocessing methods.
Template class for object cloning.
Definition: JClonable.hh:20
Physics constants.
const double getInverseSpeedOfLight()
Get inverse speed of light.
double getTanThetaC()
Get average tangent of Cherenkov angle of water corresponding to group velocity.