Belle II Software  release-05-02-19
SensorPlane.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Peter Kvasnicka, Martin Ritter *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #ifndef VXD_SENSORPLANE_H
12 #define VXD_SENSORPLANE_H
13 
14 #include <vxd/dataobjects/VxdID.h>
15 #include <vxd/geometry/SensorInfoBase.h>
16 #include <framework/logging/Logger.h>
17 //ROOT CINT has problems with the boost classes used by the GeoCache but it
18 //does not need to see them anyway
19 #ifndef __CINT__
20 #include <vxd/geometry/GeoCache.h>
21 #endif
22 
23 #include <genfit/AbsFinitePlane.h>
24 #include <cmath>
25 
26 namespace Belle2 {
31  namespace VXD {
36  class SensorPlane: public genfit::AbsFinitePlane {
37  public:
42  SensorPlane(VxdID sensorID = 0, double uTolerance = 0, double vTolerance = 0):
43  m_sensorID(sensorID), m_uTolerance(uTolerance), m_vTolerance(vTolerance), m_cosPhi(1.), m_sinPhi(0.), m_sensorInfo(0) {}
44 
49  void setRotation(double phi)
50  {
51  m_cosPhi = cos(phi);
52  m_sinPhi = sin(phi);
53  }
55  virtual ~SensorPlane() {}
56 
62  bool isInActive(double u, double v) const override
63  {
64 #ifndef __CINT__
65  //If running in ROOT CINT we do not know about GeoCache so we cannot get
66  //the SensorInfo
67  if (!m_sensorInfo) {
69  }
70 #endif
71  //No sensorInfo set so we have to bail
72  if (!m_sensorInfo) {
73  B2FATAL("Could not find sensorInfo for VXD Sensor " << VxdID(m_sensorID));
74  }
75  double uRot = m_cosPhi * u - m_sinPhi * v;
76  double vRot = m_sinPhi * u + m_cosPhi * v;
77  return m_sensorInfo->inside(uRot, vRot, m_uTolerance, m_vTolerance);
78  }
79 
81  void Print(const Option_t* option = "") const override;
82 
87  virtual genfit::AbsFinitePlane* clone() const override
88  {
89  return new SensorPlane(*this);
90  }
91 
92  private:
94  unsigned short m_sensorID;
96  double m_uTolerance;
98  double m_vTolerance;
100  double m_cosPhi;
102  double m_sinPhi;
104  mutable const SensorInfoBase* m_sensorInfo;
105 
106  ClassDefOverride(SensorPlane, 2)
107  };
108  } // vxd namespace
110 } // Belle2 namespace
111 
112 #endif /* VXD_SENSORPLANE_H */
Belle2::VxdID
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:43
Belle2::VXD::SensorPlane::m_vTolerance
double m_vTolerance
Tolerance to add to the sensor dimensions in v direction.
Definition: SensorPlane.h:106
Belle2::VXD::GeoCache::get
static const SensorInfoBase & get(Belle2::VxdID id)
Return a reference to the SensorInfo of a given SensorID.
Definition: GeoCache.h:141
Belle2::VXD::SensorPlane::Print
void Print(const Option_t *option="") const override
Prints object data.
Definition: SensorPlane.cc:17
Belle2::VXD::SensorPlane::SensorPlane
SensorPlane(VxdID sensorID=0, double uTolerance=0, double vTolerance=0)
Constructs the plane for a given VXD Sensor.
Definition: SensorPlane.h:50
Belle2::VXD::SensorInfoBase
Base class to provide Sensor Information for PXD and SVD.
Definition: SensorInfoBase.h:40
Belle2::VXD::SensorPlane::m_sensorInfo
const SensorInfoBase * m_sensorInfo
Pointer to the SensorInfo which contains the geometry information for the given sensor plane.
Definition: SensorPlane.h:112
Belle2::VXD::SensorPlane::~SensorPlane
virtual ~SensorPlane()
Destructor.
Definition: SensorPlane.h:63
Belle2::VXD::SensorPlane::m_cosPhi
double m_cosPhi
Cosine term of plane rotation, used to align SVD trapezoidal sensors.
Definition: SensorPlane.h:108
Belle2::VXD::SensorPlane::setRotation
void setRotation(double phi)
Set plane rotation angle.
Definition: SensorPlane.h:57
Belle2::VXD::SensorPlane::m_uTolerance
double m_uTolerance
Tolerance to add to the sensor dimensions in u direction.
Definition: SensorPlane.h:104
Belle2::VXD::SensorPlane::m_sinPhi
double m_sinPhi
Sine term of plane rotation, used to align SVD trapezoidal sensors.
Definition: SensorPlane.h:110
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
genfit::AbsFinitePlane
Abstract base class for finite detector planes.
Definition: AbsFinitePlane.h:43
Belle2::VXD::SensorPlane::clone
virtual genfit::AbsFinitePlane * clone() const override
Deep copy of the object.
Definition: SensorPlane.h:95
Belle2::VXD::SensorPlane::isInActive
bool isInActive(double u, double v) const override
Return whether the given coordinates are inside the finite region.
Definition: SensorPlane.h:70
Belle2::VXD::SensorPlane::m_sensorID
unsigned short m_sensorID
Sensor ID of the sensor plane.
Definition: SensorPlane.h:102
Belle2::VXD::SensorInfoBase::inside
bool inside(double u, double v, double uTolerance=DBL_EPSILON, double vTolerance=DBL_EPSILON) const
Check wether a given point is inside the active area.
Definition: SensorInfoBase.h:238
Belle2::VXD::SensorPlane
A Finite plane of one VXD Sensor.
Definition: SensorPlane.h:44