StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
St_pythia_Maker.cxx
1 //
2 // Pibero Djawotho <pibero@tamu.edu>
3 // Texas A&M University
4 // 15 Dec 2009
5 //
6 
7 // ROOT includes
8 #include "TChain.h"
9 
10 // STAR includes
11 #include "tables/St_g2t_event_Table.h"
12 #include "tables/St_g2t_pythia_Table.h"
13 #include "tables/St_g2t_vertex_Table.h"
14 
15 #include "g2t/St_g2t_get_event_Module.h"
16 #include "g2t/St_g2t_get_pythia_Module.h"
17 #include "g2t/St_g2t_particle_Module.h"
18 
19 #include "StSpinPool/StJetSkimEvent/StPythiaEvent.h"
20 
21 // Local includes
22 #include "St_pythia_Maker.h"
23 
24 ClassImp(St_pythia_Maker)
25 
26 int St_pythia_Maker::Init()
27 {
28  assert(!mFileName.IsNull());
29  mChain = new TChain("PythiaTree");
30  mChain->Add(mFileName);
31  assert(mChain);
32  mEvent = 0;
33  mChain->SetBranchAddress("PythiaBranch",&mEvent);
34  AddConst(new TDataSet("geant"));
35  return StMaker::Init();
36 }
37 
39 {
40  if (!mChain->GetEntry(GetNumber()-1)) return kStEOF;
41  assert(mEvent);
42 
43  StEvtHddr* header = GetEvtHddr();
44  header->SetRunNumber(mEvent->runId());
45  header->SetEventNumber(mEvent->eventId());
46 
47  TDataSet* geant = GetDataSet("geant");
48  assert(geant);
49  geant->Delete();
50 
51  St_g2t_event* g2t_event = new St_g2t_event("g2t_event",1);
52  geant->Add(g2t_event);
53  g2t_event_st* eventTable = g2t_event->GetTable();
54  eventTable->n_run = mEvent->runId();
55  eventTable->n_event = mEvent->eventId();
56 
57  St_g2t_vertex* g2t_vertex = new St_g2t_vertex("g2t_vertex",1);
58  geant->Add(g2t_vertex);
59  g2t_vertex_st* vertexTable = g2t_vertex->GetTable();
60  mEvent->vertex().GetXYZ(vertexTable->ge_x);
61 
62  St_particle* particle = new St_particle("particle",mEvent->numberOfParticles());
63  geant->Add(particle);
64 
65  St_g2t_pythia* g2t_pythia = new St_g2t_pythia("g2t_pythia",1);
66  geant->Add(g2t_pythia);
67  g2t_pythia_st* pythiaTable = g2t_pythia->GetTable();
68  pythiaTable->subprocess_id = mEvent->processId();
69  pythiaTable->mand_s = mEvent->s();
70  pythiaTable->mand_t = mEvent->t();
71  pythiaTable->mand_u = mEvent->u();
72  pythiaTable->hard_p = mEvent->pt();
73  pythiaTable->cos_th = mEvent->cosTheta();
74  pythiaTable->bjor_1 = mEvent->x1();
75  pythiaTable->bjor_2 = mEvent->x2();
76  pythiaTable->mstu72 = mEvent->mstu72();
77  pythiaTable->mstu73 = mEvent->mstu73();
78  pythiaTable->mstp111 = mEvent->mstp111();
79 
80  // Track loop
81  for (int i = 0; i < mEvent->numberOfParticles(); ++i) {
82  particle_st part;
83 
84  part.isthep = mEvent->particle(i)->GetStatusCode();
85  part.idhep = mEvent->particle(i)->GetPdgCode();
86  part.jmohep[0] = mEvent->particle(i)->GetFirstMother();
87  part.jmohep[1] = mEvent->particle(i)->GetSecondMother();
88  part.jdahep[0] = mEvent->particle(i)->GetFirstDaughter();
89  part.jdahep[1] = mEvent->particle(i)->GetLastDaughter();
90 
91  TLorentzVector v;
92  mEvent->particle(i)->ProductionVertex(v);
93  v.GetXYZT(part.vhep);
94 
95  TLorentzVector p;
96  mEvent->particle(i)->Momentum(p);
97  p.GetXYZT(part.phep);
98 
99  particle->AddAt(&part,i);
100  } // End track loop
101 
102  return kStOk;
103 }
virtual Int_t GetNumber() const
STAR methods.
Definition: StMaker.cxx:256
virtual void Delete(Option_t *opt="")
Definition: TDataSet.cxx:320
Definition: Stypes.h:43
Definition: Stypes.h:41