ATLAS Offline Software
Public Types | Public Member Functions | Public Attributes | Private Member Functions | List of all members
TrigConf::TrigDBConnectionConfig Class Reference

#include <TrigDBConnectionConfig.h>

Collaboration diagram for TrigConf::TrigDBConnectionConfig:

Public Types

enum  DBType { Oracle, MySQL, SQLite, DBLookup }
 
typedef std::pair< unsigned int, unsigned int > LumiPSPair
 
typedef std::vector< LumiPSPairPSKeys
 

Public Member Functions

 TrigDBConnectionConfig ()=default
 
 TrigDBConnectionConfig (const std::string &connectionStr)
 
 TrigDBConnectionConfig (DBType type, const std::string &server, unsigned int smKey, unsigned int hltPsKey)
 
 TrigDBConnectionConfig (DBType type, const std::string &server, unsigned int smKey, const PSKeys &hltPsKeyStr)
 
 TrigDBConnectionConfig (DBType type, const std::string &server, unsigned int smKey, const std::string &hltPsKeyStr)
 
void diggestStr (const std::string &str)
 
void setTypeFromStr (const std::string &typeStr)
 
void setSmKeyFromStr (const std::string &smKeyStr)
 
void setHltKeysFromStr (const std::string &hltKeyStr)
 
void setLvl1KeyFromStr (const std::string &lvl1KeyStr)
 
void setRetrialPeriodFromStr (const std::string &retrialPeriodStr)
 
void setMaxRetrialsFromStr (const std::string &maxRetrialsStr)
 
void setUseFrontierFromStr (const std::string &useFrontier)
 
std::string toString () const
 
std::string typeToString () const
 
std::string hltKeysToString () const
 

Public Attributes

DBType m_type {DBLookup}
 
std::string m_server
 
unsigned int m_smkey {0}
 
unsigned int m_hltkey {0}
 
PSKeys m_hltkeys
 
unsigned int m_lvl1key {0}
 
std::string m_schema
 
std::string m_user
 
std::string m_password
 
unsigned int m_retrialPeriod {0}
 
unsigned int m_maxRetrials {1}
 
bool m_useFrontier {false}
 

Private Member Functions

 TrigDBConnectionConfig (DBType type, const std::string &server, unsigned int smKey)
 

Detailed Description

Definition at line 21 of file TrigDBConnectionConfig.h.

Member Typedef Documentation

◆ LumiPSPair

typedef std::pair<unsigned int, unsigned int> TrigConf::TrigDBConnectionConfig::LumiPSPair

Definition at line 25 of file TrigDBConnectionConfig.h.

◆ PSKeys

Definition at line 26 of file TrigDBConnectionConfig.h.

Member Enumeration Documentation

◆ DBType

Enumerator
Oracle 
MySQL 
SQLite 
DBLookup 

Definition at line 24 of file TrigDBConnectionConfig.h.

Constructor & Destructor Documentation

◆ TrigDBConnectionConfig() [1/6]

TrigConf::TrigDBConnectionConfig::TrigDBConnectionConfig ( )
default

◆ TrigDBConnectionConfig() [2/6]

TrigConf::TrigDBConnectionConfig::TrigDBConnectionConfig ( const std::string &  connectionStr)

Definition at line 178 of file TrigDBConnectionConfig.cxx.

180 {
181  diggestStr(connectionStr);
182 }

◆ TrigDBConnectionConfig() [3/6]

TrigConf::TrigDBConnectionConfig::TrigDBConnectionConfig ( DBType  type,
const std::string &  server,
unsigned int  smKey,
unsigned int  hltPsKey 
)
inline

Definition at line 96 of file TrigDBConnectionConfig.h.

102 {
103  m_hltkey = hltPsKey;
104 }

◆ TrigDBConnectionConfig() [4/6]

TrigConf::TrigDBConnectionConfig::TrigDBConnectionConfig ( DBType  type,
const std::string &  server,
unsigned int  smKey,
const PSKeys hltPsKeyStr 
)
inline

Definition at line 107 of file TrigDBConnectionConfig.h.

113 {
114  m_hltkeys = hltPsKeys;
115 }

◆ TrigDBConnectionConfig() [5/6]

TrigConf::TrigDBConnectionConfig::TrigDBConnectionConfig ( DBType  type,
const std::string &  server,
unsigned int  smKey,
const std::string &  hltPsKeyStr 
)

Definition at line 167 of file TrigDBConnectionConfig.cxx.

173 {
174  setHltKeysFromStr(hltPsKeyStr);
175 }

◆ TrigDBConnectionConfig() [6/6]

TrigConf::TrigDBConnectionConfig::TrigDBConnectionConfig ( DBType  type,
const std::string &  server,
unsigned int  smKey 
)
inlineprivate

Definition at line 85 of file TrigDBConnectionConfig.h.

89  : m_type(type)
90  , m_server(server)
91  , m_smkey(smKey)
92 {
93 }

Member Function Documentation

◆ diggestStr()

void TrigConf::TrigDBConnectionConfig::diggestStr ( const std::string &  str)

Definition at line 208 of file TrigDBConnectionConfig.cxx.

209 {
210  string val;
211 
212  // for each attribute, if a value was provided in the connectionString, set it
213  if(!(val = extractValue(TYPE, str)).empty())
215  if(!(val = extractValue(SERVER, str)).empty())
216  m_server = val;
217  if(!(val = extractValue(SMKEY, str)).empty())
219  if(!(val = extractValue(LVL1KEY, str)).empty())
221  if(!(val = extractValue(SCHEMA, str)).empty())
222  m_schema = val;
223  if(!(val = extractValue(USER, str)).empty())
224  m_user = val;
225  if(!(val = extractValue(PWD, str)).empty())
226  m_password = val;
227  if(!(val = extractValue(RETRPER, str)).empty())
229  if(!(val = extractValue(MAXRETR, str)).empty())
231  if(!(val = extractValue(USEFRONT, str)).empty())
233 
234  // only one of the following should be specified
235  if(!(val = extractValue(HLTKEY, str)).empty())
237  if(!m_hltkey && !(val = extractValue(HLTKEYS, str)).empty())
239 }

◆ hltKeysToString()

string TrigConf::TrigDBConnectionConfig::hltKeysToString ( ) const

Definition at line 300 of file TrigDBConnectionConfig.cxx.

301 {
302  ostringstream oss;
303 
304  oss << '[';
305  for(PSKeys::const_iterator it = m_hltkeys.begin();
306  it != m_hltkeys.end(); ++it)
307  {
308  if(it != m_hltkeys.begin())
309  oss << ',';
310  oss << '(' << it->first << ',' << it->second << ')';
311  }
312  oss << ']';
313 
314  return oss.str();
315 }

◆ setHltKeysFromStr()

void TrigConf::TrigDBConnectionConfig::setHltKeysFromStr ( const std::string &  hltKeyStr)

Definition at line 257 of file TrigDBConnectionConfig.cxx.

258 {
259  if(regex_match(hltKeyStr, re_uint))
260  m_hltkey = stoi(hltKeyStr, nullptr, 0);
261  else
262  m_hltkeys = parseHltPsKeys(hltKeyStr);
263 }

◆ setLvl1KeyFromStr()

void TrigConf::TrigDBConnectionConfig::setLvl1KeyFromStr ( const std::string &  lvl1KeyStr)

Definition at line 273 of file TrigDBConnectionConfig.cxx.

274 {
275  m_lvl1key = getUInt(lvl1KeyStr, LVL1KEY);
276 }

◆ setMaxRetrialsFromStr()

void TrigConf::TrigDBConnectionConfig::setMaxRetrialsFromStr ( const std::string &  maxRetrialsStr)

Definition at line 286 of file TrigDBConnectionConfig.cxx.

288 {
289  m_maxRetrials = getUInt(maxRetrialsStr, MAXRETR);
290 }

◆ setRetrialPeriodFromStr()

void TrigConf::TrigDBConnectionConfig::setRetrialPeriodFromStr ( const std::string &  retrialPeriodStr)

Definition at line 279 of file TrigDBConnectionConfig.cxx.

281 {
282  m_retrialPeriod = getUInt(retrialPeriodStr, RETRPER);
283 }

◆ setSmKeyFromStr()

void TrigConf::TrigDBConnectionConfig::setSmKeyFromStr ( const std::string &  smKeyStr)

Definition at line 266 of file TrigDBConnectionConfig.cxx.

267 {
268  m_smkey = getUInt(smKeyStr, SMKEY);
269 }

◆ setTypeFromStr()

void TrigConf::TrigDBConnectionConfig::setTypeFromStr ( const std::string &  typeStr)

Definition at line 242 of file TrigDBConnectionConfig.cxx.

243 {
244  string low = algorithm::to_lower_copy(typeStr);
245  if(low == "oracle")
246  m_type = Oracle;
247  else if(low == "mysql")
248  m_type = MySQL;
249  else if(low == "sqlite")
250  m_type = SQLite;
251  else
252  m_type = DBLookup;
253 }

◆ setUseFrontierFromStr()

void TrigConf::TrigDBConnectionConfig::setUseFrontierFromStr ( const std::string &  useFrontier)

Definition at line 293 of file TrigDBConnectionConfig.cxx.

295 {
296  m_useFrontier = static_cast<bool>(getUInt(useFrontier, USEFRONT));
297 }

◆ toString()

string TrigConf::TrigDBConnectionConfig::toString ( ) const

Definition at line 185 of file TrigDBConnectionConfig.cxx.

186 {
187  ostringstream oss;
188  outputParam(oss, TYPE, typeToString(), true);
189  outputParam(oss, SERVER, m_server);
190  outputParam(oss, SMKEY, m_smkey);
191  outputParam(oss, LVL1KEY, m_lvl1key);
192  outputParam(oss, SCHEMA, m_schema);
193  outputParam(oss, USER, m_user);
194  outputParam(oss, PWD, m_password);
195  outputParam(oss, RETRPER, m_retrialPeriod);
196  outputParam(oss, MAXRETR, m_maxRetrials);
197  outputParam(oss, USEFRONT, m_useFrontier);
198 
199  if(m_hltkey)
200  outputParam(oss, HLTKEY, m_hltkey);
201  else
202  outputParam(oss, HLTKEYS, hltKeysToString());
203 
204  return oss.str();
205 }

◆ typeToString()

std::string TrigConf::TrigDBConnectionConfig::typeToString ( ) const
inline

Definition at line 118 of file TrigDBConnectionConfig.h.

119 {
120  switch(m_type)
121  {
122  case Oracle: return "oracle";
123  case MySQL: return "mysql";
124  case SQLite: return "sqlite";
125  case DBLookup: return "dblookup";
126  }
127 
128  return "UnknownType!";
129 }

Member Data Documentation

◆ m_hltkey

unsigned int TrigConf::TrigDBConnectionConfig::m_hltkey {0}

Definition at line 65 of file TrigDBConnectionConfig.h.

◆ m_hltkeys

PSKeys TrigConf::TrigDBConnectionConfig::m_hltkeys

Definition at line 66 of file TrigDBConnectionConfig.h.

◆ m_lvl1key

unsigned int TrigConf::TrigDBConnectionConfig::m_lvl1key {0}

Definition at line 67 of file TrigDBConnectionConfig.h.

◆ m_maxRetrials

unsigned int TrigConf::TrigDBConnectionConfig::m_maxRetrials {1}

Definition at line 72 of file TrigDBConnectionConfig.h.

◆ m_password

std::string TrigConf::TrigDBConnectionConfig::m_password

Definition at line 70 of file TrigDBConnectionConfig.h.

◆ m_retrialPeriod

unsigned int TrigConf::TrigDBConnectionConfig::m_retrialPeriod {0}

Definition at line 71 of file TrigDBConnectionConfig.h.

◆ m_schema

std::string TrigConf::TrigDBConnectionConfig::m_schema

Definition at line 68 of file TrigDBConnectionConfig.h.

◆ m_server

std::string TrigConf::TrigDBConnectionConfig::m_server

Definition at line 63 of file TrigDBConnectionConfig.h.

◆ m_smkey

unsigned int TrigConf::TrigDBConnectionConfig::m_smkey {0}

Definition at line 64 of file TrigDBConnectionConfig.h.

◆ m_type

DBType TrigConf::TrigDBConnectionConfig::m_type {DBLookup}

Definition at line 62 of file TrigDBConnectionConfig.h.

◆ m_useFrontier

bool TrigConf::TrigDBConnectionConfig::m_useFrontier {false}

Definition at line 73 of file TrigDBConnectionConfig.h.

◆ m_user

std::string TrigConf::TrigDBConnectionConfig::m_user

Definition at line 69 of file TrigDBConnectionConfig.h.


The documentation for this class was generated from the following files:
TrigConf::TrigDBConnectionConfig::m_smkey
unsigned int m_smkey
Definition: TrigDBConnectionConfig.h:64
TrigConf::TrigDBConnectionConfig::m_maxRetrials
unsigned int m_maxRetrials
Definition: TrigDBConnectionConfig.h:72
TrigConf::TrigDBConnectionConfig::m_schema
std::string m_schema
Definition: TrigDBConnectionConfig.h:68
TrigConf::TrigDBConnectionConfig::m_lvl1key
unsigned int m_lvl1key
Definition: TrigDBConnectionConfig.h:67
TrigConf::TrigDBConnectionConfig::m_useFrontier
bool m_useFrontier
Definition: TrigDBConnectionConfig.h:73
TrigConf::TrigDBConnectionConfig::setHltKeysFromStr
void setHltKeysFromStr(const std::string &hltKeyStr)
Definition: TrigDBConnectionConfig.cxx:257
python.utils.AtlRunQueryDQUtils.SERVER
string SERVER
Definition: AtlRunQueryDQUtils.py:25
TrigConf::TrigDBConnectionConfig::m_server
std::string m_server
Definition: TrigDBConnectionConfig.h:63
skel.it
it
Definition: skel.GENtoEVGEN.py:396
TrigConf::TrigDBConnectionConfig::Oracle
@ Oracle
Definition: TrigDBConnectionConfig.h:24
TrigConf::TrigDBConnectionConfig::setLvl1KeyFromStr
void setLvl1KeyFromStr(const std::string &lvl1KeyStr)
Definition: TrigDBConnectionConfig.cxx:273
TrigConf::TrigDBConnectionConfig::hltKeysToString
std::string hltKeysToString() const
Definition: TrigDBConnectionConfig.cxx:300
TrigConf::TrigDBConnectionConfig::typeToString
std::string typeToString() const
Definition: TrigDBConnectionConfig.h:118
TrigConf::TrigDBConnectionConfig::setTypeFromStr
void setTypeFromStr(const std::string &typeStr)
Definition: TrigDBConnectionConfig.cxx:242
empty
bool empty(TH1 *h)
Definition: computils.cxx:295
TrigConf::TrigDBConnectionConfig::TrigDBConnectionConfig
TrigDBConnectionConfig()=default
TrigConf::TrigDBConnectionConfig::m_type
DBType m_type
Definition: TrigDBConnectionConfig.h:62
TrigConf::TrigDBConnectionConfig::m_hltkey
unsigned int m_hltkey
Definition: TrigDBConnectionConfig.h:65
TrigConf::TrigDBConnectionConfig::m_password
std::string m_password
Definition: TrigDBConnectionConfig.h:70
TrigConf::TrigDBConnectionConfig::m_retrialPeriod
unsigned int m_retrialPeriod
Definition: TrigDBConnectionConfig.h:71
TrigConf::TrigDBConnectionConfig::setRetrialPeriodFromStr
void setRetrialPeriodFromStr(const std::string &retrialPeriodStr)
Definition: TrigDBConnectionConfig.cxx:280
TrigConf::TrigDBConnectionConfig::setMaxRetrialsFromStr
void setMaxRetrialsFromStr(const std::string &maxRetrialsStr)
Definition: TrigDBConnectionConfig.cxx:287
TrigConf::TrigDBConnectionConfig::setUseFrontierFromStr
void setUseFrontierFromStr(const std::string &useFrontier)
Definition: TrigDBConnectionConfig.cxx:294
TrigConf::TrigDBConnectionConfig::MySQL
@ MySQL
Definition: TrigDBConnectionConfig.h:24
TYPE
#define TYPE(CODE, TYP, IOTYP)
TrigConf::TrigDBConnectionConfig::SQLite
@ SQLite
Definition: TrigDBConnectionConfig.h:24
TrigConf::TrigDBConnectionConfig::diggestStr
void diggestStr(const std::string &str)
Definition: TrigDBConnectionConfig.cxx:208
TrigConf::TrigDBConnectionConfig::m_hltkeys
PSKeys m_hltkeys
Definition: TrigDBConnectionConfig.h:66
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TrigConf::TrigDBConnectionConfig::DBLookup
@ DBLookup
Definition: TrigDBConnectionConfig.h:24
str
Definition: BTagTrackIpAccessor.cxx:11
TrigConf::TrigDBConnectionConfig::setSmKeyFromStr
void setSmKeyFromStr(const std::string &smKeyStr)
Definition: TrigDBConnectionConfig.cxx:266
TrigConf::TrigDBConnectionConfig::m_user
std::string m_user
Definition: TrigDBConnectionConfig.h:69
python.html.AtlRunQueryDQSummary.server
server
Definition: AtlRunQueryDQSummary.py:22