StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StPicoETofPidTraits.cxx
1 //
2 // StPicoETofPidTraits keeps information about tracks that matched eTOF
3 //
4 
5 // C++ headers
6 #include <limits>
7 #include <cmath>
8 
9 // ROOT headers
10 #include "TMath.h"
11 
12 // PicoDst headers
13 #include "StPicoMessMgr.h"
14 #include "StPicoETofPidTraits.h"
15 
16 ClassImp( StPicoETofPidTraits )
17 
18 //_________________
20  mTrackIndex( -1 ), mHitIndex( -1 ), mMatchFlag( -1 ),
21  mTimeOfFlight( 0 ), mBeta( 0 ),
22  mDeltaX( std::numeric_limits<short>::min() ),
23  mDeltaY( std::numeric_limits<short>::min() ),
24  mCrossingX( 0 ), mCrossingY( 0 ), mCrossingZ( 0 ) {
25  /* empty */
26 }
27 
28 //_________________
30  mTrackIndex = traits.mTrackIndex;
31  mHitIndex = traits.mHitIndex;
32  mMatchFlag = traits.mMatchFlag;
33  mTimeOfFlight = traits.mTimeOfFlight;
34  mBeta = traits.mBeta;
35  mDeltaX = traits.mDeltaX;
36  mDeltaY = traits.mDeltaY;
37  mCrossingX = traits.mCrossingX;
38  mCrossingY = traits.mCrossingY;
39  mCrossingZ = traits.mCrossingZ;
40 }
41 
42 //_________________
44  /* empty */
45 }
46 
47 //_________________
48 void StPicoETofPidTraits::Print( const Char_t* option __attribute__((unused)) ) const {
49  LOG_INFO << " matched track index = " << trackIndex()
50  << " eTOF hit index = " << hitIndex()
51  << " match flag = " << matchFlag()
52  << " time of flight = " << tof()
53  << " beta = " << beta()
54  << " deltaX = " << deltaX()
55  << " deltaY = " << deltaY()
56  << " crossingX = " << crossingX()
57  << " crossingY = " << crossingY()
58  << " crossingZ = " << crossingZ()
59  << endm;
60 }
61 
62 //
63 // Setters
64 //
65 
66 //_________________
67 void StPicoETofPidTraits::setBeta( const Float_t& beta ) {
68  if( beta <= 0) {
69  mBeta = 0;
70  }
71  else {
72  mBeta = ( (beta * 20000.) > std::numeric_limits<unsigned short>::max() ?
73  std::numeric_limits<unsigned short>::max() :
74  (UShort_t)( TMath::Nint( beta * 20000. ) ) );
75  }
76 }
77 
78 //_________________
79 void StPicoETofPidTraits::setDeltaX( const Float_t& deltaX ) {
80  mDeltaX = ( fabs(deltaX * 800.) > std::numeric_limits<short>::max() ?
81  ( (deltaX>0) ? std::numeric_limits<short>::max() : std::numeric_limits<short>::min() ):
82  (Short_t)( TMath::Nint( deltaX * 800. ) ) );
83 }
84 
85 //_________________
86 void StPicoETofPidTraits::setDeltaY( const Float_t& deltaY ) {
87  mDeltaY = ( fabs(deltaY * 800.) > std::numeric_limits<short>::max() ?
88  ( (deltaY>0) ? std::numeric_limits<short>::max() : std::numeric_limits<short>::min() ):
89  (Short_t)( TMath::Nint( deltaY * 800. ) ) );
90 }
91 
92 //_________________
93 void StPicoETofPidTraits::setCrossingX( const Float_t& x ) {
94  mCrossingX = ( fabs(x * 100.) > std::numeric_limits<short>::max() ?
95  ( (x>0) ? std::numeric_limits<short>::max() : std::numeric_limits<short>::min() ):
96  (Short_t)( TMath::Nint( x * 100. ) ) );
97 }
98 
99 //_________________
100 void StPicoETofPidTraits::setCrossingY( const Float_t& y ) {
101  mCrossingY = ( fabs(y * 100.) > std::numeric_limits<short>::max() ?
102  ( (y>0) ? std::numeric_limits<short>::max() : std::numeric_limits<short>::min() ):
103  (Short_t)( TMath::Nint( y * 100. ) ) );
104 }
105 
106 //_________________
107 void StPicoETofPidTraits::setCrossingZ( const Float_t& z ) {
108  mCrossingZ = ( fabs(z * 100.) > std::numeric_limits<short>::max() ?
109  ( (z>0) ? std::numeric_limits<short>::max() : std::numeric_limits<short>::min() ):
110  (Short_t)( TMath::Nint( z * 100. ) ) );
111 }
virtual void Print(const Char_t *option="") const
Print eTOF PID traits information.
Int_t trackIndex() const
Return index of the associated track.
void setDeltaX(const Float_t &deltaX)
Set difference between track intersection and eTOF hit in local X coordinate (cm) across strips...
Float_t crossingX() const
Return global X coordinate (cm) of the track intersection with an eTOF volume.
Int_t hitIndex() const
Return index of corrsponding eTOF hit.
void setDeltaY(const Float_t &deltaY)
Set difference between track intersection and eTOF hit in local Y coordinate (cm) along strips...
Hold information about eTOF-matched tracks.
void setCrossingX(const Float_t &x)
Set global X coordinate (cm) of the track intersection with an eTOF volume.
void setCrossingZ(const Float_t &z)
Set global Z coordinate (cm) of the track intersection with an eTOF volume.
Float_t crossingY() const
Return global Y coordinate (cm) of the track intersection with an eTOF volume.
Float_t deltaY() const
Return difference between track intersection and eTOF hit in local Y coordinate (cm) along strips...
virtual ~StPicoETofPidTraits()
Destructor.
Float_t tof() const
Return time of flight (ns)
void setCrossingY(const Float_t &y)
Set global Y coordinate (cm) of the track intersection with an eTOF volume.
Float_t crossingZ() const
Return global Z coordinate (cm) of the track intersection with an eTOF volume.
Int_t matchFlag() const
StPicoETofPidTraits()
Default constructor.
Float_t deltaX() const
Return difference between track intersection and eTOF hit in local X coordinate (cm) across strips...
void setBeta(const Float_t &beta)
Set beta.
Float_t beta() const
Return beta.