ntupleTrack.cxx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /***************************************************************************
  2. *
  3. * $Id: 12 July 2000
  4. *
  5. * Author: Dominik Flierl, flierl@bnl.gov
  6. ***************************************************************************
  7. *
  8. * Description:
  9. * fill track information into an ntuple in order to determine the cuts
  10. *
  11. ***************************************************************************/
  12. #include "StHbtMaker/Cut/ntupleTrack.h"
  13. #ifdef __ROOT__
  14. ClassImp(ntupleTrack)
  15. //______________________________
  16. ntupleTrack::ntupleTrack()
  17. {
  18. // create tree
  19. mTree = new TTree("TrackTree","A Tree with all tracks in order to set the cuts");
  20. // create Branch
  21. mTree->Branch("track",&mtrack,"charge/I:nhits/I:dca/F:pt/F:p/F:px/F:py/F:pz/F:prapidity/F");
  22. }
  23. //_____________________________
  24. ntupleTrack::~ntupleTrack()
  25. {
  26. // clean up
  27. delete mTree;
  28. }
  29. //________________________________
  30. bool ntupleTrack::Pass(const StHbtTrack* track)
  31. {
  32. // extract track info and fill tree
  33. mtrack.charge = track->Charge() ;
  34. mtrack.nhits = track->NHits() ;
  35. mtrack.dca = track->DCAz() ;
  36. mtrack.pt = track->P().perp() ;
  37. mtrack.p = track->P().magnitude() ;
  38. mtrack.px = track->P().x() ;
  39. mtrack.py = track->P().y() ;
  40. mtrack.pz = track->P().z() ;
  41. mtrack.prapidity = track->P().pseudoRapidity() ;
  42. mTree->Fill();
  43. return true;
  44. }
  45. //________________________________
  46. StHbtString ntupleTrack::Report()
  47. {
  48. StHbtString t;
  49. char Ctemp[100];
  50. sprintf(Ctemp,"No actual track cut applied ! This cut class just fills a tree.\n");
  51. t+=Ctemp;
  52. return t;
  53. };
  54. #endif // ifdef ROOT