GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Protected Member Functions | Protected Attributes | List of all members
genie::KineGeneratorWithCache Class Referenceabstract

Abstract class. Provides a data caching mechanism for for concrete implementations of the EventRecordVisitorI interface, generating kinematics and wishing to cache maximum differential xsecs. More...

#include <KineGeneratorWithCache.h>

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

Protected Member Functions

 KineGeneratorWithCache ()
 
 KineGeneratorWithCache (string name)
 
 KineGeneratorWithCache (string name, string config)
 
 ~KineGeneratorWithCache ()
 
virtual double ComputeMaxXSec (const Interaction *in) const =0
 
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 double Energy (const Interaction *in) 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

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...
 

Additional Inherited Members

- Public Member Functions inherited from genie::EventRecordVisitorI
virtual ~EventRecordVisitorI ()
 
virtual void ProcessEventRecord (GHepRecord *event_rec) const =0
 
- Public Member Functions inherited from genie::Algorithm
virtual ~Algorithm ()
 
virtual void Configure (const Registry &config)
 
virtual void Configure (string config)
 
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...
 
- 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)
 

Detailed Description

Abstract class. Provides a data caching mechanism for for concrete implementations of the EventRecordVisitorI interface, generating kinematics and wishing to cache maximum differential xsecs.

      This class provides some common implementation for handling
      (retrieving, creating, searching, adding to) the cache.
      The various super-classes should implement the ComputeMaxXSec(...)
      method for computing the maximum xsec in case it has not already
      being pushed into the cache at a previous iteration. \n

      Update May 15, 2022 IK: 
      It makes possible to cache several values having different keys. 
      The example of using this opportunity see in 
      the class QELEventGeneratorSM.
Author
Costas Andreopoulos <c.andreopoulos cern.ch> University of Liverpool
Igor Kakorin kakor.nosp@m.in@j.nosp@m.inr.r.nosp@m.u Joint Institute for Nuclear Research
Created:
December 15, 2004
License:
Copyright (c) 2003-2024, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 49 of file KineGeneratorWithCache.h.

Constructor & Destructor Documentation

KineGeneratorWithCache::KineGeneratorWithCache ( )
protected

Definition at line 34 of file KineGeneratorWithCache.cxx.

34  :
36 {
37 
38 }
double fSafetyFactor
ComputeMaxXSec -&gt; ComputeMaxXSec * fSafetyFactor.
int fNumOfSafetyFactors
Number of given safety factors.
int fNumOfInterpolatorTypes
Number of given interpolators types.
KineGeneratorWithCache::KineGeneratorWithCache ( string  name)
protected

Definition at line 40 of file KineGeneratorWithCache.cxx.

40  :
42 {
43 
44 }
double fSafetyFactor
ComputeMaxXSec -&gt; ComputeMaxXSec * fSafetyFactor.
int fNumOfSafetyFactors
Number of given safety factors.
int fNumOfInterpolatorTypes
Number of given interpolators types.
const char * name
KineGeneratorWithCache::KineGeneratorWithCache ( string  name,
string  config 
)
protected

Definition at line 46 of file KineGeneratorWithCache.cxx.

46  :
48 {
49 
50 }
double fSafetyFactor
ComputeMaxXSec -&gt; ComputeMaxXSec * fSafetyFactor.
int fNumOfSafetyFactors
Number of given safety factors.
int fNumOfInterpolatorTypes
Number of given interpolators types.
const char * name
KineGeneratorWithCache::~KineGeneratorWithCache ( )
protected

Definition at line 52 of file KineGeneratorWithCache.cxx.

53 {
54 
55 }

Member Function Documentation

CacheBranchFx * KineGeneratorWithCache::AccessCacheBranch ( const Interaction in,
const int  nkey = 0 
) const
protectedvirtual

Definition at line 224 of file KineGeneratorWithCache.cxx.

References genie::Cache::AddCacheBranch(), genie::Interaction::AsString(), genie::Cache::CacheBranchKey(), genie::Cache::FindCacheBranch(), genie::Algorithm::Id(), genie::Cache::Instance(), genie::AlgId::Key(), LOG, and pINFO.

Referenced by CacheMaxXSec(), and FindMaxXSec().

226 {
227 // Returns the cache branch for this algorithm and this interaction. If no
228 // branch is found then one is created.
229 
230  Cache * cache = Cache::Instance();
231 
232  // build the cache branch key as: namespace::algorithm/config/interaction/nkey
233  string algkey = this->Id().Key();
234  string intkey = interaction->AsString();
235  string key = cache->CacheBranchKey(algkey, intkey, std::to_string(nkey));
236 
237  CacheBranchFx * cache_branch =
238  dynamic_cast<CacheBranchFx *> (cache->FindCacheBranch(key));
239  if(!cache_branch) {
240  //-- create the cache branch at the first pass
241  LOG("Kinematics", pINFO) << "No cache branch found";
242  LOG("Kinematics", pINFO) << "Creating cache branch - key = " << key;
243 
244  cache_branch = new CacheBranchFx("Max over phase space");
245  cache->AddCacheBranch(key, cache_branch);
246  }
247  assert(cache_branch);
248 
249  return cache_branch;
250 }
void AddCacheBranch(string key, CacheBranchI *branch)
Definition: Cache.cxx:88
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
string CacheBranchKey(string k0, string k1="", string k2="") const
Definition: Cache.cxx:93
#define pINFO
Definition: Messenger.h:62
CacheBranchI * FindCacheBranch(string key)
finding/adding cache branches
Definition: Cache.cxx:80
GENIE Cache Memory.
Definition: Cache.h:38
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
static Cache * Instance(void)
Definition: Cache.cxx:67
A simple cache branch storing the cached data in a TNtuple.
Definition: CacheBranchFx.h:49
string Key(void) const
Definition: AlgId.h:46
void KineGeneratorWithCache::AssertXSecLimits ( const Interaction in,
double  xsec,
double  xsec_max 
) const
protectedvirtual

Definition at line 252 of file KineGeneratorWithCache.cxx.

References fMaxXSecDiffTolerance, LOG, pERROR, pFATAL, and pWARN.

Referenced by genie::COHKinematicsGenerator::CalculateKin_AlvarezRuso(), genie::SKKinematicsGenerator::CalculateKin_AtharSingleKaon(), genie::COHKinematicsGenerator::CalculateKin_ReinSehgal(), genie::HELeptonKinematicsGenerator::ProcessEventRecord(), genie::DFRKinematicsGenerator::ProcessEventRecord(), genie::NuEKinematicsGenerator::ProcessEventRecord(), genie::QELKinematicsGenerator::ProcessEventRecord(), genie::DMEKinematicsGenerator::ProcessEventRecord(), genie::RESKinematicsGenerator::ProcessEventRecord(), genie::QELEventGenerator::ProcessEventRecord(), genie::DMELKinematicsGenerator::ProcessEventRecord(), genie::IBDKinematicsGenerator::ProcessEventRecord(), genie::DISKinematicsGenerator::ProcessEventRecord(), genie::HEDISKinematicsGenerator::ProcessEventRecord(), genie::DMELEventGenerator::ProcessEventRecord(), genie::DMDISKinematicsGenerator::ProcessEventRecord(), genie::QELEventGeneratorSM::ProcessEventRecord(), genie::SPPEventGenerator::ProcessEventRecord(), genie::QELEventGeneratorSuSA::SelectLeptonKinematics(), genie::QELKinematicsGenerator::SpectralFuncExperimentalCode(), and genie::DMELKinematicsGenerator::SpectralFuncExperimentalCode().

254 {
255  // check the computed cross section for the current kinematics against the
256  // maximum cross section used in the rejection MC method for the current
257  // interaction at the current energy.
258  if(xsec>xsec_max) {
259  double f = 200*(xsec-xsec_max)/(xsec_max+xsec);
260  if(f>fMaxXSecDiffTolerance) {
261  LOG("Kinematics", pFATAL)
262  << "xsec: (curr) = " << xsec
263  << " > (max) = " << xsec_max << "\n for " << *interaction;
264  LOG("Kinematics", pFATAL)
265  << "*** Exceeding estimated maximum differential cross section";
266  std::terminate();
267  } else {
268  LOG("Kinematics", pWARN)
269  << "xsec: (curr) = " << xsec
270  << " > (max) = " << xsec_max << "\n for " << *interaction;
271  LOG("Kinematics", pWARN)
272  << "*** The fractional deviation of " << f << " % was allowed";
273  }
274  }
275 
276  // this should never happen - print an error mesg just in case...
277  if(xsec<0) {
278  LOG("Kinematics", pERROR)
279  << "Negative cross section for current kinematics!! \n" << *interaction;
280  }
281 }
#define pERROR
Definition: Messenger.h:59
#define pFATAL
Definition: Messenger.h:56
double fMaxXSecDiffTolerance
max{100*(xsec-maxxsec)/.5*(xsec+maxxsec)} if xsec&gt;maxxsec
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pWARN
Definition: Messenger.h:60
void KineGeneratorWithCache::CacheMaxXSec ( const Interaction in,
double  xsec,
const int  nkey = 0 
) const
protectedvirtual

Definition at line 190 of file KineGeneratorWithCache.cxx.

References AccessCacheBranch(), genie::CacheBranchFx::AddValues(), genie::CacheBranchFx::CreateSpline(), Energy(), fEMin, fNumOfInterpolatorTypes, LOG, genie::CacheBranchFx::Map(), pINFO, genie::CacheBranchFx::Spl(), vInterpolatorTypes, and genie::Spline::XMax().

Referenced by MaxXSec().

192 {
193  LOG("Kinematics", pINFO)
194  << "Adding the computed max value to cache";
195  CacheBranchFx * cb = this->AccessCacheBranch(interaction, nkey);
196 
197  double E = this->Energy(interaction);
198  if (E<fEMin) return;
199  if(max_xsec>0) cb->AddValues(E,max_xsec);
200 
201  if(! cb->Spl() ) {
202  if( cb->Map().size() > 40 )
204  }
205 
206  if( cb->Spl() ) {
207  if( E < cb->Spl()->XMin() || E > cb->Spl()->XMax() ) {
209  }
210  }
211 }
void CreateSpline(string type="TSpline3")
int fNumOfInterpolatorTypes
Number of given interpolators types.
void AddValues(double x, double y)
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
Spline * Spl(void) const
Definition: CacheBranchFx.h:59
#define pINFO
Definition: Messenger.h:62
double XMax(void) const
Definition: Spline.h:89
const map< double, double > & Map(void) const
Definition: CacheBranchFx.h:58
virtual CacheBranchFx * AccessCacheBranch(const Interaction *in, const int nkey=0) const
double fEMin
min E for which maxxsec is cached - forcing explicit calc.
virtual double Energy(const Interaction *in) const
A simple cache branch storing the cached data in a TNtuple.
Definition: CacheBranchFx.h:49
std::vector< string > vInterpolatorTypes
Type of interpolator for each key in a branch.
virtual double genie::KineGeneratorWithCache::ComputeMaxXSec ( const Interaction in) const
protectedpure virtual
double KineGeneratorWithCache::ComputeMaxXSec ( const Interaction in,
const int  nkey 
) const
protectedvirtual

Reimplemented in genie::QELEventGeneratorSM.

Definition at line 283 of file KineGeneratorWithCache.cxx.

References ComputeMaxXSec().

284 {
285  if (nkey == 0)
286  {
287  return this->ComputeMaxXSec(in);
288  }
289  else
290  {
291  return -1;
292  }
293 }
virtual double ComputeMaxXSec(const Interaction *in) const =0
double KineGeneratorWithCache::Energy ( const Interaction in) const
protectedvirtual

Reimplemented in genie::COHKinematicsGenerator, genie::SKKinematicsGenerator, genie::DMEKinematicsGenerator, genie::NuEKinematicsGenerator, and genie::HELeptonKinematicsGenerator.

Definition at line 213 of file KineGeneratorWithCache.cxx.

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

Referenced by CacheMaxXSec(), and FindMaxXSec().

214 {
215 // Returns the neutrino energy at the struck nucleon rest frame. Kinematic
216 // generators should override this method if they need to cache the max-xsec
217 // values for another energy value (eg kinematic generators for IMD or COH)
218 
219  const InitialState & init_state = interaction->InitState();
220  double E = init_state.ProbeE(kRfHitNucRest);
221  return E;
222 }
double ProbeE(RefFrame_t rf) const
Initial State information.
Definition: InitialState.h:48
double KineGeneratorWithCache::FindMaxXSec ( const Interaction in,
const int  nkey = 0 
) const
protectedvirtual

Definition at line 105 of file KineGeneratorWithCache.cxx.

References AccessCacheBranch(), Energy(), genie::Spline::Evaluate(), fEMin, LOG, genie::CacheBranchFx::Map(), pINFO, genie::CacheBranchFx::Spl(), genie::Spline::XMax(), and genie::Spline::XMin().

Referenced by MaxXSec().

107 {
108 // Find a cached max xsec for the specified xsec algorithm & interaction and
109 // close to the specified energy
110 
111  // get neutrino energy
112  double E = this->Energy(interaction);
113  LOG("Kinematics", pINFO) << "E = " << E;
114 
115  if(E < fEMin) {
116  LOG("Kinematics", pINFO)
117  << "Below minimum energy - Forcing explicit calculation";
118  return -1.;
119  }
120 
121  // access the the cache branch
122  CacheBranchFx * cb = this->AccessCacheBranch(interaction, nkey);
123 
124  // if there are enough points stored in the cache buffer to build a
125  // spline, then intepolate
126  if( cb->Spl() ) {
127  if( E >= cb->Spl()->XMin() && E <= cb->Spl()->XMax()) {
128  double spl_max_xsec = cb->Spl()->Evaluate(E);
129  LOG("Kinematics", pINFO)
130  << "\nInterpolated: max (E=" << E << ") = " << spl_max_xsec;
131  return spl_max_xsec;
132  }
133  LOG("Kinematics", pINFO)
134  << "Outside spline boundaries - Forcing explicit calculation";
135  return -1.;
136  }
137 
138  // if there are not enough points at the cache buffer to have a spline,
139  // look whether there is another point that is sufficiently close
140  double dE = TMath::Min(0.25, 0.05*E);
141  const map<double,double> & fmap = cb->Map();
142  map<double,double>::const_iterator iter = fmap.lower_bound(E);
143  if(iter != fmap.end()) {
144  if(TMath::Abs(E - iter->first) < dE) return iter->second;
145  }
146 
147  return -1;
148 
149 /*
150  // build the search rule
151  double dE = TMath::Min(0.25, 0.05*E);
152  ostringstream search;
153  search << "(x-" << E << " < " << dE << ") && (x>=" << E << ")";
154 
155  // query for all the entries at a window around the current energy
156  TSQLResult * result = cb->Ntuple()->Query("x:y", search.str().c_str());
157  int nrows = result->GetRowCount();
158  LOG("Kinematics", pDEBUG)
159  << "Found " << nrows << " rows with " << search.str();
160  if(nrows <= 0) {
161  delete result;
162  return -1;
163  }
164 
165  // and now select the entry with the closest energy
166  double max_xsec = -1.0;
167  double Ep = 0;
168  double dEmin = 999;
169  TSQLRow * row = 0;
170  while( (row = result->Next()) ) {
171  double cE = atof( row->GetField(0) );
172  double cxsec = atof( row->GetField(1) );
173  double dE = TMath::Abs(E-cE);
174  if(dE < dEmin) {
175  max_xsec = cxsec;
176  Ep = cE;
177  dEmin = TMath::Min(dE,dEmin);
178  }
179  delete row;
180  }
181  delete result;
182 
183  LOG("Kinematics", pINFO)
184  << "\nRetrieved: max xsec = " << max_xsec << " cached at E = " << Ep;
185 
186  return max_xsec;
187 */
188 }
double Evaluate(double x) const
Definition: Spline.cxx:363
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
Spline * Spl(void) const
Definition: CacheBranchFx.h:59
#define pINFO
Definition: Messenger.h:62
double XMax(void) const
Definition: Spline.h:89
const map< double, double > & Map(void) const
Definition: CacheBranchFx.h:58
virtual CacheBranchFx * AccessCacheBranch(const Interaction *in, const int nkey=0) const
double fEMin
min E for which maxxsec is cached - forcing explicit calc.
virtual double Energy(const Interaction *in) const
A simple cache branch storing the cached data in a TNtuple.
Definition: CacheBranchFx.h:49
double XMin(void) const
Definition: Spline.h:88
double KineGeneratorWithCache::MaxXSec ( GHepRecord evrec,
const int  nkey = 0 
) const
protectedvirtual

Definition at line 57 of file KineGeneratorWithCache.cxx.

References CacheMaxXSec(), ComputeMaxXSec(), genie::GHepRecord::EventFlags(), FindMaxXSec(), fNumOfSafetyFactors, genie::kISkipKinematicChk, genie::kISkipProcessChk, genie::kKineGenErr, genie::kPSNull, LOG, pINFO, pNOTICE, genie::GHepRecord::SetDiffXSec(), genie::exceptions::EVGThreadException::SetReason(), genie::GHepRecord::Summary(), genie::exceptions::EVGThreadException::SwitchOnFastForward(), and vSafetyFactors.

Referenced by genie::COHKinematicsGenerator::CalculateKin_AlvarezRuso(), genie::SKKinematicsGenerator::CalculateKin_AtharSingleKaon(), genie::COHKinematicsGenerator::CalculateKin_BergerSehgal(), genie::COHKinematicsGenerator::CalculateKin_BergerSehgalFM(), genie::COHKinematicsGenerator::CalculateKin_ReinSehgal(), genie::HELeptonKinematicsGenerator::ProcessEventRecord(), genie::DFRKinematicsGenerator::ProcessEventRecord(), genie::NuEKinematicsGenerator::ProcessEventRecord(), genie::DMEKinematicsGenerator::ProcessEventRecord(), genie::QELKinematicsGenerator::ProcessEventRecord(), genie::RESKinematicsGenerator::ProcessEventRecord(), genie::QELEventGenerator::ProcessEventRecord(), genie::DMELKinematicsGenerator::ProcessEventRecord(), genie::IBDKinematicsGenerator::ProcessEventRecord(), genie::DISKinematicsGenerator::ProcessEventRecord(), genie::DMELEventGenerator::ProcessEventRecord(), genie::DMDISKinematicsGenerator::ProcessEventRecord(), genie::QELEventGeneratorSM::ProcessEventRecord(), genie::SPPEventGenerator::ProcessEventRecord(), genie::QELEventGeneratorSuSA::SelectLeptonKinematics(), genie::QELKinematicsGenerator::SpectralFuncExperimentalCode(), and genie::DMELKinematicsGenerator::SpectralFuncExperimentalCode().

58 {
59  LOG("Kinematics", pINFO)
60  << "Getting max. for the rejection method";
61 
62  double xsec_max = -1;
63  Interaction * interaction = event_rec->Summary();
64 
65  LOG("Kinematics", pINFO)
66  << "Attempting to find a cached max value";
67  xsec_max = this->FindMaxXSec(interaction, nkey);
68  if(xsec_max>0) return nkey<=fNumOfSafetyFactors-1?vSafetyFactors[nkey]*xsec_max:xsec_max;
69 
70  LOG("Kinematics", pINFO)
71  << "Attempting to compute the max value";
72  if (nkey == 0)
73  {
74  xsec_max = this->ComputeMaxXSec(interaction);
75  }
76  else
77  {
78  xsec_max = this->ComputeMaxXSec(interaction, nkey);
79  }
80 
81  if(xsec_max>0) {
82  LOG("Kinematics", pINFO) << "max = " << xsec_max;
83  this->CacheMaxXSec(interaction, xsec_max, nkey);
84  return nkey<=fNumOfSafetyFactors-1?vSafetyFactors[nkey]*xsec_max:xsec_max;
85  }
86 
87  LOG("Kinematics", pNOTICE)
88  << "Can not generate event kinematics max_xsec<=0)";
89  // xsec for selected kinematics = 0
90  event_rec->SetDiffXSec(0,kPSNull);
91  // switch on error flag
92  event_rec->EventFlags()->SetBitNumber(kKineGenErr, true);
93  // reset 'trust' bits
94  interaction->ResetBit(kISkipProcessChk);
95  interaction->ResetBit(kISkipKinematicChk);
96  // throw exception
98  exception.SetReason("kinematics generation: max_xsec<=0");
99  exception.SwitchOnFastForward();
100  throw exception;
101 
102  return 0;
103 }
int fNumOfSafetyFactors
Number of given safety factors.
virtual double ComputeMaxXSec(const Interaction *in) const =0
std::vector< double > vSafetyFactors
MaxXSec -&gt; MaxXSec * fSafetyFactors[nkey].
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
#define pINFO
Definition: Messenger.h:62
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks
Definition: Interaction.h:48
virtual double FindMaxXSec(const Interaction *in, const int nkey=0) const
#define pNOTICE
Definition: Messenger.h:61
const UInt_t kISkipProcessChk
if set, skip process validity checks
Definition: Interaction.h:47
virtual void CacheMaxXSec(const Interaction *in, double xsec, const int nkey=0) const

Member Data Documentation

double genie::KineGeneratorWithCache::fEMin
protected
bool genie::KineGeneratorWithCache::fGenerateUniformly
protected

uniform over allowed phase space + event weight?

Definition at line 77 of file KineGeneratorWithCache.h.

Referenced by genie::COHKinematicsGenerator::CalculateKin_AlvarezRuso(), genie::SKKinematicsGenerator::CalculateKin_AtharSingleKaon(), genie::COHKinematicsGenerator::CalculateKin_ReinSehgal(), genie::DFRKinematicsGenerator::LoadConfig(), genie::NuEKinematicsGenerator::LoadConfig(), genie::SKKinematicsGenerator::LoadConfig(), genie::RESKinematicsGenerator::LoadConfig(), genie::COHKinematicsGenerator::LoadConfig(), genie::DMEKinematicsGenerator::LoadConfig(), genie::IBDKinematicsGenerator::LoadConfig(), genie::QELKinematicsGenerator::LoadConfig(), genie::DISKinematicsGenerator::LoadConfig(), genie::QELEventGenerator::LoadConfig(), genie::QELEventGeneratorSuSA::LoadConfig(), genie::DMELKinematicsGenerator::LoadConfig(), genie::DMDISKinematicsGenerator::LoadConfig(), genie::DMELEventGenerator::LoadConfig(), genie::SPPEventGenerator::LoadConfig(), genie::QELEventGeneratorSM::LoadConfig(), genie::HELeptonKinematicsGenerator::ProcessEventRecord(), genie::NuEKinematicsGenerator::ProcessEventRecord(), genie::DFRKinematicsGenerator::ProcessEventRecord(), genie::SKKinematicsGenerator::ProcessEventRecord(), genie::QELKinematicsGenerator::ProcessEventRecord(), genie::DMEKinematicsGenerator::ProcessEventRecord(), genie::RESKinematicsGenerator::ProcessEventRecord(), genie::COHKinematicsGenerator::ProcessEventRecord(), genie::QELEventGenerator::ProcessEventRecord(), genie::IBDKinematicsGenerator::ProcessEventRecord(), genie::DMELKinematicsGenerator::ProcessEventRecord(), genie::DISKinematicsGenerator::ProcessEventRecord(), genie::DMELEventGenerator::ProcessEventRecord(), genie::DMDISKinematicsGenerator::ProcessEventRecord(), genie::QELEventGeneratorSM::ProcessEventRecord(), and genie::SPPEventGenerator::ProcessEventRecord().

double genie::KineGeneratorWithCache::fMaxXSecDiffTolerance
protected
int genie::KineGeneratorWithCache::fNumOfInterpolatorTypes
protected

Number of given interpolators types.

Definition at line 74 of file KineGeneratorWithCache.h.

Referenced by CacheMaxXSec(), and genie::QELEventGeneratorSM::LoadConfig().

int genie::KineGeneratorWithCache::fNumOfSafetyFactors
protected

Number of given safety factors.

Definition at line 72 of file KineGeneratorWithCache.h.

Referenced by genie::QELEventGeneratorSM::LoadConfig(), and MaxXSec().

double genie::KineGeneratorWithCache::fSafetyFactor
protected

ComputeMaxXSec -> ComputeMaxXSec * fSafetyFactor.

Definition at line 70 of file KineGeneratorWithCache.h.

Referenced by genie::RESKinematicsGenerator::ComputeMaxXSec(), genie::HELeptonKinematicsGenerator::ComputeMaxXSec(), genie::IBDKinematicsGenerator::ComputeMaxXSec(), genie::NuEKinematicsGenerator::ComputeMaxXSec(), genie::QELKinematicsGenerator::ComputeMaxXSec(), genie::DMEKinematicsGenerator::ComputeMaxXSec(), genie::QELEventGenerator::ComputeMaxXSec(), genie::SKKinematicsGenerator::ComputeMaxXSec(), genie::DMELKinematicsGenerator::ComputeMaxXSec(), genie::QELEventGeneratorSuSA::ComputeMaxXSec(), genie::DMELEventGenerator::ComputeMaxXSec(), genie::COHKinematicsGenerator::ComputeMaxXSec(), genie::SPPEventGenerator::ComputeMaxXSec(), genie::DFRKinematicsGenerator::LoadConfig(), genie::HELeptonKinematicsGenerator::LoadConfig(), genie::NuEKinematicsGenerator::LoadConfig(), genie::RESKinematicsGenerator::LoadConfig(), genie::SKKinematicsGenerator::LoadConfig(), genie::DMEKinematicsGenerator::LoadConfig(), genie::COHKinematicsGenerator::LoadConfig(), genie::IBDKinematicsGenerator::LoadConfig(), genie::QELKinematicsGenerator::LoadConfig(), genie::DISKinematicsGenerator::LoadConfig(), genie::QELEventGenerator::LoadConfig(), genie::QELEventGeneratorSuSA::LoadConfig(), genie::DMELKinematicsGenerator::LoadConfig(), genie::DMDISKinematicsGenerator::LoadConfig(), genie::HEDISKinematicsGenerator::LoadConfig(), genie::DMELEventGenerator::LoadConfig(), genie::SPPEventGenerator::LoadConfig(), genie::COHKinematicsGenerator::MaxXSec_AlvarezRuso(), and genie::HEDISKinematicsGenerator::ProcessEventRecord().

const XSecAlgorithmI* genie::KineGeneratorWithCache::fXSecModel
mutableprotected

Definition at line 68 of file KineGeneratorWithCache.h.

Referenced by genie::COHKinematicsGenerator::CalculateKin_AlvarezRuso(), genie::SKKinematicsGenerator::CalculateKin_AtharSingleKaon(), genie::COHKinematicsGenerator::CalculateKin_BergerSehgal(), genie::COHKinematicsGenerator::CalculateKin_BergerSehgalFM(), genie::COHKinematicsGenerator::CalculateKin_ReinSehgal(), genie::DFRKinematicsGenerator::ComputeMaxXSec(), genie::RESKinematicsGenerator::ComputeMaxXSec(), genie::HELeptonKinematicsGenerator::ComputeMaxXSec(), genie::QELKinematicsGenerator::ComputeMaxXSec(), genie::IBDKinematicsGenerator::ComputeMaxXSec(), genie::NuEKinematicsGenerator::ComputeMaxXSec(), genie::DMEKinematicsGenerator::ComputeMaxXSec(), genie::DISKinematicsGenerator::ComputeMaxXSec(), genie::QELEventGenerator::ComputeMaxXSec(), genie::SKKinematicsGenerator::ComputeMaxXSec(), genie::DMELKinematicsGenerator::ComputeMaxXSec(), genie::DMDISKinematicsGenerator::ComputeMaxXSec(), genie::QELEventGeneratorSuSA::ComputeMaxXSec(), genie::DMELEventGenerator::ComputeMaxXSec(), genie::COHKinematicsGenerator::ComputeMaxXSec(), genie::QELEventGeneratorSM::ComputeMaxXSec(), genie::SPPEventGenerator::ComputeMaxXSec(), genie::COHKinematicsGenerator::MaxXSec_AlvarezRuso(), genie::COHKinematicsGenerator::MaxXSec_BergerSehgal(), genie::COHKinematicsGenerator::MaxXSec_BergerSehgalFM(), genie::COHKinematicsGenerator::MaxXSec_ReinSehgal(), genie::HELeptonKinematicsGenerator::ProcessEventRecord(), genie::DFRKinematicsGenerator::ProcessEventRecord(), genie::NuEKinematicsGenerator::ProcessEventRecord(), genie::SKKinematicsGenerator::ProcessEventRecord(), genie::DMEKinematicsGenerator::ProcessEventRecord(), genie::QELKinematicsGenerator::ProcessEventRecord(), genie::RESKinematicsGenerator::ProcessEventRecord(), genie::COHKinematicsGenerator::ProcessEventRecord(), genie::QELEventGenerator::ProcessEventRecord(), genie::DMELKinematicsGenerator::ProcessEventRecord(), genie::IBDKinematicsGenerator::ProcessEventRecord(), genie::QELEventGeneratorSuSA::ProcessEventRecord(), genie::DISKinematicsGenerator::ProcessEventRecord(), genie::HEDISKinematicsGenerator::ProcessEventRecord(), genie::DMELEventGenerator::ProcessEventRecord(), genie::DMDISKinematicsGenerator::ProcessEventRecord(), genie::QELEventGeneratorSM::ProcessEventRecord(), genie::SPPEventGenerator::ProcessEventRecord(), genie::HEDISKinematicsGenerator::Scan(), genie::QELEventGeneratorSuSA::SelectLeptonKinematics(), genie::QELKinematicsGenerator::SpectralFuncExperimentalCode(), and genie::DMELKinematicsGenerator::SpectralFuncExperimentalCode().

std::vector<string> genie::KineGeneratorWithCache::vInterpolatorTypes
protected

Type of interpolator for each key in a branch.

Definition at line 73 of file KineGeneratorWithCache.h.

Referenced by CacheMaxXSec(), and genie::QELEventGeneratorSM::LoadConfig().

std::vector<double> genie::KineGeneratorWithCache::vSafetyFactors
protected

MaxXSec -> MaxXSec * fSafetyFactors[nkey].

Definition at line 71 of file KineGeneratorWithCache.h.

Referenced by genie::QELEventGeneratorSM::LoadConfig(), and MaxXSec().


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