StPicoUtilities.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #ifndef StPicoUtilities_h
  2. #define StPicoUtilities_h
  3. #include "StMuDSTMaker/COMMON/StMuTrack.h"
  4. #include "StMuDSTMaker/COMMON/StMuDst.h"
  5. namespace StPicoUtilities {
  6. //______________________________________________________________________________
  7. // Reference multiplicity |eta|<0.5
  8. inline UInt_t refMult(const UInt_t charge, const StMuDst& muDst)
  9. {
  10. // charge 0:negative, 1:positive
  11. size_t countedTracks = 0;
  12. for (Int_t itrk=0; itrk<muDst.primaryTracks()->GetEntries(); itrk++){
  13. StMuTrack* track = muDst.primaryTracks(itrk) ;
  14. if(!track) continue;
  15. // these first 3 checks are easy, save time
  16. const Bool_t isChargeOk = (charge==0&&track->charge()<0)||(charge==1&&track->charge()>0);
  17. if (track->flag()<0 || !isChargeOk || track->nHitsFit(kTpcId)<10 ) continue;
  18. // check eta, a bit more elaborate
  19. if (fabs(track->momentum().mag())<1.e-10) continue;
  20. if (fabs(track->momentum().pseudoRapidity())>0.5) continue;
  21. // finally, check dca, if a track satisfies gets inside the if, count it.
  22. if (track->dca().mag()<3) ++countedTracks;
  23. }
  24. return countedTracks;
  25. }
  26. //______________________________________________________________________________
  27. // Reference multiplicity2 |eta|>0.5
  28. inline UInt_t refMult2(const UInt_t charge, const UInt_t etaId, const StMuDst& muDst)
  29. {
  30. // charge 0:negative, 1:positive
  31. // etaId 0:East(eta<-0.5), 1:West(eta>0.5)
  32. size_t countedTracks = 0;
  33. for (Int_t itrk=0; itrk<muDst.primaryTracks()->GetEntries(); itrk++){
  34. StMuTrack* track = muDst.primaryTracks(itrk) ;
  35. if(!track) continue;
  36. // these first 3 checks are easy, save time
  37. const Bool_t isChargeOk = (charge==0&&track->charge()<0)||(charge==1&&track->charge()>0);
  38. if (track->flag()<0 || !isChargeOk || track->nHitsFit(kTpcId)<10 ) continue;
  39. // check eta, a bit more elaborate
  40. if (fabs(track->momentum().mag())<1.e-10) continue;
  41. const Double_t eta = track->momentum().pseudoRapidity() ;
  42. const Bool_t isEtaOk = (etaId==0&&(eta>-1.0&&eta<-0.5)) || (etaId==1&&(eta>0.5&&eta<1.0));
  43. if (!isEtaOk) continue;
  44. // finally, check dca, if a track satisfies gets inside the if, count it.
  45. if (track->dca().mag()<3) ++countedTracks;
  46. }
  47. return countedTracks;
  48. }
  49. //______________________________________________________________________________
  50. // Reference multiplicity half eta<0 or eta>0
  51. inline UInt_t refMultHalf(const UInt_t charge, const UInt_t etaId, const StMuDst& muDst)
  52. {
  53. // charge 0:negative, 1:positive
  54. // etaId 0:East(eta<0), 1:West(eta>0)
  55. size_t countedTracks = 0;
  56. for (Int_t itrk=0; itrk<muDst.primaryTracks()->GetEntries(); itrk++){
  57. StMuTrack* track = muDst.primaryTracks(itrk) ;
  58. if(!track) continue;
  59. // these first 3 checks are easy, save time
  60. const Bool_t isChargeOk = (charge==0&&track->charge()<0)||(charge==1&&track->charge()>0);
  61. if (track->flag()<0 || !isChargeOk || track->nHitsFit(kTpcId)<10 ) continue;
  62. // check eta, a bit more elaborate
  63. if (fabs(track->momentum().mag())<1.e-10) continue;
  64. const Double_t eta = track->momentum().pseudoRapidity() ;
  65. if (fabs(eta)>1.0) continue;
  66. const Bool_t isEtaOk = (etaId==0&&eta<0)||(etaId==1&&eta>0) ;
  67. if (!isEtaOk) continue ;
  68. // finally, check dca, if a track satisfies gets inside the if, count it.
  69. if (track->dca().mag()<3) ++countedTracks;
  70. }
  71. return countedTracks;
  72. }
  73. }
  74. #endif