CMS 3D CMS Logo

CTPPSTimingLocalTrack.cc
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * This is a part of CTPPS offline software.
4  * Authors:
5  * Laurent Forthomme (laurent.forthomme@cern.ch)
6  * Nicola Minafra (nicola.minafra@cern.ch)
7  * Mateusz Szpyrka (mateusz.szpyrka@cern.ch)
8  *
9  ****************************************************************************/
10 
12 #include <cmath>
13 
14 //----------------------------------------------------------------------------------------------------
15 
16 //--- constructors
17 
18 CTPPSTimingLocalTrack::CTPPSTimingLocalTrack() : num_hits_(0), num_planes_(0), valid_(true), t_(0.), t_sigma_(0.) {}
19 
21  const math::XYZPoint& pos0_sigma,
22  float t,
23  float t_sigma)
24  : pos0_(pos0), pos0_sigma_(pos0_sigma), num_hits_(0), num_planes_(0), valid_(false), t_(t), t_sigma_(t_sigma) {}
25 
26 //--- interface member functions
27 
29  float xTolerance = pos0_sigma_.x() + (0.5 * recHit.xWidth()) + tolerance;
30  float yTolerance = pos0_sigma_.y() + (0.5 * recHit.yWidth()) + tolerance;
31  float zTolerance = pos0_sigma_.z() + (0.5 * recHit.zWidth()) + tolerance;
32 
33  float xDiff = std::abs(pos0_.x() - recHit.x());
34  float yDiff = std::abs(pos0_.y() - recHit.y());
35  float zDiff = std::abs(pos0_.z() - recHit.z());
36 
37  switch (check) {
38  case CheckDimension::x:
39  return xDiff < xTolerance;
40  case CheckDimension::y:
41  return yDiff < yTolerance;
43  return xDiff < xTolerance && yDiff < yTolerance && zDiff < zTolerance;
44  }
45  return false;
46 }
47 
48 //====================================================================================================
49 // Other methods implementation
50 //====================================================================================================
51 
53  // start to sort by temporal coordinate
54  if (lhs.time() < rhs.time())
55  return true;
56  if (lhs.time() > rhs.time())
57  return false;
58  // then sort by x-position
59  if (lhs.x0() < rhs.x0())
60  return true;
61  if (lhs.x0() > rhs.x0())
62  return false;
63  // ...and y-position
64  if (lhs.y0() < rhs.y0())
65  return true;
66  if (lhs.y0() > rhs.y0())
67  return false;
68  // ...and z-position
69  return (lhs.z0() < rhs.z0());
70 }
Reconstructed hit in timing detectors.
float zWidth() const
const double tolerance
math::XYZPoint pos0_sigma_
error on the initial track position
static const uint16_t valid_
Definition: Constants.h:17
bool operator<(const CTPPSTimingLocalTrack &lhs, const CTPPSTimingLocalTrack &rhs)
Comparison operator.
bool containsHit(const CTPPSTimingRecHit &recHit, float tolerance=0.1f, CheckDimension check=CheckDimension::all) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float y() const
int num_hits_
number of hits participating in the track
math::XYZPoint pos0_
initial track position
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
float z() const
int num_planes_
number of planes participating in the track
float x() const
float xWidth() const
float yWidth() const