GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
KineGeneratorWithCache.h
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \class genie::KineGeneratorWithCache
5 
6 \brief Abstract class. Provides a data caching mechanism for for concrete
7  implementations of the EventRecordVisitorI interface, generating
8  kinematics and wishing to cache maximum differential xsecs.
9 
10  This class provides some common implementation for handling
11  (retrieving, creating, searching, adding to) the cache.
12  The various super-classes should implement the ComputeMaxXSec(...)
13  method for computing the maximum xsec in case it has not already
14  being pushed into the cache at a previous iteration. \n
15 
16  Update May 15, 2022 IK:
17  It makes possible to cache several values having different keys.
18  The example of using this opportunity see in
19  the class QELEventGeneratorSM.
20 
21 \author Costas Andreopoulos <c.andreopoulos \at cern.ch>
22  University of Liverpool \n
23  Igor Kakorin <kakorin@jinr.ru>
24  Joint Institute for Nuclear Research
25 
26 \created December 15, 2004
27 
28 \cpright Copyright (c) 2003-2024, The GENIE Collaboration
29  For the full text of the license visit http://copyright.genie-mc.org
30 */
31 //____________________________________________________________________________
32 
33 #ifndef _KINE_GENERATOR_WITH_CACHE_H_
34 #define _KINE_GENERATOR_WITH_CACHE_H_
35 
36 #include <string>
37 
40 #include "Framework/Utils/Range1.h"
41 
42 using std::string;
43 
44 namespace genie {
45 
46 class CacheBranchFx;
47 class XSecAlgorithmI;
48 
50 
51 protected:
53  KineGeneratorWithCache(string name);
54  KineGeneratorWithCache(string name, string config);
56 
57  virtual double ComputeMaxXSec (const Interaction * in) const = 0;
58  virtual double ComputeMaxXSec (const Interaction * in, const int nkey) const;
59  virtual double MaxXSec (GHepRecord * evrec, const int nkey=0) const;
60  virtual double FindMaxXSec (const Interaction * in, const int nkey=0) const;
61  virtual void CacheMaxXSec (const Interaction * in, double xsec, const int nkey=0) const;
62  virtual double Energy (const Interaction * in) const;
63 
64  virtual CacheBranchFx * AccessCacheBranch (const Interaction * in, const int nkey=0) const;
65 
66  virtual void AssertXSecLimits (const Interaction * in, double xsec, double xsec_max) const;
67 
68  mutable const XSecAlgorithmI * fXSecModel;
69 
70  double fSafetyFactor; ///< ComputeMaxXSec -> ComputeMaxXSec * fSafetyFactor
71  std::vector<double> vSafetyFactors; ///< MaxXSec -> MaxXSec * fSafetyFactors[nkey]
72  int fNumOfSafetyFactors; ///< Number of given safety factors
73  std::vector<string> vInterpolatorTypes; ///< Type of interpolator for each key in a branch
74  int fNumOfInterpolatorTypes; ///< Number of given interpolators types
75  double fMaxXSecDiffTolerance; ///< max{100*(xsec-maxxsec)/.5*(xsec+maxxsec)} if xsec>maxxsec
76  double fEMin; ///< min E for which maxxsec is cached - forcing explicit calc.
77  bool fGenerateUniformly; ///< uniform over allowed phase space + event weight?
78 };
79 
80 } // genie namespace
81 
82 #endif // _KINE_GENERATOR_WITH_CACHE_H_
Cross Section Calculation Interface.
bool fGenerateUniformly
uniform over allowed phase space + event weight?
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the &#39;Visito...
double fSafetyFactor
ComputeMaxXSec -&gt; ComputeMaxXSec * fSafetyFactor.
virtual void AssertXSecLimits(const Interaction *in, double xsec, double xsec_max) const
double fMaxXSecDiffTolerance
max{100*(xsec-maxxsec)/.5*(xsec+maxxsec)} if xsec&gt;maxxsec
int fNumOfSafetyFactors
Number of given safety factors.
virtual double MaxXSec(GHepRecord *evrec, const int nkey=0) const
Abstract class. Provides a data caching mechanism for for concrete implementations of the EventRecord...
int fNumOfInterpolatorTypes
Number of given interpolators types.
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
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
virtual double FindMaxXSec(const Interaction *in, const int nkey=0) const
A simple cache branch storing the cached data in a TNtuple.
Definition: CacheBranchFx.h:49
GENIE&#39;s GHEP MC event record.
Definition: GHepRecord.h:45
std::vector< string > vInterpolatorTypes
Type of interpolator for each key in a branch.
virtual void CacheMaxXSec(const Interaction *in, double xsec, const int nkey=0) const