StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtMuDstMakerReader.cxx
1 /***************************************************************************
2  *
3  * $Id: StHbtMuDstMakerReader.cxx,v 1.5 2004/10/12 13:48:53 kisiel Exp $
4  * Author: Frank Laue, BNL, laue@bnl.gov
5  *
6  **************************************************************************/
7 #include "StChain.h"
8 
9 #include "StEvent/StEventTypes.h"
10 
11 #include "StEventUtilities/StuRefMult.hh"
12 #include "StEventUtilities/StuProbabilityPidAlgorithm.h"
13 
14 #include "StarClassLibrary/StPhysicalHelixD.hh"
15 #include "StarClassLibrary/StTimer.hh"
16 
17 #include "StFlowMaker/StFlowMaker.h"
18 #include "StFlowMaker/StFlowSelection.h"
19 #include "StFlowMaker/StFlowEvent.h"
20 
22 #include "StStrangeMuDstMaker/StStrangeEvMuDst.hh"
23 #include "StStrangeMuDstMaker/StV0MuDst.hh"
24 #include "StStrangeMuDstMaker/StV0Mc.hh"
25 #include "StStrangeMuDstMaker/StXiMuDst.hh"
26 #include "StStrangeMuDstMaker/StXiMc.hh"
27 #include "StStrangeMuDstMaker/StKinkMuDst.hh"
28 #include "StStrangeMuDstMaker/StKinkMc.hh"
29 
30 #include "StMuDSTMaker/COMMON/StMuException.hh"
31 #include "StMuDSTMaker/COMMON/StMuEvent.h"
32 #include "StMuDSTMaker/COMMON/StMuTrack.h"
33 #include "StMuDSTMaker/COMMON/StMuDebug.h"
34 #include "StMuDSTMaker/COMMON/StMuCut.h"
35 #include "StMuDSTMaker/COMMON/StMuDst.h"
36 
37 #include "StHbtMuDstMakerReader.h"
38 #include "StHbtMaker/Infrastructure/StHbtEvent.hh"
39 #include "StHbtMaker/Base/StHbtEventCut.h"
40 
41 #include "TFile.h"
42 #include "TTree.h"
43 #include "TClass.h"
44 #include "TChain.h"
45 #include "TStreamerInfo.h"
46 #include "TClonesArray.h"
47 
48 ClassImp(StHbtMuDstMakerReader)
49 
50 #if !(ST_NO_NAMESPACES)
51  using namespace units;
52 #endif
53 
54 
55 //-----------------------------------------------------------------------
56 //-----------------------------------------------------------------------
57 //-----------------------------------------------------------------------
58 StHbtMuDstMakerReader::StHbtMuDstMakerReader(StMuDstMaker* maker) :
59  mFlowMaker(0), mMuDstMaker(maker),
60  mTrackType(primary), mReadTracks(1),
61  mReadV0s(1), mReadXis(1), mReadKinks(1), mFinish(0),
62  mHbtEvent(0)
63 {
64  mEventCounter=0;
65  mReaderStatus = 0;
66 
67 }
68 
69 //-----------------------------------------------------------------------
70 //-----------------------------------------------------------------------
71 //-----------------------------------------------------------------------
72 StHbtMuDstMakerReader::~StHbtMuDstMakerReader(){
73 }
74 //-----------------------------------------------------------------------
75 //-----------------------------------------------------------------------
76 //-----------------------------------------------------------------------
77 void StHbtMuDstMakerReader::clear(){
78  DEBUGMESSAGE1("");
79  // if (mHbtEvent) { delete mHbtEvent; mHbtEvent=0; }
80 }
81 //-----------------------------------------------------------------------
82 //-----------------------------------------------------------------------
83 //-----------------------------------------------------------------------
84 int StHbtMuDstMakerReader::Init(){
85  DEBUGMESSAGE1("");
86 // if (!ioMaker) mIOMaker = (StIOMaker*)GetMaker("IOMaker");
87 // if (!mStStrangeMuDstMaker) mStStrangeMuDstMaker = (StStrangeMuDstMaker*)GetMaker("StrangeMaker");
88 // if (!mFlowMaker) = (StFlowMaker*)GetMaker("FlowMaker");
89  return 0;
90 }
91 
92 //-----------------------------------------------------------------------
93 //-----------------------------------------------------------------------
94 //-----------------------------------------------------------------------
95 void StHbtMuDstMakerReader::Clear(){
96  DEBUGMESSAGE1("");
97  clear();
98 }
99 //-----------------------------------------------------------------------
100 //-----------------------------------------------------------------------
101 //-----------------------------------------------------------------------
102 StHbtEvent* StHbtMuDstMakerReader::ReturnHbtEvent(){
103  DEBUGMESSAGE1("");
104  StTimer timer;
105  timer.start();
106  clear();
107  mMuDst=mMuDstMaker->muDst();
108  mHbtEvent=0;
109  if (mMuDst && mMuDst->event() ) {
110  DEBUGVALUE3(mMuDst);
111  mMuDst->fixTrackIndices();
112  mHbtEvent = new StHbtEvent(mMuDst, mTrackType);
113 
114  // Apply event cut, if available
115  if (mEventCut) {
116  if (!(mEventCut->Pass(mHbtEvent))){
117  delete mHbtEvent;
118  mHbtEvent = 0;
119  return 0;
120  }
121  }
122  }
123  else
124  {
125  // DTSMaker returned NULL, so we are not OK
126  mReaderStatus = 1;
127  }
128 
129 
130  if (mFlowMaker && mHbtEvent ) {
131  int harmonic = 1;
132  mFlowMaker->FlowSelection()->SetHarmonic(harmonic);
133  float psi = mFlowMaker->FlowEventPointer()->Psi(mFlowMaker->FlowSelection());
134  mHbtEvent->SetReactionPlane(psi);
135  }
136 
137  return mHbtEvent;
138 }
139 //-----------------------------------------------------------------------
140 //-----------------------------------------------------------------------
141 //-----------------------------------------------------------------------
142 void StHbtMuDstMakerReader::Finish() {
143  if (mFinish) {
144  for ( int i=0; i<10; i++) {
145  cout << "why are you calling the Finish() again ???????" << endl;
146  cout << "are you the stupid chain destructor ???????????" << endl;
147  }
148  }
149  else {
150  mFinish = true;
151  }
152  return;
153 }
154 void StHbtMuDstMakerReader::setProbabilityPidFile(const char* file) {
155  if (mProbabilityPidAlgorithm)
156  mProbabilityPidAlgorithm->readParametersFromFile(file);
157 }
158 /***************************************************************************
159  *
160  * $Log: StHbtMuDstMakerReader.cxx,v $
161  * Revision 1.5 2004/10/12 13:48:53 kisiel
162  * Properly hadle mReaderStatus to make frontLoadedEventCut work
163  *
164  * Revision 1.4 2004/02/24 19:50:00 magestro
165  * Added optional event cut
166  *
167  * Revision 1.3 2003/02/13 19:02:20 magestro
168  * Removed offending cout statement
169  *
170  * Revision 1.2 2003/01/31 20:22:57 magestro
171  * Small changes to eliminate compiler warnings
172  *
173  * Revision 1.1 2002/08/27 18:21:26 laue
174  * New reader. Wrapper around the StMuDstMaker
175  *
176  *
177  **************************************************************************/
178 
179 
180 
181 
182 
183 
184 
185 
186 
187 
188 
189 
190 
191 
192 
193 
194 
195 
StMuDst * muDst()
Definition: StMuDstMaker.h:425
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Definition: StMuDst.h:320
static void fixTrackIndices(TClonesArray *primary, TClonesArray *global)
checks and if necessary corrects the indecies of elements pointing to each other (e.g., a primary track&#39;s index to the corresponding global track)
Definition: StMuDst.cxx:291