StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StPicoBTofPidTraits.cxx
1 //
2 // StPicoBTofPidTraits keeps information about tracks that matched BTOF
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 "StPicoBTofPidTraits.h"
15 
16 ClassImp(StPicoBTofPidTraits)
17 
18 //_________________
20  mTrackIndex(-1), mBTofCellId(-1), mBTofMatchFlag(-1),
21  mBTof(0), mBTofBeta(0),
22  mBTofYLocal( std::numeric_limits<short>::min() ),
23  mBTofZLocal( std::numeric_limits<short>::min() ),
24  mBTofHitPosX( std::numeric_limits<short>::min() ),
25  mBTofHitPosY( std::numeric_limits<short>::min() ),
26  mBTofHitPosZ( std::numeric_limits<short>::min() ),
27  mNSigmaElectron( std::numeric_limits<short>::min() ),
28  mNSigmaPion( std::numeric_limits<short>::min() ),
29  mNSigmaKaon( std::numeric_limits<short>::min() ),
30  mNSigmaProton( std::numeric_limits<short>::min() ) {
31  /* empty */
32 }
33 
34 //_________________
36  mTrackIndex = traits.mTrackIndex;
37  mBTofCellId = traits.mBTofCellId;
38  mBTofMatchFlag = traits.mBTofMatchFlag;
39  mBTof = traits.mBTof;
40  mBTofBeta = traits.mBTofBeta;
41  mBTofYLocal = traits.mBTofYLocal;
42  mBTofZLocal = traits.mBTofZLocal;
43  mBTofHitPosX = traits.mBTofHitPosX;
44  mBTofHitPosY = traits.mBTofHitPosY;
45  mBTofHitPosZ = traits.mBTofHitPosZ;
46  mNSigmaElectron = traits.mNSigmaElectron;
47  mNSigmaPion = traits.mNSigmaPion;
48  mNSigmaKaon = traits.mNSigmaKaon;
49  mNSigmaProton = traits.mNSigmaProton;
50 }
51 
52 //_________________
54  /* empty */
55 }
56 
57 //_________________
58 void StPicoBTofPidTraits::setBeta(Float_t beta) {
59  if( beta <= 0) {
60  mBTofBeta = 0;
61  }
62  else {
63  mBTofBeta = ( (beta * 20000.) > std::numeric_limits<unsigned short>::max() ?
64  std::numeric_limits<unsigned short>::max() :
65  (UShort_t)( TMath::Nint( beta * 20000. ) ) );
66  }
67 }
68 
69 //_________________
70 void StPicoBTofPidTraits::setYLocal(Float_t yLocal) {
71  mBTofYLocal = ( fabs(yLocal * 1000.) > std::numeric_limits<short>::max() ?
72  ( (yLocal>0) ? std::numeric_limits<short>::max() :
73  std::numeric_limits<short>::min() ):
74  (Short_t)( TMath::Nint( yLocal * 1000. ) ) );
75 }
76 
77 //_________________
78 void StPicoBTofPidTraits::setZLocal(Float_t zLocal) {
79  mBTofZLocal = ( fabs(zLocal * 1000.) > std::numeric_limits<short>::max() ?
80  ( (zLocal>0) ? std::numeric_limits<short>::max() :
81  std::numeric_limits<short>::min() ):
82  (Short_t)( TMath::Nint( zLocal * 1000. ) ) );
83 }
84 
85 //_________________
87  mBTofHitPosX = ( fabs(x * 100.) > std::numeric_limits<short>::max() ?
88  ( (x>0) ? std::numeric_limits<short>::max() :
89  std::numeric_limits<short>::min() ):
90  (Short_t)( TMath::Nint( x * 100. ) ) );
91 }
92 
93 //_________________
95  mBTofHitPosY = ( fabs(y * 100.) > std::numeric_limits<short>::max() ?
96  ( (y>0) ? std::numeric_limits<short>::max() :
97  std::numeric_limits<short>::min() ):
98  (Short_t)( TMath::Nint( y * 100. ) ) );
99 }
100 
101 //_________________
103  mBTofHitPosZ = ( fabs(z * 100.) > std::numeric_limits<short>::max() ?
104  ( (z>0) ? std::numeric_limits<short>::max() :
105  std::numeric_limits<short>::min() ):
106  (Short_t)( TMath::Nint( z * 100. ) ) );
107 }
108 
109 //_________________
110 void StPicoBTofPidTraits::setHitPositionXYZ(Float_t x, Float_t y, Float_t z) {
112 }
113 
114 //_________________
116  mNSigmaElectron = ( fabs(sigma * 1000.) > std::numeric_limits<short>::max() ?
117  ( (sigma > 0) ? std::numeric_limits<short>::max() :
118  std::numeric_limits<short>::min() ) :
119  (Short_t)( TMath::Nint( sigma * 1000. ) ) );
120 }
121 
122 //_________________
124  mNSigmaPion = ( fabs(sigma * 1000.) > std::numeric_limits<short>::max() ?
125  ( (sigma > 0) ? std::numeric_limits<short>::max() :
126  std::numeric_limits<short>::min() ) :
127  (Short_t)( TMath::Nint( sigma * 1000. ) ) );
128 }
129 
130 //_________________
132  mNSigmaKaon = ( fabs(sigma * 1000.) > std::numeric_limits<short>::max() ?
133  ( (sigma > 0) ? std::numeric_limits<short>::max() :
134  std::numeric_limits<short>::min() ) :
135  (Short_t)( TMath::Nint( sigma * 1000. ) ) );
136 }
137 
138 //_________________
140  mNSigmaProton = ( fabs(sigma * 1000.) > std::numeric_limits<short>::max() ?
141  ( (sigma > 0) ? std::numeric_limits<short>::max() :
142  std::numeric_limits<short>::min() ) :
143  (Short_t)( TMath::Nint( sigma * 1000. ) ) );
144 }
145 
146 //_________________
147 void StPicoBTofPidTraits::Print(const Char_t* option __attribute__((unused)) ) const {
148  LOG_INFO << " Matched track index = " << mTrackIndex << endm;
149  LOG_INFO << " BTOF cellId = " << btofCellId() << " tof = " << btof()
150  << " beta = " << btofBeta() << endm;
151  LOG_INFO << " BTOF match = " << btofMatchFlag() << " yLocal/zLocal "
152  << btofYLocal() << " " << btofZLocal() << endm;
153 }
154 
Float_t btofZLocal() const
Return zLocal (compression = zLocal * 1000)
Int_t btofCellId() const
Return BTOF cell ID (encoding = (tray-1)*192+(module-1)*6+(cell-1): -1 - no match ) ...
void setZLocal(Float_t zLocal)
Set zLocal.
void setNSigmaProton(Float_t sigma)
Set nsigma(proton)
virtual ~StPicoBTofPidTraits()
Destructor.
Float_t btofYLocal() const
Return yLocal (compression = yLocal * 1000)
virtual void Print(const Char_t *option="") const
Print TOF PID traits information.
void setHitPositionZ(Float_t z)
Set hit position z (cm)
Float_t btofBeta() const
Return beta (compression = beta * 20000)
void setHitPositionXYZ(Float_t x, Float_t y, Float_t z)
Set hit position (x,y,z)
Float_t btof() const
Return time of flight.
void setNSigmaElectron(Float_t sigma)
Set nsigma(electron)
void setNSigmaKaon(Float_t sigma)
Set nsigma(kaon)
void setHitPositionY(Float_t y)
Set hit position y (cm)
void setNSigmaPion(Float_t sigma)
Set nsigma(pion)
void setHitPositionX(Float_t x)
Set hit position x (cm)
void setBeta(Float_t beta)
Set beta.
StPicoBTofPidTraits()
Default constructor.
Int_t btofMatchFlag() const
Return matching flag (0 - no match, 1 - one-to-one, 2 - one-to-multiple)
void setYLocal(Float_t yLocal)
Set yLocal.