CMS 3D CMS Logo

CTPPSDiamondLocalTrack.h
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  *
8  ****************************************************************************/
9 
10 #ifndef DataFormats_CTPPSReco_CTPPSDiamondLocalTrack
11 #define DataFormats_CTPPSReco_CTPPSDiamondLocalTrack
12 
15 
16 //----------------------------------------------------------------------------------------------------
17 
19 {
20  public:
22  num_hits_( 0 ), num_planes_( 0 ), valid_( true ),
23  t_( 0. ), t_sigma_( 0. ), ts_index_( 0 ), mh_( 0 ) {}
24  CTPPSDiamondLocalTrack( const math::XYZPoint& pos0, const math::XYZPoint& pos0_sigma, float t, float t_sigma, int oot_idx, int mult_hits ) :
25  pos0_( pos0 ), pos0_sigma_( pos0_sigma ),
26  num_hits_( 0 ), num_planes_( 0 ), valid_( false ),
27  t_( t ), t_sigma_( t_sigma ), ts_index_( oot_idx ), mh_( mult_hits ) {}
29 
30  inline bool containsHit( const CTPPSDiamondRecHit& recHit, float tolerance = 0.1 ) const {
31  const float x_low = pos0_.x() - pos0_sigma_.x() - tolerance;
32  const float x_high = pos0_.x() + pos0_sigma_.x() + tolerance;
33  return ( ( recHit.getZ() * pos0_.z() > 0. )
35  && ( ( recHit.getX() + 0.5 * recHit.getXWidth() > x_low && recHit.getX() + 0.5 * recHit.getXWidth() < x_high )
36  || ( recHit.getX() - 0.5 * recHit.getXWidth() > x_low && recHit.getX() - 0.5 * recHit.getXWidth() < x_high )
37  || ( recHit.getX() - 0.5 * recHit.getXWidth() < x_low && recHit.getX() + 0.5 * recHit.getXWidth() > x_high ) ) );
38  }
39 
40  //--- spatial get'ters
41 
42  inline float getX0() const { return pos0_.x(); }
43  inline float getX0Sigma() const { return pos0_sigma_.x(); }
44 
45  inline float getY0() const { return pos0_.y(); }
46  inline float getY0Sigma() const { return pos0_sigma_.y(); }
47 
48  inline float getZ0() const { return pos0_.z(); }
49  inline float getZ0Sigma() const { return pos0_sigma_.z(); }
50 
51  inline int getNumOfHits() const { return num_hits_; }
52  inline int getNumOfPlanes() const { return num_planes_; }
53 
54  //--- spatial set'ters
55 
56  inline void setPosition( const math::XYZPoint& pos0 ) { pos0_ = pos0; }
57  inline void setPositionSigma( const math::XYZPoint& pos0_sigma ) { pos0_sigma_ = pos0_sigma; }
58 
59  inline void setNumOfHits( const int num_hits ) { num_hits_ = num_hits; }
60  inline void setNumOfPlanes( const int num_planes ) { num_planes_ = num_planes; }
61 
62  inline bool isValid() const { return valid_; }
63  inline void setValid( bool valid ) { valid_ = valid; }
64 
65  //--- temporal get'ters
66 
67  inline float getT() const { return t_; }
68  inline float getTSigma() const { return t_sigma_; }
69 
70  //--- temporal set'ters
71 
72  inline void setT( const float t ) { t_ = t; }
73  inline void setTSigma( const float t_sigma ) { t_sigma_ = t_sigma; }
74 
75  inline void setOOTIndex( const int i ) { ts_index_ = i; }
76  inline int getOOTIndex() const { return ts_index_; }
77 
78  inline void setMultipleHits( const int i ) { mh_ = i; }
79  inline int getMultipleHits() const { return mh_; }
80 
81  private:
82  //--- spatial information
83 
88 
90  int num_hits_;
91 
94 
96  bool valid_;
97 
98  //--- timing information
99 
100  float t_;
101  float t_sigma_;
105  int mh_;
106 };
107 
108 inline bool operator<( const CTPPSDiamondLocalTrack& lhs, const CTPPSDiamondLocalTrack& rhs )
109 {
110  // start to sort by temporal coordinate
111  if ( lhs.getT() < rhs.getT() ) return true;
112  if ( lhs.getT() > rhs.getT() ) return false;
113  // then sort by x-position
114  return ( lhs.getX0() < rhs.getX0() );
115 }
116 
117 #endif
118 
float getX() const
int ts_index_
Time slice index.
Reconstructed hit in diamond detectors.
const double tolerance
CTPPSDiamondLocalTrack(const math::XYZPoint &pos0, const math::XYZPoint &pos0_sigma, float t, float t_sigma, int oot_idx, int mult_hits)
int num_planes_
number of planes participating in the track
int getOOTIndex() const
int mh_
Multiple hits counter.
void setMultipleHits(const int i)
bool operator<(const CTPPSDiamondLocalTrack &lhs, const CTPPSDiamondLocalTrack &rhs)
bool containsHit(const CTPPSDiamondRecHit &recHit, float tolerance=0.1) const
float getZ() const
float getXWidth() const
void setPositionSigma(const math::XYZPoint &pos0_sigma)
void setNumOfHits(const int num_hits)
void setPosition(const math::XYZPoint &pos0)
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
void setNumOfPlanes(const int num_planes)
math::XYZPoint pos0_
initial track position
static constexpr int TIMESLICE_WITHOUT_LEADING
void setTSigma(const float t_sigma)
int num_hits_
number of hits participating in the track
math::XYZPoint pos0_sigma_
error on the initial track position