Jpp
JMatch1D.hh
Go to the documentation of this file.
1 #ifndef __JTRIGGER__JMATCH1D__
2 #define __JTRIGGER__JMATCH1D__
3 
4 #include "JTools/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  {
47  }
48 
49 
50  /**
51  * Match operator.
52  *
53  * \param first hit
54  * \param second hit
55  * \return match result
56  */
57  virtual bool operator()(const JHit_t& first, const JHit_t& second) const
58  {
59  z = first.getZ() - second.getZ();
60  t = fabs(first.getT() - second.getT() - z * getInverseSpeedOfLight());
61 
62  if (t > TMax_ns) {
63  return false;
64  }
65 
66  x = first.getX() - second.getX();
67  y = first.getY() - second.getY();
68  d = sqrt(x*x + y*y);
69 
70  if (d <= 0.5 * RMax_m)
72  else if (d <= RMax_m)
73  return t <= (RMax_m - d) * getTanThetaC() * getInverseSpeedOfLight() + TMaxExtra_ns;
74 
75  return false;
76  }
77 
78 
79  double RMax_m;
80  double TMax_ns;
81  double TMaxExtra_ns;
82 
83  private:
84  mutable double x;
85  mutable double y;
86  mutable double z;
87  mutable double d;
88  mutable double t;
89  };
90 }
91 
92 #endif
JTRIGGER::JMatch1D::z
double z
Definition: JMatch1D.hh:86
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JTRIGGER::JMatch1D::y
double y
Definition: JMatch1D.hh:85
JTRIGGER::JMatch1D
1D match criterion.
Definition: JMatch1D.hh:31
JTOOLS::getInverseSpeedOfLight
const double getInverseSpeedOfLight()
Get inverse speed of light.
Definition: JConstants.hh:100
JConstants.hh
JTOOLS::getIndexOfRefraction
double getIndexOfRefraction()
Get average index of refraction of water.
Definition: JConstants.hh:111
JTRIGGER::JMatch1D::t
double t
Definition: JMatch1D.hh:88
JTOOLS::getTanThetaC
double getTanThetaC()
Get average tangent of Cherenkov angle of water.
Definition: JConstants.hh:133
JTRIGGER::JMatch1D::d
double d
Definition: JMatch1D.hh:87
JMatch.hh
JTRIGGER::JMatch1D::TMax_ns
double TMax_ns
Definition: JMatch1D.hh:80
JTRIGGER::JMatch1D::TMaxExtra_ns
double TMaxExtra_ns
Definition: JMatch1D.hh:81
JTRIGGER::JMatch1D::operator()
virtual bool operator()(const JHit_t &first, const JHit_t &second) const
Match operator.
Definition: JMatch1D.hh:57
JTRIGGER
Checksum.
Definition: JSupport/JSupport.hh:35
JTRIGGER::JMatch1D::RMax_m
double RMax_m
Definition: JMatch1D.hh:79
JTRIGGER::JMatch1D::x
double x
Definition: JMatch1D.hh:84
JTRIGGER::JMatch1D::JMatch1D
JMatch1D(const double roadWidth_m, const double Tmax_ns=0.0)
Constructor.
Definition: JMatch1D.hh:41
JLANG::JClonable
Template class for object cloning.
Definition: JClonable.hh:20