Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pipeline #112

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions inc/TRestGeant4Track.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@ class TRestGeant4Track {
inline Double_t GetGlobalTime() const { return fGlobalTimestamp; }
inline Double_t GetTimeLength() const { return fTimeLength; }
inline Double_t GetInitialKineticEnergy() const { return fInitialKineticEnergy; }
inline Double_t GetTotalDepositedEnergy() const { return fHits.GetTotalDepositedEnergy(); }
inline TVector3 GetInitialPosition() const { return fInitialPosition; }
inline Double_t GetWeight() const { return fWeight; }
inline Double_t GetEnergy() const { return fHits.GetEnergy(); }
inline Double_t GetTotalEnergy() const { return fHits.GetTotalEnergy(); }
inline Double_t GetLength() const { return fLength; }

TString GetInitialVolume() const;
Expand Down
4 changes: 2 additions & 2 deletions src/TRestGeant4Event.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ TRestHits TRestGeant4Event::GetHits(Int_t volID) const {
Double_t z = g4Hits.GetZ(n);
Double_t en = g4Hits.GetEnergy(n);

hits.AddHit(x, y, z, en);
hits.AddHit({x, y, z}, en);
}
}

Expand All @@ -264,7 +264,7 @@ Double_t TRestGeant4Event::GetEnergyDepositedByParticle(const TString& particleN
Double_t energy = 0;
for (const auto& track : fTracks) {
if (particleName.EqualTo(track.GetParticleName())) {
energy += track.GetEnergy();
energy += track.GetTotalEnergy();
}
}
return energy;
Expand Down
26 changes: 13 additions & 13 deletions src/TRestGeant4NeutronTaggingProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -361,24 +361,24 @@ TRestEvent* TRestGeant4NeutronTaggingProcess::ProcessEvent(TRestEvent* inputEven
double neutronsCapturedEDepByNeutronAndChildrenInVeto = 0;

std::set<int> parents = {track.GetTrackID()};
std::map<int, double> energy_in_veto;
std::map<int, double> energyInVeto;
for (unsigned int child = 0; child < fOutputG4Event->GetNumberOfTracks(); child++) {
const auto& track_child = fOutputG4Event->GetTrack(child);
if ((parents.count(track_child.GetParentID()) > 0) ||
parents.count(track_child.GetTrackID()) > 0) {
const auto& trackChild = fOutputG4Event->GetTrack(child);
if ((parents.count(trackChild.GetParentID()) > 0) ||
parents.count(trackChild.GetTrackID()) > 0) {
// track or parent is in list of tracks, we add to list and add energy
parents.insert(track_child.GetTrackID());
neutronsCapturedEDepByNeutronAndChildren += track_child.GetEnergy();
if (track_child.GetTrackID() == track.GetTrackID()) {
neutronsCapturedEDepByNeutron += track_child.GetEnergy();
parents.insert(trackChild.GetTrackID());
neutronsCapturedEDepByNeutronAndChildren += trackChild.GetTotalEnergy();
if (trackChild.GetTrackID() == track.GetTrackID()) {
neutronsCapturedEDepByNeutron += trackChild.GetTotalEnergy();
}
for (const auto& vetoId : fVetoVolumeIds) {
neutronsCapturedEDepByNeutronAndChildrenInVeto +=
track_child.GetEnergyInVolume(vetoId);
energy_in_veto[vetoId] += track_child.GetEnergyInVolume(vetoId);
if (track_child.GetTrackID() == track.GetTrackID()) {
trackChild.GetEnergyInVolume(vetoId);
energyInVeto[vetoId] += trackChild.GetEnergyInVolume(vetoId);
if (trackChild.GetTrackID() == track.GetTrackID()) {
neutronsCapturedEDepByNeutronInVeto +=
track_child.GetEnergyInVolume(vetoId);
trackChild.GetEnergyInVolume(vetoId);
}
}
}
Expand All @@ -394,7 +394,7 @@ TRestEvent* TRestGeant4NeutronTaggingProcess::ProcessEvent(TRestEvent* inputEven
// get max and min energy in each veto (to compare with energy in ALL vetoes)
double energyMaxVeto = 0;
double energyMinVeto = -1;
for (const auto& pair : energy_in_veto) {
for (const auto& pair : energyInVeto) {
auto E = pair.second;
if (E > energyMaxVeto) energyMaxVeto = E;
if (E < energyMaxVeto || energyMinVeto == -1) energyMinVeto = E;
Expand Down