StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StjMCKinMuDst.cxx
1 // $Id: StjMCKinMuDst.cxx,v 1.1 2008/08/22 22:10:25 tai Exp $
2 // Copyright (C) 2008 Tai Sakuma <sakuma@bnl.gov>
3 #include "StjMCKinMuDst.h"
4 
5 #include <StMuDSTMaker/COMMON/StMuDstMaker.h>
6 #include <StMuDSTMaker/COMMON/StMuDst.h>
7 #include <StMuDSTMaker/COMMON/StMuEvent.h>
8 
9 #include "tables/St_g2t_event_Table.h"
10 #include "tables/St_particle_Table.h"
11 #include "tables/St_g2t_pythia_Table.h"
12 
13 #include <iostream>
14 
15 ClassImp(StjMCKinMuDst)
16 
17 using namespace std;
18 
19 void StjMCKinMuDst::readIfNewEvent() const
20 {
21  if(isNewEvent()) readNewEvent();
22 }
23 
24 bool StjMCKinMuDst::isNewEvent() const
25 {
26  if(_runNumber != _uDstMaker->muDst()->event()->runId()) return true;
27  if(_eventId != _uDstMaker->muDst()->event()->eventId()) return true;
28  return false;
29 }
30 
31 void StjMCKinMuDst::readNewEvent() const
32 {
33  _runNumber = _uDstMaker->muDst()->event()->runId();
34  _eventId = _uDstMaker->muDst()->event()->eventId();
35 
36  _vertexZ = _uDstMaker->muDst()->event()->primaryVertexPosition().z();
37 
38  TDataSet *Event = _uDstMaker->GetDataSet("geant");
39  TDataSetIter geantDstI(Event);
40  St_g2t_pythia *Pg2t_pythia = (St_g2t_pythia *)geantDstI("g2t_pythia");
41  g2t_pythia_st *g2t_pythia1 = Pg2t_pythia->GetTable();
42  _s = g2t_pythia1->mand_s;
43  _t = g2t_pythia1->mand_t;
44  _u = g2t_pythia1->mand_u;
45  _pt = g2t_pythia1->hard_p;
46  _costh = g2t_pythia1->cos_th;
47  _x1 = g2t_pythia1->bjor_1;
48  _x2 = g2t_pythia1->bjor_2;
49 
50  St_g2t_event *Pg2t_event = (St_g2t_event *)geantDstI("g2t_event");
51  g2t_event_st *g2t_event1 = Pg2t_event->GetTable();
52  _pid = g2t_event1->subprocess_id;
53 }
54 
55 int StjMCKinMuDst::runNumber()
56 {
57  readIfNewEvent();
58  return _runNumber;
59 }
60 
61 int StjMCKinMuDst::eventId()
62 {
63  readIfNewEvent();
64  return _eventId;
65 }
66 
67 double StjMCKinMuDst::vertexZ()
68 {
69  readIfNewEvent();
70  return _vertexZ;
71 }
72 
73 double StjMCKinMuDst::s()
74 {
75  readIfNewEvent();
76  return _s;
77 }
78 
79 double StjMCKinMuDst::t()
80 {
81  readIfNewEvent();
82  return _t;
83 }
84 
85 double StjMCKinMuDst::u()
86 {
87  readIfNewEvent();
88  return _u;
89 }
90 
91 double StjMCKinMuDst::pt()
92 {
93  readIfNewEvent();
94  return _pt;
95 }
96 
97 double StjMCKinMuDst::costh()
98 {
99  readIfNewEvent();
100  return _costh;
101 }
102 
103 double StjMCKinMuDst::x1()
104 {
105  readIfNewEvent();
106  return _x1;
107 }
108 
109 double StjMCKinMuDst::x2()
110 {
111  readIfNewEvent();
112  return _x2;
113 }
114 
115 int StjMCKinMuDst::pid()
116 {
117  readIfNewEvent();
118  return _pid;
119 }
120 
121 
StThreeVectorF primaryVertexPosition(int vtx_id=-1) const
The StMuDst is supposed to be structured in &#39;physical events&#39;. Therefore there is only 1 primary vert...
Definition: StMuEvent.cxx:221
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
Definition: AgUStep.h:26