StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StStandardHbtEventReader.cxx
1 /***************************************************************************
2  *
3  * $Id: StStandardHbtEventReader.cxx,v 1.39 2003/05/16 21:30:18 magestro Exp $
4  *
5  * Author: Mike Lisa, Ohio State, lisa@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 running
10  * root4star with StEventReaderMaker.
11  * It inherits from StHbtReaderMaker
12  *
13  * Since this StHbtEventReader class gets its input from StEvent in root4star,
14  * it needs to know what chain has the StEventReaderMaker on it. So you have
15  * to initialize (thru SetTheEventMaker()).
16  * Other StHbtEventReader classes (that might read ASCII files for example)
17  * would need other information, like the filename I guess, and so would
18  * have other private data members that they access.
19  *
20  ***************************************************************************
21  *
22  * $Log: StStandardHbtEventReader.cxx,v $
23  * Revision 1.39 2003/05/16 21:30:18 magestro
24  * Removed obsolete include file
25  *
26  * Revision 1.38 2003/05/07 20:05:26 magestro
27  * Removed StFlowTagMaker.h include
28  *
29  * Revision 1.37 2003/01/31 20:22:57 magestro
30  * Small changes to eliminate compiler warnings
31  *
32  * Revision 1.36 2001/12/05 14:42:18 laue
33  * updated for trigger(action)word and l3TriggerAlgorithm
34  *
35  * Revision 1.33 2001/06/21 19:18:42 laue
36  * Modified Files: (to match the changed base classes)
37  * StHbtAsciiReader.cxx StHbtAsciiReader.h
38  * StHbtAssociationReader.cxx StHbtAssociationReader.h
39  * StHbtBinaryReader.cxx StHbtBinaryReader.h
40  * StHbtGstarTxtReader.cxx StHbtGstarTxtReader.h
41  * StHbtStrangeMuDstEventReader.cxx
42  * StHbtStrangeMuDstEventReader.h StStandardHbtEventReader.cxx
43  * Added Files: new reader
44  * StHbtTTreeReader.cxx StHbtTTreeReader.h
45  *
46  * Revision 1.32 2001/06/04 19:09:54 rcwells
47  * Adding B-field, run number, and improved reaction plane functionality
48  *
49  * Revision 1.31 2001/05/25 23:24:01 lisa
50  * Added in StHbtKink stuff
51  *
52  * Revision 1.30 2001/05/15 15:30:18 rcwells
53  * Added magnetic field to StHbtEvent
54  *
55  * Revision 1.29 2001/04/25 18:08:16 perev
56  * HPcorrs
57  *
58  * Revision 1.28 2001/02/08 22:38:26 laue
59  * Reader can now switch between different track types: primary is default
60  *
61  * Revision 1.26 2000/10/17 17:25:23 laue
62  * Added the dE/dx information for v0s
63  *
64  * Revision 1.25 2000/08/31 22:32:37 laue
65  * Readers updated for new StHbtEvent version 3.
66  *
67  * Revision 1.24 2000/07/16 21:14:45 laue
68  * StStandardHbtEventReader modified to read primary tracks only
69  *
70  * Some unnecessary includes removed.
71  * Changes from StV0MiniDst to StStrangeMuDst
72  *
73  * Revision 1.22 2000/06/08 16:12:11 laue
74  * StStandardHbtEventReader.cxx: Topology map for V0 fixed
75  * StHbtMcEventReader.cxx: V0 updated
76  *
77  * Revision 1.21 2000/05/25 21:04:30 laue
78  * StStandarsHbtEventReader updated for the new StStrangMuDstMaker
79  *
80  * Revision 1.19 2000/04/03 16:22:07 laue
81  * some include files changed
82  *
83  * Revision 1.18 2000/02/26 19:06:12 laue
84  * Some unnecessary includes removed.
85  * StThreeVectorD replace by StHbtThreeVector.
86  * StHbtBinaryReader now can derive output filename from StIOMaker
87  *
88  * Revision 1.17 2000/02/18 22:01:56 laue
89  * Implementation of a collections of StHbtEventWriters.
90  * We now can write multiple microDsts at a time.
91  *
92  * All readers can have front-loaded cuts now. For that reason some
93  * functionality was moved from the specific readers to the base class
94  *
95  * Revision 1.16 2000/02/01 00:35:29 laue
96  * namespaces and other little things (see Thomas CC5 migration page) changed
97  * to run on the new Solaris Compiler CC5
98  *
99  * Revision 1.15 2000/01/25 17:35:27 laue
100  * I. In order to run the stand alone version of the StHbtMaker the following
101  * changes have been done:
102  * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements
103  * b) unnecessary includes of StMaker.h have been removed
104  * c) the subdirectory StHbtMaker/doc/Make has been created including everything
105  * needed for the stand alone version
106  *
107  * II. To reduce the amount of compiler warning
108  * a) some variables have been type casted
109  * b) some destructors have been declared as virtual
110  *
111  * Revision 1.14 1999/12/03 22:24:37 lisa
112  * (1) make Cuts and CorrFctns point back to parent Analysis (as well as other way). (2) Accommodate new PidTraits mechanism
113  *
114  * Revision 1.13 1999/11/24 21:56:05 laue
115  * a typo fixed ; ClassDef() was splitted by an accidental carriage-return
116  * ----------------------------------------------------------------------
117  *
118  * Revision 1.12 1999/09/28 15:06:06 didenko
119  * Cleanup dependencies on non existing h-files
120  *
121  * Revision 1.11 1999/09/24 01:23:14 fisyak
122  * Reduced Include Path
123  *
124  * Revision 1.10 1999/09/17 22:38:03 lisa
125  * first full integration of V0s into StHbt framework
126  *
127  * Revision 1.9 1999/09/16 18:48:01 lisa
128  * replace placeholder HbtV0Track stuff with Helens StHbtV0 classes
129  *
130  * Revision 1.8 1999/09/08 04:15:53 lisa
131  * persistent microDST implementation tweaked to please fickle solaris details
132  *
133  * Revision 1.7 1999/09/03 22:39:17 lisa
134  * Readers now MUST have Report() methods and MAY have WriteHbtEvent() methods
135  *
136  * Revision 1.6 1999/07/27 20:21:10 lisa
137  * Franks fixes of StTrack and subsequent changes to particleCut and EventReader
138  *
139  * Revision 1.5 1999/07/24 16:24:25 lisa
140  * adapt StHbtMaker to dev version of library - solaris still gives problems with strings
141  *
142  * Revision 1.4 1999/07/19 14:24:07 hardtke
143  * modifications to implement uDST
144  *
145  * Revision 1.3 1999/07/06 22:33:24 lisa
146  * Adjusted all to work in pro and new - dev itself is broken
147  *
148  * Revision 1.2 1999/06/29 17:50:28 fisyak
149  * formal changes to account new StEvent, does not complie yet
150  *
151  * Revision 1.1.1.1 1999/06/29 16:02:57 lisa
152  * Installation of StHbtMaker
153  *
154  **************************************************************************/
155 #include "StHbtMaker/Reader/StStandardHbtEventReader.h"
156 #include "StChain.h"
157 
158 
159 #include "StEvent.h"
160 #include "StEventTypes.h"
161 #include "StEventUtilities/StuRefMult.hh"
162 #include "StEventSummary.h"
163 #include "StGlobalTrack.h"
164 #include "StTrackNode.h"
165 #include "StContainers.h"
166 #include "StPrimaryVertex.h"
167 #include "StVertex.h"
168 #include "StMeasuredPoint.h"
169 #include "StDedxPidTraits.h"
170 #include "StTrackPidTraits.h"
171 #include "StTrackGeometry.h"
172 #include "StTrackDetectorInfo.h"
173 #include "StParticleTypes.hh"
174 #include "StTpcDedxPidAlgorithm.h"
175 #include "StHit.h"
176 #include "StEventInfo.h"
177 //#include "StuProbabilityPidAlgorithm.h" // new
178 #include <math.h>
179 
180 
181 #include "SystemOfUnits.h" // has "tesla" in it
182 #include "StHbtMaker/Infrastructure/StHbtTrackCollection.hh"
183 #include "StHbtMaker/Infrastructure/StHbtV0Collection.hh"
184 #include "StHbtMaker/Infrastructure/StHbtXiCollection.hh"
185 #include "StHbtMaker/Infrastructure/StHbtKinkCollection.hh"
186 #include "StHbtMaker/Infrastructure/StHbtEvent.hh"
187 #include "StHbtMaker/Base/StHbtEventCut.h"
188 #include "StHbtMaker/Base/StHbtTrackCut.h"
189 #include "StHbtMaker/Base/StHbtV0Cut.h"
190 #include "StHbtMaker/Base/StHbtXiCut.h"
191 #include "StHbtMaker/Base/StHbtKinkCut.h"
193 #include "StStrangeMuDstMaker/StV0MuDst.hh"
194 #include "StStrangeMuDstMaker/StXiMuDst.hh"
195 #include "StStrangeMuDstMaker/StKinkMuDst.hh"
196 
197 #include "StEventMaker/StEventMaker.h"
198 
199 #include "StFlowMaker/StFlowMaker.h"
200 #include "StFlowMaker/StFlowEvent.h"
201 #include "StFlowAnalysisMaker/StFlowAnalysisMaker.h"
202 #include "StFlowMaker/StFlowSelection.h"
203 
204 //#define STHBTDEBUG
205 
206 #ifdef __ROOT__
207 ClassImp(StStandardHbtEventReader)
208 #endif
209 
210 #if !(ST_NO_NAMESPACES)
211  using namespace units;
212 #endif
213 
214 
215 //__________________
216 StStandardHbtEventReader::StStandardHbtEventReader() : mTrackType(primary), mReadTracks(1), mReadV0s(1), mReadXis(1), mReadKinks(1) {
217  mTheEventMaker=0;
218  mTheV0Maker=0;
219  mTheTagReader = 0;
220  mReaderStatus = 0; // "good"
221  mFlowMaker = 0;
222  mFlowAnalysisMaker = 0;
223 }
224 //__________________
225 StStandardHbtEventReader::~StStandardHbtEventReader(){
226  if (mEventCut) delete mEventCut;
227  if (mTrackCut) delete mTrackCut;
228  if (mV0Cut) delete mV0Cut;
229  if (mXiCut) delete mXiCut;
230  if (mKinkCut) delete mKinkCut;
231 }
232 //__________________
233 StHbtString StStandardHbtEventReader::Report(){
234  StHbtString temp = "\n This is the StStandardHbtEventReader\n";
235  char ccc[100];
236  sprintf(ccc," Track type is %d\n",mTrackType);
237  temp += ccc;
238  sprintf(ccc," mReadTracks is %d\n",mReadTracks);
239  temp += ccc;
240  sprintf(ccc," mReadV0s is %d\n",mReadV0s);
241  temp += ccc;
242  sprintf(ccc," mReadXis is %d\n",mReadXis);
243  temp += ccc;
244  temp += "---> EventCuts in Reader: ";
245  if (mEventCut) {
246  temp += mEventCut->Report();
247  }
248  else {
249  temp += "NONE";
250  }
251  temp += "\n---> TrackCuts in Reader: ";
252  if (mTrackCut) {
253  temp += mTrackCut->Report();
254  }
255  else {
256  temp += "NONE";
257  }
258  temp += "\n---> V0Cuts in Reader: ";
259  if (mV0Cut) {
260  temp += mV0Cut->Report();
261  }
262  else {
263  temp += "NONE";
264  }
265  temp += "\n---> XiCuts in Reader: ";
266  if (mXiCut) {
267  temp += mXiCut->Report();
268  }
269  else {
270  temp += "NONE";
271  }
272  temp += "\n---> KinkCuts in Reader: ";
273  if (mKinkCut) {
274  temp += mKinkCut->Report();
275  }
276  else {
277  temp += "NONE";
278  }
279  temp += "\n";
280  return temp;
281 }
282 //__________________
283 StHbtEvent* StStandardHbtEventReader::ReturnHbtEvent(){
284  cout << " StStandardHbtEventReader::ReturnHbtEvent()" << endl;
285 
287  // get StEvent //
289  StEvent* rEvent = 0;
290 
291  if (mTheEventMaker) { // an event maker was specified in the macro
292  StEventMaker* tempMaker = (StEventMaker*) mTheEventMaker;
293  rEvent = tempMaker->event();
294  }
295  else { // no event maker was specified, we assume that an event.root file was read
296  cout << " read from event.root file " << endl;
297  rEvent = (StEvent *) GetInputDS("StEvent");
298  cout << " read from event.root file " << endl;
299  }
300  if (!rEvent){
301  cout << " StStandardHbtEventReader::ReturnHbtEvent() - No StEvent!!! " << endl;
302  return 0;
303  }
304 
305  /*
306  StEventSummary* summary = rEvent->summary();
307  if (!summary){
308  cout << " StStandardHbtEventReader::ReturnHbtEvent() - No StEventSummary!!! " << endl;
309  return 0;
310  }
311  */
312 
313  // if this event has no tags, then return
314  if (!mTheTagReader)
315  cout << " StStandardHbtEventReader::ReturnHbtEvent() - no tag reader " << endl;
316 
317  if (mTheTagReader) {
318  cout << " StStandardHbtEventReader::ReturnHbtEvent() - tag reader is switched on " << endl;
319  if (!mTheTagReader->EventMatch(rEvent->info()->runId() , rEvent->info()->id()) ) {
320  cout << " StStandardHbtEventReader::ReturnHbtEvent() - no tags for this event" << endl;
321  return 0;
322  }
323  }
324 
325 
326  StHbtEvent* hbtEvent = new StHbtEvent;
327  unsigned int mult = rEvent->trackNodes().size();
328 
329  if ( rEvent->numberOfPrimaryVertices() != 1) {
330  cout << " StStandardHbtEventReader::ReturnHbtEvent() - rEvent->numberOfPrimaryVertices()=" <<
331  rEvent->numberOfPrimaryVertices() << endl;
332  delete hbtEvent;
333  return 0;
334  }
335  StHbtThreeVector vp = rEvent->primaryVertex()->position();
336  hbtEvent->SetPrimVertPos(vp);
337  cout << " StStandardHbtEventReader::ReturnHbtEvent() - primary vertex : " << vp << endl;
338 
339  // Run number
340  hbtEvent->SetRunNumber( rEvent->runId() );
341 
342  if ( rEvent->summary() ) {
343  hbtEvent->SetMagneticField(rEvent->summary()->magneticField());
344  cout <<" StStandardHbtEventReader - magnetic field " << hbtEvent->MagneticField() << endl;
345 
346  }
347  else {
348  cout << "StStandardHbtEventReader - no StEvent summary -> no magnetic field written to HbtEvent" << endl;
349  }
350 
351  if ( rEvent->l0Trigger() ) {
352  hbtEvent->SetTriggerWord(rEvent->l0Trigger()->triggerWord());
353  hbtEvent->SetTriggerActionWord(rEvent->l0Trigger()->triggerActionWord());
354  }
355  else {
356  cout << "StStandardHbtEventReader - no StEvent l0Trigger" << endl;
357  }
358 
359  int nL3Processed,nL3Accept,nL3Build;
360  unsigned int firedL3TriggerAlgorithm=0;
361  if ( rEvent->l3Trigger() && rEvent->l3Trigger()->l3EventSummary()) {
362  const StL3EventSummary* mL3EventSummary = rEvent->l3Trigger()->l3EventSummary();
363  unsigned int nAlgorithms = mL3EventSummary->numberOfAlgorithms();
364  cout << "Number of L3 algorithms for this run: " << nAlgorithms << endl;
365  const StSPtrVecL3AlgorithmInfo& mL3AlgInfo = mL3EventSummary->algorithms();
366  for (unsigned int i=0; i<nAlgorithms; i++) {
367  int algId = mL3AlgInfo[i]->id();
368  nL3Processed = mL3AlgInfo[i]->numberOfProcessedEvents();
369  nL3Accept = mL3AlgInfo[i]->numberOfAcceptedEvents();
370  nL3Build = mL3AlgInfo[i]->numberOfBuildEvents();
371  if (mL3AlgInfo[i]->build()) cout << "**";
372  cout << " alg id " << algId << ":\t #proc " << nL3Processed << "\t #accept " << nL3Accept << "\t #build " << nL3Build << endl;
373  }
374 
375  // print triggered algorithms
376  const StPtrVecL3AlgorithmInfo& mL3TriggerAlgInfo = mL3EventSummary->algorithmsAcceptingEvent();
377  cout << "Number of L3 algorithms which triggered this event: " << mL3TriggerAlgInfo.size() << endl;
378  cout << "triggered algorithms: ";
379  for (unsigned int i=0; i<mL3TriggerAlgInfo.size(); i++) cout << mL3TriggerAlgInfo[i]->id() << " ";
380  cout << endl;
381 
382  firedL3TriggerAlgorithm=0;
383  for (StPtrVecL3AlgorithmInfoConstIterator theIter = mL3TriggerAlgInfo.begin(); theIter != mL3TriggerAlgInfo.end(); ++theIter) {
384  firedL3TriggerAlgorithm |= ( 1<<((*theIter)->id()) );
385  cout << ((*theIter)->id()) << " " << firedL3TriggerAlgorithm << endl;
386  }
387  hbtEvent->SetL3TriggerAlgorithm(0,firedL3TriggerAlgorithm);
388  }
389  else {
390  cout << "StStandardHbtEventReader - no StEvent l3Trigger" << endl;
391  }
392  cout << "StStandardHbtEventReader - done" << endl;
393 
394 
395  // By now, all event-wise information has been extracted and stored in hbtEvent
396  // see if it passes any front-loaded event cut
397  if (mEventCut){
398  if (!(mEventCut->Pass(hbtEvent))){ // event failed! - return null pointer (but leave Reader status flag as "good")
399  delete hbtEvent;
400  return 0;
401  }
402  }
403 
404  StTrack* pTrack; // primary
405  StTrack* gTrack; // global
406  StTrack* cTrack; // current track
407 
408  cout << "StStandardHbtReader::ReturnHbtEvent() - We have " << mult << " tracks to store - we skip tracks with nhits==0" << endl;
409 
410  StTpcDedxPidAlgorithm* PidAlgorithm = new StTpcDedxPidAlgorithm();
411 
412  if (!PidAlgorithm) cout << " StStandardHbtEventReader::ReturnHbtEvent() - Whoa!! No PidAlgorithm!! " << endl;
413 
414  // the following just point to particle definitions in StEvent
415  //StElectron* Electron = StElectron::instance();
416  //StPionPlus* Pion = StPionPlus::instance();
417  //StKaonPlus* Kaon = StKaonPlus::instance();
418  //StProton* Proton = StProton::instance();
419 
420  int iNoHits = 0;
421  int iNoPidTraits = 0;
422  int iFailedCut =0;
423  int iNoBestGuess =0;
424  int iBadFlag =0;
425  int iTracks = 0;
426  int iGoodTracks =0;
427  int iWrongTrackType =0;
428 
429  // loop over all the tracks, accept only global
430  for (unsigned int icount=0; icount<(unsigned int)mult; icount++){
431  cTrack = rEvent->trackNodes()[icount]->track(mTrackType);
432  if (cTrack) {
433  iTracks++;
434  if (cTrack->flag()>=0) iGoodTracks++;
435 #ifdef STHBTDEBUG
436  cout << iTracks << " " << iGoodTracks << " : ";
437  cout << cTrack->type() << " ";
438  cout << cTrack->flag() << " ";
439  cout << cTrack->key() << " ";
440  cout << cTrack->impactParameter() << " ";
441  cout << cTrack->numberOfPossiblePoints() << " ";
442  cout << endl;
443 #endif
444  }
445  }
446 
447  hbtEvent->SetNumberOfTracks(iTracks);
448  hbtEvent->SetNumberOfGoodTracks(iGoodTracks);
449 
450  hbtEvent->SetUncorrectedNumberOfPositivePrimaries(uncorrectedNumberOfPositivePrimaries(*rEvent));
451  hbtEvent->SetUncorrectedNumberOfNegativePrimaries(uncorrectedNumberOfNegativePrimaries(*rEvent));
452  hbtEvent->SetEventNumber(rEvent->info()->id());
453 
454  if (rEvent->triggerDetectorCollection()) {
455  StZdcTriggerDetector zdc = rEvent->triggerDetectorCollection()->zdc();
456  hbtEvent->SetZdcAdcWest((int)zdc.adc(10)); // Zdc West sum attenuated
457  hbtEvent->SetZdcAdcEast((int)zdc.adc(13)); // Zdc East sum attenuated
458  }
459  else {
460  cout << "StStandardHbtEventReader::Return(...) - no triggerDetectorCollection " << endl;
461  }
462 
463  /*
464  // Randy commented this out since the RP is obtained from the FlowMaker now
465  // Didn't remove in case someone found it useful
466  if (mTheTagReader) {
467  hbtEvent->SetEventNumber(mTheTagReader->tag("mEventNumber"));
468  // reaction plane from tags
469  StHbtThreeVector a( mTheTagReader->tag("qxa",1), mTheTagReader->tag("qya",1),0);
470  StHbtThreeVector b( mTheTagReader->tag("qxb",1), mTheTagReader->tag("qyb",1),0);
471  float reactionPlane = (a+b).phi();
472  float reactionPlaneSubEventDifference = a.angle(b);
473  cout << " reactionPlane : " << reactionPlane/3.1415927*180.;
474  cout << " reactionPlaneSubEventDifference : " << reactionPlaneSubEventDifference/3.1415927*180. << endl;
475  hbtEvent->SetReactionPlane(reactionPlane);
476  hbtEvent->SetReactionPlaneSubEventDifference(reactionPlaneSubEventDifference);
477  }
478  */
479 
480 
481  // For Aihong's pid
482  // StuProbabilityPidAlgorithm aihongsPid(*rEvent);
483  if (mReadTracks) {
484  for (unsigned int icount=0; icount<(unsigned int)mult; icount++){
485 #ifdef STHBTDEBUG
486  cout << " track# " << icount;
487  cout << " -1- ";
488 #endif
489  gTrack = rEvent->trackNodes()[icount]->track(global);
490  pTrack = rEvent->trackNodes()[icount]->track(primary);
491  cTrack = rEvent->trackNodes()[icount]->track(mTrackType);
492 
493  // don't make a hbtTrack if not a primary track
494  if (!cTrack) { iWrongTrackType++; continue; }
495  if (cTrack->flag() < 0) { iBadFlag++; continue; }
496 
497  if (!gTrack) {
498  cout << "StStandardHbtEventReader::Return(...) - no global track pointer !?! " << endl;
499  continue;
500  }
501 
502  // check number points in tpc
503  if (!cTrack->detectorInfo()) {
504  cout << "StStandardHbtEventReader::Return(...) - no detector info " << endl;
505  assert(0);
506  }
507 
508  int nhits = cTrack->detectorInfo()->numberOfPoints(kTpcId);
509  if (nhits==0) {
510  iNoHits++;
511 #ifdef STHBTDEBUG
512  cout << "No hits -- skipping track (because it crashes otherwise)" << endl;
513 #endif
514  continue;
515  }
516 
517  // while getting the bestGuess, the pidAlgorithm (StTpcDedxPidAlgorithm) is set up.
518  // pointers to track and pidTraits are set
519  StParticleDefinition* BestGuess = (StParticleDefinition*)cTrack->pidTraits(*PidAlgorithm);
520  // if (BestGuess) cout << "best guess for particle is " << BestGuess->name() << endl; //2dec9
521  if (!BestGuess){
522 #ifdef STHBTDEBUG
523  cout << " noGuess ";
524 #endif
525  iNoBestGuess++;
526  continue;
527  }
528 
529 #ifdef STHBTDEBUG
530  cout << "Getting readty to instantiate new StHbtTrack " << endl;
531 #endif
532 
533  // o.k., we got the track with all we need, let's create the StHbtTrack
534  StHbtTrack* hbtTrack = new StHbtTrack(rEvent,cTrack);
535 
536  if (mTrackCut){
537 #ifdef STHBTDEBUG
538  cout << " -cut- ";
539  cout << endl;
540 #endif
541  if (!(mTrackCut->Pass(hbtTrack))){ // track failed - delete it and skip the push_back
542  iFailedCut++;
543  delete hbtTrack;
544  continue;
545  }
546  }
547 
548 #ifdef STHBTDEBUG
549  cout << " -p- ";
550  cout << endl;
551 #endif
552  hbtEvent->TrackCollection()->push_back(hbtTrack);
553  }
554  }
555  printf(" StStandardHbtEventReader::ReturnHbtEvent() - %8i tracks of type %i \n",iTracks,mTrackType);
556  printf(" StStandardHbtEventReader::ReturnHbtEvent() - %8i good tracks of type %i \n",iGoodTracks,mTrackType);
557  printf(" StStandardHbtEventReader::ReturnHbtEvent() - %8i wrong type tracks \n",iWrongTrackType);
558  printf(" StStandardHbtEventReader::ReturnHbtEvent() - %8i no hits, tracks skipped \n",iNoHits);
559  printf(" StStandardHbtEventReader::ReturnHbtEvent() - %8i no tpcPidTraits, tracks skipped \n",iNoPidTraits);
560  printf(" StStandardHbtEventReader::ReturnHbtEvent() - %8i failed tracks cuts, track skipped \n",iFailedCut);
561  printf(" StStandardHbtEventReader::ReturnHbtEvent() - %8i bad flag, track skipped \n",iBadFlag);
562  printf(" StStandardHbtEventReader::ReturnHbtEvent() - %8i(%i) tracks pushed into collection \n",hbtEvent->TrackCollection()->size(), mult);
563 
564  delete PidAlgorithm;
565  //Now do v0 stuff
566 
567  //Pick up pointer v0 minidst maker
568  //StV0MiniDstMaker* v0Maker = (StV0MiniDstMaker *) mTheV0Maker;
569  StStrangeMuDstMaker* muDstMaker = (StStrangeMuDstMaker *) mTheV0Maker;
570 
571  /* **********************************************/
572  /* now read the v0 from the StStrangeMuDstMaker */
573  /* **********************************************/
574  if( muDstMaker && mReadV0s ) {
575  for( int i= 0; i < muDstMaker->GetNV0(); i++){
576  StV0MuDst* v0FromMuDst = muDstMaker->GetV0(i);
577  //v0FromMuDst->UpdateV0();
578  StHbtV0* hbtV0 = new StHbtV0(*v0FromMuDst);
579  // By now, all track-wise information has been extracted and stored in hbtTrack
580  // see if it passes any front-loaded event cut
581  if (mV0Cut){
582  if (!(mV0Cut->Pass(hbtV0))){ // track failed - delete it and skip the push_back
583  delete hbtV0;
584  continue;
585  }
586  }
587  hbtEvent->V0Collection()->push_back(hbtV0);
588  } // end of loop over strangeness groups v0's
589  printf(" StStandardHbtEventReader::ReturnHbtEvent() - %8i(%i) V0s pushed into collection \n",
590  hbtEvent->V0Collection()->size(),
591  muDstMaker->GetNV0());
592  }
593 
594  /* **********************************************/
595  /* now read the xi from the StStrangeMuDstMaker */
596  /* **********************************************/
597  if( muDstMaker && mReadXis ) {
598  for( int i= 0; i < muDstMaker->GetNXi(); i++){
599  StXiMuDst* xiFromMuDst = muDstMaker->GetXi(i);
600  //xiFromMuDst->UpdateXi();
601  StHbtXi* hbtXi = new StHbtXi(*xiFromMuDst);
602  // By now, all track-wise information has been extracted and stored in hbtTrack
603  // see if it passes any front-loaded event cut
604  if (mXiCut){
605  if (!(mXiCut->Pass(hbtXi))){ // track failed - delete it and skip the push_back
606  delete hbtXi;
607  continue;
608  }
609  }
610  hbtEvent->XiCollection()->push_back(hbtXi);
611  } // end of loop over strangeness groups xi's
612  printf(" StStandardHbtEventReader::ReturnHbtEvent() - %8i(%i) Xis pushed into collection \n",
613  hbtEvent->XiCollection()->size(),
614  muDstMaker->GetNXi());
615  }
616 
617 
618  /* *************************************/
619  /* now read the kinks from the StEvent */
620  /* *************************************/
621  // Now do the Kink Stuff - mal 25May2001
622  //StKinkVertex* starKink;
623  StHbtKink* hbtKink;
624  if( mReadKinks ) {
625  for (unsigned int icount=0; icount<(unsigned int)rEvent->kinkVertices().size(); icount++)
626  {
627  StKinkVertex* starKink = rEvent->kinkVertices()[icount];
628  hbtKink = new StHbtKink(*starKink, vp);
629  // before pushing onto the StHbtKinkCollection, make sure this kink passes any front-loaded cuts...
630  if (mKinkCut){
631  if (!(mKinkCut->Pass(hbtKink))){ // kink failed - the "continue" will skip the push_back
632  delete hbtKink;
633  continue;
634  }
635  }
636  hbtEvent->KinkCollection()->push_back(hbtKink);
637  }
638  printf(" StStandardHbtEventReader::ReturnHbtEvent() - %8i(%i) Kinks pushed into collection \n",
639  hbtEvent->KinkCollection()->size(),
640  rEvent->kinkVertices().size());
641  }
642 
643  // Can't get Reaction Plane until whole HbtEvent is filled
644  if ( mFlowMaker && hbtEvent ) {
645 // mFlowMaker->FillFlowEvent(hbtEvent);
646 // // First get RP for whole event
647 // mFlowMaker->FlowSelection()->SetSubevent(-1);
648 // double reactionPlane = mFlowMaker->FlowEventPointer()->Psi(mFlowMaker->FlowSelection());
649 // cout << "Reaction Plane " << reactionPlane << endl;
650 // hbtEvent->SetReactionPlane(reactionPlane);
651 // // Sub event RPs
652 // mFlowMaker->FlowSelection()->SetSubevent(0);
653 // double RP1 = mFlowMaker->FlowEventPointer()->Psi(mFlowMaker->FlowSelection());
654 // mFlowMaker->FlowSelection()->SetSubevent(1);
655 // double RP2 = mFlowMaker->FlowEventPointer()->Psi(mFlowMaker->FlowSelection());
656 // hbtEvent->SetReactionPlaneSubEventDifference(RP1-RP2);
657 // // if Flow Analysis is switched on ... make correction histogram
658 // if (mFlowAnalysisMaker) mFlowAnalysisMaker->Make();
659  }
660 
661  // There might be event cuts that modify the collections of Tracks or V0 in the event.
662  // These cuts have to be done after the event is built. That's why we have the event cut
663  // at this point for the second time.
664  // An example of this kind of cuts will be an cut that removes spit tracks from the event.
665  if (mEventCut){
666  if (!(mEventCut->Pass(hbtEvent))){ // event failed! - return null pointer (but leave Reader status flag as "good")
667  delete hbtEvent;
668  return 0;
669  }
670  }
671 
672  return hbtEvent;
673 }
674 
675 
676 
677 
678 
679 
680 
681 
682 
683 
684 
685 
686 
687 
688 
689 
690 
691 
692 
693 
694