helensV0Cut.cxx 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. /***************************************************************************
  2. *
  3. * $Id: helensV0Cut.cxx,v 1.11 2003/09/02 17:58:21 perev Exp $
  4. *
  5. * Authors: Helen Caines, Tom Humanic, Ohio State, humanic@mps.ohio-state.edu
  6. ***************************************************************************
  7. *
  8. * Description: part of STAR HBT Framework: StHbtMaker package
  9. * a V0 particle cut that selects on phasespace, particle type, etc..
  10. *
  11. ***************************************************************************
  12. *
  13. * $Log: helensV0Cut.cxx,v $
  14. * Revision 1.11 2003/09/02 17:58:21 perev
  15. * gcc 3.2 updates + WarnOff
  16. *
  17. * Revision 1.10 2001/09/28 20:41:19 lisa
  18. * fixes to V0 object and cut
  19. *
  20. * Revision 1.9 2000/10/09 21:56:16 laue
  21. * Helens new cuts
  22. *
  23. * Revision 1.7 2000/03/17 17:22:53 laue
  24. * Roberts new three particle correlations implemented.
  25. *
  26. * Revision 1.6 2000/03/16 01:57:17 laue
  27. * Copy constructor added to some cuts
  28. *
  29. * Revision 1.5 2000/02/11 18:02:26 laue
  30. * Debug output removed
  31. *
  32. * Revision 1.4 2000/02/01 00:31:27 laue
  33. * *** empty log message ***
  34. *
  35. * Revision 1.3 2000/01/25 17:35:02 laue
  36. * I. In order to run the stand alone version of the StHbtMaker the following
  37. * changes have been done:
  38. * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements
  39. * b) unnecessary includes of StMaker.h have been removed
  40. * c) the subdirectory StHbtMaker/doc/Make has been created including everything
  41. * needed for the stand alone version
  42. *
  43. * II. To reduce the amount of compiler warning
  44. * a) some variables have been type casted
  45. * b) some destructors have been declared as virtual
  46. *
  47. * Revision 1.2 1999/10/05 11:37:38 lisa
  48. * Helens realistic V0Cut and Franks memory-sealed McReader
  49. *
  50. * Revision 1.1 1999/09/23 23:28:03 lisa
  51. * add helensV0Cut AND rename mikes and franks ParticleCuts to TrackCuts AND update documentation
  52. *
  53. *
  54. **************************************************************************/
  55. #include "StHbtMaker/Cut/helensV0Cut.h"
  56. #include <cstdio>
  57. #ifdef __ROOT__
  58. ClassImp(helensV0Cut)
  59. #endif
  60. helensV0Cut::helensV0Cut(){
  61. mNV0sPassed = mNV0sFailed = 0;
  62. mV0MassRange[0] =0;
  63. mV0MassRange[1]=10000;
  64. mdcaV0daughters[0]=0;
  65. mdcaV0daughters[1]=1000;
  66. mdcaV0ToPrimVertex[0]=0;
  67. mdcaV0ToPrimVertex[1]=1000;
  68. mdecayLengthV0[0]=0;
  69. mdecayLengthV0[1]=10000;
  70. mtpcHitsPos[0]=0;
  71. mtpcHitsPos[1]=1000;
  72. mtpcHitsNeg[0]=0;
  73. mtpcHitsNeg[1]=1000;
  74. mdcaPosToPrimVertex[0]=0;
  75. mdcaPosToPrimVertex[1]=1000;
  76. mdcaNegToPrimVertex[0]=0;
  77. mdcaNegToPrimVertex[1]=10000;
  78. mptArmV0[0]=0;
  79. mptArmV0[1]=100;
  80. malphaV0[0]=-10;
  81. malphaV0[1]=10;
  82. mChargedEdx=0;
  83. mdEdx[0]=0;
  84. mdEdx[1]=-10;
  85. mdEdx[2]=0;
  86. mdEdx[3]=-10;
  87. mPt[0]=0;
  88. mPt[1]=100000;
  89. mRapidity[0]=-100000;
  90. mRapidity[1]=100000;
  91. V0Type = "K0Short";
  92. mMass = 0.498;
  93. }
  94. //------------------------------
  95. //helensV0Cut::~helensV0Cut(){
  96. // /* noop */
  97. //}
  98. //------------------------------
  99. bool helensV0Cut::Pass(const StHbtV0* V0){
  100. int inMassRange;
  101. #ifdef STHBTDEBUG
  102. cout << endl;
  103. cout << " * dcaV0Daughters " << V0->dcaV0Daughters();
  104. cout << " * dcaV0ToPrimVertex " << V0->dcaV0ToPrimVertex();
  105. cout << " * decayLengthV0 " << V0->decayLengthV0();
  106. cout << " * tpcHitsPos " << V0->tpcHitsPos();
  107. cout << " * tpcHitsNeg " << V0->tpcHitsNeg();
  108. cout << " * dcaPosToPrimVertex " << V0->dcaPosToPrimVertex();
  109. cout << " * dcaNegToPrimVertex " << V0->dcaNegToPrimVertex();
  110. cout << " * ptArmV0 " << V0->ptArmV0();
  111. cout << " * alphaV0 " << V0->alphaV0();
  112. cout << " * dEdxPos " << V0->dedxPos();
  113. cout << " * dEdxNeg " << V0->dedxNeg();
  114. cout << endl;
  115. #endif
  116. inMassRange=0;
  117. // Find out what particle is desired
  118. if( strstr(V0Type,"k") || strstr(V0Type,"K")){
  119. if( V0->massK0Short() < (mV0MassRange[1]) &&
  120. V0->massK0Short() > (mV0MassRange[0]) ) inMassRange=1;
  121. }
  122. else if( (strstr(V0Type,"anti") || strstr(V0Type,"ANTI"))){
  123. if( V0->massAntiLambda() < (mV0MassRange[1]) &&
  124. V0->massAntiLambda() > (mV0MassRange[0]) ) inMassRange=1;
  125. }
  126. else if( (strstr(V0Type,"ambda") || strstr(V0Type,"AMBDA"))){
  127. if( V0->massLambda() < (mV0MassRange[1]) &&
  128. V0->massLambda() > (mV0MassRange[0]) ) inMassRange=1;
  129. }
  130. bool goodPID = ( inMassRange &&
  131. (V0->dcaV0Daughters() > mdcaV0daughters[0]) &&
  132. (V0->dcaV0Daughters() < mdcaV0daughters[1]) &&
  133. (V0->dcaV0ToPrimVertex() > mdcaV0ToPrimVertex[0]) &&
  134. (V0->dcaV0ToPrimVertex() < mdcaV0ToPrimVertex[1]) &&
  135. (V0->decayLengthV0() > mdecayLengthV0[0]) &&
  136. (V0->decayLengthV0() < mdecayLengthV0[1]) &&
  137. (V0->tpcHitsPos() > mtpcHitsPos[0]) &&
  138. (V0->tpcHitsPos() < mtpcHitsPos[1]) &&
  139. (V0->tpcHitsNeg() > mtpcHitsNeg[0]) &&
  140. (V0->tpcHitsNeg() < mtpcHitsNeg[1]) &&
  141. (V0->dcaPosToPrimVertex() > mdcaPosToPrimVertex[0]) &&
  142. (V0->dcaPosToPrimVertex() < mdcaPosToPrimVertex[1]) &&
  143. (V0->dcaNegToPrimVertex() > mdcaNegToPrimVertex[0]) &&
  144. (V0->dcaNegToPrimVertex() < mdcaNegToPrimVertex[1]) &&
  145. (V0->ptArmV0() > mptArmV0[0]) &&
  146. (V0->ptArmV0() < mptArmV0[1]) &&
  147. (V0->alphaV0() > malphaV0[0]) &&
  148. (V0->alphaV0() < malphaV0[1]));
  149. if(goodPID && mChargedEdx){
  150. if( mChargedEdx <0){
  151. goodPID = ( (V0->dedxNeg() > (mdEdx[0]*V0->ptNeg()+mdEdx[1])) &&
  152. (V0->dedxNeg() > (mdEdx[2]*V0->ptNeg()+mdEdx[3])));
  153. }
  154. if( mChargedEdx > 0){
  155. goodPID = ( (V0->dedxPos() > (mdEdx[0]*V0->ptPos()+mdEdx[1])) &&
  156. (V0->dedxPos() > (mdEdx[2]*V0->ptPos()+mdEdx[3])));
  157. }
  158. }
  159. if (goodPID){
  160. float TEnergy = ::sqrt((V0->ptotV0())*(V0->ptotV0())+mMass*mMass);
  161. float TRapidity = 0.5*::log((TEnergy+V0->momV0().z())/
  162. (TEnergy-V0->momV0().z()));
  163. float Pt = V0->ptV0();
  164. #ifdef STHBTDEBUG
  165. cout << " * Pt " << Pt;
  166. cout << " * mPt[0] " << mPt[0];
  167. cout << " * mPt[1] " << mPt[1];
  168. cout << " * TRapidity " << TRapidity;
  169. cout << " * mRapidity[0] " << mRapidity[0];
  170. cout << " * mRapidity[1] " << mRapidity[1];
  171. cout << " * Pt " << (Pt > mPt[0]) && (Pt < mPt[1]);
  172. cout << " * y " << (TRapidity > mRapidity[0]) && (TRapidity < mRapidity[1]);
  173. cout << endl;
  174. #endif
  175. bool goodV0=
  176. ((Pt > mPt[0]) &&
  177. (Pt < mPt[1]) &&
  178. (TRapidity > mRapidity[0]) &&
  179. (TRapidity < mRapidity[1]));
  180. goodV0 ? mNV0sPassed++ : mNV0sFailed++;
  181. return (goodV0);
  182. }
  183. else{
  184. mNV0sFailed++;
  185. return (goodPID);
  186. }
  187. }
  188. //------------------------------
  189. StHbtString helensV0Cut::Report(){
  190. string Stemp;
  191. char Ctemp[100];
  192. sprintf(Ctemp,"--helensV0Cut--\n Particle mass:\t%E\n",this->Mass());
  193. Stemp=Ctemp;
  194. sprintf(Ctemp,"V0 mass range:\t%E - %E\n",mV0MassRange[0],
  195. mV0MassRange[1]);
  196. Stemp+=Ctemp;
  197. sprintf(Ctemp,"dcaV0daughters:\t%E - %E\n",mdcaV0daughters[0],
  198. mdcaV0daughters[1]);
  199. Stemp+=Ctemp;
  200. sprintf(Ctemp,"dcaV0ToPrimVertex:\t%E - %E\n",mdcaV0ToPrimVertex[0],
  201. mdcaV0ToPrimVertex[1]);
  202. Stemp+=Ctemp;
  203. sprintf(Ctemp,"decayLengthV0:\t%E - %E\n",mdecayLengthV0[0],
  204. mdecayLengthV0[1]);
  205. Stemp+=Ctemp;
  206. sprintf(Ctemp,"tpcHitsPos:\t%d - %d\n",mtpcHitsPos[0],mtpcHitsPos[1]);
  207. Stemp+=Ctemp;
  208. sprintf(Ctemp,"tpcHitsNeg:\t%d - %d\n",mtpcHitsNeg[0],mtpcHitsNeg[1]);
  209. Stemp+=Ctemp;
  210. sprintf(Ctemp,"dcaPosToPrimVertex:\t%E - %E\n",mdcaPosToPrimVertex[0],
  211. mdcaPosToPrimVertex[1]);
  212. Stemp+=Ctemp;
  213. sprintf(Ctemp,"dcaNegToPrimVertex:\t%E - %E\n",mdcaNegToPrimVertex[0],
  214. mdcaNegToPrimVertex[1]);
  215. Stemp+=Ctemp;
  216. sprintf(Ctemp,"dedx>:\t%E pt+%E and \t%E pt+ %E for Charge %E\n ",mdEdx[0],mdEdx[1],mdEdx[2],mdEdx[3],mChargedEdx);
  217. Stemp+=Ctemp;
  218. sprintf(Ctemp,"ptArmV0:\t%E - %E\n",mptArmV0[0],mptArmV0[1]);
  219. Stemp+=Ctemp;
  220. sprintf(Ctemp,"alphaV0:\t%E - %E\n",malphaV0[0],malphaV0[1]);
  221. Stemp+=Ctemp;
  222. sprintf(Ctemp,"Particle pT:\t%E - %E\n",mPt[0],mPt[1]);
  223. Stemp+=Ctemp;
  224. sprintf(Ctemp,"Particle rapidity:\t%E - %E\n",mRapidity[0],mRapidity[1]);
  225. Stemp+=Ctemp;
  226. sprintf(Ctemp,"Number of V0s which passed:\t%ld Number which failed:\t%ld\n",mNV0sPassed,mNV0sFailed);
  227. Stemp += Ctemp;
  228. StHbtString returnThis = Stemp;
  229. return returnThis;
  230. }