Jpp  master_rocky-40-g5f0272dcd
the software that should make you happy
DomCrossing.hh
Go to the documentation of this file.
1 #ifndef __DOMCROSSING__
2 #define __DOMCROSSING__
3 
4 #include <cmath>
5 
7 
8 /**
9  * \author mdejong
10  */
11 
12  /**
13  * Class to check whether a photon emitted from a position along the
14  * z-axis crosses a DOM (approximated by a disc)
15  * first, inefficient version
16  */
17 
18  class DomCrossing {
19 
20  private:
21  double __Rdom;
22  public:
23 
24  DomCrossing(const double Rdom):__Rdom(Rdom)
25  {}
27  {}
28 
29  bool operator()(const double theta,
30  const double phi,
31  const double z,
32  const double R,
33  const double dscat)
34  {
35  using namespace JGEOMETRY3D;
36 
37  const JVector3D p0(R,0,0);
38  const JVector3D n(sin(theta),0,cos(theta));
39  const JVector3D l0(0,0,z);
40  const JVector3D l(sin(theta)*cos(phi),sin(theta)*sin(phi),cos(theta));
41 
42  const double d = JVector3D(p0-l0).getDot(n)/l.getDot(n);
43 
44  if(d<0) return false;
45 
46  const JVector3D crossing = l0+JVector3D(l.getX()*d,l.getY()*d,l.getZ()*d);
47 
48  const double hitdist = (p0-crossing).getLength();
49 
50  const double dist = sqrt(z*z+R*R);
51 
52  if(hitdist<__Rdom&&dscat>=dist) return true;
53  else return false;
54 
55  }
56 
57  };
58 
59  // DomCrossing shadow;
60 #endif
Class to check whether a photon emitted from a position along the z-axis crosses a DOM (approximated ...
Definition: DomCrossing.hh:18
DomCrossing(const double Rdom)
Definition: DomCrossing.hh:24
bool operator()(const double theta, const double phi, const double z, const double R, const double dscat)
Definition: DomCrossing.hh:29
double __Rdom
Definition: DomCrossing.hh:21
Data structure for vector in three dimensions.
Definition: JVector3D.hh:36
double getY() const
Get y position.
Definition: JVector3D.hh:104
double getZ() const
Get z position.
Definition: JVector3D.hh:115
double getDot(const JVector3D &vector) const
Get dot product.
Definition: JVector3D.hh:282
double getX() const
Get x position.
Definition: JVector3D.hh:94
Auxiliary classes and methods for 3D geometrical objects and operations.
Definition: JAngle3D.hh:19
const int n
Definition: JPolint.hh:786