StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
example.C
1 // NOTE - chain needs to be declared global so for StHbtEventReader
2 //==========================================================================================
3 class StMuDstMaker;
4 
5 StMuDstMaker* maker;
6 
7 void example() {
8  if (gClassTable->GetID("TTable") < 0) {
9  gSystem->Load("libTable");
10  gSystem->Load("libPhysics");
11  }
12  gROOT->LoadMacro("StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
13  loadSharedLibraries();
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,"","test.lis","MuDst.root",2); // set up maker in read mode
20  StMuDbReader* db = StMuDbReader::instance();
21  // db->addDb("/star/u/laue/afsWork/P02gc.db");
22  // db->addDb("/star/u/laue/afsWork/P02gd.db");
23 
24  iret = maker->Make(); // read an event
25  iret = maker->Make();
26 
27 
28  StMuEvent* e = maker->muDst()->event();
29  StL0Trigger t;
30  StEventInfo info;
31  if (e) {
32  t=e->l0Trigger();
33  info=e->eventInfo();
34  }
35 
36  int n = maker->muDst()->primaryTracks()->GetEntries(); // get number of primary tracks
37 
38  for (int i=0; i<n; i++) {
39  StMuTrack* primaryTrack = maker->muDst()->primaryTracks(i); // get pointer to primary track
40  StMuTrack* global = primaryTrack->globalTrack();
41  cout << endl;
42  StMuTrack* tt = primaryTrack;
43  printf("primary momentum=%8f first-helix=%8f last-outerHelix=%8f length=%8f lengthMeasured=%8f charge=%d \n",
44  tt->p().mag(), (tt->firstPoint() - tt->helix().origin()).mag(), (tt->lastPoint() - tt->outerHelix().origin()).mag(), tt->length(), tt->lengthMeasured(), tt->charge() );
45  StMuTrack* tt = global;
46  printf("global momentum=%8f first-helix=%8f last-outerHelix=%8f length=%8f lengthMeasured=%8f charge=%d \n",
47  tt->p().mag(), (tt->firstPoint() - tt->helix().origin()).mag(), (tt->lastPoint() - tt->outerHelix().origin()).mag(), tt->length(), tt->lengthMeasured(), tt->charge() );
48  }
49  printf("EVENT id=%d, runId=%d unix time=%d trigWord=0x%0x bXing=%d spinBits=%d nPrim=%d\n", info.id(), info.runId(), info.time(), t.triggerWord(),t.bunchCrossingId(), t.spinBits(),n);
50 
51 
52 }
53 
54 
55 
Double_t lengthMeasured() const
Returns length of track (cm) from first to last measured point.
Definition: StMuTrack.cxx:418
virtual int Make()
StMuDst * muDst()
Definition: StMuDstMaker.h:425
StMuDstMaker(const char *name="MuDst")
Default constructor.
Double_t length() const
Returns length of track (cm) from primary vertex to last measured point.
Definition: StMuTrack.cxx:416
static void setLevel(unsigned int level)
sets the debug level
Definition: StMuDebug.h:74
StPhysicalHelixD helix() const
Returns inner helix (first measured point)
Definition: StMuTrack.cxx:407
Short_t charge() const
Returns charge.
Definition: StMuTrack.h:255
const StThreeVectorF & p() const
Returns 3-momentum at dca to primary vertex.
Definition: StMuTrack.h:259
const StThreeVectorF & firstPoint() const
Returns positions of first measured point.
Definition: StMuTrack.h:261
static TObjArray * primaryTracks()
returns pointer to a list of tracks belonging to the selected primary vertex
Definition: StMuDst.h:301
const StThreeVector< double > & origin() const
-sign(q*B);
Definition: StHelix.hh:224
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Definition: StMuDst.h:320
const StThreeVectorF & lastPoint() const
Returns positions of last measured point.
Definition: StMuTrack.h:262
const StMuTrack * globalTrack() const
Returns pointer to associated global track. Null pointer if no global track available.
Definition: StMuTrack.h:272
StPhysicalHelixD outerHelix() const
Returns outer helix (last measured point)
Definition: StMuTrack.cxx:412