print particles in sensitive detecor

parent fb796b71
......@@ -25,6 +25,7 @@ public:
private:
B1HitsCollection* hitCollection;
G4int HCID;
G4int track_id;
};
#endif
......@@ -19,10 +19,19 @@ B1SD::~B1SD() {
G4bool B1SD::ProcessHits(G4Step* step, G4TouchableHistory* ROhist) {
G4TouchableHandle touchable = step->GetPreStepPoint()->GetTouchableHandle();
B1Hits* hit = new B1Hits();
hit->get_track(step);
hitCollection->insert(hit);
return true;
const G4String particle_name = step->GetTrack()->GetDynamicParticle()->GetParticleDefinition()->GetParticleName();
//G4cout << particle_def->GetParticleName() << G4endl;
G4int track = step->GetTrack()->GetTrackID();
if (track != track_id) {
B1Hits* hit = new B1Hits();
hit->set_partdef(particle_name);
hitCollection->insert(hit);
track_id = track;
return true;
} else {
return true;
}
}
void B1SD::Initialize(G4HCofThisEvent* HCE) {
......
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