GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
genie::HELeptonKinematicsGenerator Class Reference

Kinematics generator for HELepton. More...

#include <HELeptonKinematicsGenerator.h>

Inheritance diagram for genie::HELeptonKinematicsGenerator:
Inheritance graph
[legend]
Collaboration diagram for genie::HELeptonKinematicsGenerator:
Collaboration graph
[legend]

Public Member Functions

 HELeptonKinematicsGenerator ()
 
 HELeptonKinematicsGenerator (string config)
 
 ~HELeptonKinematicsGenerator ()
 
void ProcessEventRecord (GHepRecord *event_rec) 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. More...
 
virtual AlgStatus_t GetStatus (void) const
 Get algorithm status. More...
 
virtual bool AllowReconfig (void) const
 
virtual AlgCmp_t Compare (const Algorithm *alg) const
 Compare with input algorithm. More...
 
virtual void SetId (const AlgId &id)
 Set algorithm ID. More...
 
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. More...
 

Private Member Functions

void LoadConfig (void)
 
double ComputeMaxXSec (const Interaction *in) const
 
double Energy (const Interaction *in) const
 

Private Attributes

double fDeltaN1NuE
 
double fDeltaN1NuMu
 
double fDeltaN1NuTau
 

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::KineGeneratorWithCache
 KineGeneratorWithCache ()
 
 KineGeneratorWithCache (string name)
 
 KineGeneratorWithCache (string name, string config)
 
 ~KineGeneratorWithCache ()
 
virtual double ComputeMaxXSec (const Interaction *in, const int nkey) const
 
virtual double MaxXSec (GHepRecord *evrec, const int nkey=0) const
 
virtual double FindMaxXSec (const Interaction *in, const int nkey=0) const
 
virtual void CacheMaxXSec (const Interaction *in, double xsec, const int nkey=0) const
 
virtual CacheBranchFxAccessCacheBranch (const Interaction *in, const int nkey=0) const
 
virtual void AssertXSecLimits (const Interaction *in, double xsec, double xsec_max) const
 
- 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. More...
 
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. More...
 
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. More...
 
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 More...
 
int AddLowRegistry (Registry *rp, bool owns=true)
 add registry with lowest priority, also update ownership More...
 
int MergeTopRegistry (const Registry &r)
 
int AddTopRegisties (const vector< Registry * > &rs, bool owns=false)
 Add registries with top priority, also udated Ownerships. More...
 
- Protected Attributes inherited from genie::KineGeneratorWithCache
const XSecAlgorithmIfXSecModel
 
double fSafetyFactor
 ComputeMaxXSec -> ComputeMaxXSec * fSafetyFactor. More...
 
std::vector< double > vSafetyFactors
 MaxXSec -> MaxXSec * fSafetyFactors[nkey]. More...
 
int fNumOfSafetyFactors
 Number of given safety factors. More...
 
std::vector< string > vInterpolatorTypes
 Type of interpolator for each key in a branch. More...
 
int fNumOfInterpolatorTypes
 Number of given interpolators types. More...
 
double fMaxXSecDiffTolerance
 max{100*(xsec-maxxsec)/.5*(xsec+maxxsec)} if xsec>maxxsec More...
 
double fEMin
 min E for which maxxsec is cached - forcing explicit calc. More...
 
bool fGenerateUniformly
 uniform over allowed phase space + event weight? More...
 
- Protected Attributes inherited from genie::Algorithm
bool fAllowReconfig
 
bool fOwnsSubstruc
 true if it owns its substructure (sub-algs,...) More...
 
AlgId fID
 algorithm name and configuration set More...
 
vector< Registry * > fConfVect
 
vector< bool > fOwnerships
 ownership for every registry in fConfVect More...
 
AlgStatus_t fStatus
 algorithm execution status More...
 
AlgMapfOwnedSubAlgMp
 local pool for owned sub-algs (taken out of the factory pool) More...
 

Detailed Description

Kinematics generator for HELepton.

Author
Alfonso Garcia <aagarciasoto km3net.de> IFIC & Harvard University
Created:
Dec 8, 2021
License:
Copyright (c) 2003-2024, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org or see $GENIE/LICENSE

Definition at line 26 of file HELeptonKinematicsGenerator.h.

Constructor & Destructor Documentation

HELeptonKinematicsGenerator::HELeptonKinematicsGenerator ( )

Definition at line 34 of file HELeptonKinematicsGenerator.cxx.

34  :
35 KineGeneratorWithCache("genie::HELeptonKinematicsGenerator")
36 {
37 
38 }
HELeptonKinematicsGenerator::HELeptonKinematicsGenerator ( string  config)

Definition at line 40 of file HELeptonKinematicsGenerator.cxx.

40  :
41 KineGeneratorWithCache("genie::HELeptonKinematicsGenerator", config)
42 {
43 
44 }
HELeptonKinematicsGenerator::~HELeptonKinematicsGenerator ( )

Definition at line 46 of file HELeptonKinematicsGenerator.cxx.

47 {
48 
49 }

Member Function Documentation

double HELeptonKinematicsGenerator::ComputeMaxXSec ( const Interaction in) const
privatevirtual

Implements genie::KineGeneratorWithCache.

Definition at line 210 of file HELeptonKinematicsGenerator.cxx.

References genie::Interaction::AsString(), genie::KineGeneratorWithCache::fSafetyFactor, genie::KineGeneratorWithCache::fXSecModel, genie::ProcessInfo::IsPhotonCoherent(), genie::Interaction::KinePtr(), genie::kKVn1, genie::kKVn2, genie::kKVn3, genie::kPSn1n2fE, genie::kPSn1n2n3fE, pDEBUG, genie::Interaction::ProcInfo(), genie::Kinematics::SetKV(), SLOG, and genie::XSecAlgorithmI::XSec().

212 {
213 // Computes the maximum differential cross section in the requested phase
214 // space. This method overloads KineGeneratorWithCache::ComputeMaxXSec
215 // method and the value is cached at a circular cache branch for retrieval
216 // during subsequent event generation.
217 // The computed max differential cross section does not need to be the exact
218 // maximum. The number used in the rejection method will be scaled up by a
219 // safety factor. But it needs to be fast - do not use a very small y step.
220 
221  double max_xsec = -1.0;
222 
223  ROOT::Math::Minimizer * min = ROOT::Math::Factory::CreateMinimizer("Minuit");
224 
225  const ProcessInfo & proc_info = interaction->ProcInfo();
226  if(proc_info.IsPhotonCoherent()) {
227 
228  utils::gsl::d2Xsec_dn1dn2dn3_E f(fXSecModel,interaction,-1);
229  min->SetFunction( f );
230  min->SetMaxFunctionCalls(10000);
231  min->SetTolerance(0.05);
232 
233  min->SetFixedVariable ( 0, "n1", 1.);
234  min->SetLimitedVariable ( 1, "n2", 0., 0.01, 0., 1.);
235  min->SetLimitedVariable ( 2, "n3", 0., 0.01, 0., 1.);
236  min->Minimize();
237  min->SetFixedVariable ( 0, "n1", 1.);
238  min->SetLimitedVariable ( 1, "n2", min->X()[1], 0.01, TMath::Max(0.,min->X()[1]-0.1), TMath::Min(1.,min->X()[1]+0.1));
239  min->SetLimitedVariable ( 2, "n3", min->X()[2], 0.01, TMath::Max(0.,min->X()[2]-0.1), TMath::Min(1.,min->X()[2]+0.1));
240  min->Minimize();
241  interaction->KinePtr()->SetKV(kKVn1,min->X()[0]);
242  interaction->KinePtr()->SetKV(kKVn2,min->X()[1]);
243  interaction->KinePtr()->SetKV(kKVn3,min->X()[2]);
244  SLOG("HELeptonKinematics", pDEBUG) << "Minimum found -> n1: 1, n2: " << min->X()[1] << ", n3: " << min->X()[2] << ", xsec: " << fXSecModel->XSec(interaction, kPSn1n2n3fE);
245  max_xsec = TMath::Max(fXSecModel->XSec(interaction, kPSn1n2n3fE),max_xsec);
246 
247  min->SetFixedVariable ( 0, "n1", -1.);
248  min->SetLimitedVariable ( 1, "n2", 0., 0.01, 0., 1.);
249  min->SetLimitedVariable ( 2, "n3", 0., 0.01, 0., 1.);
250  min->Minimize();
251  min->SetFixedVariable ( 0, "n1", -1.);
252  min->SetLimitedVariable ( 1, "n2", min->X()[1], 0.01, TMath::Max(0.,min->X()[1]-0.1), TMath::Min(1.,min->X()[1]+0.1));
253  min->SetLimitedVariable ( 2, "n3", min->X()[2], 0.01, TMath::Max(0.,min->X()[2]-0.1), TMath::Min(1.,min->X()[2]+0.1));
254  interaction->KinePtr()->SetKV(kKVn1,min->X()[0]);
255  interaction->KinePtr()->SetKV(kKVn2,min->X()[1]);
256  interaction->KinePtr()->SetKV(kKVn3,min->X()[2]);
257  SLOG("HELeptonKinematics", pDEBUG) << "Minimum found -> n1: -1, n2: " << min->X()[1] << ", n3: " << min->X()[2] << ", xsec: " << fXSecModel->XSec(interaction, kPSn1n2n3fE);
258  max_xsec = TMath::Max(fXSecModel->XSec(interaction, kPSn1n2n3fE),max_xsec);
259 
260  }
261  else {
262 
263  const int Nscan = 100;
264  const int n1min = -1.;
265  const int n1max = 1.;
266  const int n2min = 0.;
267  const int n2max = 1.;
268  const double dn1 = (n1max-n1min)/(double)Nscan;
269  const double dn2 = (n2max-n2min)/(double)
270  Nscan;
271 
272  double scan_n1 = 0.;
273  double scan_n2 = 0.;
274  for (int i=0; i<Nscan; i++) {
275  double n1 = n1min + dn1*i;
276  for (int j=0; j<Nscan; j++) {
277  double n2 = n2min + dn2*j;
278  interaction->KinePtr()->SetKV(kKVn1,n1);
279  interaction->KinePtr()->SetKV(kKVn2,n2);
280  double dxsec = fXSecModel->XSec(interaction, kPSn1n2fE);
281  if ( dxsec > max_xsec ) {
282  scan_n1 = n1;
283  scan_n2 = n2;
284  max_xsec = dxsec;
285  }
286  }
287  }
288 
289  utils::gsl::d2Xsec_dn1dn2_E f(fXSecModel,interaction,-1);
290  min->SetFunction( f );
291  min->SetMaxFunctionCalls(10000);
292  min->SetTolerance(0.05);
293  min->SetLimitedVariable ( 0, "n1", scan_n1, 0.001, TMath::Max(-1.,scan_n1-0.1), TMath::Min(1.,scan_n1+0.1));
294  min->SetLimitedVariable ( 1, "n2", scan_n2, 0.1, TMath::Max(-0.,scan_n2-0.1), TMath::Min(1.,scan_n2+0.1));
295  min->Minimize();
296  interaction->KinePtr()->SetKV(kKVn1,min->X()[0]);
297  interaction->KinePtr()->SetKV(kKVn2,min->X()[1]);
298  max_xsec = fXSecModel->XSec(interaction, kPSn1n2fE);
299  SLOG("HELeptonKinematics", pDEBUG) << "Minimum found -> n1: " << min->X()[0] << ", n2: " << min->X()[1];
300 
301  }
302 
303  // Apply safety factor, since value retrieved from the cache might
304  // correspond to a slightly different energy.
305  max_xsec *= fSafetyFactor;
306 
307  SLOG("HELeptonKinematics", pDEBUG) << interaction->AsString();
308  SLOG("HELeptonKinematics", pDEBUG) << "Max xsec in phase space = " << max_xsec;
309  SLOG("HELeptonKinematics", pDEBUG) << "Computed using alg = " << *fXSecModel;
310 
311  return max_xsec;
312 }
double fSafetyFactor
ComputeMaxXSec -&gt; ComputeMaxXSec * fSafetyFactor.
A class encapsulating an enumeration of interaction types (EM, Weak-CC, Weak-NC) and scattering types...
Definition: ProcessInfo.h:46
bool IsPhotonCoherent(void) const
virtual double XSec(const Interaction *i, KinePhaseSpace_t k=kPSfE) const =0
Compute the cross section for the input interaction.
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Definition: Messenger.h:84
#define pDEBUG
Definition: Messenger.h:63
void HELeptonKinematicsGenerator::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 324 of file HELeptonKinematicsGenerator.cxx.

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

325 {
326  Algorithm::Configure(config);
327  this->LoadConfig();
328 }
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
void HELeptonKinematicsGenerator::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 330 of file HELeptonKinematicsGenerator.cxx.

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

331 {
332  Algorithm::Configure(config);
333  this->LoadConfig();
334 }
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
double HELeptonKinematicsGenerator::Energy ( const Interaction in) const
privatevirtual

Reimplemented from genie::KineGeneratorWithCache.

Definition at line 314 of file HELeptonKinematicsGenerator.cxx.

References genie::Interaction::InitState(), genie::kRfLab, and genie::InitialState::ProbeE().

315 {
316 // Override the base class Energy() method to cache the max xsec for the
317 // neutrino energy in the LAB rather than in the hit nucleon rest frame.
318 
319  const InitialState & init_state = interaction->InitState();
320  double E = init_state.ProbeE(kRfLab);
321  return E;
322 }
double ProbeE(RefFrame_t rf) const
Initial State information.
Definition: InitialState.h:48
void HELeptonKinematicsGenerator::LoadConfig ( void  )
private

Definition at line 336 of file HELeptonKinematicsGenerator.cxx.

References fDeltaN1NuE, fDeltaN1NuMu, fDeltaN1NuTau, genie::KineGeneratorWithCache::fMaxXSecDiffTolerance, genie::KineGeneratorWithCache::fSafetyFactor, and genie::Algorithm::GetParamDef().

Referenced by Configure().

337 {
338 // Reads its configuration data from its configuration Registry and loads them
339 // in private data members to avoid looking up at the Registry all the time.
340 
341  //-- Safety factor for the maximum differential cross section
342  GetParamDef( "MaxXSec-SafetyFactor", fSafetyFactor, 2. ) ;
343 
344  //-- Maximum allowed fractional cross section deviation from maxim cross
345  // section used in rejection method
346  GetParamDef( "MaxXSec-DiffTolerance", fMaxXSecDiffTolerance, 999999. ) ;
347  assert(fMaxXSecDiffTolerance>=0);
348 
349  //-- Sampling range for n1 variable
350  GetParamDef( "Delta-N1-NuE", fDeltaN1NuE, 0. ) ;
351  GetParamDef( "Delta-N1-NuMu", fDeltaN1NuMu, 0. ) ;
352  GetParamDef( "Delta-N1-NuTau", fDeltaN1NuTau, 0. ) ;
353 
354 
355 }
double fSafetyFactor
ComputeMaxXSec -&gt; ComputeMaxXSec * fSafetyFactor.
double fMaxXSecDiffTolerance
max{100*(xsec-maxxsec)/.5*(xsec+maxxsec)} if xsec&gt;maxxsec
bool GetParamDef(const RgKey &name, T &p, const T &def) const
void HELeptonKinematicsGenerator::ProcessEventRecord ( GHepRecord event_rec) const
virtual

Implements genie::EventRecordVisitorI.

Definition at line 51 of file HELeptonKinematicsGenerator.cxx.

References genie::KineGeneratorWithCache::AssertXSecLimits(), genie::Kinematics::ClearRunningValues(), genie::EventGeneratorI::CrossSectionAlg(), genie::GHepRecord::EventFlags(), fDeltaN1NuE, fDeltaN1NuMu, fDeltaN1NuTau, genie::KineGeneratorWithCache::fGenerateUniformly, genie::KineGeneratorWithCache::fXSecModel, genie::Interaction::InitState(), genie::RunningThreadInfo::Instance(), genie::RandomGen::Instance(), genie::pdg::IsNuE(), genie::pdg::IsNuMu(), genie::pdg::IsNuTau(), genie::ProcessInfo::IsPhotonCoherent(), genie::Interaction::KinePtr(), genie::kKineGenErr, genie::kKVn1, genie::kKVn2, genie::kKVn3, genie::kPSn1n2fE, genie::kPSn1n2n3fE, LOG, genie::KineGeneratorWithCache::MaxXSec(), pDEBUG, pINFO, pNOTICE, genie::InitialState::ProbePdg(), genie::Interaction::ProcInfo(), pWARN, genie::RandomGen::RndKine(), genie::RunningThreadInfo::RunningThread(), genie::GHepRecord::SetDiffXSec(), genie::Kinematics::SetKV(), genie::exceptions::EVGThreadException::SetReason(), genie::GHepRecord::Summary(), genie::exceptions::EVGThreadException::SwitchOnFastForward(), and genie::XSecAlgorithmI::XSec().

52 {
53  if(fGenerateUniformly) {
54  LOG("HELeptonKinematics", pNOTICE)
55  << "Generating kinematics uniformly over the allowed phase space";
56  }
57 
58  //-- Get the random number generators
60 
61  //-- Access cross section algorithm for running thread
63  const EventGeneratorI * evg = rtinfo->RunningThread();
64  fXSecModel = evg->CrossSectionAlg();
65 
66  Interaction * interaction = evrec->Summary();
67 
68  //-- For the subsequent kinematic selection with the rejection method:
69  // Calculate the max differential cross section or retrieve it from the
70  // cache. Throw an exception and quit the evg thread if a non-positive
71  // value is found.
72  // If the kinematics are generated uniformly over the allowed phase
73  // space the max xsec is irrelevant
74  double xsec_max = this->MaxXSec(evrec);
75 
76  const ProcessInfo & proc_info = interaction->ProcInfo();
77  if(proc_info.IsPhotonCoherent()) {
78 
79  double nupdg = interaction->InitState().ProbePdg();
80 
81  double n2min = 0.;
82  double n2max = 1.;
83  double n3min = 0.;
84  double n3max = 1.;
85  double dn2 = n2max-n2min;
86  double dn3 = n3max-n3min;
87 
88  double n1max = 0.;
89  double n1min = 0.;
90  if (pdg::IsNuE (TMath::Abs(nupdg))) { n1min = 1.-fDeltaN1NuE; n1max = 1.+fDeltaN1NuE; }
91  else if (pdg::IsNuMu (TMath::Abs(nupdg))) { n1min = 1.-fDeltaN1NuMu; n1max = 1.+fDeltaN1NuMu; }
92  else if (pdg::IsNuTau(TMath::Abs(nupdg))) { n1min = 1.-fDeltaN1NuTau; n1max = 1.+fDeltaN1NuTau; }
93  double dn1 = n1max-n1min;
94 
95 
96  //-- Try to select a valid inelastisity y
97  double xsec = -1;
98  unsigned int iter = 0;
99  bool accept = false;
100 
101  while(1) {
102  iter++;
103  if(iter > 1000000) {
104  LOG("HELeptonKinematics", pWARN)
105  << "*** Could not select a valid y after "
106  << iter << " iterations";
107  evrec->EventFlags()->SetBitNumber(kKineGenErr, true);
109  exception.SetReason("Couldn't select kinematics");
110  exception.SwitchOnFastForward();
111  throw exception;
112  }
113 
114  double n2 = n2min + dn2 * rnd->RndKine().Rndm();
115  double n3 = n3min + dn3 * rnd->RndKine().Rndm();
116  double n1 = n1min + dn1 * rnd->RndKine().Rndm();
117  n1 = (n1>1.) ? n1-2. : n1;
118 
119  interaction->KinePtr()->SetKV(kKVn1,n1);
120  interaction->KinePtr()->SetKV(kKVn2,n2);
121  interaction->KinePtr()->SetKV(kKVn3,n3);
122 
123  LOG("HELeptonKinematics", pDEBUG) << "Trying: n1 = " << n1 << ", n2 = " << n2 << ", n3 = " << n3;
124 
125  //-- computing cross section for the current kinematics
126  xsec = fXSecModel->XSec(interaction, kPSn1n2n3fE);
127 
128  this->AssertXSecLimits(interaction, xsec, xsec_max);
129 
130  double t = xsec_max * rnd->RndKine().Rndm();
131  LOG("HELeptonKinematics", pDEBUG) << "xsec= "<< xsec<< ", J= 1, Rnd= "<< t;
132 
133  accept = (t<xsec);
134 
135  //-- If the generated kinematics are accepted, finish-up module's job
136  if(accept) {
137  LOG("HELeptonKinematics", pINFO) << "Selected: n1 = " << n1 << ", n2 = " << n2 << ", n3 = " << n3;
138 
139  // set the cross section for the selected kinematics
140  evrec->SetDiffXSec(xsec,kPSn1n2n3fE);
141 
142  // lock selected kinematics & clear running values
143  interaction->KinePtr()->ClearRunningValues();
144 
145  return;
146  }
147  }// iterations
148 
149  }
150  else {
151  double n1min = -1.;
152  double n1max = 1.;
153  double n2min = 0.;
154  double n2max = 1.;
155  double dn1 = n1max-n1min;
156  double dn2 = n2max-n2min;
157 
158  //-- Try to select a valid inelastisity y
159  double xsec = -1;
160  unsigned int iter = 0;
161  bool accept = false;
162 
163  while(1) {
164  iter++;
165  if(iter > 1000000) {
166  LOG("HELeptonKinematics", pWARN)
167  << "*** Could not select a valid y after "
168  << iter << " iterations";
169  evrec->EventFlags()->SetBitNumber(kKineGenErr, true);
171  exception.SetReason("Couldn't select kinematics");
172  exception.SwitchOnFastForward();
173  throw exception;
174  }
175 
176  double n1 = n1min + dn1 * rnd->RndKine().Rndm();
177  double n2 = n2min + dn2 * rnd->RndKine().Rndm();
178  interaction->KinePtr()->SetKV(kKVn1,n1);
179  interaction->KinePtr()->SetKV(kKVn2,n2);
180 
181  LOG("HELeptonKinematics", pDEBUG) << "Trying: n1 = " << n1 << ", n2 = " << n2;
182 
183  //-- computing cross section for the current kinematics
184  xsec = fXSecModel->XSec(interaction, kPSn1n2fE);
185 
186  this->AssertXSecLimits(interaction, xsec, xsec_max);
187 
188  double t = xsec_max * rnd->RndKine().Rndm();
189  LOG("HELeptonKinematics", pDEBUG) << "xsec= "<< xsec<< ", J= 1, Rnd= "<< t;
190 
191  accept = (t<xsec);
192 
193  //-- If the generated kinematics are accepted, finish-up module's job
194  if(accept) {
195  LOG("HELeptonKinematics", pINFO) << "Selected: n1 = " << n1 << ", n2 = " << n2;
196 
197  // set the cross section for the selected kinematics
198  evrec->SetDiffXSec(xsec,kPSn1n2fE);
199 
200  // lock selected kinematics & clear running values
201  interaction->KinePtr()->ClearRunningValues();
202 
203  return;
204  }
205  }// iterations
206 
207  }
208 }
bool IsNuTau(int pdgc)
Definition: PDGUtils.cxx:168
bool fGenerateUniformly
uniform over allowed phase space + event weight?
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:71
Kinematics * KinePtr(void) const
Definition: Interaction.h:76
virtual void AssertXSecLimits(const Interaction *in, double xsec, double xsec_max) const
Defines the EventGeneratorI interface.
virtual double MaxXSec(GHepRecord *evrec, const int nkey=0) const
bool IsNuE(int pdgc)
Definition: PDGUtils.cxx:158
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:29
bool IsNuMu(int pdgc)
Definition: PDGUtils.cxx:163
Summary information for an interaction.
Definition: Interaction.h:56
An exception thrown by EventRecordVisitorI when the normal processing sequence has to be disrupted (f...
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
A class encapsulating an enumeration of interaction types (EM, Weak-CC, Weak-NC) and scattering types...
Definition: ProcessInfo.h:46
int ProbePdg(void) const
Definition: InitialState.h:64
#define pINFO
Definition: Messenger.h:62
TRandom3 & RndKine(void) const
rnd number generator used by kinematics generators
Definition: RandomGen.h:50
bool IsPhotonCoherent(void) const
#define pWARN
Definition: Messenger.h:60
virtual double XSec(const Interaction *i, KinePhaseSpace_t k=kPSfE) const =0
Compute the cross section for the input interaction.
void SetKV(KineVar_t kv, double value)
Definition: Kinematics.cxx:335
static RunningThreadInfo * Instance(void)
virtual const XSecAlgorithmI * CrossSectionAlg(void) const =0
const InitialState & InitState(void) const
Definition: Interaction.h:69
const ProcessInfo & ProcInfo(void) const
Definition: Interaction.h:70
#define pNOTICE
Definition: Messenger.h:61
void ClearRunningValues(void)
Definition: Kinematics.cxx:347
const EventGeneratorI * RunningThread(void)
Keep info on the event generation thread currently on charge. This is used so that event generation m...
#define pDEBUG
Definition: Messenger.h:63

Member Data Documentation

double genie::HELeptonKinematicsGenerator::fDeltaN1NuE
private

Definition at line 50 of file HELeptonKinematicsGenerator.h.

Referenced by LoadConfig(), and ProcessEventRecord().

double genie::HELeptonKinematicsGenerator::fDeltaN1NuMu
private

Definition at line 51 of file HELeptonKinematicsGenerator.h.

Referenced by LoadConfig(), and ProcessEventRecord().

double genie::HELeptonKinematicsGenerator::fDeltaN1NuTau
private

Definition at line 52 of file HELeptonKinematicsGenerator.h.

Referenced by LoadConfig(), and ProcessEventRecord().


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