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 
19  num_hits_( 0 ), num_planes_( 0 ), valid_( true ),
20  t_( 0. ), t_sigma_( 0. )
21 {}
22 
24  float t, float t_sigma ) :
25  pos0_( pos0 ), pos0_sigma_( pos0_sigma ), num_hits_( 0 ), num_planes_( 0 ), valid_( false ),
26  t_( t ), t_sigma_( t_sigma )
27 {}
28 
29 //--- interface member functions
30 
31 bool
33 {
34  float xTolerance = pos0_sigma_.x() + ( 0.5 * recHit.getXWidth() ) + tolerance;
35  float yTolerance = pos0_sigma_.y() + ( 0.5 * recHit.getYWidth() ) + tolerance;
36  float zTolerance = pos0_sigma_.z() + ( 0.5 * recHit.getZWidth() ) + tolerance;
37 
38  float xDiff = std::abs( pos0_.x() - recHit.getX() );
39  float yDiff = std::abs( pos0_.y() - recHit.getY() );
40  float zDiff = std::abs( pos0_.z() - recHit.getZ() );
41 
42  switch ( check ) {
43  case CheckDimension::x:
44  return xDiff < xTolerance;
45  case CheckDimension::y:
46  return yDiff < yTolerance;
48  return xDiff < xTolerance && yDiff < yTolerance && zDiff < zTolerance;
49  }
50  return false;
51 }
52 
53 //====================================================================================================
54 // Other methods implementation
55 //====================================================================================================
56 
57 bool
59 {
60  // start to sort by temporal coordinate
61  if ( lhs.getT() < rhs.getT() ) return true;
62  if ( lhs.getT() > rhs.getT() ) return false;
63  // then sort by x-position
64  if ( lhs.getX0() < rhs.getX0() ) return true;
65  if ( lhs.getX0() > rhs.getX0() ) return false;
66  // ...and y-position
67  if ( lhs.getY0() < rhs.getY0() ) return true;
68  if ( lhs.getY0() > rhs.getY0() ) return false;
69  // ...and z-position
70  return ( lhs.getZ0() < rhs.getZ0() );
71 }
72 
Reconstructed hit in timing detectors.
float getX() const
float getYWidth() const
const double tolerance
math::XYZPoint pos0_sigma_
error on the initial track position
float getZWidth() const
static const uint16_t valid_
Definition: Constants.h:17
float getY() const
bool operator<(const CTPPSTimingLocalTrack &lhs, const CTPPSTimingLocalTrack &rhs)
Comparison operator.
bool containsHit(const CTPPSTimingRecHit &recHit, float tolerance=0.1f, CheckDimension check=CheckDimension::all) const
float getZ() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float getXWidth() 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
int num_planes_
number of planes participating in the track
def check(config)
Definition: trackerTree.py:14