30 G4HCofThisEvent* HCsThisEvent =
event->GetHCofThisEvent();
31 if (!HCsThisEvent)
return;
34 " run_action is null - cannot access digitization routines or streamers.");
37 int thread_id = G4Threading::G4GetThreadId();
38 int eventID =
event->GetEventID();
41 auto gevent_header = std::make_unique<GEventHeader>(
goptions, eventID, thread_id);
42 auto eventDataCollection = std::make_shared<GEventDataCollection>(
goptions, std::move(gevent_header));
45 for (G4int hci = 0; hci < HCsThisEvent->GetNumberOfCollections(); hci++) {
49 std::string hcSDName = thisGHC->GetSDname();
53 " no digitization routines map available for collection ", hcSDName,
54 " in thread ", thread_id);
58 " for event number ", eventID,
59 " for collection number ", hci + 1,
60 " collection name: ", hcSDName);
63 auto it = digi_map->find(hcSDName);
64 if (it == digi_map->end()) {
66 " no digitization routine registered for collection ", hcSDName,
67 " in thread ", thread_id);
69 auto digitization_routine = it->second;
72 if (!gstreamers_map) {
77 if (digitization_routine !=
nullptr) {
79 for (
size_t hitIndex = 0; hitIndex < thisGHC->GetSize(); hitIndex++) {
80 auto thisHit = (
GHit*)thisGHC->GetHit(hitIndex);
82 auto true_data = digitization_routine->collectTrueInformation(thisHit, hitIndex);
83 auto digi_data = digitization_routine->digitizeHit(thisHit, hitIndex);
84 eventDataCollection->addDetectorDigitizedData(hcSDName, std::move(digi_data));
85 eventDataCollection->addDetectorTrueInfoData(hcSDName, std::move(true_data));
88 for (
const auto& [name,
gstreamer] : *gstreamers_map) {
90 gstreamer->publishEventData(eventDataCollection);