ATLAS Offline Software
Static Public Member Functions | Private Member Functions | List of all members
VP1QtUtils Class Reference

#include <VP1QtUtils.h>

Collaboration diagram for VP1QtUtils:

Static Public Member Functions

static bool expertSettingIsSet (const QString &type, const QString &name)
 
static QString expertSettingValue (const QString &type, const QString &name)
 
static bool expertSettingIsOn (const QString &type, const QString &name)
 
static void setExpertSetting (const QString &type, const QString &name, const QString &content)
 
static bool environmentVariableIsSet (const QString &name)
 
static QString environmentVariableValue (const QString &name)
 
static bool environmentVariableIsOn (const QString &name)
 
static void setEnvironmentVariable (const QString &name, const QString &content)
 
static void unsetEnvironmentVariable (const QString &name)
 
static QImage fadeImage (QImage img0, QImage img1, double fadefact)
 

Private Member Functions

 VP1QtUtils ()
 
 ~VP1QtUtils ()
 

Detailed Description

Definition at line 24 of file VP1QtUtils.h.

Constructor & Destructor Documentation

◆ VP1QtUtils()

VP1QtUtils::VP1QtUtils ( )
private

◆ ~VP1QtUtils()

VP1QtUtils::~VP1QtUtils ( )
private

Member Function Documentation

◆ environmentVariableIsOn()

bool VP1QtUtils::environmentVariableIsOn ( const QString &  name)
static

Definition at line 127 of file VP1QtUtils.cxx.

128 {
129  QByteArray env = qgetenv(name.toStdString().c_str());
130  QString val(env.isNull() ? "" : QString ( env ));
131  bool ison = true;
132  if (val==""||val=="0")
133  ison = false;
134  else if (0==QString::compare(val,"false",Qt::CaseInsensitive))
135  ison = false;
136  else if (0==QString::compare(val,"off",Qt::CaseInsensitive))
137  ison = false;
138  else if (0==QString::compare(val,"no",Qt::CaseInsensitive))
139  ison = false;
140  if (VP1Msg::verbose())
141  VP1Msg::messageVerbose("VP1QtUtils::environmentVariableIsOn called for variable '"+name+"'. Returning "+ VP1Msg::str(ison)+".");
142  return ison;
143 }

◆ environmentVariableIsSet()

bool VP1QtUtils::environmentVariableIsSet ( const QString &  name)
static

Definition at line 108 of file VP1QtUtils.cxx.

109 {
110  const bool set = !qgetenv(name.toStdString().c_str()).isNull();
111  if (VP1Msg::verbose())
112  VP1Msg::messageVerbose("VP1QtUtils::environmentVariableIsSet called for variable '"+name+"'. Returning "+VP1Msg::str(set));
113  return set;
114 }

◆ environmentVariableValue()

QString VP1QtUtils::environmentVariableValue ( const QString &  name)
static

Definition at line 117 of file VP1QtUtils.cxx.

118 {
119  QByteArray env = qgetenv(name.toStdString().c_str());
120  QString val(env.isNull() ? "" : QString ( env ));
121  if (VP1Msg::verbose())
122  VP1Msg::messageVerbose("VP1QtUtils::environmentVariableValue called for variable '"+name+"'. Returning '"+ val+"'.");
123  return val;
124 }

◆ expertSettingIsOn()

bool VP1QtUtils::expertSettingIsOn ( const QString &  type,
const QString &  name 
)
static

Definition at line 60 of file VP1QtUtils.cxx.

61 {
62  QString env;
63  if(type=="general"){
64  QSettings generalSettings("ATLAS", "VP1Light");
65  env = generalSettings.value(name).toString();
66  } else {
67  QSettings expertSettings(QCoreApplication::applicationDirPath()+"/../vp1.ini", QSettings::NativeFormat);
68  env = expertSettings.value(name).toString();
69  }
70  QString val(env.isNull() ? "" : env );
71  bool ison = true;
72  if (val==""||val=="0")
73  ison = false;
74  else if (0==QString::compare(val,"false",Qt::CaseInsensitive))
75  ison = false;
76  else if (0==QString::compare(val,"off",Qt::CaseInsensitive))
77  ison = false;
78  else if (0==QString::compare(val,"no",Qt::CaseInsensitive))
79  ison = false;
80  if (VP1Msg::verbose())
81  VP1Msg::messageVerbose("VP1QtUtils::expertSettingIsOn called for variable '"+name+"'. Returning "+ VP1Msg::str(ison)+".");
82  return ison;
83 }

◆ expertSettingIsSet()

bool VP1QtUtils::expertSettingIsSet ( const QString &  type,
const QString &  name 
)
static

Definition at line 27 of file VP1QtUtils.cxx.

28 {
29  bool set;
30  if(type=="general"){
31  QSettings generalSettings("ATLAS", "VP1Light");
32  set = !generalSettings.value(name).toString().isEmpty();
33  } else {
34  QSettings expertSettings(QCoreApplication::applicationDirPath()+"/../vp1.ini", QSettings::NativeFormat);
35  set = !expertSettings.value(name).toString().isEmpty();
36  }
37  if (VP1Msg::verbose())
38  VP1Msg::messageVerbose("VP1QtUtils::expertSettingIsSet called for variable '"+name+"'. Returning "+VP1Msg::str(set));
39  return set;
40 }

◆ expertSettingValue()

QString VP1QtUtils::expertSettingValue ( const QString &  type,
const QString &  name 
)
static

Definition at line 43 of file VP1QtUtils.cxx.

44 {
45  QString env;
46  if(type=="general"){
47  QSettings generalSettings("ATLAS", "VP1Light");
48  env = generalSettings.value(name).toString();
49  } else {
50  QSettings expertSettings(QCoreApplication::applicationDirPath()+"/../vp1.ini", QSettings::NativeFormat);
51  env = expertSettings.value(name).toString();
52  }
53  QString val(env.isNull() ? "" : env);
54  if (VP1Msg::verbose())
55  VP1Msg::messageVerbose("VP1QtUtils::expertSettingValue called for variable '"+name+"'. Returning '"+ val+"'.");
56  return val;
57 }

◆ fadeImage()

QImage VP1QtUtils::fadeImage ( QImage  img0,
QImage  img1,
double  fadefact 
)
static

Definition at line 176 of file VP1QtUtils.cxx.

176  {
177  if (fadefact<0.0||fadefact>1.0||img0.isNull()||img1.isNull()||img0.width()!=img1.width()||img0.height()!=img1.height())
178  return QImage();
179  if (fadefact==0)
180  return img0;
181  if (fadefact==1)
182  return img1;
183  QImage img = img0;
184  double oneminusfadefact(1.0-fadefact);
185  const int w(img.width()), h(img.height());
186  for (int iw = 0; iw<w; ++iw)
187  for (int ih = 0; ih<h; ++ih) {
188  QColor col0(img0.pixel(iw,ih));
189  QColor col1(img1.pixel(iw,ih));
190  img.setPixel ( iw,ih,QColor::fromRgbF(col0.redF()*oneminusfadefact + col1.redF()*fadefact,
191  col0.greenF()*oneminusfadefact + col1.greenF()*fadefact,
192  col0.blueF()*oneminusfadefact + col1.blueF()*fadefact).rgb() );
193  }
194  return img;
195 }

◆ setEnvironmentVariable()

void VP1QtUtils::setEnvironmentVariable ( const QString &  name,
const QString &  content 
)
static

Definition at line 146 of file VP1QtUtils.cxx.

147 {
148  if (name.isEmpty()) {
149  VP1Msg::messageDebug("VP1QtUtils::setEnvironmentVariable WARNING: called with empty variable name!");
150  return;
151  }
152 
153  if (VP1Msg::verbose())
154  VP1Msg::messageVerbose("VP1QtUtils::setEnvironmentVariable: Setting variable '"+name+"' to value '"+content+"'.");
155 
156  //Don't see any Qt function for this, so we go directly to the stdlib call:
157  ::setenv(name.toStdString().c_str(),content.toStdString().c_str(),1/*override present value*/);
158 }

◆ setExpertSetting()

void VP1QtUtils::setExpertSetting ( const QString &  type,
const QString &  name,
const QString &  content 
)
static

Definition at line 86 of file VP1QtUtils.cxx.

87 {
88  if (name.isEmpty()) {
89  VP1Msg::messageDebug("VP1QtUtils::setEnvironmentVariable WARNING: called with empty variable name!");
90  return;
91  }
92 
93  if (VP1Msg::verbose())
94  VP1Msg::messageVerbose("VP1QtUtils::setEnvironmentVariable: Setting variable '"+name+"' to value '"+content+"'.");
95 
96  if(type=="general"){
97  QSettings generalSettings("ATLAS", "VP1Light");
98  generalSettings.setValue(name, content);
99  } else {
100  QSettings expertSettings(QCoreApplication::applicationDirPath()+"/../vp1.ini", QSettings::NativeFormat);
101  expertSettings.setValue(name, content);
102  }
103 }

◆ unsetEnvironmentVariable()

void VP1QtUtils::unsetEnvironmentVariable ( const QString &  name)
static

Definition at line 161 of file VP1QtUtils.cxx.

162 {
163  if (name.isEmpty()) {
164  VP1Msg::messageDebug("VP1QtUtils::unsetEnvironmentVariable WARNING: called with empty variable name!");
165  return;
166  }
167  //Don't see any Qt function for this, so we go directly to the stdlib call:
168 
169  if (VP1Msg::verbose())
170  VP1Msg::messageVerbose("VP1QtUtils::unsetEnvironmentVariable: Unsetting variable '"+name+"'.");
171 
172  ::unsetenv(name.toStdString().c_str());
173 }

The documentation for this class was generated from the following files:
Amg::compare
std::pair< int, int > compare(const AmgSymMatrix(N) &m1, const AmgSymMatrix(N) &m2, double precision=1e-9, bool relative=false)
compare two matrices, returns the indices of the first element that fails the condition,...
Definition: EventPrimitivesHelpers.h:109
VP1String::str
static QString str(const QString &s)
Definition: VP1String.h:49
grepfile.content
string content
Definition: grepfile.py:56
extractSporadic.h
list h
Definition: extractSporadic.py:97
getCastorRun.setenv
def setenv()
Definition: getCastorRun.py:9
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
VP1Msg::messageVerbose
static void messageVerbose(const QString &)
Definition: VP1Msg.cxx:84
VP1Msg::messageDebug
static void messageDebug(const QString &)
Definition: VP1Msg.cxx:39
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
VP1Msg::verbose
static bool verbose()
Definition: VP1Msg.h:31
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
python.DataFormatRates.env
env
Definition: DataFormatRates.py:32