StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjTPCRandomMuDst.cxx
1 // $Id: StjTPCRandomMuDst.cxx,v 1.2 2010/05/30 07:10:06 pibero Exp $
2 #include "StjTPCRandomMuDst.h"
3 
4 #include <StMuDSTMaker/COMMON/StMuTrack.h>
5 #include <StMuDSTMaker/COMMON/StMuDst.h>
6 #include <StMuDSTMaker/COMMON/StMuDstMaker.h>
7 #include <StMuDSTMaker/COMMON/StMuEvent.h>
8 
9 #include <mudst/StMuEmcPosition.h>
10 #include <StEmcUtil/geometry/StEmcGeom.h>
11 
12 #include <TVector3.h>
13 #include <stdio.h>
14 
15 StjTPCRandomMuDst::StjTPCRandomMuDst(StMuDstMaker* uDstMaker, Double_t randomSelectorProb, bool randomSelectorAt, UInt_t randomSelectorSeed)
16  : StjTPCMuDst(),
17  _randomSelector( randomSelectorProb, randomSelectorAt, randomSelectorSeed )
18 {
19 }
20 
21 StjTrackList StjTPCRandomMuDst::getTrackList()
22 {
23  StjTrackList ret;
24 
25  //StMuDst* uDst = _uDstMaker->muDst();
26 
27  //double magneticField = uDst->event()->magneticField()/10.0; // Tesla
28  double magneticField = StMuDst::event()->magneticField()/10.0; // Tesla
29  StMuTrack * mutrack = 0;
30  TObjArray tracks;
31 
32  int nTracks = StMuDst::numberOfPrimaryTracks();
33 
34  // I considered removing this and replacing it with simply a call to set
35  // the random selector container on the primary tracks of the StMuDst, but
36  // I don't know how that will bias the results when the cuts are made in
37  // the while loop below. I think that it might be better to make the cuts
38  // building the data set that is then eventually used to actually grab the
39  // random tracks.
40  for ( int ii = 0; ii < nTracks; ++ii )
41  {
42  mutrack = StMuDst::primaryTracks(ii);
43 
44  if ( mutrack->flag() < 0 )
45  continue;
46 
47  if ( mutrack->topologyMap().trackFtpcEast()
48  || mutrack->topologyMap().trackFtpcWest()
49  )
50  continue;
51 
52  tracks.AddLast( mutrack );
53  }
54 
55 // _randomSelector.SetContainer( uDstMaker->muDst()->primaryTracks() );
56  _randomSelector.SetContainer( &tracks );
57 
58  while (
59  (mutrack = dynamic_cast<StMuTrack *>(_randomSelector.GetNextRandom()))
60  )
61  {
62  UInt_t trackIndex =
63  _randomSelector.GetNumberReturned()
64  + _randomSelector.GetNumberSkipped()
65  - 1;
66 
67  StjTrack track = createTrack(mutrack, trackIndex, magneticField);
68 
69  ret.push_back(track);
70  }
71 
72  return ret;
73 }
short flag() const
Returns flag, (see StEvent manual for type information)
Definition: StMuTrack.h:230
static TObjArray * primaryTracks()
returns pointer to a list of tracks belonging to the selected primary vertex
Definition: StMuDst.h:301
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Definition: StMuDst.h:320
StTrackTopologyMap topologyMap() const
Returns topology map.
Definition: StMuTrack.h:254