helensLaPV0Cut.cxx 8.9 KB

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