StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StPicoMtdPidTraits.cxx
1 //
2 // StPicoMtdPidTraits stores information related to the MTD-matched track
3 //
4 
5 // C++ headers
6 #include <limits>
7 
8 // PicoDst headers
9 #include "StPicoMessMgr.h"
10 #include "StPicoMtdPidTraits.h"
11 
12 // ROOT headers
13 #include "TMath.h"
14 
15 ClassImp(StPicoMtdPidTraits)
16 
17 //_________________
19  mTrackIndex(-1), mMtdHitIndex(-1), mMatchFlag(-1),
20  mDeltaY(-999.), mDeltaZ(-999.), mDeltaTimeOfFlight(-999.),
21  mBeta( 0 ), mMtdHitChan(-1) {
22  /* emtpy */
23 }
24 
25 //_________________
27  mTrackIndex = traits.mTrackIndex;
28  mMtdHitIndex = traits.mMtdHitIndex;
29  mMatchFlag = traits.mMatchFlag;
30  mDeltaY = traits.mDeltaY;
31  mDeltaZ = traits.mDeltaZ;
32  mDeltaTimeOfFlight = traits.mDeltaTimeOfFlight;
33  mBeta = traits.mBeta;
34  mMtdHitChan = traits.mMtdHitChan;
35 }
36 
37 //_________________
39  /* emtpy */
40 }
41 
42 //_________________
43 void StPicoMtdPidTraits::Print(const Char_t* option __attribute__((unused)) ) const {
44 
45  LOG_INFO << "Matched hit: backleg = " << backleg()
46  << ", module = " << module()
47  << ", cell = " << cell()
48  << endm;
49  LOG_INFO << "Matched track index = " << mTrackIndex << endm;
50  LOG_INFO << "(DeltaY, DeltaZ, DeltaTOF, beta) = ("
51  << mDeltaY << ", "
52  << mDeltaZ << ", "
53  << mDeltaTimeOfFlight << ", "
54  << mBeta << ")" << endm;
55 }
56 
57 //_________________
58 void StPicoMtdPidTraits::setHitChannel(Int_t backleg, Int_t module, Int_t cell) {
59  Int_t gchan = (backleg - 1) * 60 + (module - 1) * 12 + cell;
60  mMtdHitChan = (gchan > std::numeric_limits<short>::max()) ? -1 : (Short_t) gchan;
61 }
62 
63 //_________________
64 void StPicoMtdPidTraits::setBeta(Float_t beta) {
65  if( beta <= 0 ) {
66  mBeta = 0;
67  }
68  else {
69  mBeta = ( (beta * 20000.) > std::numeric_limits<unsigned short>::max() ?
70  std::numeric_limits<unsigned short>::max() :
71  (UShort_t)( TMath::Nint( beta * 20000. ) ) );
72  }
73 }
74 
75 //_________________
77  mDeltaY = ( TMath::Abs(dy * 200.) > std::numeric_limits<short>::max() ?
78  ( (dy > 0) ? std::numeric_limits<short>::max() :
79  std::numeric_limits<short>::min() ) :
80  (Short_t)( TMath::Nint( dy * 200.) ) );
81 }
82 
83 //_________________
85  // Provides 1.5 cm precision
86  mDeltaZ = ( TMath::Abs(dz * 200.) > std::numeric_limits<short>::max() ?
87  ( (dz > 0) ? std::numeric_limits<short>::max() :
88  std::numeric_limits<short>::min() ) :
89  (Short_t)( TMath::Nint( dz * 200. ) ) );
90 }
Holds information about MTD-matched track.
virtual void Print(const Char_t *option="") const
Print MTD PID traits information.
Int_t cell() const
Return cell number.
Int_t backleg() const
Return backleg number.
void setDeltaZ(Float_t dz)
Set delta Z.
StPicoMtdPidTraits()
Default constructor.
void setHitChannel(Int_t backleg, Int_t module, Int_t cell)
Set hit channel: (backleg-1) * 60 + (module-1) * 12 + cell.
void setDeltaY(Float_t dy)
Set delta Y.
void setBeta(Float_t beta)
Set beta.
virtual ~StPicoMtdPidTraits()
Destructor.
Int_t module() const
Return module number.