StFemtoTrack.cxx 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. #include "StFemtoTrack.h"
  2. #include "TMath.h"
  3. ClassImp(StFemtoTrack)
  4. //_________________
  5. StFemtoTrack::StFemtoTrack() {
  6. mId = -999;
  7. mNSigmaElectron = -999;
  8. mNSigmaPion = -999;
  9. mNSigmaKaon = -999;
  10. mNSigmaProton = -999;
  11. mDedx = 0;
  12. mMomX = 0.;
  13. mMomY = 0.;
  14. mMomZ = 0.;
  15. mBeta = -999.;
  16. }
  17. //_________________
  18. StFemtoTrack::StFemtoTrack(Float_t px, Float_t py, Float_t pz) {
  19. mId = -999;
  20. mNSigmaElectron = -999;
  21. mNSigmaPion = -999;
  22. mNSigmaKaon = -999;
  23. mNSigmaProton = -999;
  24. mDedx = 0;
  25. mMomX = px;
  26. mMomY = py;
  27. mMomZ = pz;
  28. mBeta = -999.;
  29. }
  30. //_________________
  31. StFemtoTrack::~StFemtoTrack() {
  32. /* nothing to do*/
  33. }
  34. //_________________
  35. Short_t StFemtoTrack::GetType() const {
  36. if( (mMomX <= 1e-5) &&
  37. (mMomY <= 1e-5) &&
  38. (mMomZ <= 1e-5) ) {
  39. return 0; //Global
  40. }
  41. else {
  42. return 1; //Primary
  43. }
  44. }
  45. //_________________
  46. Bool_t StFemtoTrack::GetIsTofTrack() {
  47. if(mBeta < -1.) {
  48. return false;
  49. }
  50. else {
  51. return true;
  52. }
  53. }
  54. //_________________
  55. void StFemtoTrack::SetP(Float_t px, Float_t py, Float_t pz) {
  56. mMomX = px;
  57. mMomY = py;
  58. mMomZ = pz;
  59. }
  60. //_________________
  61. TVector3 StFemtoTrack::GetP() const {
  62. TVector3 p(mMomX, mMomY, mMomZ);
  63. return p;
  64. }
  65. //_________________
  66. Float_t StFemtoTrack::GetPt() const {
  67. return TMath::Sqrt(mMomX*mMomX + mMomY*mMomY);
  68. }
  69. //_________________
  70. Float_t StFemtoTrack::GetPtot() const {
  71. return TMath::Sqrt(mMomX*mMomX + mMomY*mMomY + mMomZ*mMomZ);
  72. }
  73. //_________________
  74. Float_t StFemtoTrack::GetEta() const {
  75. float ptot = TMath::Sqrt(mMomX*mMomX + mMomY*mMomY + mMomZ*mMomZ);
  76. float eta = 0.5*TMath::Log( (ptot + mMomZ) / (ptot - mMomZ) );
  77. return eta;
  78. }
  79. //_________________
  80. void StFemtoTrack::SetGlobalP(Float_t px, Float_t py, Float_t pz) {
  81. mGlobMomX = px;
  82. mGlobMomY = py;
  83. mGlobMomZ = pz;
  84. }
  85. //_________________
  86. UShort_t StFemtoTrack::GetNHitsFit() const {
  87. if(StFemtoTrack::GetType() == 1) {
  88. return (TMath::Abs(mNHits)+1);
  89. }
  90. else {
  91. return TMath::Abs(mNHits);
  92. }
  93. }
  94. //_________________
  95. TVector3 StFemtoTrack::GetGlobalP() const {
  96. TVector3 p( mGlobMomX, mGlobMomY, mGlobMomZ );
  97. return p;
  98. }
  99. //_________________
  100. Float_t StFemtoTrack::GetPtGlobal() const {
  101. return TMath::Sqrt(mGlobMomX*mGlobMomX + mGlobMomY*mGlobMomY);
  102. }
  103. //_________________
  104. Float_t StFemtoTrack::GetPtotGlobal() const {
  105. return TMath::Sqrt(mGlobMomX*mGlobMomX + mGlobMomY*mGlobMomY + mGlobMomZ*mGlobMomZ);
  106. }
  107. //_________________
  108. Float_t StFemtoTrack::GetMassSqr() const {
  109. float mSqr = -999.;
  110. if(mBeta > 0.) {
  111. float ptot = TMath::Sqrt(mMomX*mMomX + mMomY*mMomY + mMomZ*mMomZ);
  112. mSqr = ptot*ptot * (1./(mBeta*mBeta) - 1.);
  113. }
  114. return mSqr;
  115. }
  116. //_________________
  117. void StFemtoTrack::SetNSigmaElectron(Float_t ns) {
  118. if(TMath::Abs(ns*1000) >= SHORTMAX) {
  119. if(ns>0) {
  120. mNSigmaElectron = SHORTMAX;
  121. }
  122. else {
  123. mNSigmaElectron = -SHORTMAX;
  124. }
  125. }
  126. else {
  127. mNSigmaElectron = (Short_t)(ns*1000);
  128. }
  129. }
  130. //_________________
  131. void StFemtoTrack::SetNSigmaPion(Float_t ns) {
  132. if(TMath::Abs(ns*1000) >= SHORTMAX) {
  133. if(ns>0) {
  134. mNSigmaPion = SHORTMAX;
  135. }
  136. else {
  137. mNSigmaPion = -SHORTMAX;
  138. }
  139. }
  140. else {
  141. mNSigmaPion = (Short_t)(ns*1000);
  142. }
  143. }
  144. //_________________
  145. void StFemtoTrack::SetNSigmaKaon(Float_t ns) {
  146. if(TMath::Abs(ns*1000) >= SHORTMAX) {
  147. if(ns>0) {
  148. mNSigmaKaon = SHORTMAX;
  149. }
  150. else {
  151. mNSigmaKaon = -SHORTMAX;
  152. }
  153. }
  154. else {
  155. mNSigmaKaon = (Short_t)(ns*1000);
  156. }
  157. }
  158. //_________________
  159. void StFemtoTrack::SetNSigmaProton(Float_t ns) {
  160. if(TMath::Abs(ns*1000) >= SHORTMAX) {
  161. if(ns>0) {
  162. mNSigmaProton = SHORTMAX;
  163. }
  164. else {
  165. mNSigmaProton = -SHORTMAX;
  166. }
  167. }
  168. else {
  169. mNSigmaProton = (Short_t)(ns*1000);
  170. }
  171. }
  172. //_________________
  173. void StFemtoTrack::SetDCAxGlobal(Float_t x) {
  174. if(TMath::Abs(x*10000) >= SHORTMAX) {
  175. if(x>0) {
  176. mDCAxGlobal = SHORTMAX;
  177. }
  178. else {
  179. mDCAxGlobal = -SHORTMAX;
  180. }
  181. }
  182. else {
  183. mDCAxGlobal = (Short_t)(x * 10000);
  184. }
  185. }
  186. //_________________
  187. void StFemtoTrack::SetDCAyGlobal(Float_t y) {
  188. if(TMath::Abs(y*10000) >= SHORTMAX) {
  189. if(y>0) {
  190. mDCAyGlobal = SHORTMAX;
  191. }
  192. else {
  193. mDCAyGlobal = -SHORTMAX;
  194. }
  195. }
  196. else {
  197. mDCAyGlobal = (Short_t)(y * 10000);
  198. }
  199. }
  200. //_________________
  201. void StFemtoTrack::SetDCAzGlobal(Float_t z) {
  202. if(TMath::Abs(z*10000) >= SHORTMAX) {
  203. if(z>0) {
  204. mDCAzGlobal = SHORTMAX;
  205. }
  206. else {
  207. mDCAzGlobal = -SHORTMAX;
  208. }
  209. }
  210. else {
  211. mDCAzGlobal = (Short_t)(z * 10000);
  212. }
  213. }
  214. //_________________
  215. void StFemtoTrack::SetDCAGlobal(Float_t x, Float_t y, Float_t z) {
  216. if(TMath::Abs(x*10000) >= SHORTMAX) {
  217. if(x>0) {
  218. mDCAxGlobal = SHORTMAX;
  219. }
  220. else {
  221. mDCAxGlobal = -SHORTMAX;
  222. }
  223. }
  224. else {
  225. mDCAxGlobal = (Short_t)(x * 10000);
  226. }
  227. if(TMath::Abs(y*10000) >= SHORTMAX) {
  228. if(y>0) {
  229. mDCAyGlobal = SHORTMAX;
  230. }
  231. else {
  232. mDCAyGlobal = -SHORTMAX;
  233. }
  234. }
  235. else {
  236. mDCAyGlobal = (Short_t)(y * 10000);
  237. }
  238. if(TMath::Abs(z*10000) >= SHORTMAX) {
  239. if(z>0) {
  240. mDCAzGlobal = SHORTMAX;
  241. }
  242. else {
  243. mDCAzGlobal = -SHORTMAX;
  244. }
  245. }
  246. else {
  247. mDCAzGlobal = (Short_t)(z * 10000);
  248. }
  249. }
  250. //_________________
  251. void StFemtoTrack::SetDedx(Float_t dEdx) {
  252. if(dEdx >= USHORTMAX) {
  253. mDedx = USHORTMAX;
  254. }
  255. else {
  256. mDedx = (UShort_t)(dEdx * 1e9);
  257. }
  258. }
  259. //_________________
  260. void StFemtoTrack::SetDedx(Double_t dEdx) {
  261. if(dEdx >= USHORTMAX) {
  262. mDedx = USHORTMAX;
  263. }
  264. else {
  265. mDedx = (UShort_t)(dEdx * 1e9);
  266. }
  267. }
  268. //_________________
  269. Float_t StFemtoTrack::GetDCAxyGlobal() const {
  270. Float_t x = (Float_t)mDCAxGlobal * 0.0001;
  271. Float_t y = (Float_t)mDCAyGlobal * 0.0001;
  272. return TMath::Sqrt(x*x + y*y);
  273. }
  274. //_________________
  275. Float_t StFemtoTrack::GetDCAGlobal() const {
  276. Float_t x = (Float_t)mDCAxGlobal * 0.0001;
  277. Float_t y = (Float_t)mDCAyGlobal * 0.0001;
  278. Float_t z = (Float_t)mDCAzGlobal * 0.0001;
  279. return TMath::Sqrt(x*x + y*y + z*z);
  280. }