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

fixed two bug for the GeantinoRecording #276

Merged
merged 9 commits into from
Jun 24, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 4 additions & 3 deletions Examples/Algorithms/Geant4/src/EventAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ void EventAction::clear() {
///
/// This only contains valid data after the end-of-event action has been
/// executed.
const std::vector<Acts::RecordedMaterialTrack>& EventAction::materialTracks()
const {
return m_materialTracks;
std::vector<Acts::RecordedMaterialTrack> EventAction::materialTracks() {
auto materialTracks = m_materialTracks;
m_materialTracks.clear();
return materialTracks;
}
2 changes: 1 addition & 1 deletion Examples/Algorithms/Geant4/src/EventAction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class EventAction final : public G4UserEventAction {
///
/// This only contains valid data after the end-of-event action has been
/// executed.
const std::vector<Acts::RecordedMaterialTrack>& materialTracks() const;
std::vector<Acts::RecordedMaterialTrack> materialTracks();

private:
/// Instance of the EventAction
Expand Down
8 changes: 4 additions & 4 deletions Examples/Run/Geant4/RunSimGeantinoRecording.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ int main(int argc, char* argv[]) {

// setup the Geant4 algorithm
GeantinoRecording::Config g4;
std::string materialTrackCollection = g4.outputMaterialTracks;
g4.detectorConstruction =
std::make_unique<DD4hepDetectorConstruction>(*geometrySvc->lcdd());
g4.tracksPerEvent = 100;
Expand All @@ -57,12 +58,11 @@ int main(int argc, char* argv[]) {
RootMaterialTrackWriter::Config materialTrackWriter;
materialTrackWriter.prePostStep = true;
materialTrackWriter.recalculateTotals = true;
materialTrackWriter.collection = g4.outputMaterialTracks;
materialTrackWriter.collection = materialTrackCollection;
materialTrackWriter.filePath =
joinPaths(outputDir, g4.outputMaterialTracks + ".root");
joinPaths(outputDir, materialTrackCollection + ".root");
sequencer.addWriter(std::make_shared<RootMaterialTrackWriter>(
materialTrackWriter, logLevel));
}

return sequencer.run();
sequencer.run();
}