Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JMatch1D.hh
Go to the documentation of this file.
1#ifndef __JTRIGGER__JMATCH1D__
2#define __JTRIGGER__JMATCH1D__
3
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 */
15namespace JTRIGGER {}
16namespace JPP { using namespace JTRIGGER; }
17
18namespace 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 {
51 TMax_ns = 0.5 * RMax_m * getTanThetaC() * getInverseSpeedOfLight() + TMaxExtra_ns;
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)
76 return t <= d * getTanThetaC() * getInverseSpeedOfLight() + TMaxExtra_ns;
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;
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
Base class for match operations for cluster and hit-preprocessing methods.
Physics constants.
1D match criterion.
Definition JMatch1D.hh:33
JMatch1D(const double roadWidth_m, const double Tmax_ns=0.0)
Constructor.
Definition JMatch1D.hh:41
virtual bool operator()(const JHit_t &first, const JHit_t &second) const override
Match operator.
Definition JMatch1D.hh:62
double getIndexOfRefraction()
Get average index of refraction of water corresponding to group velocity.
const double getInverseSpeedOfLight()
Get inverse speed of light.
double getTanThetaC()
Get average tangent of Cherenkov angle of water corresponding to group velocity.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for triggering.
Template class for object cloning.
Definition JClonable.hh:59