GENIEGenerator
Loading...
Searching...
No Matches
genie::COHDNuEventGenerator Class Reference

Generates complete COHDNu events. Is a concrete implementation of the EventRecordVisitorI interface. More...

#include <COHDNuEventGenerator.h>

Inheritance diagram for genie::COHDNuEventGenerator:
[legend]
Collaboration diagram for genie::COHDNuEventGenerator:
[legend]

Public Member Functions

 COHDNuEventGenerator ()
 COHDNuEventGenerator (string config)
 ~COHDNuEventGenerator ()
void ProcessEventRecord (GHepRecord *event) const
void Configure (const Registry &config)
void Configure (string config)
Public Member Functions inherited from genie::EventRecordVisitorI
virtual ~EventRecordVisitorI ()
Public Member Functions inherited from genie::Algorithm
virtual ~Algorithm ()
virtual void FindConfig (void)
virtual const RegistryGetConfig (void) const
RegistryGetOwnedConfig (void)
virtual const AlgIdId (void) const
 Get algorithm ID.
virtual AlgStatus_t GetStatus (void) const
 Get algorithm status.
virtual bool AllowReconfig (void) const
virtual AlgCmp_t Compare (const Algorithm *alg) const
 Compare with input algorithm.
virtual void SetId (const AlgId &id)
 Set algorithm ID.
virtual void SetId (string name, string config)
const AlgorithmSubAlg (const RgKey &registry_key) const
void AdoptConfig (void)
void AdoptSubstructure (void)
virtual void Print (ostream &stream) const
 Print algorithm info.

Private Member Functions

void LoadConfig (void)
void GenerateKinematics (GHepRecord *event) const
void AddFinalStateDarkNeutrino (GHepRecord *event) const
void AddRecoilNucleus (GHepRecord *event) const

Private Attributes

const XSecAlgorithmIfXSecModel
bool fGenerateUniformly
double fSafetyFactor
double fMaxXSecDiffTolerance
double fDNuMass
double fDNuMass2

Additional Inherited Members

Static Public Member Functions inherited from genie::Algorithm
static string BuildParamVectKey (const std::string &comm_name, unsigned int i)
static string BuildParamVectSizeKey (const std::string &comm_name)
static string BuildParamMatKey (const std::string &comm_name, unsigned int i, unsigned int j)
static string BuildParamMatRowSizeKey (const std::string &comm_name)
static string BuildParamMatColSizeKey (const std::string &comm_name)
Protected Member Functions inherited from genie::EventRecordVisitorI
 EventRecordVisitorI ()
 EventRecordVisitorI (string name)
 EventRecordVisitorI (string name, string config)
Protected Member Functions inherited from genie::Algorithm
 Algorithm ()
 Algorithm (string name)
 Algorithm (string name, string config)
void Initialize (void)
void DeleteConfig (void)
void DeleteSubstructure (void)
RegistryExtractLocalConfig (const Registry &in) const
RegistryExtractLowerConfig (const Registry &in, const string &alg_key) const
 Split an incoming configuration Registry into a block valid for the sub-algo identified by alg_key.
template<class T>
bool GetParam (const RgKey &name, T &p, bool is_top_call=true) const
template<class T>
bool GetParamDef (const RgKey &name, T &p, const T &def) const
template<class T>
int GetParamVect (const std::string &comm_name, std::vector< T > &v, bool is_top_call=true) const
 Handle to load vectors of parameters.
int GetParamVectKeys (const std::string &comm_name, std::vector< RgKey > &k, bool is_top_call=true) const
template<class T>
int GetParamMat (const std::string &comm_name, TMatrixT< T > &mat, bool is_top_call=true) const
 Handle to load matrix of parameters.
template<class T>
int GetParamMatSym (const std::string &comm_name, TMatrixTSym< T > &mat, bool is_top_call=true) const
int GetParamMatKeys (const std::string &comm_name, std::vector< RgKey > &k, bool is_top_call=true) const
int AddTopRegistry (Registry *rp, bool owns=true)
 add registry with top priority, also update ownership
int AddLowRegistry (Registry *rp, bool owns=true)
 add registry with lowest priority, also update ownership
int MergeTopRegistry (const Registry &r)
int AddTopRegisties (const vector< Registry * > &rs, bool owns=false)
 Add registries with top priority, also udated Ownerships.
Protected Attributes inherited from genie::Algorithm
bool fAllowReconfig
bool fOwnsSubstruc
 true if it owns its substructure (sub-algs,...)
AlgId fID
 algorithm name and configuration set
vector< Registry * > fConfVect
vector< bool > fOwnerships
 ownership for every registry in fConfVect
AlgStatus_t fStatus
 algorithm execution status
AlgMapfOwnedSubAlgMp
 local pool for owned sub-algs (taken out of the factory pool)

Detailed Description

Generates complete COHDNu events. Is a concrete implementation of the EventRecordVisitorI interface.

Author
Iker de Icaza <i.de-icaza-astiz \at sussex.ac.uk> University of Sussex

Costas Andreopoulos <c.andreopoulos \at cern.ch> University of Liverpool

Created:\n June 30, 2020
License:\n Copyright (c) 2003-2025, The GENIE Collaboration
For the full text of the license visit http://copyright.genie-mc.org

Definition at line 31 of file COHDNuEventGenerator.h.

Constructor & Destructor Documentation

◆ COHDNuEventGenerator() [1/2]

COHDNuEventGenerator::COHDNuEventGenerator ( )

Definition at line 46 of file COHDNuEventGenerator.cxx.

46 :
47 EventRecordVisitorI("genie::COHDNuEventGenerator")
48{
49
50}

References genie::EventRecordVisitorI::EventRecordVisitorI().

◆ COHDNuEventGenerator() [2/2]

COHDNuEventGenerator::COHDNuEventGenerator ( string config)

Definition at line 52 of file COHDNuEventGenerator.cxx.

52 :
53 EventRecordVisitorI("genie::COHDNuEventGenerator", config)
54{
55
56}

References genie::EventRecordVisitorI::EventRecordVisitorI().

◆ ~COHDNuEventGenerator()

COHDNuEventGenerator::~COHDNuEventGenerator ( )

Definition at line 58 of file COHDNuEventGenerator.cxx.

59{
60
61}

Member Function Documentation

◆ AddFinalStateDarkNeutrino()

void COHDNuEventGenerator::AddFinalStateDarkNeutrino ( GHepRecord * event) const
private

Definition at line 185 of file COHDNuEventGenerator.cxx.

186{
187 GHepParticle * probe = event->Probe();
188
189 const TLorentzVector & vtx = *(probe->X4());
190 TLorentzVector x4l(vtx); // position 4-vector
191
192 event->AddParticle(probe -> Pdg() > 0 ? kPdgDarkNeutrino : kPdgAntiDarkNeutrino,
194 event->ProbePosition(), event->TargetNucleusPosition(),
195 -1,-1, event->Summary()->Kine().FSLeptonP4(), x4l);
196}
const TLorentzVector * X4(void) const
virtual int ProbePosition(void) const
virtual Interaction * Summary(void) const
virtual int TargetNucleusPosition(void) const
const Kinematics & Kine(void) const
Definition Interaction.h:71
const TLorentzVector & FSLeptonP4(void) const
Definition Kinematics.h:65
@ kIStDecayedState
Definition GHepStatus.h:32
const int kPdgDarkNeutrino
Definition PDGCodes.h:221
const int kPdgAntiDarkNeutrino
Definition PDGCodes.h:222

References genie::Kinematics::FSLeptonP4(), genie::Interaction::Kine(), genie::kIStDecayedState, genie::kPdgAntiDarkNeutrino, genie::kPdgDarkNeutrino, genie::GHepRecord::ProbePosition(), genie::GHepRecord::Summary(), genie::GHepRecord::TargetNucleusPosition(), and genie::GHepParticle::X4().

Referenced by ProcessEventRecord().

◆ AddRecoilNucleus()

void COHDNuEventGenerator::AddRecoilNucleus ( GHepRecord * event) const
private

Definition at line 198 of file COHDNuEventGenerator.cxx.

199{
200 GHepParticle * probe = event->Probe();
201 GHepParticle * target = event->TargetNucleus();
202 GHepParticle * fsl = event->Particle(probe->FirstDaughter());
203
204 const TLorentzVector & p4probe = * ( probe -> P4() );
205 const TLorentzVector & p4target = * ( target -> P4() );
206 const TLorentzVector & p4fsl = * ( fsl -> P4() );
207
208 const TLorentzVector & p4recoil = p4probe + p4target - p4fsl;
209
210 LOG("COHDNu", pNOTICE)
211 << "Recoil 4-momentum: " << utils::print::P4AsString(&p4recoil);
212
213 const TLorentzVector & vtx = *(probe->X4());
214
215 event->AddParticle(event->TargetNucleus()->Pdg(),
217 event->TargetNucleusPosition(), event->ProbePosition(),
218 -1,-1, p4recoil, vtx);
219}
#define pNOTICE
Definition Messenger.h:61
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
int Pdg(void) const
int FirstDaughter(void) const
virtual GHepParticle * TargetNucleus(void) const
string P4AsString(const TLorentzVector *p)
@ kIStStableFinalState
Definition GHepStatus.h:30

References genie::GHepParticle::FirstDaughter(), genie::kIStStableFinalState, LOG, genie::utils::print::P4AsString(), genie::GHepParticle::Pdg(), pNOTICE, genie::GHepRecord::ProbePosition(), genie::GHepRecord::TargetNucleus(), genie::GHepRecord::TargetNucleusPosition(), and genie::GHepParticle::X4().

Referenced by ProcessEventRecord().

◆ Configure() [1/2]

void COHDNuEventGenerator::Configure ( const Registry & config)
virtual

Configure the algorithm with an external registry The registry is merged with the top level registry if it is owned, Otherwise a copy of it is added with the highest priority

Reimplemented from genie::Algorithm.

Definition at line 221 of file COHDNuEventGenerator.cxx.

222{
223 Algorithm::Configure(config);
224 this->LoadConfig();
225}
virtual void Configure(const Registry &config)
Definition Algorithm.cxx:62

References genie::Algorithm::Configure(), and LoadConfig().

◆ Configure() [2/2]

void COHDNuEventGenerator::Configure ( string config)
virtual

Configure the algorithm from the AlgoConfigPool based on param_set string given in input An algorithm contains a vector of registries coming from different xml configuration files, which are loaded according a very precise prioriy This methods will load a number registries in order of priority: 1) "Tunable" parameter set from CommonParametes. This is loaded with the highest prioriry and it is designed to be used for tuning procedure Usage not expected from the user. 2) For every string defined in "CommonParame" the corresponding parameter set will be loaded from CommonParameter.xml 3) parameter set specified by the config string and defined in the xml file of the algorithm 4) if config is not "Default" also the Default parameter set from the same xml file will be loaded Effectively this avoids the repetion of a parameter when it is not changed in the requested configuration

Reimplemented from genie::Algorithm.

Definition at line 227 of file COHDNuEventGenerator.cxx.

228{
229 Algorithm::Configure(config);
230 this->LoadConfig();
231}

References genie::Algorithm::Configure(), and LoadConfig().

◆ GenerateKinematics()

void COHDNuEventGenerator::GenerateKinematics ( GHepRecord * event) const
private

Definition at line 70 of file COHDNuEventGenerator.cxx.

71{
72 Interaction * interaction = event->Summary();
73 interaction->SetBit(kISkipProcessChk);
74 interaction->SetBit(kISkipKinematicChk);
75
76 // Get the random number generators
77 RandomGen * rnd = RandomGen::Instance();
78
79 // Get the kinematical limits
80 const InitialState & init_state = interaction -> InitState();
81 double E_nu = init_state.ProbeE(kRfLab);
82
83 // Access cross section algorithm for running thread
84 RunningThreadInfo * rtinfo = RunningThreadInfo::Instance();
85 const EventGeneratorI * evg = rtinfo->RunningThread();
87
88 double gDNuE = -1; // generated Dark Neutrino Energy
89 double gxsec = -1; // dsig/dDENu at generated DNuE
90
91 // Generate kinematics
93 LOG("COHDNu", pFATAL)
94 << "Option to generate kinematics uniformly not supported";
95 exit(1);
96 }
97 else {
98 // For the subsequent kinematic selection with the rejection method:
99 // Calculate the max differential cross section.
100 // Always at Q^2 = 0 for energies and model tested,
101 // but go ahead and do the calculation nevertheless.
102 utils::gsl::dXSec_dEDNu_E xsec_func(fXSecModel, interaction, fDNuMass, -1.);
103 Range1D_t DNuEnergy = xsec_func.IntegrationRange();
104 double dDNuE = DNuEnergy.max - DNuEnergy.min;
105 ROOT::Math::BrentMinimizer1D minimizer;
106 minimizer.SetFunction( xsec_func, DNuEnergy.min, DNuEnergy.max);
107 minimizer.Minimize(1000, 1, 1E-5);
108 double DNuE_for_xsec_max = minimizer.XMinimum();
109 double xsec_max = -1. * xsec_func(DNuE_for_xsec_max); // xsec in units of 1E-38 cm2/GeV
110
111 // Try to select a valid E_N
112 unsigned int iter = 0;
113 while(1) {
114 iter++;
115 if(iter > kRjMaxIterations) {
116 LOG("COHDNu", pWARN)
117 << "*** Could not select a valid DNuE after " << iter << " iterations";
118 event->EventFlags()->SetBitNumber(kKineGenErr, true);
119 genie::exceptions::EVGThreadException exception;
120 exception.SetReason("Couldn't select kinematics");
121 exception.SwitchOnFastForward();
122 throw exception;
123 } // max iterations
124
125 gDNuE = DNuEnergy.min + dDNuE * rnd->RndKine().Rndm();
126 LOG("COHDNu", pINFO) << "Trying: E_N = " << gDNuE;
127
128 // Computing cross section for the current kinematics
129 gxsec = -1. * xsec_func(gDNuE);
130
131 if(gxsec > xsec_max) {
132 double frac = TMath::Abs(gxsec-xsec_max)/xsec_max;
133 if(frac > fMaxXSecDiffTolerance) {
134 LOG("COHDNu", pWARN)
135 << "Current computed cross-section (" << gxsec/(units::cm2)
136 << " cm2/GeV^2) exceeds the maximum cross-section ("
137 << xsec_max/(units::cm2) << " beyond the specified tolerance";
138 }
139 }
140
141 // Decide whether to accept the current kinematic point
142 double t = fSafetyFactor * xsec_max * rnd->RndKine().Rndm();
143 //this->AssertXSecLimits(interaction, gxsec, xsec_max);
144 LOG("COHDNu", pINFO)
145 << "dxsec/dQ2 = " << gxsec/(units::cm2) << " cm2/GeV^2"
146 << "J = 1, rnd = " << t;
147 bool accept = (t<gxsec);
148 if(accept) break; // exit loop
149 } // 1
150 } // generate uniformly
151
152 // reset bits
153 interaction->ResetBit(kISkipProcessChk);
154 interaction->ResetBit(kISkipKinematicChk);
155
156 double M_target = interaction->InitState().Tgt().Mass();
157
158 double ETimesM = E_nu * M_target;
159 double EPlusM = E_nu + M_target;
160
161 double p_DNu = TMath::Sqrt(gDNuE*gDNuE - fDNuMass2);
162 double cos_theta_DNu = (gDNuE*EPlusM - ETimesM - 0.5*fDNuMass2) / (E_nu * p_DNu);
163 double theta_DNu = TMath::ACos(cos_theta_DNu);
164
165 // Take a unit vector along the neutrino direction @ the LAB
166 GHepParticle * probe = event->Probe();
167 TVector3 unit_nudir = probe->P4()->Vect().Unit();
168
169 TVector3 DNu_3vector = TVector3(0,0,0);
170 double phi = 2.*kPi * rnd->RndKine().Rndm();
171 DNu_3vector.SetMagThetaPhi(p_DNu, theta_DNu, phi);
172 DNu_3vector.RotateUz(unit_nudir);
173 TLorentzVector P4_DNu = TLorentzVector(DNu_3vector, gDNuE);
174 interaction->KinePtr()->SetFSLeptonP4(P4_DNu);
175
176 // lock selected kinematics & clear running values
177 double gQ2 = -(P4_DNu - *(probe->P4())).M2();
178 interaction->KinePtr()->SetQ2(gQ2, true);
179 interaction->KinePtr()->ClearRunningValues();
180
181 // Set the cross section for the selected kinematics
182 event->SetDiffXSec(gxsec * (1E-38*units::cm2), kPSEDNufE);
183}
#define pINFO
Definition Messenger.h:62
#define pFATAL
Definition Messenger.h:56
#define pWARN
Definition Messenger.h:60
const XSecAlgorithmI * fXSecModel
virtual const XSecAlgorithmI * CrossSectionAlg(void) const =0
const TLorentzVector * P4(void) const
const Target & Tgt(void) const
double ProbeE(RefFrame_t rf) const
const InitialState & InitState(void) const
Definition Interaction.h:69
Kinematics * KinePtr(void) const
Definition Interaction.h:76
void SetQ2(double Q2, bool selected=false)
void ClearRunningValues(void)
void SetFSLeptonP4(const TLorentzVector &p4)
static RandomGen * Instance()
Access instance.
Definition RandomGen.cxx:74
TRandom3 & RndKine(void) const
rnd number generator used by kinematics generators
Definition RandomGen.h:50
static RunningThreadInfo * Instance(void)
const EventGeneratorI * RunningThread(void)
double Mass(void) const
Definition Target.cxx:224
double gQ2
static const unsigned int kRjMaxIterations
Definition Controls.h:26
static constexpr double cm2
Definition Units.h:69
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks
Definition Interaction.h:48
@ kRfLab
Definition RefFrame.h:26
const UInt_t kISkipProcessChk
if set, skip process validity checks
Definition Interaction.h:47
@ kKineGenErr
Definition GHepFlags.h:31

References genie::Kinematics::ClearRunningValues(), genie::units::cm2, genie::EventGeneratorI::CrossSectionAlg(), fDNuMass, fDNuMass2, fGenerateUniformly, fMaxXSecDiffTolerance, fSafetyFactor, fXSecModel, gQ2, genie::Interaction::InitState(), genie::RandomGen::Instance(), genie::RunningThreadInfo::Instance(), genie::utils::gsl::dXSec_dEDNu_E::IntegrationRange(), genie::Interaction::KinePtr(), genie::kISkipKinematicChk, genie::kISkipProcessChk, genie::kKineGenErr, genie::constants::kPi, genie::kPSEDNufE, genie::kRfLab, genie::controls::kRjMaxIterations, LOG, genie::Target::Mass(), genie::Range1D_t::max, genie::Range1D_t::min, genie::GHepParticle::P4(), pFATAL, pINFO, genie::InitialState::ProbeE(), pWARN, genie::RandomGen::RndKine(), genie::RunningThreadInfo::RunningThread(), genie::Kinematics::SetFSLeptonP4(), genie::Kinematics::SetQ2(), genie::exceptions::EVGThreadException::SetReason(), genie::exceptions::EVGThreadException::SwitchOnFastForward(), and genie::InitialState::Tgt().

Referenced by ProcessEventRecord().

◆ LoadConfig()

void COHDNuEventGenerator::LoadConfig ( void )
private

Definition at line 233 of file COHDNuEventGenerator.cxx.

234{
235 fXSecModel = 0;
236
237 // max xsec safety factor (for rejection method) and min cached energy
238 this->GetParamDef( "MaxXSec-SafetyFactor", fSafetyFactor, 1.05 ) ;
239
240 // Generate kinematics uniformly over allowed phase space and compute
241 // an event weight?
242 this->GetParamDef( "UniformOverPhaseSpace", fGenerateUniformly, false ) ;
243
244 // Maximum allowed fractional cross section deviation from maxim cross
245 // section used in rejection method
246 this->GetParamDef( "MaxXSec-DiffTolerance", fMaxXSecDiffTolerance, 999999. ) ;
247 assert(fMaxXSecDiffTolerance>=0);
248
249 fDNuMass = 0.;
250 this->GetParam("Dark-NeutrinoMass", fDNuMass);
252
253}
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
bool GetParamDef(const RgKey &name, T &p, const T &def) const

References fDNuMass, fDNuMass2, fGenerateUniformly, fMaxXSecDiffTolerance, fSafetyFactor, fXSecModel, genie::Algorithm::GetParam(), and genie::Algorithm::GetParamDef().

Referenced by Configure(), and Configure().

◆ ProcessEventRecord()

void COHDNuEventGenerator::ProcessEventRecord ( GHepRecord * event) const
virtual

Implements genie::EventRecordVisitorI.

Definition at line 63 of file COHDNuEventGenerator.cxx.

64{
65 this -> GenerateKinematics (event);
66 this -> AddFinalStateDarkNeutrino (event);
67 this -> AddRecoilNucleus (event);
68}
void GenerateKinematics(GHepRecord *event) const
void AddFinalStateDarkNeutrino(GHepRecord *event) const
void AddRecoilNucleus(GHepRecord *event) const

References AddFinalStateDarkNeutrino(), AddRecoilNucleus(), and GenerateKinematics().

Member Data Documentation

◆ fDNuMass

double genie::COHDNuEventGenerator::fDNuMass
private

Definition at line 62 of file COHDNuEventGenerator.h.

Referenced by GenerateKinematics(), and LoadConfig().

◆ fDNuMass2

double genie::COHDNuEventGenerator::fDNuMass2
private

Definition at line 62 of file COHDNuEventGenerator.h.

Referenced by GenerateKinematics(), and LoadConfig().

◆ fGenerateUniformly

bool genie::COHDNuEventGenerator::fGenerateUniformly
private

Definition at line 58 of file COHDNuEventGenerator.h.

Referenced by GenerateKinematics(), and LoadConfig().

◆ fMaxXSecDiffTolerance

double genie::COHDNuEventGenerator::fMaxXSecDiffTolerance
private

Definition at line 60 of file COHDNuEventGenerator.h.

Referenced by GenerateKinematics(), and LoadConfig().

◆ fSafetyFactor

double genie::COHDNuEventGenerator::fSafetyFactor
private

Definition at line 59 of file COHDNuEventGenerator.h.

Referenced by GenerateKinematics(), and LoadConfig().

◆ fXSecModel

const XSecAlgorithmI* genie::COHDNuEventGenerator::fXSecModel
mutableprivate

Definition at line 56 of file COHDNuEventGenerator.h.

Referenced by GenerateKinematics(), and LoadConfig().


The documentation for this class was generated from the following files: