StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StGammaPythiaEventMaker.cxx
1 //
2 // Pibero Djawotho <pibero@indiana.edu>
3 // Indiana University
4 // 19 July 2007
5 //
6 // Algorithms and implementations by Michael Betancourt (MIT)
7 //
8 
9 #include "tables/St_g2t_event_Table.h"
10 #include "tables/St_particle_Table.h"
11 #include "StMcEvent/StMcEventTypes.hh"
12 #include "StSpinPool/StMCAsymMaker/StMCAsymMaker.h"
13 #include "StGammaPythiaEvent.h"
14 #include "StGammaPythiaEventMaker.h"
15 #include "TMath.h"
16 
17 ClassImp(StGammaPythiaEventMaker);
18 
20 // Maker Init //
23 {
24 
25  // Check pointer to Pythia event
26  if(!mPythia)
27  {
28  LOG_WARN << "No StGammaPythiaEvent" << endm;
29  return kStWarn;
30  }
31 
32  // Get StMcEvent
33  StMcEvent* mcEvent = (StMcEvent*)GetDataSet("StMcEvent");
34  if(!mcEvent)
35  {
36  LOG_WARN << "No StMcEvent" << endm;
37  return kStWarn;
38  }
39 
40  // Get base StPythiaEvent pointer from StMCAsymMaker
41  StMCAsymMaker* asym = dynamic_cast<StMCAsymMaker*>(GetMakerInheritsFrom("StMCAsymMaker"));
42  if(!asym)
43  {
44  LOG_WARN << "No StMCAsymMaker" << endm;
45  return kStWarn;
46  }
47 
48  new (mPythia) StGammaPythiaEvent(asym->pythiaEvent());
49 
51  // Store stable hadrons from the PYTHIA record //
53 
54  // Fetch the PYTHIA event record
55  TDataSet *Event = GetDataSet("geant");
56  if(!Event)
57  {
58  LOG_WARN << "No geant data set!" << endm;
59  return kStWarn;
60  }
61 
62  TDataSetIter geantDstI(Event);
63  St_particle *particleTabPtr = (St_particle*)geantDstI("particle");
64  particle_st *pTable = particleTabPtr->GetTable();
65 
66  // Store stable hadrons
67  for(int i = 0; i < particleTabPtr->GetNRows(); ++i)
68  {
69 
70  if(pTable[i].isthep != 1) continue;
71 
72  if(TMath::Abs(pTable[i].idhep) < 100) continue;
73 
74  mPythia->hadron().push_back(TLorentzVector(pTable[i].phep[0], pTable[i].phep[1], pTable[i].phep[2], pTable[i].phep[3]));
75 
76  if(pTable[i].idhep == 111)
77  {
78  mPythia->neutralPion().push_back(TLorentzVector(pTable[i].phep[0], pTable[i].phep[1], pTable[i].phep[2], pTable[i].phep[3]));
79  }
80 
81  }
82 
84  // Store prompt photons, distinguishing //
85  // between converted and nonconverted //
87 
88  // Check for prompt photon subprocess ID
89  St_g2t_event* Pg2t_event = (St_g2t_event*)geantDstI("g2t_event");
90  g2t_event_st* g2t_event = Pg2t_event->GetTable();
91  long pid = g2t_event->subprocess_id;
92 
93  bool photonEvent = (pid==14) || (pid==18) || (pid==29) || (pid==114) || (pid==115);
94  if(!photonEvent) return kStOk;
95 
96  // Collect photons from primary vertex, looping over daughters
97  StMcVertex *primary=mcEvent->primaryVertex();
98 
99  for(UInt_t id = 0; id < primary->numberOfDaughters(); ++id)
100  {
101 
102  StMcTrack *track = primary->daughter(id);
103  if ( !track ) continue;
104  const StLorentzVectorF& trackV=track->fourMomentum();
105 
106  // Require that track is a photon
107  bool promptFlag = (track->geantId() == 1);
108 
109  // Require that track is not a daughter of the initial partons
110  promptFlag &= track->parent()->eventGenLabel() >= 5;
111 
112  // Require that track is a daughter of a photon (how PYTHIA handles the evoluton of the
113  // final state prompt photon to a stable photon)
114  promptFlag &= track->parent()->pdgId() == 22;
115 
116  // Check for conversion and store photons
117  if(promptFlag)
118  {
119 
120  if(track->stopVertex())
121  {
122  mPythia->conversion().push_back(TLorentzVector(trackV.px(),trackV.py(),trackV.pz(),trackV.e()));
123  }
124  else
125  {
126  mPythia->prompt().push_back(TLorentzVector(trackV.px(),trackV.py(),trackV.pz(),trackV.e()));
127  }
128 
129  }
130 
131  }
132 
133  return kStOk;
134 
135 }
Monte Carlo Track class All information on a simulated track is stored in this class: kinematics...
Definition: StMcTrack.hh:144
Definition: Stypes.h:42
Definition: AgUStep.h:26
Event data structure to hold all information from a Monte Carlo simulation. This class is the interfa...
Definition: StMcEvent.hh:169
Definition: Stypes.h:41