HitMergingPairCut.cxx 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /***************************************************************************
  2. *
  3. * $Id: HitMergingPairCut.cxx,v 1.2 2003/09/02 17:58:21 perev Exp $
  4. *
  5. * Author: Fabrice Retiere
  6. ***************************************************************************
  7. *
  8. * Description: Allow to cut on hit merging
  9. * Usage :
  10. * HitMergingPairCut* pairCut = new HitMergingPairCut();
  11. * pairCut->setDefaultHalfFieldMergingPar();
  12. * pairCut->setMaxFracOfMergedRow(MaxMergedHit);
  13. *
  14. ***************************************************************************
  15. *
  16. * $Log: HitMergingPairCut.cxx,v $
  17. * Revision 1.2 2003/09/02 17:58:21 perev
  18. * gcc 3.2 updates + WarnOff
  19. *
  20. * Revision 1.1 2001/12/14 23:11:27 fretiere
  21. * Add class HitMergingCut. Add class fabricesPairCut = HitMerginCut + pair purity cuts. Add TpcLocalTransform function which convert to local tpc coord (not pretty). Modify StHbtTrack, StHbtParticle, StHbtHiddenInfo, StHbtPair to handle the hit information and cope with my code
  22. *
  23. *
  24. **************************************************************************/
  25. #include "StHbtMaker/Cut/HitMergingPairCut.h"
  26. #include "Infrastructure/StHbtPair.hh"
  27. #include <string>
  28. #include <cstdio>
  29. #include <Stsstream.h>
  30. #ifdef __ROOT__
  31. ClassImp(HitMergingPairCut)
  32. #endif
  33. //__________________
  34. HitMergingPairCut::HitMergingPairCut(){
  35. mNPairsPassed = mNPairsFailed = 0;
  36. mMaxFracPair= 0.2;
  37. setDefaultHalfFieldMergingPar();
  38. }
  39. //__________________
  40. //HitMergingPairCut::~HitMergingPairCut(){
  41. // /* no-op */
  42. //}
  43. void HitMergingPairCut::setMergingPar(double aMaxDuInner, double aMaxDzInner,
  44. double aMaxDuOuter, double aMaxDzOuter){
  45. StHbtPair tPair;
  46. tPair.setMergingPar(aMaxDuInner, aMaxDzInner,
  47. aMaxDuOuter, aMaxDzOuter);
  48. }
  49. void HitMergingPairCut::setDefaultFullFieldMergingPar(){
  50. StHbtPair tPair;
  51. tPair.setDefaultFullFieldMergingPar();
  52. }
  53. void HitMergingPairCut::setDefaultHalfFieldMergingPar(){
  54. StHbtPair tPair;
  55. tPair.setDefaultHalfFieldMergingPar();
  56. }
  57. //__________________
  58. bool HitMergingPairCut::Pass(const StHbtPair* pair){
  59. bool temp = pair->getFracOfMergedRow()<mMaxFracPair;
  60. temp ? mNPairsPassed++ : mNPairsFailed++;
  61. return temp;
  62. }
  63. //__________________
  64. StHbtString HitMergingPairCut::Report(){
  65. string Stemp = "HitMerging Pair Cut - total dummy-- always returns true\n";
  66. char Ctemp[100];
  67. sprintf(Ctemp,"Number of pairs which passed:\t%ld Number which failed:\t%ld\n",mNPairsPassed,mNPairsFailed);
  68. Stemp += Ctemp;
  69. StHbtString returnThis = Stemp;
  70. return returnThis;
  71. }
  72. //__________________
  73. ostrstream* HitMergingPairCut::finalReport() const{
  74. ostrstream* tFinalReport = new ostrstream;
  75. (*tFinalReport) << "_____ HitMerging pair Cut _____ " << endl
  76. << " N pairs passed : " << mNPairsPassed << endl
  77. << " N pairs failed : " << mNPairsFailed << endl
  78. << ends;
  79. return tFinalReport;
  80. }