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