gregsTrackCut.cxx 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. #include "StHbtMaker/Cut/gregsTrackCut.h"
  2. #include <sstream>
  3. #ifdef __ROOT__
  4. ClassImp(gregsTrackCut)
  5. #endif
  6. //#define STHBTDEBUG
  7. //_________________
  8. gregsTrackCut::gregsTrackCut() {
  9. mNTracksPassed = mNTracksFailed = 0;
  10. mNSigmaElectron[0] = -1e9; mNSigmaElectron[1] = +1e9;
  11. mNSigmaPion[0] = -1e9; mNSigmaPion[1] = +1e9;
  12. mNSigmaKaon[0] = -1e9; mNSigmaKaon[1] = +1e9;
  13. mNSigmaProton[0] = -1e9; mNSigmaProton[1] = +1e9;
  14. mEta[0] = -1e9; mEta[1] = +1e9;
  15. mRapidity[0] = -1e9; mRapidity[1] = +1e9;
  16. mP[0] = -1e9; mP[1] = +1e9;
  17. mPt[0] = -1e9; mPt[1] = +1e9;
  18. mPx[0] = -1e9; mPx[1] = +1e9;
  19. mPy[0] = -1e9; mPy[1] = +1e9;
  20. mPz[0] = -1e9; mPz[1] = +1e9;
  21. mDCA[0] = -1e9; mDCA[1] = +1e9;
  22. mDCAGlobal[0] = -1e9; mDCAGlobal[1] = +1e9;
  23. mNHits[0] = 0; mNHits[1] = 60;
  24. mNHitsFit[0] = 0; mNHitsFit[1] = 60;
  25. mNdEdxHits[0] = 0; mNdEdxHits[1] = 60;
  26. mTofMassSqr[0] = -1e9; mTofMassSqr[1] = +1e9;
  27. mAntiSplit = 0.;
  28. mCharge = 0;
  29. mPIDSelection = 2;
  30. mType = 1;
  31. mPartId = 4; // kaon selection by befault
  32. mTpcTrackMom[0] = -1e9; mTpcTrackMom[1] = +1e9;
  33. mTofTrackMom[0] = -1e9; mTofTrackMom[1] = +1e9;
  34. mTpcTrackPt[0] = -1e9; mTpcTrackPt[1] = +1e9;
  35. mTofTrackPt[0] = -1e9; mTofTrackPt[1] = +1e9;
  36. mInverseBetaDifferce[0] = -1e9; mInverseBetaDifferce[1]=+1e9;
  37. mTofNSigmaElectron[0] = -3; mTofNSigmaElectron[1] = 3;
  38. mTofNSigmaPion[0] = -3; mTofNSigmaPion[1] = 3;
  39. mTofNSigmaKaon[0] = -3; mTofNSigmaKaon[1] = 3;
  40. mTofNSigmaProton[0] = -3; mTofNSigmaProton[1] = 3;
  41. }
  42. //_________________
  43. gregsTrackCut::gregsTrackCut(gregsTrackCut& c) : StHbtTrackCut(c) {
  44. mNTracksPassed = mNTracksFailed = 0;
  45. mCharge = c.mCharge;
  46. mType = c.mType;
  47. mAntiSplit = c.mAntiSplit;
  48. mNSigmaElectron[0] = c.mNSigmaElectron[0]; mNSigmaElectron[1] = c.mNSigmaElectron[1];
  49. mNSigmaPion[0] = c.mNSigmaPion[0]; mNSigmaPion[1] = c.mNSigmaPion[1];
  50. mNSigmaKaon[0] = c.mNSigmaKaon[0]; mNSigmaKaon[1] = c.mNSigmaKaon[1];
  51. mNSigmaProton[0] = c.mNSigmaProton[0]; mNSigmaProton[1] = c.mNSigmaProton[1];
  52. mNHits[0] = c.mNHits[0]; mNHits[1] = c.mNHits[1];
  53. mNHitsFit[0] = c.mNHitsFit[0]; mNHitsFit[1] = c.mNHitsFit[1];
  54. mNdEdxHits[0] = c.mNdEdxHits[0]; mNdEdxHits[1] = c.mNdEdxHits[1];
  55. mP[0] = c.mP[0]; mP[1] = c.mP[1];
  56. mPt[0] = c.mPt[0]; mPt[1] = c.mPt[1];
  57. mPx[0] = c.mPx[0]; mPx[1] = c.mPx[1];
  58. mPy[0] = c.mPy[0]; mPy[1] = c.mPy[1];
  59. mPz[0] = c.mPz[0]; mPz[1] = c.mPz[1];
  60. mRapidity[0] = c.mRapidity[0]; mRapidity[1] = c.mRapidity[1];
  61. mEta[0] = c.mEta[0]; mEta[1] = c.mEta[1];
  62. mDCA[0] = c.mDCA[0]; mDCA[1] = c.mDCA[1];
  63. mDCAGlobal[0] = c.mDCAGlobal[0]; mDCAGlobal[1] = c.mDCAGlobal[1];
  64. mTofMassSqr[0] = c.mTofMassSqr[0]; mTofMassSqr[1] = c.mTofMassSqr[1];
  65. mPIDSelection = c.mPIDSelection;
  66. mTpcTrackMom[0] = c.mTpcTrackMom[0]; mTpcTrackMom[1] = c.mTpcTrackMom[1];
  67. mTofTrackMom[0] = c.mTofTrackMom[0]; mTofTrackMom[1] = c.mTofTrackMom[1];
  68. mTpcTrackPt[0] = c.mTpcTrackPt[0]; mTpcTrackPt[1] = c.mTpcTrackPt[1];
  69. mTofTrackPt[0] = c.mTofTrackPt[0]; mTofTrackPt[1] = c.mTofTrackPt[1];
  70. mPartId = c.mPartId;
  71. mInverseBetaDifferce[0] = c.mInverseBetaDifferce[0]; mInverseBetaDifferce[1] = c.mInverseBetaDifferce[1];
  72. mTofNSigmaElectron[0] = c.mTofNSigmaElectron[0]; mTofNSigmaElectron[1] = c.mTofNSigmaElectron[1];
  73. mTofNSigmaPion[0] = c.mTofNSigmaPion[0]; mTofNSigmaPion[1] = c.mTofNSigmaPion[1];
  74. mTofNSigmaKaon[0] = c.mTofNSigmaKaon[0]; mTofNSigmaKaon[1] = c.mTofNSigmaKaon[1];
  75. mTofNSigmaProton[0] = c.mTofNSigmaProton[0]; mTofNSigmaProton[1] = c.mTofNSigmaProton[1];
  76. mNTracksPassed=0;
  77. mNTracksFailed=0;
  78. #ifdef STHBTDEBUG
  79. cout << " gregsTrackCut::gregsTrackCut(gregsTrackCut& c) " << endl;
  80. #endif
  81. }
  82. //_________________
  83. gregsTrackCut::~gregsTrackCut() {
  84. /* empty */
  85. }
  86. //_________________
  87. bool gregsTrackCut::Pass(const StHbtTrack* track) {
  88. #ifdef STHBTDEBUG
  89. cout << endl << " *** gregsTrackCut::Pass(const StHbtTrack* track) " << endl;
  90. #endif
  91. float TEnergy = ::sqrt(track->P().mag2()+mMass*mMass);
  92. float TRapidity = 0.5*::log((TEnergy+track->P().z())/
  93. (TEnergy-track->P().z()));
  94. float TPseudoRap = 0.5*::log( (track->P().mag()+track->P().z()) /
  95. (track->P().mag()-track->P().z()) );
  96. float aSplit = (float)track->NHitsFit()/track->NHitsPossible();
  97. //Checking the particle ID
  98. /*
  99. if(mPartId == 1) {
  100. cout << "gregsTrackCut::Pass() - mPartId=1 (electron)" << endl;
  101. }
  102. else if(mPartId == 3) {
  103. cout << "gregsTrackCut::Pass() - mPartId=3 (pion)" << endl;
  104. }
  105. else if(mPartId == 4) {
  106. cout << "gregsTrackCut::Pass() - mPartId=4 (kaon)" << endl;
  107. }
  108. else if(mPartId == 5) {
  109. cout << "gregsTrackCut::Pass() - mPartId=5 (proton)" << endl;
  110. }
  111. else {
  112. cout << "gregsTrackCut::Pass() - Unknown mPartId: " << mPartId
  113. << " Resetting to mPartId=4 (kaon)" << endl;
  114. mPartId=4;
  115. }
  116. */
  117. if(mPartId<1 || mPartId>5 || mPartId==2) {
  118. cout << "gregsTrackCut::Pass() - Unknown mPartId: " << mPartId
  119. << " Resetting to mPartId=4 (kaon)" << endl;
  120. mPartId=4;
  121. }
  122. //Check 1/beta - 1/beta_{mass_hypothesis}
  123. float mInvBetaDifference = 0.;
  124. float mInvBetaPredicted = -999.;
  125. if(track->TofBeta() > 0) {
  126. mInvBetaPredicted = ::sqrt(mMass*mMass+track->P().mag2())/track->P().mag();
  127. mInvBetaDifference = 1./track->TofBeta() - mInvBetaPredicted;
  128. }
  129. #ifdef STHBTDEBUG
  130. cout<< "NSigmaElec = " << track->NSigmaElectron() << endl
  131. << "NSigmaPion = " << track->NSigmaPion() << endl
  132. << "NSigmaKaon = " << track->NSigmaKaon() << endl
  133. << "NSigmaProt = " << track->NSigmaProton() << endl
  134. << "DCAxy = " << track->DCAxy() << endl
  135. << "DCAGlobal = " << track->DCAxyGlobal() << endl
  136. << "NHits = " << track->NHits() << endl
  137. << "NHitsFit = " << track->NHitsFit() << endl
  138. << "NHitsPoss = " << track->NHitsPossible() << endl
  139. << "NHitsDedx = " << track->NHitsDedx() << endl
  140. << "P = " << track->P().mag() << endl
  141. << "Pt = " << track->Pt() << endl
  142. << "Rapidity = " << TRapidity << endl
  143. << "Charge = " << track->Charge() << endl
  144. << "Type = " << track->TrackType()<< endl
  145. << "TofMassSqr = " << track->TofMassSqr()<< endl
  146. << "TofBeta = " << track->TofBeta()<< endl
  147. << "AntiSplit = " << aSplit << endl
  148. << "PseudoRap = " << TPseudoRap << endl
  149. << "PartId = " << mPartId << endl
  150. << "SetMass = " << mMass << endl
  151. << "InvBetaDiff= " << mInvBetaDifference << endl;
  152. #endif
  153. bool mGoodCharge = (track->Charge() == mCharge);
  154. bool mGoodTrack=( true &&
  155. (track->TrackType() == mType) &&
  156. (aSplit >= mAntiSplit ) &&
  157. (track->DCAxy() >= mDCA[0]) && (track->DCAxy() <= mDCA[1]) &&
  158. (track->DCAxyGlobal() >= mDCAGlobal[0]) && (track->DCAxyGlobal() <= mDCAGlobal[1]) &&
  159. (track->NHits() >= mNHits[0]) && (track->NHits() <= mNHits[1]) &&
  160. (track->NHitsFit() >= mNHitsFit[0]) && (track->NHitsFit() <= mNHitsFit[1]) &&
  161. (track->NHitsDedx() >= mNdEdxHits[0]) && (track->NHitsDedx() <= mNdEdxHits[1]) &&
  162. (track->P().mag() >= mP[0]) && (track->P().mag() <= mP[1]) &&
  163. (track->Pt() >= mPt[0]) && (track->Pt() <= mPt[1]) &&
  164. (track->P().x() >= mPx[0]) && (track->P().x() <= mPx[1]) &&
  165. (track->P().y() >= mPy[0]) && (track->P().y() <= mPy[1]) &&
  166. (track->P().z() >= mPz[0]) && (track->P().z() <= mPz[1]) &&
  167. (TPseudoRap >= mEta[0]) &&
  168. (TPseudoRap <= mEta[1]) &&
  169. (TRapidity >= mRapidity[0]) &&
  170. (TRapidity <= mRapidity[1])
  171. );
  172. //No need to check PID if track is parameters are bad
  173. if(!mGoodCharge || !mGoodTrack) {
  174. mNTracksFailed++;
  175. return false;
  176. }
  177. bool mGoodPID = false;
  178. bool mGoodTofTrack = false;
  179. bool mGoodTofPID = false;
  180. bool mGoodTpcTrack = false;
  181. bool mGoodTpcPID = false;
  182. bool mGoodTnTPID = false;
  183. bool mGoodToTPID = false;
  184. #ifdef STHBTDEBUG
  185. cout << "mPIDSelection acceptable values: 0-TPC, 1-ToF, 2-TnT, 3-ToT" << endl;
  186. cout << "Chosen mPIDSelection: " << mPIDSelection << endl;
  187. #endif
  188. if(mPIDSelection<0 || mPIDSelection>4) {
  189. cout << "gregsTrackCut::Pass() - Wrong mPIDSelection: " << mPIDSelection << endl;
  190. cout << "Resetting to ToT: 3" << endl;
  191. mPIDSelection = 3;
  192. }
  193. //Depends from selection flag: 0-TPC, 1-ToF, 2-TnT, 3-ToT
  194. /**********************************************/
  195. if(mPIDSelection == 0) {
  196. #ifdef STHBTDEBUG
  197. cout << "TPC PID selection" << endl;
  198. #endif
  199. if( (track->P().mag() >= mTpcTrackMom[0]) &&
  200. (track->P().mag() <= mTpcTrackMom[1]) &&
  201. (track->Pt() >= mTpcTrackPt[0]) &&
  202. (track->Pt() <= mTpcTrackPt[1]) )
  203. mGoodTpcTrack = true;
  204. if((mPartId == 1) && mGoodTpcTrack) {
  205. if( ((track->NSigmaElectron() >= mNSigmaElectron[0]) &&
  206. (track->NSigmaElectron() <= mNSigmaElectron[1])) &&
  207. ((track->NSigmaPion() <= mNSigmaPion[0]) ||
  208. (track->NSigmaPion() >= mNSigmaPion[1])) &&
  209. ((track->NSigmaKaon() <= mNSigmaKaon[0]) ||
  210. (track->NSigmaKaon() >= mNSigmaKaon[1])) &&
  211. ((track->NSigmaProton() <= mNSigmaProton[0]) ||
  212. (track->NSigmaProton() >= mNSigmaProton[1])) )
  213. mGoodTpcPID = true;
  214. #ifdef STHBTDEBUG
  215. cout << "TPC electron PID check: " << mGoodTpcPID << endl;
  216. #endif
  217. }
  218. else if((mPartId == 3) && mGoodTpcTrack) {
  219. if( ((track->NSigmaPion() >= mNSigmaPion[0]) &&
  220. (track->NSigmaPion() <= mNSigmaPion[1])) &&
  221. ((track->NSigmaElectron() <= mNSigmaElectron[0]) ||
  222. (track->NSigmaElectron() >= mNSigmaElectron[1])) &&
  223. ((track->NSigmaKaon() <= mNSigmaKaon[0]) ||
  224. (track->NSigmaKaon() >= mNSigmaKaon[1])) &&
  225. ((track->NSigmaProton() <= mNSigmaProton[0]) ||
  226. (track->NSigmaProton() >= mNSigmaProton[1])) )
  227. mGoodTpcPID = true;
  228. #ifdef STHBTDEBUG
  229. cout << "TPC pion PID check: " << mGoodTpcPID << endl;
  230. #endif
  231. }
  232. else if((mPartId == 4) && mGoodTpcTrack) {
  233. if( ((track->NSigmaKaon() >= mNSigmaKaon[0]) &&
  234. (track->NSigmaKaon() <= mNSigmaKaon[1])) &&
  235. ((track->NSigmaElectron() <= mNSigmaElectron[0]) ||
  236. (track->NSigmaElectron() >= mNSigmaElectron[1])) &&
  237. ((track->NSigmaPion() <= mNSigmaPion[0]) ||
  238. (track->NSigmaPion() >= mNSigmaPion[1])) &&
  239. ((track->NSigmaProton() <= mNSigmaProton[0]) ||
  240. (track->NSigmaProton() >= mNSigmaProton[1])) )
  241. mGoodTpcPID = true;
  242. #ifdef STHBTDEBUG
  243. cout << "TPC kaon PID check: " << mGoodTpcPID << endl;
  244. #endif
  245. }
  246. else if((mPartId == 5) && mGoodTpcTrack) {
  247. if( ((track->NSigmaProton() >= mNSigmaProton[0]) &&
  248. (track->NSigmaProton() <= mNSigmaProton[1])) &&
  249. ((track->NSigmaElectron() <= mNSigmaElectron[0]) ||
  250. (track->NSigmaElectron() >= mNSigmaElectron[1])) &&
  251. ((track->NSigmaPion() <= mNSigmaPion[0]) ||
  252. (track->NSigmaPion() >= mNSigmaPion[1])) &&
  253. ((track->NSigmaKaon() <= mNSigmaKaon[0]) ||
  254. (track->NSigmaKaon() >= mNSigmaKaon[1])) )
  255. mGoodTpcPID = true;
  256. #ifdef STHBTDEBUG
  257. cout << "TPC proton PID check: " << mGoodTpcPID << endl;
  258. #endif
  259. }
  260. } // if(mPIDSelection == 0)
  261. /*********************************************/
  262. else if(mPIDSelection == 1) {
  263. #ifdef STHBTDEBUG
  264. cout << "ToF PID selection" << endl;
  265. #endif
  266. //Track must have a ToF signal
  267. if(track->TofBeta() > 0) {
  268. if( (track->P().mag() >= mTofTrackMom[0]) &&
  269. (track->P().mag() <= mTofTrackMom[1]) &&
  270. (track->Pt() >= mTofTrackPt[0]) &&
  271. (track->Pt() <= mTofTrackPt[1]) &&
  272. mInvBetaDifference >= mInverseBetaDifferce[0] &&
  273. mInvBetaDifference <= mInverseBetaDifferce[1])
  274. mGoodTofTrack = true;
  275. if( track->TofMassSqr() >= mTofMassSqr[0] &&
  276. track->TofMassSqr() <= mTofMassSqr[1] &&
  277. mGoodTofTrack)
  278. mGoodTofPID = true;
  279. #ifdef STHBTDEBUG
  280. cout << "ToF PID check: " << mGoodTofPID << endl;
  281. #endif
  282. } //if(track->TofBeta()>0)
  283. } //else if(mPIDSelection == 1)
  284. else if(mPIDSelection == 2) {
  285. #ifdef STHBTDEBUG
  286. cout << "TnT PID selection" << endl;
  287. #endif
  288. //Track must have a ToF signal
  289. if(track->TofBeta() > 0) {
  290. if( (track->P().mag() >= mTofTrackMom[0]) &&
  291. (track->P().mag() <= mTofTrackMom[1]) &&
  292. (track->Pt() >= mTofTrackPt[0]) &&
  293. (track->Pt() <= mTofTrackPt[1]) &&
  294. mInvBetaDifference >= mInverseBetaDifferce[0] &&
  295. mInvBetaDifference <= mInverseBetaDifferce[1] )
  296. mGoodTofTrack = true;
  297. if(mGoodTofTrack &&
  298. track->TofMassSqr() >= mTofMassSqr[0] &&
  299. track->TofMassSqr() <= mTofMassSqr[1] )
  300. mGoodTofPID = true;
  301. if((mPartId==1) && mGoodTofPID) {
  302. if((track->NSigmaElectron() >= mNSigmaElectron[0]) &&
  303. (track->NSigmaElectron() <= mNSigmaElectron[1]))
  304. mGoodTnTPID = true;
  305. } //if((mPartId==1) && mGoodTofPID)
  306. if((mPartId==3) && mGoodTofPID) {
  307. if( (track->NSigmaPion() >= mNSigmaPion[0]) &&
  308. (track->NSigmaPion() <= mNSigmaPion[1]) )
  309. mGoodTnTPID = true;
  310. } //if((mPartId==3) && mGoodTofPID)
  311. if((mPartId==4) && mGoodTofPID) {
  312. if( (track->NSigmaKaon() >= mNSigmaKaon[0]) &&
  313. (track->NSigmaKaon() <= mNSigmaKaon[1]) )
  314. mGoodTnTPID = true;
  315. } //if((mPartId==4) && mGoodTofPID)
  316. if((mPartId==5) && mGoodTofPID) {
  317. if( (track->NSigmaProton() >= mNSigmaProton[0]) &&
  318. (track->NSigmaProton() <= mNSigmaProton[1]) )
  319. mGoodTnTPID = true;
  320. } //if((mPartId==5) && mGoodTofPID)
  321. } //if(track->TofBeta() > 0)
  322. #ifdef STHBTDEBUG
  323. cout << "TnT PID check: " << mGoodTnTPID << endl;
  324. #endif
  325. } //else if(mPIDSelection == 2)
  326. /****************************************************/
  327. else if(mPIDSelection == 3) {
  328. #ifdef STHBTDEBUG
  329. cout << "ToT PID selection" << endl;
  330. cout << "Selecting particle type: " << mPartId << endl;
  331. #endif
  332. //If track has a ToF signal then we use ToF PID only
  333. if(track->TofBeta() > 0) {
  334. if( (track->P().mag() >= mTofTrackMom[0]) &&
  335. (track->P().mag() <= mTofTrackMom[1]) &&
  336. (track->Pt() >= mTofTrackPt[0]) &&
  337. (track->Pt() <= mTofTrackPt[1]) &&
  338. mInvBetaDifference >= mInverseBetaDifferce[0] &&
  339. mInvBetaDifference <= mInverseBetaDifferce[1] )
  340. mGoodTofTrack = true;
  341. if( track->TofMassSqr() >= mTofMassSqr[0] &&
  342. track->TofMassSqr() <= mTofMassSqr[1] &&
  343. mGoodTofTrack)
  344. mGoodToTPID = true;
  345. #ifdef STHBTDEBUG
  346. cout << "TofCut passed: " << mGoodToTPID << endl;
  347. #endif
  348. } //if(track->TofBeta() > 0)
  349. else {
  350. if( (track->P().mag() >= mTpcTrackMom[0]) &&
  351. (track->P().mag() <= mTpcTrackMom[1]) &&
  352. (track->Pt() >= mTpcTrackPt[0]) &&
  353. (track->Pt() <= mTpcTrackPt[1]) )
  354. mGoodTpcTrack = true;
  355. if((mPartId == 1) && mGoodTpcTrack) {
  356. if( ((track->NSigmaElectron() >= mNSigmaElectron[0]) &&
  357. (track->NSigmaElectron() <= mNSigmaElectron[1])) &&
  358. ((track->NSigmaPion() <= mNSigmaPion[0]) ||
  359. (track->NSigmaPion() >= mNSigmaPion[1])) &&
  360. ((track->NSigmaKaon() <= mNSigmaKaon[0]) ||
  361. (track->NSigmaKaon() >= mNSigmaKaon[1])) &&
  362. ((track->NSigmaProton() <= mNSigmaProton[0]) ||
  363. (track->NSigmaProton() >= mNSigmaProton[1])) )
  364. mGoodToTPID = true;
  365. #ifdef STHBTDEBUG
  366. cout << "ToT electron TPC PID check: " << mGoodTpcPID << endl;
  367. #endif
  368. } //if((mPartId == 1) && mGoodTpcTrack)
  369. else if((mPartId == 3) && mGoodTpcTrack) {
  370. if( ((track->NSigmaPion() >= mNSigmaPion[0]) &&
  371. (track->NSigmaPion() <= mNSigmaPion[1])) &&
  372. ((track->NSigmaElectron() <= mNSigmaElectron[0]) ||
  373. (track->NSigmaElectron() >= mNSigmaElectron[1])) &&
  374. ((track->NSigmaKaon() <= mNSigmaKaon[0]) ||
  375. (track->NSigmaKaon() >= mNSigmaKaon[1])) &&
  376. ((track->NSigmaProton() <= mNSigmaProton[0]) ||
  377. (track->NSigmaProton() >= mNSigmaProton[1])) )
  378. mGoodToTPID = true;
  379. #ifdef STHBTDEBUG
  380. cout << "ToT pion TPC PID check: " << mGoodTpcPID << endl;
  381. #endif
  382. } //else if((mPartId == 3) && mGoodTpcTrack)
  383. else if((mPartId == 4) && mGoodTpcTrack) {
  384. if( ((track->NSigmaKaon() >= mNSigmaKaon[0]) &&
  385. (track->NSigmaKaon() <= mNSigmaKaon[1])) &&
  386. ((track->NSigmaElectron() <= mNSigmaElectron[0]) ||
  387. (track->NSigmaElectron() >= mNSigmaElectron[1])) &&
  388. ((track->NSigmaPion() <= mNSigmaPion[0]) ||
  389. (track->NSigmaPion() >= mNSigmaPion[1])) &&
  390. ((track->NSigmaProton() <= mNSigmaProton[0]) ||
  391. (track->NSigmaProton() >= mNSigmaProton[1])) )
  392. mGoodToTPID = true;
  393. #ifdef STHBTDEBUG
  394. cout << "ToT kaon TPC PID check: " << mGoodTpcPID << endl;
  395. #endif
  396. } //else if((mPartId == 4) && mGoodTpcTrack)
  397. else if((mPartId == 5) && mGoodTpcTrack) {
  398. if( ((track->NSigmaProton() >= mNSigmaProton[0]) &&
  399. (track->NSigmaProton() <= mNSigmaProton[1])) &&
  400. ((track->NSigmaElectron() <= mNSigmaElectron[0]) ||
  401. (track->NSigmaElectron() >= mNSigmaElectron[1])) &&
  402. ((track->NSigmaPion() <= mNSigmaPion[0]) ||
  403. (track->NSigmaPion() >= mNSigmaPion[1])) &&
  404. ((track->NSigmaKaon() <= mNSigmaKaon[0]) ||
  405. (track->NSigmaKaon() >= mNSigmaKaon[1])) )
  406. mGoodToTPID = true;
  407. #ifdef STHBTDEBUG
  408. cout << "ToT proton TPC PID check: " << mGoodTpcPID << endl;
  409. #endif
  410. } //else if((mPartId == 5) && mGoodTpcTrack)
  411. } //else to if(track->TofBeta() > 0)
  412. #ifdef STHBTDEBUG
  413. cout << "ToT PID check: " << mGoodToTPID << endl;
  414. #endif
  415. } //else if(mPIDSelection == 3)
  416. /***********************************************************/
  417. //If ToF signal, then ToF+TPC and TPC only if no ToF signal
  418. else if(mPIDSelection == 4) {
  419. #ifdef STHBTDEBUG
  420. cout << "ToT+TPC PID selection" << endl;
  421. cout << "Selecting particle type: " << mPartId << endl;
  422. #endif
  423. //If track has a ToF signal then we use ToF PID only
  424. if(track->TofBeta() > 0) {
  425. if( (track->P().mag() >= mTofTrackMom[0]) &&
  426. (track->P().mag() <= mTofTrackMom[1]) &&
  427. (track->Pt() >= mTofTrackPt[0]) &&
  428. (track->Pt() <= mTofTrackPt[1]) &&
  429. mInvBetaDifference >= mInverseBetaDifferce[0] &&
  430. mInvBetaDifference <= mInverseBetaDifferce[1] )
  431. mGoodTofTrack = true;
  432. if( track->TofMassSqr() >= mTofMassSqr[0] &&
  433. track->TofMassSqr() <= mTofMassSqr[1] &&
  434. mGoodTofTrack)
  435. mGoodTofPID = true;
  436. if((mPartId == 1) && mGoodTofPID) {
  437. if(track->NSigmaElectron() >= mTofNSigmaElectron[0] &&
  438. track->NSigmaElectron() <= mTofNSigmaElectron[1])
  439. mGoodToTPID = true;
  440. }
  441. else if((mPartId == 3) && mGoodTofPID) {
  442. if(track->NSigmaPion() >= mTofNSigmaPion[0] &&
  443. track->NSigmaPion() <= mTofNSigmaPion[1])
  444. mGoodToTPID = true;
  445. }
  446. else if((mPartId == 4) && mGoodTofPID) {
  447. if(track->NSigmaKaon() >= mTofNSigmaKaon[0] &&
  448. track->NSigmaKaon() <= mTofNSigmaKaon[1])
  449. mGoodToTPID = true;
  450. }
  451. else if((mPartId == 5) && mGoodTofPID) {
  452. if(track->NSigmaProton() >= mTofNSigmaProton[0] &&
  453. track->NSigmaProton() <= mTofNSigmaProton[1])
  454. mGoodToTPID = true;
  455. }
  456. #ifdef STHBTDEBUG
  457. cout << "TofCut passed: " << mGoodToTPID << endl;
  458. #endif
  459. } //if(track->TofBeta() > 0)
  460. else {
  461. if( (track->P().mag() >= mTpcTrackMom[0]) &&
  462. (track->P().mag() <= mTpcTrackMom[1]) &&
  463. (track->Pt() >= mTpcTrackPt[0]) &&
  464. (track->Pt() <= mTpcTrackPt[1]) )
  465. mGoodTpcTrack = true;
  466. if((mPartId == 1) && mGoodTpcTrack) {
  467. if( ((track->NSigmaElectron() >= mNSigmaElectron[0]) &&
  468. (track->NSigmaElectron() <= mNSigmaElectron[1])) &&
  469. ((track->NSigmaPion() <= mNSigmaPion[0]) ||
  470. (track->NSigmaPion() >= mNSigmaPion[1])) &&
  471. ((track->NSigmaKaon() <= mNSigmaKaon[0]) ||
  472. (track->NSigmaKaon() >= mNSigmaKaon[1])) &&
  473. ((track->NSigmaProton() <= mNSigmaProton[0]) ||
  474. (track->NSigmaProton() >= mNSigmaProton[1])) )
  475. mGoodToTPID = true;
  476. #ifdef STHBTDEBUG
  477. cout << "ToT electron TPC PID check: " << mGoodTpcPID << endl;
  478. #endif
  479. } //if((mPartId == 1) && mGoodTpcTrack)
  480. else if((mPartId == 3) && mGoodTpcTrack) {
  481. if( ((track->NSigmaPion() >= mNSigmaPion[0]) &&
  482. (track->NSigmaPion() <= mNSigmaPion[1])) &&
  483. ((track->NSigmaElectron() <= mNSigmaElectron[0]) ||
  484. (track->NSigmaElectron() >= mNSigmaElectron[1])) &&
  485. ((track->NSigmaKaon() <= mNSigmaKaon[0]) ||
  486. (track->NSigmaKaon() >= mNSigmaKaon[1])) &&
  487. ((track->NSigmaProton() <= mNSigmaProton[0]) ||
  488. (track->NSigmaProton() >= mNSigmaProton[1])) )
  489. mGoodToTPID = true;
  490. #ifdef STHBTDEBUG
  491. cout << "ToT pion TPC PID check: " << mGoodTpcPID << endl;
  492. #endif
  493. } //else if((mPartId == 3) && mGoodTpcTrack)
  494. else if((mPartId == 4) && mGoodTpcTrack) {
  495. if( ((track->NSigmaKaon() >= mNSigmaKaon[0]) &&
  496. (track->NSigmaKaon() <= mNSigmaKaon[1])) &&
  497. ((track->NSigmaElectron() <= mNSigmaElectron[0]) ||
  498. (track->NSigmaElectron() >= mNSigmaElectron[1])) &&
  499. ((track->NSigmaPion() <= mNSigmaPion[0]) ||
  500. (track->NSigmaPion() >= mNSigmaPion[1])) &&
  501. ((track->NSigmaProton() <= mNSigmaProton[0]) ||
  502. (track->NSigmaProton() >= mNSigmaProton[1])) )
  503. mGoodToTPID = true;
  504. #ifdef STHBTDEBUG
  505. cout << "ToT kaon TPC PID check: " << mGoodTpcPID << endl;
  506. #endif
  507. } //else if((mPartId == 4) && mGoodTpcTrack)
  508. else if((mPartId == 5) && mGoodTpcTrack) {
  509. if( ((track->NSigmaProton() >= mNSigmaProton[0]) &&
  510. (track->NSigmaProton() <= mNSigmaProton[1])) &&
  511. ((track->NSigmaElectron() <= mNSigmaElectron[0]) ||
  512. (track->NSigmaElectron() >= mNSigmaElectron[1])) &&
  513. ((track->NSigmaPion() <= mNSigmaPion[0]) ||
  514. (track->NSigmaPion() >= mNSigmaPion[1])) &&
  515. ((track->NSigmaKaon() <= mNSigmaKaon[0]) ||
  516. (track->NSigmaKaon() >= mNSigmaKaon[1])) )
  517. mGoodToTPID = true;
  518. #ifdef STHBTDEBUG
  519. cout << "ToT proton TPC PID check: " << mGoodTpcPID << endl;
  520. #endif
  521. } //else if((mPartId == 5) && mGoodTpcTrack)
  522. } //else to if(track->TofBeta() > 0)
  523. #ifdef STHBTDEBUG
  524. cout << "ToT PID check: " << mGoodToTPID << endl;
  525. #endif
  526. } //else if(mPIDSelection == 4)
  527. else {
  528. cout << "gregsTrackCut::Pass - If you see this message then you "
  529. << "are in a big trouble with mPIDSelection" << endl;
  530. }
  531. if((mPIDSelection==0) && (mGoodTrack) && (mGoodTpcPID) && (mGoodCharge))
  532. mGoodPID = true;
  533. if((mPIDSelection==1) && (mGoodTrack) && (mGoodTofPID) && (mGoodCharge))
  534. mGoodPID = true;
  535. if((mPIDSelection==2) && (mGoodTrack) && (mGoodTnTPID) && (mGoodCharge))
  536. mGoodPID = true;
  537. if((mPIDSelection==3) && (mGoodTrack) && (mGoodToTPID) && (mGoodCharge))
  538. mGoodPID = true;
  539. if((mPIDSelection==4) && (mGoodTrack) && (mGoodToTPID) && (mGoodCharge))
  540. mGoodPID = true;
  541. #ifdef STHBTDEBUG
  542. cout << " mGoodCharge: " << mGoodCharge << " mGoodTrack: " << mGoodTrack
  543. << " mGoodPID: " << mGoodPID << endl;
  544. #endif
  545. (mGoodPID) ? mNTracksPassed++ : mNTracksFailed++;
  546. #ifdef STHBTDEBUG
  547. if(mGoodPID)
  548. cout << "Single particle cut passed" << endl;
  549. else
  550. cout << "Single particle cut failed" << endl;
  551. #endif
  552. return (mGoodPID);
  553. }
  554. //_________________
  555. StHbtString gregsTrackCut::Report(){
  556. stringstream rep_stream;
  557. rep_stream << endl << "-- gregsTrackCut --" << endl
  558. << "Charge: " << mCharge<< endl
  559. << "mPartId: " << mPartId << endl
  560. << mNSigmaPion[0] << " <= nSigma(pi) <= " << mNSigmaPion[1] << endl
  561. << mNSigmaKaon[0] << " <= nSigma(K) <= " << mNSigmaKaon[1] << endl
  562. << mNSigmaProton[0] << " <= nSigma(p) <= " << mNSigmaProton[1] << endl
  563. << mTofNSigmaPion[0] << " <= ToF TPC nSigma(pi) <= " << mTofNSigmaPion[1] << endl
  564. << mTofNSigmaKaon[0] << " <= ToF TPC nSigma(K) <= " << mTofNSigmaKaon[1] << endl
  565. << mTofNSigmaProton[0] << " <= ToF TPC NSigma(p) <= " << mTofNSigmaProton[1] << endl
  566. << mNHits[0] << " <= NHits <= " << mNHits[1] << endl
  567. << mNHitsFit[0] << " <= NHitsFit <= " << mNHitsFit[1] << endl
  568. << mNdEdxHits[0] << " <= NHits <= " << mNdEdxHits[1] << endl
  569. << mPt[0] << " <= pT <= " << mPt[1] << endl
  570. << mP[0] << " <= p <= " << mP[1] << endl
  571. << mRapidity[0] << " <= rapidity <= " << mRapidity[1] << endl
  572. << mEta[0] << " <= pseudorapidity <= " << mEta[1] << endl
  573. << mDCA[0] << " <= dca <= " << mDCA[1] << endl
  574. << mTofMassSqr[0] << " <= ToF m^2 <= " << mTofMassSqr[1] << endl
  575. << mInverseBetaDifferce[0] << " <= 1/beta-1/beta_hypo <= " << mInverseBetaDifferce[1] << endl
  576. << "NHitsFit/NHitsPossible > " << mAntiSplit << endl
  577. << " >>> N Tracks passed " << mNTracksPassed << endl
  578. << " >>> N Tracks failed " << mNTracksFailed << endl;
  579. return (rep_stream.str());
  580. }