Jpp
 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 "JTools/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 JMatch<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  {
45  }
46 
47 
48  /**
49  * Clone object.
50  *
51  * \return match result
52  */
54  {
55  return new JMatch3G<JHit_t>(*this);
56  }
57 
58 
59  /**
60  * Match operator.
61  *
62  * \param first hit
63  * \param second hit
64  * \return match result
65  */
66  virtual bool operator()(const JHit_t& first, const JHit_t& second) const
67  {
68  t = fabs(first.getT() - second.getT());
69 
70  if (t > TMax_ns) {
71  return false;
72  }
73 
74  x = first.getX() - second.getX();
75  y = first.getY() - second.getY();
76  z = first.getZ() - second.getZ();
77  d = sqrt(x*x + y*y + z*z);
78 
79  if (d <= 0.5 * DMax_m)
81  else if (d <= DMax_m)
83 
84  return false;
85  }
86 
87 
88  double DMax_m;
89  double TMax_ns;
90  double TMaxExtra_ns;
91 
92  private:
93  mutable double x;
94  mutable double y;
95  mutable double z;
96  mutable double d;
97  mutable double t;
98  };
99 }
100 
101 #endif
virtual bool operator()(const JHit_t &first, const JHit_t &second) const
Match operator.
Definition: JMatch3G.hh:66
3G match criterion.
Definition: JMatch3G.hh:29
double getIndexOfRefraction()
Get average index of refraction of water.
Definition: JConstants.hh:111
double TMaxExtra_ns
Definition: JMatch3G.hh:90
Function object interface for hit matching.
Definition: JMatch.hh:27
const double getInverseSpeedOfLight()
Get inverse speed of light.
Definition: JConstants.hh:100
Base class for match operations inside clusterize methods.
Constants.
JMatch3G(const double Dmax_m, const double Tmax_ns=0.0)
Constructor.
Definition: JMatch3G.hh:39
JMatch< JHit_t > * clone() const
Clone object.
Definition: JMatch3G.hh:53