print particles in sensitive detector

parent 8ec16bf6
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include "G4Allocator.hh" #include "G4Allocator.hh"
#include "G4THitsCollection.hh" #include "G4THitsCollection.hh"
#include "G4Step.hh" #include "G4Step.hh"
#include "G4ParticleDefinition.hh"
class B1Hits: public G4VHit { class B1Hits: public G4VHit {
...@@ -10,7 +11,15 @@ public: ...@@ -10,7 +11,15 @@ public:
~B1Hits(); ~B1Hits();
void print(); void print();
G4int get_track(G4Step* step); void set_partdef (const G4String particle_name);
const G4String getParticleInTarget() {
return fParticleInTarget;
}
private:
G4String fParticleInTarget;
}; };
typedef G4THitsCollection<B1Hits> B1HitsCollection; typedef G4THitsCollection<B1Hits> B1HitsCollection;
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "G4SystemOfUnits.hh" #include "G4SystemOfUnits.hh"
#include "G4ios.hh" #include "G4ios.hh"
B1Hits::B1Hits() { B1Hits::B1Hits() {
} }
...@@ -19,6 +20,6 @@ B1Hits::~B1Hits() { ...@@ -19,6 +20,6 @@ B1Hits::~B1Hits() {
} }
G4int B1Hits::get_track(G4Step* step) { void B1Hits::set_partdef(const G4String particle_name) {
return step->GetTrack()->GetTrackID(); fParticleInTarget = particle_name;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment