MINT2
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CachedByEvent< T > Class Template Referenceabstract

#include <CachedByEvent.h>

Inheritance diagram for CachedByEvent< T >:
MINT::IFitParDependent

Public Member Functions

virtual T getNewVal (IDalitzEvent &evt)=0
 
 CachedByEvent ()
 
 CachedByEvent (const CachedByEvent &)
 
getValWithCaching (IDalitzEvent &evt)
 
getValWithCachingPermutation (IDalitzEvent &evt)
 
- Public Member Functions inherited from MINT::IFitParDependent
virtual bool changedSinceLastCall () const =0
 
virtual void rememberFitParValues ()=0
 
virtual const FitParRefoperator[] (unsigned int i) const =0
 
virtual unsigned int size () const =0
 
virtual void listFitParDependencies (std::ostream &os) const =0
 

Protected Member Functions

long int rememberNumber ()
 
long int rememberNumberPermutation (IDalitzEvent &evt)
 
long int configNumber ()
 
recalculate (IDalitzEvent &evt)
 
recalculatePermutation (IDalitzEvent &evt)
 

Protected Attributes

long int _rememberNumber
 
std::vector< long int > _rememberNumberPermutation
 
long int _configNumber
 

Detailed Description

template<typename T>
class CachedByEvent< T >

Definition at line 14 of file CachedByEvent.h.

Constructor & Destructor Documentation

◆ CachedByEvent() [1/2]

template<typename T>
CachedByEvent< T >::CachedByEvent ( )
inline

Definition at line 63 of file CachedByEvent.h.

63 : _rememberNumber(-9999), _configNumber(0){}
long int _configNumber
Definition: CachedByEvent.h:22
long int _rememberNumber
Definition: CachedByEvent.h:20

◆ CachedByEvent() [2/2]

template<typename T>
CachedByEvent< T >::CachedByEvent ( const CachedByEvent< T > &  )
inline

Definition at line 64 of file CachedByEvent.h.

64 : _rememberNumber(-9999), _configNumber(0) {}
long int _configNumber
Definition: CachedByEvent.h:22
long int _rememberNumber
Definition: CachedByEvent.h:20

Member Function Documentation

◆ configNumber()

template<typename T>
long int CachedByEvent< T >::configNumber ( )
inlineprotected

Definition at line 43 of file CachedByEvent.h.

43  {
44  if(_configNumber <= 0) _configNumber=1;
45  return _configNumber;
46  }
long int _configNumber
Definition: CachedByEvent.h:22

◆ getNewVal()

template<typename T>
virtual T CachedByEvent< T >::getNewVal ( IDalitzEvent evt)
pure virtual

Implemented in SF_BtoVP1_VtoTV0_TtoP2P3, SF_BtoVP1_VtoTV0_TtoP2P3_BASE, SF_BtoPP1_PtoVV0_VtoP2P3, SF_BtoPP1_PtoVV0_VtoP2P3_BASE, SF_BtoSP1_StoVV0_VtoP2P3, SF_BtoSP1_StoVV0_VtoP2P3_BASE, SF_BtoPV0_PtoP1V1_V1toP2P3, SF_BtoPV0_PtoP1V1_V1toP2P3_BASE, SF_BtoVP1_VtoSV0_StoP2P3, SF_BtoVP1_VtoSV0_StoP2P3_BASE, SF_BtoVP1_VtoAP2_AtoV0P3, SF_BtoVP1_VtoAP2_AtoV0P3_BASE, SF_BtoPV0_PtoS_StoP2P3, SF_BtoPV0_PtoS_StoP2P3_BASE, SF_BtoPV_PtoP1V0_VtoP2P3, SF_BtoPV_PtoP1V0_VtoP2P3_BASE, SF_BtoPS_PtoP1V0_StoP2P3, SF_BtoPS_PtoP1V0_StoP2P3_BASE, SF_BtoAS_AtoP1V0_StoP2P3, SF_BtoAS_AtoP1V0_StoP2P3_BASE, SF_BtoAV_AtoP1V0_VtoP2P3_D, SF_BtoAV_AtoP1V0_VtoP2P3_P, SF_BtoAV_AtoP1V0_VtoP2P3, SF_BtoAV_AtoP1V0_VtoP2P3_BASE, SF_BtoV1V2_V1toP1V0_V2toP2P3, SF_BtoV1V2_V1toP1V0_V2toP2P3_BASE, SF_BtoAP1_AtoVV0_VtoP2P3, SF_BtoAP1_AtoVV0_VtoP2P3_BASE, SF_BtoV1P1_V1toV2V0_V2toP2P3, SF_BtoV1P1_V1toV2V0_V2toP2P3_BASE, SF_BtoVP1_VtoV0S_StoP2P3, SF_BtoVP1_VtoV0S_StoP2P3_BASE, SF_BtoTV0_TtoVP1_VtoP2P3_P, SF_BtoTV0_TtoVP1_VtoP2P3_BASE, SF_BtoPseudoTV0_PseudoTtoTP1_TtoP2P3_P, SF_BtoPseudoTV0_PseudoTtoTP1_TtoP2P3_BASE, SF_BtoPseudoTV0_PseudoTtoSP1_StoP2P3_P, SF_BtoPseudoTV0_PseudoTtoSP1_StoP2P3_BASE, SF_BtoPseudoTV0_PseudoTtoVP1_VtoP2P3_D, SF_BtoPseudoTV0_PseudoTtoVP1_VtoP2P3_P, SF_BtoPseudoTV0_PseudoTtoVP1_VtoP2P3_BASE, SF_BtoV1V0_V1toV2P1_V2toP2P3_D, SF_BtoV1V0_V1toV2P1_V2toP2P3_P, SF_BtoV1V0_V1toV2P1_V2toP2P3, SF_BtoV1V0_V1toV2P1_V2toP2P3_BASE, SF_BtoAV0_AtoSP1_StoP2P3_D, SF_VtoAP1_AtoV0P2, SF_BtoAV0_AtoSP1_StoP2P3_P, SF_VtoAP1_AtoV0P2_BASE, SF_BtoAV0_AtoSP1_StoP2P3, SF_VtoSV0_StoP2P3, SF_BtoAV0_AtoSP1_StoP2P3_BASE, SF_VtoSV0_StoP2P3_BASE, SF_BtoAV0_AtoVP1_VtoP2P3_D, SF_VtoV0P1_V0toP2P3, SF_BtoAV0_AtoVP1_VtoP2P3_P, SF_VtoV0P1_V0toP2P3_BASE, SF_BtoAV0_AtoVP1Dwave_VtoP2P3_D, Amplitude, SF_AtoSP1_StoP2P3, SF_BtoAV0_AtoVP1Dwave_VtoP2P3_P, SF_AtoSP1_StoP2P3_BASE, SF_BtoAV0_AtoVP1Dwave_VtoP2P3, SF_AtoVP1_VtoP2P3_D, TimePdfIntegrator, SF_BtoAV0_AtoVP1_VtoP2P3, SF_AtoVP1_VtoP2P3, SpinFactor, SF_BtoAV0_AtoVP1_VtoP2P3_BASE, and SF_AtoVP1_VtoP2P3_BASE.

◆ getValWithCaching()

template<typename T>
T CachedByEvent< T >::getValWithCaching ( IDalitzEvent evt)
inline

Definition at line 66 of file CachedByEvent.h.

66  {
67  //return getNewVal(evt); // debug only <<<<<<<<<<<<<<<
69  _configNumber++;
70  return recalculate(evt);
71  }
72 
73  T result;
74  if(! evt.retrieveValue(rememberNumber(), result, configNumber())){
75  return recalculate(evt);
76  }
77  //std::cout << "using cached result" << std::endl;
78 
79  /*
80  // debugging stuff:
81  if(result != getNewVal(evt)){
82  std::cout << "=============================================================" << std::endl;
83  std::cout << "Nothing has changed? Hah! Check: " << result << " == " << getNewVal(evt)
84  << " ?? (" << rememberNumber() << ")" << std::endl;
85  listFitParDependencies(std::cout);
86  std::cout << "=============================================================" << std::endl;
87  }
88  */
89 
90  return result;
91  }
virtual bool changedSinceLastCall() const =0
virtual bool retrieveValue(int i, std::complex< double > &value, long int configNumber)=0
long int _configNumber
Definition: CachedByEvent.h:22
T recalculate(IDalitzEvent &evt)
Definition: CachedByEvent.h:48
long int configNumber()
Definition: CachedByEvent.h:43
long int rememberNumber()
Definition: CachedByEvent.h:24

◆ getValWithCachingPermutation()

template<typename T>
T CachedByEvent< T >::getValWithCachingPermutation ( IDalitzEvent evt)
inline

Definition at line 93 of file CachedByEvent.h.

93  {
94  //return getNewVal(evt); // debug only <<<<<<<<<<<<<<<<<<<
96  if(evt.permutationIndex()==0) _configNumber++;
97  return recalculatePermutation(evt);
98  }
99  T result;
100  if(! evt.retrieveValue(rememberNumberPermutation(evt), result, configNumber())){
101  return recalculatePermutation(evt);
102  }
103  //std::cout << "using cached result" << std::endl;
104 
105  /*
106  // debugging stuff:
107  if(result != getNewVal(evt)){
108  std::cout << "=============================================================" << std::endl;
109  std::cout << "Nothing has changed? Hah! Check: " << result << " == " << getNewVal(evt)
110  << " ?? (" << rememberNumberPermutation(evt) << ")" << std::endl;
111  listFitParDependencies(std::cout);
112  std::cout << "=============================================================" << std::endl;
113  }
114  */
115 
116  return result;
117  }
virtual bool changedSinceLastCall() const =0
long int rememberNumberPermutation(IDalitzEvent &evt)
Definition: CachedByEvent.h:32
virtual bool retrieveValue(int i, std::complex< double > &value, long int configNumber)=0
long int _configNumber
Definition: CachedByEvent.h:22
long int configNumber()
Definition: CachedByEvent.h:43
T recalculatePermutation(IDalitzEvent &evt)
Definition: CachedByEvent.h:55
virtual int permutationIndex() const =0

◆ recalculate()

template<typename T>
T CachedByEvent< T >::recalculate ( IDalitzEvent evt)
inlineprotected

Definition at line 48 of file CachedByEvent.h.

48  {
49  T result(getNewVal(evt));
51  evt.setValue(rememberNumber(), result, configNumber());
52  return result;
53  }
virtual void rememberFitParValues()=0
long int configNumber()
Definition: CachedByEvent.h:43
long int rememberNumber()
Definition: CachedByEvent.h:24
virtual void setValue(int i, const std::complex< double > &value, long int configNumber)=0
virtual T getNewVal(IDalitzEvent &evt)=0

◆ recalculatePermutation()

template<typename T>
T CachedByEvent< T >::recalculatePermutation ( IDalitzEvent evt)
inlineprotected

Definition at line 55 of file CachedByEvent.h.

55  {
56  T result(getNewVal(evt));
58  evt.setValue(rememberNumberPermutation(evt), result, configNumber());
59  return result;
60  }
long int rememberNumberPermutation(IDalitzEvent &evt)
Definition: CachedByEvent.h:32
virtual void rememberFitParValues()=0
long int configNumber()
Definition: CachedByEvent.h:43
virtual void setValue(int i, const std::complex< double > &value, long int configNumber)=0
virtual T getNewVal(IDalitzEvent &evt)=0

◆ rememberNumber()

template<typename T>
long int CachedByEvent< T >::rememberNumber ( )
inlineprotected

Definition at line 24 of file CachedByEvent.h.

24  {
25  if(_rememberNumber < 0){
27  std::cout << "just assigned _rememberNumber "<< _rememberNumber << std::endl;
28  }
29  return _rememberNumber;
30  }
static long int assignUniqueRememberNumber()
Definition: DalitzEvent.cpp:29
long int _rememberNumber
Definition: CachedByEvent.h:20

◆ rememberNumberPermutation()

template<typename T>
long int CachedByEvent< T >::rememberNumberPermutation ( IDalitzEvent evt)
inlineprotected

Definition at line 32 of file CachedByEvent.h.

32  {
33  if(_rememberNumberPermutation.size() <
34  static_cast<unsigned int>(evt.numPermutations())){
36  for(unsigned int i=0; i < static_cast<unsigned int>(evt.numPermutations()); i++)
38 
39  }
41  }
static long int assignUniqueRememberNumber()
Definition: DalitzEvent.cpp:29
virtual int numPermutations() const =0
virtual int permutationIndex() const =0
std::vector< long int > _rememberNumberPermutation
Definition: CachedByEvent.h:21

Member Data Documentation

◆ _configNumber

template<typename T>
long int CachedByEvent< T >::_configNumber
protected

Definition at line 22 of file CachedByEvent.h.

◆ _rememberNumber

template<typename T>
long int CachedByEvent< T >::_rememberNumber
protected

Definition at line 20 of file CachedByEvent.h.

◆ _rememberNumberPermutation

template<typename T>
std::vector<long int> CachedByEvent< T >::_rememberNumberPermutation
protected

Definition at line 21 of file CachedByEvent.h.


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