13 #include "G4VProcess.hh"
17 #include "GaudiKernel/Bootstrap.h"
18 #include "GaudiKernel/ISvcLocator.h"
19 #include "GaudiKernel/IMessageSvc.h"
25 AthMessaging(
Gaudi::svcLocator()->service< IMessageSvc >(
"MessageSvc" ),
"G4AtlantisDumper"),
27 m_evtStore(
"StoreGateSvc/StoreGateSvc",
"G4AtlantisDumper"),
28 m_detStore(
"StoreGateSvc/DetectorStore",
"G4AtlantisDumper"),
35 const G4Track *
t=aStep->GetTrack();
39 int id=
t->GetTrackID();
40 int pid=
t->GetParentID();
42 int fs=aStep->IsFirstStepInVolume();
43 int ls=aStep->IsLastStepInVolume();
44 int stepn=
t->GetCurrentStepNumber();
46 const G4TrackVector *sec=aStep->GetSecondary();
47 int nsec=0;
if (sec) nsec=sec->size();
49 double tedep=aStep->GetTotalEnergyDeposit();
50 double tnedep=aStep->GetNonIonizingEnergyDeposit();
51 double length=aStep->GetStepLength();
52 int pdg=
t->GetDefinition()->GetPDGEncoding();
65 const G4VProcess *
p =
t->GetCreatorProcess();
66 G4String
pn=
"none";
if(
p)
pn=
p->GetProcessName();
68 G4ThreeVector pos1=aStep->GetPreStepPoint()->GetPosition();
69 double x1=pos1.x();
double y1=pos1.y();
double z1=pos1.z();
70 double t1=aStep->GetPreStepPoint()->GetGlobalTime();
71 G4ThreeVector pos2=aStep->GetPostStepPoint()->GetPosition();
72 double x2=pos2.x();
double y2=pos2.y();
double z2=pos2.z();
73 double t2=aStep->GetPostStepPoint()->GetGlobalTime();
74 G4ThreeVector
p1=aStep->GetPreStepPoint()->GetMomentum();
75 double px1=
p1.x();
double py1=
p1.y();
double pz1=
p1.z();
76 G4ThreeVector
p2=aStep->GetPostStepPoint()->GetMomentum();
77 double px2=
p2.x();
double py2=
p2.y();
double pz2=
p2.z();
78 double ke1=aStep->GetPreStepPoint()->GetKineticEnergy();
79 double ke2=aStep->GetPostStepPoint()->GetKineticEnergy();
82 double mass=aStep->GetPreStepPoint()->GetMass();
83 double charge=aStep->GetPreStepPoint()->GetCharge();
86 (*m_file)<<
"ACH_G4Step";
87 (*m_file)<<
" "<<
m_nsteps; (*m_file)<<
" "<<
id; (*m_file)<<
" "<<
pid; (*m_file)<<
" "<<(
int)
fs; (*m_file)<<
" "<<(
int)
ls; (*m_file)<<
" "<<stepn;
88 (*m_file)<<
" "<<
pn; (*m_file)<<
" "<<nsec;
89 (*m_file)<<
" "<<tedep; (*m_file)<<
" "<<tnedep; (*m_file)<<
" "<<
length; (*m_file)<<
" "<<pdg; (*m_file)<<
" "<<
mass; (*m_file)<<
" "<<
charge;
90 (*m_file)<<
" "<<
x1; (*m_file)<<
" "<<
y1; (*m_file)<<
" "<<z1; (*m_file)<<
" "<<
t1;
91 (*m_file)<<
" "<<px1; (*m_file)<<
" "<<py1; (*m_file)<<
" "<<pz1; (*m_file)<<
" "<<ke1;
92 (*m_file)<<
" "<<
x2; (*m_file)<<
" "<<
y2; (*m_file)<<
" "<<z2; (*m_file)<<
" "<<
t2;
93 (*m_file)<<
" "<<px2; (*m_file)<<
" "<<py2; (*m_file)<<
" "<<pz2; (*m_file)<<
" "<<ke2;
115 ATH_MSG_INFO(
"G4AtlantisDumper could not get event info!");
119 int athevent =
evt->eventNumber();
120 int athrun =
evt->runNumber();
121 ATH_MSG_INFO(
"G4AtlantisDumper: Athena run event is "<<athrun<<
" "<<athevent);
123 int length=snprintf(buf, 1000,
"G4Atlantis_%d_%d.txt", athrun, athevent);
125 ATH_MSG_WARNING(
"BeginOfEvent:: m_filename string (" << buf <<
") was truncated" );
127 ATH_MSG_INFO(
"G4AtlantisDumper: Opening m_file "<<buf);
128 m_file =
new std::ofstream();