ATLAS Offline Software
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
Pythia8_UserHooks::UserSetting< T > Class Template Reference

#include <UserSetting.h>

Collaboration diagram for Pythia8_UserHooks::UserSetting< T >:

Public Member Functions

 UserSetting (const std::string &name, const T &defaultValue)
 
operator() (Pythia8::Settings *settingsPtr)
 

Protected Attributes

std::string m_paramName
 
m_param
 
Pythia8::Settings * m_settingsPtr
 
bool m_retrieved
 

Private Member Functions

uncachedRetrieve ()
 
double uncachedRetrieve ()
 
int uncachedRetrieve ()
 
bool uncachedRetrieve ()
 
std::string uncachedRetrieve ()
 

Detailed Description

template<class T>
class Pythia8_UserHooks::UserSetting< T >

Definition at line 18 of file UserSetting.h.

Constructor & Destructor Documentation

◆ UserSetting()

template<class T >
Pythia8_UserHooks::UserSetting< T >::UserSetting ( const std::string &  name,
const T &  defaultValue 
)
inline

Definition at line 22 of file UserSetting.h.

22  :
24  m_param(defaultValue),
25  m_settingsPtr(0),
26  m_retrieved(false){
27 
28  typename std::map<std::string, T>::const_iterator test = UserHooksFactory::userSettings<T>().find(m_paramName);
29  if(test != UserHooksFactory::userSettings<T>().end()) throw std::runtime_error("Duplicate user-defined setting already exists: " + m_paramName);
30  UserHooksFactory::userSettings<T>()[m_paramName] = defaultValue;
31 
32  }

Member Function Documentation

◆ operator()()

template<class T >
T Pythia8_UserHooks::UserSetting< T >::operator() ( Pythia8::Settings *  settingsPtr)
inline

Definition at line 34 of file UserSetting.h.

34  {
35 
36  if(m_settingsPtr == 0 && settingsPtr == 0) throw std::runtime_error("settingsPtr is not yet initialised!");
37 
38  if(m_retrieved && m_settingsPtr == settingsPtr) return m_param;
39 
40  m_settingsPtr = settingsPtr;
42  m_retrieved = true;
43  return m_param;
44  };

◆ uncachedRetrieve() [1/5]

template<class T >
T Pythia8_UserHooks::UserSetting< T >::uncachedRetrieve ( )
private

◆ uncachedRetrieve() [2/5]

double Pythia8_UserHooks::UserSetting< double >::uncachedRetrieve ( )
inlineprivate

Definition at line 60 of file UserSetting.h.

60  {
61  if(m_settingsPtr->isParm(m_paramName)){
62  return m_settingsPtr->parm(m_paramName);
63  }
64 
65  throw std::runtime_error("UserSetting " + m_paramName + " does not exist!");
66  return m_param;
67  }

◆ uncachedRetrieve() [3/5]

int Pythia8_UserHooks::UserSetting< int >::uncachedRetrieve ( )
inlineprivate

Definition at line 70 of file UserSetting.h.

70  {
71  if(m_settingsPtr->isMode(m_paramName)){
72  return m_settingsPtr->mode(m_paramName);
73  }
74 
75  throw std::runtime_error("UserSetting " + m_paramName + " does not exist!");
76  return m_param;
77  }

◆ uncachedRetrieve() [4/5]

bool Pythia8_UserHooks::UserSetting< bool >::uncachedRetrieve ( )
inlineprivate

Definition at line 80 of file UserSetting.h.

80  {
81  if(m_settingsPtr->isFlag(m_paramName)){
82  return m_settingsPtr->flag(m_paramName);
83  }
84 
85  throw std::runtime_error("UserSetting " + m_paramName + " does not exist!");
86  return m_param;
87  }

◆ uncachedRetrieve() [5/5]

std::string Pythia8_UserHooks::UserSetting< std::string >::uncachedRetrieve ( )
inlineprivate

Definition at line 91 of file UserSetting.h.

91  {
92  if(m_settingsPtr->isWord(m_paramName)){
93  return m_settingsPtr->word(m_paramName);
94  }
95 
96  throw std::runtime_error("UserSetting " + m_paramName + " does not exist!");
97  return m_param;
98  }

Member Data Documentation

◆ m_param

template<class T >
T Pythia8_UserHooks::UserSetting< T >::m_param
protected

Definition at line 49 of file UserSetting.h.

◆ m_paramName

template<class T >
std::string Pythia8_UserHooks::UserSetting< T >::m_paramName
protected

Definition at line 48 of file UserSetting.h.

◆ m_retrieved

template<class T >
bool Pythia8_UserHooks::UserSetting< T >::m_retrieved
protected

Definition at line 51 of file UserSetting.h.

◆ m_settingsPtr

template<class T >
Pythia8::Settings* Pythia8_UserHooks::UserSetting< T >::m_settingsPtr
protected

Definition at line 50 of file UserSetting.h.


The documentation for this class was generated from the following file:
TrigInDetValidation_Base.test
test
Definition: TrigInDetValidation_Base.py:147
Pythia8_UserHooks::UserSetting::m_settingsPtr
Pythia8::Settings * m_settingsPtr
Definition: UserSetting.h:50
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
Pythia8_UserHooks::UserSetting::m_paramName
std::string m_paramName
Definition: UserSetting.h:44
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Pythia8_UserHooks::UserSetting::m_retrieved
bool m_retrieved
Definition: UserSetting.h:51
Pythia8_UserHooks::UserSetting::uncachedRetrieve
T uncachedRetrieve()
Pythia8_UserHooks::UserSetting::m_param
T m_param
Definition: UserSetting.h:49