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