Skip to content

Commit

Permalink
update merge logic
Browse files Browse the repository at this point in the history
  • Loading branch information
lobis committed Aug 19, 2023
1 parent e8789a8 commit abe2372
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions macros/REST_Geant4_MergeRestG4Files.C
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,16 @@ void REST_Geant4_MergeRestG4Files(const char* outputFilename, const char* inputF
eventTree->SetBranchAddress("TRestGeant4EventBranch", &event);
for (int j = 0; j < eventTree->GetEntries(); j++) {
eventTree->GetEntry(j);
Int_t eventId = event->GetID();
*mergeEvent = *event;

Int_t eventId = mergeEvent->GetID();
if (eventIds.find(eventId) != eventIds.end()) {
const maxEventId = *max_element(eventIds.begin(), eventIds.end());
eventId = maxEventId + 1;
}
eventIds.insert(eventId);
event->SetID(eventId);
*mergeEvent = *event;
mergeEvent->SetID(eventId);

mergeEventTree->Fill();
mergeRun->GetAnalysisTree()->Fill();
}
Expand All @@ -93,7 +95,7 @@ void REST_Geant4_MergeRestG4Files(const char* outputFilename, const char* inputF
mergeRun->GetOutputFile()->cd();

gGeoManager->Write("Geometry", TObject::kOverwrite);
// mergeRun->AddMetadata(static_cast<TRestMetadata*>(&mergeMetadata));

mergeMetadata.SetName("geant4Metadata");
mergeMetadata.Write();
mergeRun->UpdateOutputFile();
Expand Down

0 comments on commit abe2372

Please sign in to comment.