StHbtStrangeMuDstEventReader.cxx 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. /***************************************************************************
  2. *
  3. * $Id: StHbtStrangeMuDstEventReader.cxx,v 1.2 2001/06/21 19:18:42 laue Exp $
  4. *
  5. * Author: Frank Laue, Ohio State, laue@mps.ohio-state.edu
  6. ***************************************************************************
  7. *
  8. * Description: part of STAR HBT Framework: StHbtMaker package
  9. * This is the HbtEventReader class to be used when reading the
  10. * StStrangeMuDsts produced by the STAR Strangeness group
  11. *
  12. ***************************************************************************
  13. *
  14. * $Log: StHbtStrangeMuDstEventReader.cxx,v $
  15. * Revision 1.2 2001/06/21 19:18:42 laue
  16. * Modified Files: (to match the changed base classes)
  17. * StHbtAsciiReader.cxx StHbtAsciiReader.h
  18. * StHbtAssociationReader.cxx StHbtAssociationReader.h
  19. * StHbtBinaryReader.cxx StHbtBinaryReader.h
  20. * StHbtGstarTxtReader.cxx StHbtGstarTxtReader.h
  21. * StHbtStrangeMuDstEventReader.cxx
  22. * StHbtStrangeMuDstEventReader.h StStandardHbtEventReader.cxx
  23. * Added Files: new reader
  24. * StHbtTTreeReader.cxx StHbtTTreeReader.h
  25. *
  26. * Revision 1.1 2000/12/13 20:45:00 laue
  27. * New reader to read directly from the StStrangeMuDstMaker's V0 files
  28. *
  29. *
  30. **************************************************************************/
  31. #include "StHbtMaker/Reader/StHbtStrangeMuDstEventReader.h"
  32. #include "StChain.h"
  33. #include <math.h>
  34. #include "StHbtMaker/Reader/StHbtGstarTxtReader.h"
  35. #include "StHbtMaker/Base/StHbtEventCut.h"
  36. #include "StHbtMaker/Base/StHbtTrackCut.h"
  37. #include "StHbtMaker/Base/StHbtV0Cut.h"
  38. #include "StHbtMaker/Base/StHbtKinkCut.h"
  39. #include "SystemOfUnits.h" // has "tesla" in it
  40. #include "StHbtMaker/Infrastructure/StHbtV0Collection.hh"
  41. #include "StStrangeMuDstMaker/StStrangeMuDstMaker.h"
  42. #include "StStrangeMuDstMaker/StStrangeEvMuDst.hh"
  43. #include "StStrangeMuDstMaker/StV0MuDst.hh"
  44. #ifdef __ROOT__
  45. ClassImp(StHbtStrangeMuDstEventReader)
  46. #endif
  47. #if !(ST_NO_NAMESPACES)
  48. using namespace units;
  49. #endif
  50. //__________________
  51. StHbtStrangeMuDstEventReader::StHbtStrangeMuDstEventReader(){
  52. mReaderStatus = 0; // "good"
  53. mStrangeMuDstMaker =0;
  54. }
  55. //__________________
  56. StHbtStrangeMuDstEventReader::StHbtStrangeMuDstEventReader(StStrangeMuDstMaker* maker) : mStrangeMuDstMaker(maker) {
  57. mReaderStatus = 0; // "good"
  58. }
  59. //__________________
  60. StHbtStrangeMuDstEventReader::~StHbtStrangeMuDstEventReader(){
  61. if (mEventCut) delete mEventCut;
  62. if (mV0Cut) delete mV0Cut;
  63. }
  64. //__________________
  65. StHbtString StHbtStrangeMuDstEventReader::Report(){
  66. StHbtString temp = "\n This is the StHbtStrangeMuDstEventReader\n";
  67. temp += "---> EventCuts in Reader: ";
  68. if (mEventCut) {
  69. temp += mEventCut->Report();
  70. }
  71. else {
  72. temp += "NONE";
  73. }
  74. temp += "\n---> V0Cuts in Reader: ";
  75. if (mV0Cut) {
  76. temp += mV0Cut->Report();
  77. }
  78. else {
  79. temp += "NONE";
  80. }
  81. temp += "\n";
  82. return temp;
  83. }
  84. //__________________
  85. StHbtEvent* StHbtStrangeMuDstEventReader::ReturnHbtEvent(){
  86. #ifdef STHBTDEBUG
  87. cout << " StHbtStrangeMuDstEventReader::ReturnHbtEvent()" << endl;
  88. #endif
  89. StStrangeEvMuDst* strangeEvMuDst = mStrangeMuDstMaker->GetEvent();
  90. if (!strangeEvMuDst){
  91. cout << " StHbtStrangeMuDstEventReader::ReturnHbtEvent() - No StrangeEvMuDst !!! " << endl;
  92. return 0;
  93. }
  94. StHbtEvent* hbtEvent = new StHbtEvent;
  95. StHbtThreeVector vp = StHbtThreeVector(strangeEvMuDst->primaryVertexX(),strangeEvMuDst->primaryVertexY(),strangeEvMuDst->primaryVertexZ());
  96. cout << " StHbtStrangeMuDstEventReader::ReturnHbtEvent() - primary vertex : " << vp << endl;
  97. hbtEvent->SetPrimVertPos(vp);
  98. hbtEvent->SetNumberOfTracks(strangeEvMuDst->primaryTracks());
  99. hbtEvent->SetEventNumber(strangeEvMuDst->event());
  100. // By now, all event-wise information has been extracted and stored in hbtEvent
  101. // see if it passes any front-loaded event cut
  102. if (mEventCut){
  103. if (!(mEventCut->Pass(hbtEvent))){ // event failed! - return null pointer (but leave Reader status flag as "good")
  104. delete hbtEvent;
  105. return 0;
  106. }
  107. }
  108. for( int i= 0; i < mStrangeMuDstMaker->GetNV0(); i++){
  109. StV0MuDst* v0FromMuDst = mStrangeMuDstMaker->GetV0(i);
  110. //v0FromMuDst->UpdateV0();
  111. StHbtV0* hbtV0 = new StHbtV0;
  112. hbtV0->SetdecayLengthV0(v0FromMuDst->decayLengthV0());
  113. hbtV0->SetdecayVertexV0X(v0FromMuDst->decayVertexV0X());
  114. hbtV0->SetdecayVertexV0Y(v0FromMuDst->decayVertexV0Y());
  115. hbtV0->SetdecayVertexV0Z(v0FromMuDst->decayVertexV0Z());
  116. hbtV0->SetdcaV0Daughters(v0FromMuDst->dcaV0Daughters());
  117. hbtV0->SetdcaV0ToPrimVertex(v0FromMuDst->dcaV0ToPrimVertex());
  118. hbtV0->SetdcaPosToPrimVertex(v0FromMuDst->dcaPosToPrimVertex());
  119. hbtV0->SetdcaNegToPrimVertex(v0FromMuDst->dcaNegToPrimVertex());
  120. hbtV0->SetmomPosX(v0FromMuDst->momPosX());
  121. hbtV0->SetmomPosY(v0FromMuDst->momPosY());
  122. hbtV0->SetmomPosZ(v0FromMuDst->momPosZ());
  123. hbtV0->SetmomNegX(v0FromMuDst->momNegX());
  124. hbtV0->SetmomNegY(v0FromMuDst->momNegY());
  125. hbtV0->SetmomNegZ(v0FromMuDst->momNegZ());
  126. #ifdef STHBTDEBUG
  127. std::cout << " hist pos ";
  128. std::cout << v0FromMuDst->topologyMapPos().numberOfHits(kTpcId);
  129. std::cout << " hist neg ";
  130. std::cout << v0FromMuDst->topologyMapNeg().numberOfHits(kTpcId) << std::endl;
  131. #endif
  132. hbtV0->SettpcHitsPos(v0FromMuDst->topologyMapPos().numberOfHits(kTpcId));
  133. hbtV0->SettpcHitsNeg(v0FromMuDst->topologyMapNeg().numberOfHits(kTpcId));
  134. hbtV0->SetTrackTopologyMapPos(0,v0FromMuDst->topologyMapPos().data(0));
  135. hbtV0->SetTrackTopologyMapPos(1,v0FromMuDst->topologyMapPos().data(1));
  136. hbtV0->SetTrackTopologyMapNeg(0,v0FromMuDst->topologyMapNeg().data(0));
  137. hbtV0->SetTrackTopologyMapNeg(1,v0FromMuDst->topologyMapNeg().data(1));
  138. hbtV0->SetkeyPos(v0FromMuDst->keyPos());
  139. hbtV0->SetkeyNeg(v0FromMuDst->keyNeg());
  140. #ifdef STHBTDEBUG
  141. std::cout << " keyPos " << v0FromMuDst->keyPos() << std::endl;
  142. std::cout << " keyNeg " << v0FromMuDst->keyNeg() << std::endl;
  143. #endif
  144. hbtV0->SetmomV0X(v0FromMuDst->momV0X());
  145. hbtV0->SetmomV0Y(v0FromMuDst->momV0Y());
  146. hbtV0->SetmomV0Z(v0FromMuDst->momV0Z());
  147. #ifdef STHBTDEBUG
  148. std::cout << " alpha ";
  149. std::cout << v0FromMuDst->alphaV0();
  150. std::cout << " ptArm ";
  151. std::cout << v0FromMuDst->ptArmV0() << std::endl;
  152. #endif
  153. hbtV0->SetalphaV0(v0FromMuDst->alphaV0());
  154. hbtV0->SetptArmV0(v0FromMuDst->ptArmV0());
  155. hbtV0->SetdedxPos(v0FromMuDst->dedxPos());
  156. hbtV0->SetdedxNeg(v0FromMuDst->dedxNeg());
  157. // By now, all track-wise information has been extracted and stored in hbtTrack
  158. // see if it passes any front-loaded event cut
  159. if (mV0Cut){
  160. if (!(mV0Cut->Pass(hbtV0))){ // track failed - delete it and skip the push_back
  161. delete hbtV0;
  162. continue;
  163. }
  164. }
  165. hbtEvent->V0Collection()->push_back(hbtV0);
  166. } // end of loop over strangeness groups v0's
  167. //Store total number of v0s in v0Mudst so can start from there next time
  168. #ifdef STHBTDEBUG
  169. cout << " StHbtStrangeMuDstEventReader::ReturnHbtEvent() - " << hbtEvent->V0Collection()->size();
  170. cout << " V0s pushed in collection " << endl;
  171. #endif
  172. printf(" StHbtStrangeMuDstEventReader::ReturnHbtEvent() - %8i(%i) V0s pushed into collection \n",
  173. hbtEvent->V0Collection()->size(),
  174. mStrangeMuDstMaker->GetNV0());
  175. // There might be event cuts that modify the collections of Tracks or V0 in the event.
  176. // These cuts have to be done after the event is built. That's why we have the event cut
  177. // at this point for the second time.
  178. // An example of this kind of cuts will be an cut that removes spit tracks from the event.
  179. if (mEventCut){
  180. if (!(mEventCut->Pass(hbtEvent))){ // event failed! - return null pointer (but leave Reader status flag as "good")
  181. delete hbtEvent;
  182. return 0;
  183. }
  184. }
  185. return hbtEvent;
  186. }