All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
ana::CutVarCache< T, U, V > Class Template Reference

Helper for HandleRecord. More...

Public Member Functions

 CutVarCache ()
 
Get (const U &var, const V *sr)
 

Protected Attributes

std::vector< T > fVals
 
std::vector< bool > fValsSet
 

Detailed Description

template<class T, class U, class V>
class ana::CutVarCache< T, U, V >

Helper for HandleRecord.

Definition at line 150 of file SpectrumLoader.cxx.

Constructor & Destructor Documentation

template<class T, class U, class V>
ana::CutVarCache< T, U, V >::CutVarCache ( )
inline

Definition at line 153 of file SpectrumLoader.cxx.

153 : fVals(U::MaxID()+1), fValsSet(U::MaxID()+1, false) {}
std::vector< T > fVals
std::vector< bool > fValsSet

Member Function Documentation

template<class T, class U, class V>
T ana::CutVarCache< T, U, V >::Get ( const U &  var,
const V sr 
)
inline

Definition at line 155 of file SpectrumLoader.cxx.

156  {
157  const unsigned int id = var.ID();
158 
159  if(fValsSet[id]){
160  return fVals[id];
161  }
162  else{
163  const T val = var(sr);
164  fVals[id] = val;
165  fValsSet[id] = true;
166  return val;
167  }
168  }
std::vector< T > fVals
std::vector< bool > fValsSet

Member Data Documentation

template<class T, class U, class V>
std::vector<T> ana::CutVarCache< T, U, V >::fVals
protected

Definition at line 172 of file SpectrumLoader.cxx.

template<class T, class U, class V>
std::vector<bool> ana::CutVarCache< T, U, V >::fValsSet
protected

Definition at line 173 of file SpectrumLoader.cxx.


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