StPicoCut.cxx 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. #include "StEnumerations.h"
  2. #include "StPicoCut.h"
  3. #include "StPicoV0.h"
  4. #include "StPicoTrack.h"
  5. #include "StPicoConstants.h"
  6. #include "StMessMgr.h"
  7. #include "StMuDSTMaker/COMMON/StMuEvent.h"
  8. #include "StMuDSTMaker/COMMON/StMuTrack.h"
  9. ClassImp(StPicoCut)
  10. //----------------------------------------------------------------------------------
  11. StPicoCut::StPicoCut() {}
  12. //----------------------------------------------------------------------------------
  13. StPicoCut::~StPicoCut() {}
  14. //----------------------------------------------------------------------------------
  15. bool StPicoCut::passEvent( StMuEvent *ev )
  16. {
  17. if(!ev){
  18. // LOG_INFO << "StPicoCut::passEvent No StMuEvent" << endm;
  19. return kFALSE;
  20. }
  21. StThreeVectorF pVertex = ev->eventSummary().primaryVertexPosition();
  22. if(fabs(pVertex.x())<1.e-5 && fabs(pVertex.y())<1.e-5 && fabs(pVertex.z())<1.e-5){
  23. // LOG_INFO << "StPicoCut::passEvent bad vertices (x,y,z) = ("
  24. // << pVertex.x() << ","
  25. // << pVertex.y() << ","
  26. // << pVertex.z() << ")"
  27. // << endm;
  28. return kFALSE;
  29. }
  30. if(fabs(pVertex.z())>Pico::mVzMax){
  31. // LOG_INFO << "StPicoCut::passEvent z-vertex out of range, vz = " << pVertex.z() << endm;
  32. return kFALSE;
  33. }
  34. const Float_t vx = pVertex.x() ;
  35. const Float_t vy = pVertex.y() ;
  36. if(sqrt(vx*vx+vy*vy)>Pico::mVrMax){
  37. // LOG_INFO << "StPicoCut::passEvent vr-vertex out of range, vr = " << sqrt(vx*vx+vy*vy)
  38. // << ", vx = " << vx
  39. // << ", vy = " << vy
  40. // << endm;
  41. return kFALSE ;
  42. }
  43. bool isTrg = kFALSE;
  44. for(int i=0;i<nTrigger;i++) {
  45. if(ev->triggerIdCollection().nominal().isTrigger(Pico::mTriggerId[i])){
  46. // LOG_INFO << "StPicoCut::passEvent Fire trigger = " << Pico::mTriggerId[i] << endm;
  47. isTrg = kTRUE;
  48. }
  49. }
  50. if(!isTrg) return kFALSE;
  51. if(ev->refMult()<Pico::mRefMultMin) return kFALSE;
  52. return kTRUE;
  53. }
  54. //----------------------------------------------------------------------------------
  55. bool StPicoCut::passTrack( StMuTrack *t )
  56. {
  57. if(!t) return kFALSE;
  58. if(t->type()!=global) return kFALSE;
  59. if(t->flag()<0||t->flag()>1000) {
  60. return kFALSE;
  61. }
  62. if(t->p().perp()<Pico::mPtMin) return kFALSE;
  63. if(t->dcaGlobal().mag()>Pico::mGDcaMax) return kFALSE;
  64. if(t->flag()/100<7) { // TPC tracks
  65. if( t->nHitsFit(kTpcId) < Pico::mNHitsFitMin ) return kFALSE;
  66. if( (1.0*t->nHitsFit(kTpcId))/(1.0*t->nHitsPoss(kTpcId)) < Pico::mRatioMin ) return kFALSE;
  67. } else { // FTPC tracks
  68. float eta = t->p().pseudoRapidity();
  69. int nHitsFitFtpc = 0;
  70. int nHitsMaxFtpc = 0;
  71. if(eta>0) {
  72. nHitsFitFtpc = t->nHitsFit(kFtpcWestId);
  73. nHitsMaxFtpc = t->nHitsPoss(kFtpcWestId);
  74. } else {
  75. nHitsFitFtpc = t->nHitsFit(kFtpcEastId);
  76. nHitsMaxFtpc = t->nHitsPoss(kFtpcEastId);
  77. }
  78. float ratioFtpc = (1.*nHitsFitFtpc)/(1.*nHitsMaxFtpc);
  79. if( nHitsFitFtpc < Pico::mNHitsFtpcFlowMin ) return kFALSE;
  80. if( ratioFtpc < Pico::mRatioMin ) return kFALSE;
  81. }
  82. return kTRUE;
  83. }
  84. //----------------------------------------------------------------------------------
  85. bool StPicoCut::passV0Daughter( StPicoTrack *t )
  86. {
  87. if(!t) return kFALSE;
  88. if(t->nHitsFit()<Pico::mV0DaughterNHitsFitMin) return kFALSE;
  89. bool pionCand = fabs(t->nSigmaPion())<=Pico::mV0DaughterNSigmaPionMax &&
  90. ( ( t->gMom().perp()<Pico::mV0DaughterDca2VertexPtMax && t->dca()>=Pico::mV0KsPionDca2VertexMin ) ||
  91. t->gMom().perp()>=Pico::mV0DaughterDca2VertexPtMax );
  92. bool protonCand = fabs(t->nSigmaProton())<=Pico::mV0DaughterNSigmaProtonMax &&
  93. ( ( t->gMom().perp()<Pico::mV0DaughterDca2VertexPtMax && t->dca()>=Pico::mV0LambdaProtonDca2VertexMin ) ||
  94. t->gMom().perp()>=Pico::mV0DaughterDca2VertexPtMax );
  95. if( !pionCand && !protonCand ) return kFALSE;
  96. return kTRUE;
  97. }
  98. //----------------------------------------------------------------------------------
  99. bool StPicoCut::passV0( StPicoV0 *v0, StMuEvent *ev )
  100. {
  101. if(!v0) return kFALSE;
  102. if(v0->dcaDaughters()>Pico::mV0DcaDaughtersMax) return kFALSE;
  103. StThreeVectorF v0Mom = v0->momentum(pos) + v0->momentum(neg);
  104. StThreeVectorF pVtx = ev->eventSummary().primaryVertexPosition();
  105. if(v0Mom.dot(v0->v0Pos()-pVtx)<=0) return kFALSE; // V0 going away from primary vertex
  106. return kTRUE;
  107. }
  108. //----------------------------------------------------------------------------------
  109. bool StPicoCut::passKs( StPicoV0 *v0 )
  110. {
  111. if(!v0) return kFALSE;
  112. v0->setParticleHypothesis(pion, pion);
  113. StPicoTrack *t_pos = v0->track(pos);
  114. StPicoTrack *t_neg = v0->track(neg);
  115. // dEdx selection
  116. if(fabs(t_pos->nSigmaPion())>Pico::mV0KsNSigmaPionMax) return kFALSE;
  117. if(fabs(t_neg->nSigmaPion())>Pico::mV0KsNSigmaPionMax) return kFALSE;
  118. // daughter-pVertex dca cut for low pT tracks
  119. if(t_pos->gMom().perp()<Pico::mV0DaughterDca2VertexPtMax &&
  120. t_pos->dca()<Pico::mV0KsPionDca2VertexMin) return kFALSE;
  121. if(t_neg->gMom().perp()<Pico::mV0DaughterDca2VertexPtMax &&
  122. t_neg->dca()<Pico::mV0KsPionDca2VertexMin) return kFALSE;
  123. // typology cut
  124. if(v0->dca2Vertex()>Pico::mV0KsDca2VertexMax) return kFALSE;
  125. if(v0->decayLength()<Pico::mV0KsDecayLengthMin || v0->decayLength()>Pico::mV0KsDecayLengthMax) return kFALSE;
  126. // mass cut
  127. if(fabs(v0->m()-Pico::mMassV0[ks])>Pico::mV0KsMassWindowMax) return kFALSE;
  128. return kTRUE;
  129. }
  130. //----------------------------------------------------------------------------------
  131. bool StPicoCut::passLambda( StPicoV0 *v0 )
  132. {
  133. if(!v0) return kFALSE;
  134. v0->setParticleHypothesis(proton, pion);
  135. StPicoTrack *t_pos = v0->track(pos);
  136. StPicoTrack *t_neg = v0->track(neg);
  137. // dEdx selection
  138. if(fabs(t_pos->nSigmaProton())>Pico::mV0LambdaNSigmaProtonMax) return kFALSE;
  139. if(fabs(t_neg->nSigmaPion())>Pico::mV0LambdaNSigmaPionMax) return kFALSE;
  140. // daughter-pVertex dca cut for low pT tracks
  141. if(t_pos->gMom().perp()<Pico::mV0DaughterDca2VertexPtMax &&
  142. t_pos->dca()<Pico::mV0LambdaProtonDca2VertexMin) return kFALSE;
  143. if(t_neg->gMom().perp()<Pico::mV0DaughterDca2VertexPtMax &&
  144. t_neg->dca()<Pico::mV0LambdaPionDca2VertexMin) return kFALSE;
  145. // typology cut
  146. if(v0->dca2Vertex()>Pico::mV0LambdaDca2VertexMax) return kFALSE;
  147. if(v0->decayLength()<Pico::mV0LambdaDecayLengthMin || v0->decayLength()>Pico::mV0LambdaDecayLengthMax) return kFALSE;
  148. // mass cut
  149. if(fabs(v0->m()-Pico::mMassV0[lambda])>Pico::mV0LambdaMassWindowMax) return kFALSE;
  150. return kTRUE;
  151. }
  152. //----------------------------------------------------------------------------------
  153. bool StPicoCut::passLbar( StPicoV0 *v0 )
  154. {
  155. if(!v0) return kFALSE;
  156. v0->setParticleHypothesis(pion, proton);
  157. StPicoTrack *t_pos = v0->track(pos);
  158. StPicoTrack *t_neg = v0->track(neg);
  159. // dEdx selection
  160. if(fabs(t_pos->nSigmaPion())>Pico::mV0LambdaNSigmaPionMax) return kFALSE;
  161. if(fabs(t_neg->nSigmaProton())>Pico::mV0LambdaNSigmaProtonMax) return kFALSE;
  162. // daughter-pVertex dca cut for low pT tracks
  163. if(t_pos->gMom().perp()<Pico::mV0DaughterDca2VertexPtMax &&
  164. t_pos->dca()<Pico::mV0LambdaPionDca2VertexMin) return kFALSE;
  165. if(t_neg->gMom().perp()<Pico::mV0DaughterDca2VertexPtMax &&
  166. t_neg->dca()<Pico::mV0LambdaProtonDca2VertexMin) return kFALSE;
  167. // typology cut
  168. if(v0->dca2Vertex()>Pico::mV0LambdaDca2VertexMax) return kFALSE;
  169. if(v0->decayLength()<Pico::mV0LambdaDecayLengthMin || v0->decayLength()>Pico::mV0LambdaDecayLengthMax) return kFALSE;
  170. // mass cut
  171. if(fabs(v0->m()-Pico::mMassV0[lambda])>Pico::mV0LambdaMassWindowMax) return kFALSE;
  172. return kTRUE;
  173. }
  174. //----------------------------------------------------------------------------------
  175. int StPicoCut::flowFlag( StMuTrack *p )
  176. {
  177. if(!p) return others;
  178. if(p->type()!=primary) return others;
  179. if(p->vertexIndex()!=0) return others;
  180. StThreeVectorF mom = p->p();
  181. float pt = mom.perp();
  182. float eta = mom.pseudoRapidity();
  183. float gDca = p->dcaGlobal().mag();
  184. int nHitsFitTpc = p->nHitsFit(kTpcId);
  185. int nHitsMaxTpc = p->nHitsPoss(kTpcId);
  186. float ratioTpc = (1.*nHitsFitTpc)/(1.*nHitsMaxTpc);
  187. int nHitsFitFtpc = 0;
  188. int nHitsMaxFtpc = 0;
  189. if(eta>0) {
  190. nHitsFitFtpc = p->nHitsFit(kFtpcWestId);
  191. nHitsMaxFtpc = p->nHitsPoss(kFtpcWestId);
  192. } else {
  193. nHitsFitFtpc = p->nHitsFit(kFtpcEastId);
  194. nHitsMaxFtpc = p->nHitsPoss(kFtpcEastId);
  195. }
  196. float ratioFtpc = (1.*nHitsFitFtpc)/(1.*nHitsMaxFtpc);
  197. if( pt > Pico::mPtTpcFlowMin && pt < Pico::mPtTpcFlowMax &&
  198. gDca < Pico::mDcaTpcFlowMax &&
  199. fabs(eta) < Pico::mEtaTpcFlowMax &&
  200. nHitsFitTpc >= Pico::mNHitsTpcFlowMin && ratioTpc > Pico::mRatioMin )
  201. return tpcFlow;
  202. if( pt > Pico::mPtFtpcFlowMin && pt < Pico::mPtFtpcFlowMax &&
  203. gDca < Pico::mDcaFtpcFlowMax &&
  204. fabs(eta) < Pico::mEtaFtpcFlowMax && fabs(eta) > Pico::mEtaFtpcFlowMin &&
  205. nHitsFitFtpc >= Pico::mNHitsFtpcFlowMin && ratioFtpc > Pico::mRatioMin )
  206. return ftpcFlow;
  207. return others;
  208. }