LDMX Software
DarkBrem.cxx
1
2#include "SimCore/BiasOperators/DarkBrem.h"
3
4//------------//
5// Geant4 //
6//------------//
7#include "G4RunManager.hh"
8
9namespace simcore {
10namespace biasoperators {
11
13 : XsecBiasingOperator(name, p) {
14 volume_ = p.getParameter<std::string>("volume");
15 factor_ = p.getParameter<double>("factor");
16 bias_all_ = p.getParameter<bool>("bias_all");
17}
18
20 const G4Track* track, const G4BiasingProcessInterface* callingProcess) {
21 std::string currentProcess =
22 callingProcess->GetWrappedProcess()->GetProcessName();
23 if (currentProcess.compare(this->getProcessToBias()) == 0) {
24 // bias only the primary particle if we don't want to bias all particles
25 if (not bias_all_ and track->GetParentID() != 0) return nullptr;
26
27 G4double interactionLength =
28 callingProcess->GetWrappedProcess()->GetCurrentInteractionLength();
29
30 double dbXsecUnbiased = 1. / interactionLength;
31 double dbXsecBiased = dbXsecUnbiased * factor_;
32
33 if (G4RunManager::GetRunManager()->GetVerboseLevel() > 1) {
34 std::cout << "[ DarkBremXsecBiasingOperator ]: "
35 << " Unbiased DBrem xsec: " << dbXsecUnbiased
36 << " -> Biased xsec: " << dbXsecBiased << std::endl;
37 }
38
39 return BiasedXsec(dbXsecBiased);
40 }
41 return nullptr;
42}
43
45 h.setIntParameter("BiasOperator::DarkBrem::Bias All Electrons", bias_all_);
46 h.setFloatParameter("BiasOperator::DarkBrem::Factor", factor_);
47 h.setStringParameter("BiasOperator::DarkBrem::Volume", volume_);
48}
49} // namespace biasoperators
50} // namespace simcore
51
52DECLARE_XSECBIASINGOPERATOR(simcore::biasoperators::DarkBrem)
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:27
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89
Run-specific configuration and data stored in its own output TTree alongside the event TTree in the o...
Definition RunHeader.h:54
void setFloatParameter(const std::string &name, float value)
Set a float parameter value.
Definition RunHeader.h:189
void setStringParameter(const std::string &name, std::string value)
Set a string parameter value.
Definition RunHeader.h:214
void setIntParameter(const std::string &name, int value)
Set an int parameter value.
Definition RunHeader.h:164
Our specialization of the biasing operator used with Geant4.
G4VBiasingOperation * BiasedXsec(double biased_xsec)
Helper method for passing a biased interaction length to the Geant4 biasing framework.
Bias operator for the dark brem process.
Definition DarkBrem.h:16
void RecordConfig(ldmx::RunHeader &header) const override
Record the configuration of this biasing operator into the run header.
Definition DarkBrem.cxx:44
double factor_
factor we want to bias by
Definition DarkBrem.h:100
bool bias_all_
should we bias all electrons? (or only the primary)
Definition DarkBrem.h:103
DarkBrem(std::string name, const framework::config::Parameters &p)
Constructor.
Definition DarkBrem.cxx:12
std::string volume_
DEBUG FUNCTION This function is called by the biasing interface class during PostStepDoIt.
Definition DarkBrem.h:97
G4VBiasingOperation * ProposeOccurenceBiasingOperation(const G4Track *track, const G4BiasingProcessInterface *callingProcess) override
Calculate the biased cross section given the input process and track.
Definition DarkBrem.cxx:19