Skip to content
This repository was archived by the owner on May 6, 2024. It is now read-only.
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
25 changes: 25 additions & 0 deletions include/SimCore/UserEventInformation.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,23 @@ class UserEventInformation : public G4VUserEventInformation {
/// Decrease the number of brem candidates in an event.
void decBremCandidateCount() { bremCandidateCount_ -= 1; }

/**
* Set the Z of the element in which the dark brem ocurred
*
* @param[in] z atomic Z of element in which the dark brem ocurred
*/
void setDarkBremMaterialZ(double z) { db_material_z_ = z; }

/**
* Get the Z of the element in which the dark brem ocurred
*
* @note This will return -1 if no dark brem ocurred within
* this event.
*
* @param[in] z atomic Z of element in which the dark brem ocurred
*/
double getDarkBremMaterialZ() const { return db_material_z_; }

/**
* Set the event weight.
*
Expand Down Expand Up @@ -140,6 +157,14 @@ class UserEventInformation : public G4VUserEventInformation {
* Was the most recent step a electron-nuclear interaction?
*/
bool last_step_en_{false};

/**
* atomic Z of the element in which dark brem occurred (-1 if didn't happen)
*
* The default is -1. and so will provide unphysical results if the
* dark brem did not occur within the event in question.
*/
double db_material_z_{-1.};
};
} // namespace simcore

Expand Down
21 changes: 20 additions & 1 deletion src/SimCore/APrimePhysics.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,34 @@

#include "G4DarkBreM/G4APrime.h"
#include "G4DarkBreM/G4DarkBreMModel.h"
#include "SimCore/UserEventInformation.h"

// Geant4
#include "G4Electron.hh"
#include "G4EventManager.hh"
#include "G4ProcessManager.hh"

namespace simcore {

const std::string APrimePhysics::NAME = "APrime";

APrimePhysics::APrimePhysics(const framework::config::Parameters &params)
/**
* Store the atomic Z for the element in which the dark brem occurred.
*
* This function is registered with G4DarkBremsstrahlung and will be
* called with the element that the dark brem will occurr off of. We
* store the element Z in UserEventInformation for later serialization
* into the EventHeader
*
* @param[in] element G4Element off-which the dark brem occurred
*/
static void store_element_z(const G4Element& element) {
static_cast<UserEventInformation*>(
G4EventManager::GetEventManager()->GetUserInformation())
->setDarkBremMaterialZ(element.GetZ());
}

APrimePhysics::APrimePhysics(const framework::config::Parameters& params)
: G4VPhysicsConstructor(APrimePhysics::NAME),
parameters_{params},
process_{nullptr} {
Expand Down Expand Up @@ -74,6 +92,7 @@ void APrimePhysics::ConstructProcess() {
parameters_.getParameter<bool>("only_one_per_event"),
1., /* global bias - should use bias operator instead */
parameters_.getParameter<bool>("cache_xsec"));
process_->RegisterStorageMechanism(store_element_z);
} else {
EXCEPTION_RAISE("BadConf",
"Unrecognized model name '" + model_name + "'.");
Expand Down
3 changes: 2 additions & 1 deletion src/SimCore/DetectorConstruction.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ static bool isInEcal(G4LogicalVolume* vol, const std::string& vol_to_bias) {
volumeName.contains("PCB") || volumeName.contains("strongback") ||
volumeName.contains("Glue") || volumeName.contains("CFMix") ||
volumeName.contains("Al") || volumeName.contains("C")) &&
volumeName.contains("volume"));
volumeName.contains("volume")) ||
(volumeName.contains("nohole_motherboard"));
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/SimCore/SimulatorBase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ void SimulatorBase::updateEventHeader(ldmx::EventHeader& eventHeader) const {
event_info->getPNEnergy());
eventHeader.setFloatParameter("total_electronuclear_energy",
event_info->getENEnergy());
eventHeader.setFloatParameter("db_material_z",
event_info->getDarkBremMaterialZ());
}
void SimulatorBase::onProcessEnd() {
runManager_->TerminateEventLoop();
Expand Down