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 
52 bool operator<(const CTPPSTimingLocalTrack& lhs, const CTPPSTimingLocalTrack& rhs) {
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 }
CTPPSTimingLocalTrack.h
funct::false
false
Definition: Factorize.h:29
CTPPSTimingLocalTrack::containsHit
bool containsHit(const CTPPSTimingRecHit &recHit, float tolerance=0.1f, CheckDimension check=CheckDimension::all) const
Definition: CTPPSTimingLocalTrack.cc:27
CTPPSTimingLocalTrack
Definition: CTPPSTimingLocalTrack.h:18
CTPPSTimingLocalTrack::CTPPSTimingLocalTrack
CTPPSTimingLocalTrack()
Definition: CTPPSTimingLocalTrack.cc:17
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
sistrip::valid_
static const uint16_t valid_
Definition: Constants.h:17
CTPPSTimingLocalTrack::pos0_sigma_
math::XYZPoint pos0_sigma_
error on the initial track position
Definition: CTPPSTimingLocalTrack.h:78
CTPPSTimingLocalTrack::z0
float z0() const
Definition: CTPPSTimingLocalTrack.h:43
RPCNoise_example.check
check
Definition: RPCNoise_example.py:71
CTPPSTimingLocalTrack::time
float time() const
Definition: CTPPSTimingLocalTrack.h:64
CTPPSTimingLocalTrack::CheckDimension
CheckDimension
Definition: CTPPSTimingLocalTrack.h:30
CTPPSTimingLocalTrack::pos0_
math::XYZPoint pos0_
initial track position
Definition: CTPPSTimingLocalTrack.h:76
operator<
bool operator<(const CTPPSTimingLocalTrack &lhs, const CTPPSTimingLocalTrack &rhs)
Comparison operator.
Definition: CTPPSTimingLocalTrack.cc:51
CTPPSTimingLocalTrack::CheckDimension::all
funct::true
true
Definition: Factorize.h:173
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
tolerance
const double tolerance
Definition: HGCalGeomParameters.cc:29
CTPPSTimingLocalTrack::x0
float x0() const
Definition: CTPPSTimingLocalTrack.h:37
CTPPSTimingLocalTrack::y0
float y0() const
Definition: CTPPSTimingLocalTrack.h:40
CTPPSTimingLocalTrack::CheckDimension::y
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
CTPPSTimingLocalTrack::CheckDimension::x
CTPPSTimingRecHit
Reconstructed hit in timing detectors.
Definition: CTPPSTimingRecHit.h:13
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644