From 79a7764365e8b53d1c677df1a4521ffb1b97373f Mon Sep 17 00:00:00 2001 From: Sam de Jong Date: Wed, 28 Mar 2018 10:18:25 -0700 Subject: [PATCH] Corrected source location --- include/Commands.h | 2 +- include/EventAction.hh | 8 ++++++++ src/EventAction.cc | 5 +++-- src/RunAction.cc | 1 + src/SteppingAction.cc | 7 +++++-- xml/miscObjects.xml | 2 +- 6 files changed, 19 insertions(+), 6 deletions(-) diff --git a/include/Commands.h b/include/Commands.h index b5b1c92..0f96ffe 100644 --- a/include/Commands.h +++ b/include/Commands.h @@ -7,7 +7,7 @@ std::vector UICommands(){ std::vector commands; commands.push_back("/gps/particle neutron"); - commands.push_back("/gps/pos/centre 0.0 0.0 0.0 cm"); + commands.push_back("/gps/pos/centre -3.5 -8.5 -9.8 cm"); commands.push_back("/gps/ang/type iso"); commands.push_back("/gps/pos/type Point"); commands.push_back("/gps/ene/type Arb"); diff --git a/include/EventAction.hh b/include/EventAction.hh index 9dbd1bd..624b061 100644 --- a/include/EventAction.hh +++ b/include/EventAction.hh @@ -37,6 +37,7 @@ public: inline void leftWall(); inline void leftObject(int n); inline void crossedSphere(int n); + inline void setPID(int PID); void setdataNtuple(int n) {dataNtuple=n;} void setGeoNtuple(int n) {geoNtuple=n;} @@ -63,6 +64,8 @@ private: int dataNtuple; int geoNtuple; + int ParticleID; + G4double ePostGraphite; //number of channels and objects @@ -143,6 +146,11 @@ inline void EventAction::crossedSphere(int n){ nCrossedRadii[n] += 1/(4*3.14159*pow(diffusionRadii[n],2)); } +inline void EventAction::setPID(int PID){ + if(PID==2112) + ParticleID=PID; +} + #endif diff --git a/src/EventAction.cc b/src/EventAction.cc index 138dac8..c3eaa14 100644 --- a/src/EventAction.cc +++ b/src/EventAction.cc @@ -138,10 +138,11 @@ void EventAction::EndOfEventAction( const G4Event* eve) analysisManager->FillNtupleDColumn(dataNtuple, 5, tubeY); analysisManager->FillNtupleDColumn(dataNtuple, 6, tubeZ); + analysisManager->FillNtupleIColumn(dataNtuple, 7, ParticleID); for(int i=0; iFillNtupleIColumn(dataNtuple, 7+i, 1); - else analysisManager->FillNtupleIColumn(dataNtuple, 7+i, 0); + if(leftObj[i]==1) analysisManager->FillNtupleIColumn(dataNtuple, 8+i, 1); + else analysisManager->FillNtupleIColumn(dataNtuple, 8+i, 0); } for(int i=0; iCreateNtupleDColumn(dataNtuple,"he3TubeYPos"); analysisManager->CreateNtupleDColumn(dataNtuple,"he3TubeZPos"); + analysisManager->CreateNtupleIColumn(dataNtuple, "ParticleID"); diff --git a/src/SteppingAction.cc b/src/SteppingAction.cc index 0ff7d4b..39f0fb6 100644 --- a/src/SteppingAction.cc +++ b/src/SteppingAction.cc @@ -52,10 +52,13 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep) int PDG=a1Track->GetDefinition()->GetPDGEncoding(); + + fEventAction->setPID(PDG); if(fabs(pre_posn.x())cubeSize||fabs(post_posn.y())>cubeSize||fabs(post_posn.z())>cubeSize){ - if(PDG==2112) fEventAction->leftGraphite(a1Track->GetKineticEnergy()); + if(PDG==2112) + fEventAction->leftGraphite(a1Track->GetKineticEnergy()); } } @@ -89,7 +92,7 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep) //if the particle leaves one of the objects for(int i=0; iGetphysiMisc(i)) { - fEventAction->leftObject(i); + if(PDG==2112) fEventAction->leftObject(i); } } diff --git a/xml/miscObjects.xml b/xml/miscObjects.xml index 09666b9..23fa4b2 100644 --- a/xml/miscObjects.xml +++ b/xml/miscObjects.xml @@ -11,7 +11,7 @@ G4_POLYETHYLENE - 1 + 0 0