Project
Loading...
Searching...
No Matches
ConfigurationManager.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
16
18#include <fairlogger/Logger.h>
19#include <TSystem.h>
20
21using namespace std;
22
23namespace o2
24{
25namespace event_visualisation
26{
27
29{
30 static ConfigurationManager instance;
31 return instance;
32}
33
34void ConfigurationManager::getConfig(TEnv& settings) const
35{
36 TString fileName;
37 if (not this->mOptionsFileName.empty() and settings.ReadFile(fileName = this->mOptionsFileName, kEnvUser) >= 0) {
38 return; // precise located options file name read succesfully
39 }
40 if (settings.ReadFile(fileName = ".o2eve_config", kEnvUser) < 0) {
41 LOGF(warn, "could not find .o2eve_config in working directory! Trying .o2eve_config in home directory");
42 if (settings.ReadFile(fileName = Form("%s/.o2eve_config", gSystem->Getenv("HOME")), kEnvUser) < 0) {
43 LOGF(warn, "could not find .o2eve_config in home directory! Trying o2eve_config in home directory");
44 if (settings.ReadFile(fileName = Form("%s/o2eve_config", gSystem->Getenv("HOME")), kEnvUser) < 0) {
45 LOGF(warn, "could not find o2eve_config in home directory! Trying o2eve_config in O2/EventVisualisation");
46 if (settings.ReadFile(fileName = Form("%s/EventVisualisation/o2eve_config",
47 gSystem->Getenv("ALICEO2_INSTALL_PATH")),
48 kEnvUser) < 0) {
49 LOGF(fatal, "could not find .o2eve_config or o2eve_config file!.");
50 exit(0);
51 }
52 }
53 }
54 }
55 LOGF(info, Form("using %s config settings", fileName.Data()));
56}
57
58const ConfigurationManager* ConfigurationManager::loadSettings()
59{
60 if (this->mSettingsLoadCounter <= 0) {
61 this->getConfig(mSettings);
62 this->mSettingsLoadCounter = mSettings.GetValue("settings.reload", 10000);
63 }
64 this->mSettingsLoadCounter--;
65 return this;
66}
67
69{
70 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue("refresh.rate", 5);
71}
72
74{
75 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue("outreach.frequency.refresh.rate", 1);
76}
77
78std::string ConfigurationManager::getScreenshotPath(const char* prefix)
79{
80 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue((std::string(prefix) + ".path").c_str(), "Screenshots");
81}
82
84{
85 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue("outreach.files.max", 10);
86}
87
89{
90 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue((std::string(prefix) + ".width").c_str(), 3840);
91}
92
94{
95 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue((std::string(prefix) + ".height").c_str(), 2160);
96}
97
99{
100 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue((std::string(prefix) + ".pixel_object_scale.3d").c_str(), 0);
101}
102
104{
105 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue((std::string(prefix) + ".pixel_object_scale.rphi").c_str(), 0);
106}
107
109{
110 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue((std::string(prefix) + ".pixel_object_scale.zy").c_str(), 0);
111}
112
114{
115 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue("screenshot.monthly", 0);
116}
117
119{
120 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue("data.default", "NEWEST");
121}
122
124{
125 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue("data.synthetic.run.dir",
126 "jsons/synthetic");
127}
128
130{
131 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue("data.cosmics.run.dir",
132 "jsons/cosmics");
133}
134
136{
137 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue("data.physics.run.dir",
138 "jsons/physics");
139}
140
142{
143 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue("simple.geom.R3.path", "");
144}
145
147{
148 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue("background.color", 1);
149}
150
152{
153 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue("simple.geom.R3.path", "");
154}
155
157{
158 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue("simple.geom.R3.path", "");
159}
160
162{
163 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue("camera.3D.rotation.horizontal", -0.4);
164}
165
167{
168 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue("camera.3D.rotation.vertical", 1.0);
169}
170
172{
173 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue("camera.3D.zoom", 1.0);
174}
175
177{
178 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue("camera.R-Phi.zoom", 1.0);
179}
180
182{
183 return ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue("camera.Z-Y.zoom", 1.0);
184}
185
187{
188 static std::string str = ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue("screenshot.logo.o2",
189 "o2.png");
190 return str.c_str();
191}
192
194{
195 static std::string str = ConfigurationManager::getInstance().loadSettings()->mSettings.GetValue(
196 "screenshot.logo.alice", "alice-white.png");
197 return str.c_str();
198}
199
200} // namespace event_visualisation
201} // namespace o2
static std::string getScreenshotPath(const char *prefix)
static UInt_t getScreenshotHeight(const char *prefix)
static ConfigurationManager & getInstance()
Returns an instance of ConfigurationManager.
void getConfig(TEnv &settings) const
Returns current event display configuration.
static UInt_t getScreenshotPixelObjectScale3d(const char *prefix)
static UInt_t getScreenshotPixelObjectScaleZY(const char *prefix)
static UInt_t getScreenshotWidth(const char *prefix)
static UInt_t getScreenshotPixelObjectScaleRphi(const char *prefix)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Defining DataPointCompositeObject explicitly as copiable.
const std::string str