Skip to content

Commit

Permalink
Try to debug root saving for Windows MT
Browse files Browse the repository at this point in the history
  • Loading branch information
tbaudier committed Sep 30, 2024
1 parent a305351 commit d68b6c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions core/opengate_core/opengate_lib/GatePhaseSpaceActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,39 +185,46 @@ void GatePhaseSpaceActor::SteppingAction(G4Step *step) {
}

void GatePhaseSpaceActor::EndOfEventAction(const G4Event *event) {
std::cout << __func__ << std::endl;
// For a given event, when no step never reach the phsp:
// if the option is on, we store a "fake" step, with the event information.
// All other attributes will be "empty" (mostly 0)
auto &l = fThreadLocalData.Get();
if (fStoreAbsorbedEvent && !l.fCurrentEventHasBeenStored) {
// Put empty value for all attributes
std::cout << "coucou0" << std::endl;
fHits->FillDigiWithEmptyValue();

// Except EventPosition
auto *att = fHits->GetDigiAttribute("EventPosition");
auto p = event->GetPrimaryVertex(0)->GetPosition();
auto &values = att->Get3Values();
values.back() = p;
std::cout << "coucou1" << std::endl;

// Except EventID
att = fHits->GetDigiAttribute("EventID");
auto &values_id = att->GetIValues();
values_id.back() = event->GetEventID();
std::cout << "coucou2" << std::endl;

// Except EventDirection
att = fHits->GetDigiAttribute("EventDirection");
auto &values_dir = att->Get3Values();
auto d = event->GetPrimaryVertex(0)->GetPrimary(0)->GetMomentumDirection();
values_dir.back() = d;
std::cout << "coucou3" << std::endl;

// Except EventKineticEnergy
att = fHits->GetDigiAttribute("EventKineticEnergy");
auto &values_en = att->GetDValues();
auto e = event->GetPrimaryVertex(0)->GetPrimary(0)->GetKineticEnergy();
values_en.back() = e;
std::cout << "coucou4" << std::endl;

// increase the nb of absorbed events
fNumberOfAbsorbedEvents++;
std::cout << "coucou5" << std::endl;
}
}

Expand Down
4 changes: 2 additions & 2 deletions opengate/tests/src/test038_gan_phsp_spect_gan_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ def create_simulation(sim, paths, colli="lehr"):
sim, "spect1_crystal", "test038_gan_proj.mhd"
)
# gate_spect.add_ge_nm670_spect_simplified_digitizer(sim, 'spect2_crystal', paths.output / 'test033_proj_2.mhd')
singles_actor = sim.actor_manager.get_actor(f"Singles_spect1_crystal")
singles_actor.output_filename = "test038_gan_singles.root"
#singles_actor = sim.actor_manager.get_actor(f"Singles_spect1_crystal")
#singles_actor.output_filename = "test038_gan_singles.root"

# motion of the spect, create also the run time interval
"""heads = [spect1] # [spect1, spect2]
Expand Down

0 comments on commit d68b6c7

Please sign in to comment.