StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
exampleFix.C
1 // NOTE - chain needs to be declared global so for StHbtEventReader
2 //==========================================================================================
3 #include "/afs/rhic.bnl.gov/star/packages/DEV/StRoot/StarClassLibrary/StTimer.hh"
4 
5 class StMuDstMaker;
6 
7 StMuDstMaker* maker;
8 
9 void exampleFix() {
10 
11  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
12  loadSharedLibraries();
13 
14  cout << " loading done " << endl;
15 
16  StMuDebug::setLevel(0); // switch of some debug output
17 
18  int iret=0;
19  maker = new StMuDstMaker(0,0,"MuDST/central/ReversedFullField/runs/","","MuDst"); // set up maker in read mode
20  for (int i=0; i<100; i++) {
21  iret = maker->Make(); // read an event
22  if (iret) break;
23 
24  StMuDst* dst = maker->muDst();
25  dst->fixTrackIndices();
26  int n = maker->muDst()->primaryTracks()->GetEntries(); // get number of primary tracks
27  for (int i=0; i<n; i++) {
28  StMuTrack* primaryTrack = maker->muDst()->primaryTracks(i); // get pointer to primary track
29  printf("momentumPrimary=%8f ",primaryTrack->p().mag());
30  if (primaryTrack->globalTrack()) {
31  printf("momentumGlobal=%8f ratio=%8f\n",primaryTrack->globalTrack()->p().mag(),primaryTrack->p().mag()/primaryTrack->globalTrack()->p().mag());
32  }
33  }
34  }
35 }
36 
37 
38 
virtual int Make()
StMuDst * muDst()
Definition: StMuDstMaker.h:425
StMuDstMaker(const char *name="MuDst")
Default constructor.
static void setLevel(unsigned int level)
sets the debug level
Definition: StMuDebug.h:74
const StThreeVectorF & p() const
Returns 3-momentum at dca to primary vertex.
Definition: StMuTrack.h:259
static TObjArray * primaryTracks()
returns pointer to a list of tracks belonging to the selected primary vertex
Definition: StMuDst.h:301
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
const StMuTrack * globalTrack() const
Returns pointer to associated global track. Null pointer if no global track available.
Definition: StMuTrack.h:272