Skip to content

Commit

Permalink
also record particle type (PDG ID) in Germanium output scheme (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
ManuelHu authored Apr 26, 2024
1 parent 74b8598 commit eef66cf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions include/RMGGermaniumDetector.hh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class RMGGermaniumDetectorHit : public G4VHit {
void Draw() override;

int detector_uid = -1;
int particle_type = -1;
float energy_deposition = -1;
G4ThreeVector global_position;
double global_time = -1;
Expand Down
1 change: 1 addition & 0 deletions src/RMGGermaniumDetector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ bool RMGGermaniumDetector::ProcessHits(G4Step* step, G4TouchableHistory* /*histo
// create a new hit and fill it
auto* hit = new RMGGermaniumDetectorHit();
hit->detector_uid = det_uid;
hit->particle_type = step->GetTrack()->GetDefinition()->GetPDGEncoding();
hit->energy_deposition = step->GetTotalEnergyDeposit();
hit->global_position = prestep->GetPosition();
hit->global_time = prestep->GetGlobalTime();
Expand Down
12 changes: 7 additions & 5 deletions src/RMGGermaniumOutputScheme.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ void RMGGermaniumOutputScheme::AssignOutputNames(G4AnalysisManager* ana_man) {
ana_man->CreateNtuple(this->GetNtupleName(det.second.uid), "Event data");

ana_man->CreateNtupleIColumn(id, "evtid");
ana_man->CreateNtupleIColumn(id, "particle");
ana_man->CreateNtupleDColumn(id, "edep");
ana_man->CreateNtupleDColumn(id, "time");
ana_man->CreateNtupleDColumn(id, "xloc");
Expand Down Expand Up @@ -88,11 +89,12 @@ void RMGGermaniumOutputScheme::EndOfEventAction(const G4Event* event) {
auto ntupleid = rmg_man->GetNtupleID(hit->detector_uid);

ana_man->FillNtupleIColumn(ntupleid, 0, event->GetEventID());
ana_man->FillNtupleDColumn(ntupleid, 1, hit->energy_deposition / u::keV);
ana_man->FillNtupleDColumn(ntupleid, 2, hit->global_time / u::ns);
ana_man->FillNtupleDColumn(ntupleid, 3, hit->global_position.getX() / u::m);
ana_man->FillNtupleDColumn(ntupleid, 4, hit->global_position.getY() / u::m);
ana_man->FillNtupleDColumn(ntupleid, 5, hit->global_position.getZ() / u::m);
ana_man->FillNtupleIColumn(ntupleid, 1, hit->particle_type);
ana_man->FillNtupleDColumn(ntupleid, 2, hit->energy_deposition / u::keV);
ana_man->FillNtupleDColumn(ntupleid, 3, hit->global_time / u::ns);
ana_man->FillNtupleDColumn(ntupleid, 4, hit->global_position.getX() / u::m);
ana_man->FillNtupleDColumn(ntupleid, 5, hit->global_position.getY() / u::m);
ana_man->FillNtupleDColumn(ntupleid, 6, hit->global_position.getZ() / u::m);

// NOTE: must be called here for hit-oriented output
ana_man->AddNtupleRow(ntupleid);
Expand Down

0 comments on commit eef66cf

Please sign in to comment.