Skip to content

Commit bc7ec0d

Browse files
jmyrchasawenzel
authored andcommitted
o2-eve: added cmd-line parameter to point to specific configuration file, fixed no data scenario
1 parent 0977f19 commit bc7ec0d

7 files changed

Lines changed: 35 additions & 11 deletions

File tree

EventVisualisation/Base/include/EventVisualisationBase/ConfigurationManager.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
///
1313
/// \file ConfigurationManager.h
1414
/// \author Jeremi Niedziela
15+
/// \author Julian Myrcha
1516
///
1617

1718
#ifndef ALICE_O2_EVENTVISUALISATION_BASE_CONFIGURATIONMANAGER_H
@@ -24,20 +25,29 @@ namespace o2
2425
namespace event_visualisation
2526
{
2627
/// Version of the software
27-
const static std::string o2_eve_version = "1.40";
28+
const static std::string o2_eve_version = "1.50";
2829

2930
/// Configuration Manager allows an easy access to the config file.
3031
///
3132
/// Configuration Manager is a singleton which assures an access to
32-
/// the correct configuration file, regardless wether it is located
33+
/// the correct configuration file, regardless of where it is located
3334
/// in the users home directory or in the O2 installation path.
3435

3536
class ConfigurationManager
3637
{
38+
private:
39+
std::string mOptionsFileName;
40+
3741
public:
3842
/// Returns an instance of ConfigurationManager
3943
static ConfigurationManager& getInstance();
4044

45+
/// sets precise location of option file name (if not empty only this is used)
46+
static void setOptionsFileName(const std::string& fileName)
47+
{
48+
getInstance().mOptionsFileName = fileName;
49+
}
50+
4151
/// Returns current event display configuration
4252
void getConfig(TEnv& settings) const;
4353

EventVisualisation/Base/src/ConfigurationManager.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ ConfigurationManager& ConfigurationManager::getInstance()
3535
void ConfigurationManager::getConfig(TEnv& settings) const
3636
{
3737
TString fileName;
38+
if (not this->mOptionsFileName.empty() and settings.ReadFile(fileName = this->mOptionsFileName, kEnvUser) >= 0) {
39+
return; // precise located options file name read succesfully
40+
}
3841
if (settings.ReadFile(fileName = ".o2eve_config", kEnvUser) < 0) {
3942
LOG(warn) << "could not find .o2eve_config in working directory! Trying .o2eve_config in home directory";
4043
if (settings.ReadFile(fileName = Form("%s/.o2eve_config", gSystem->Getenv("HOME")), kEnvUser) < 0) {

EventVisualisation/Base/src/DataSourceOnline.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ std::vector<std::pair<VisualisationEvent, EVisualisationGroup>> DataSourceOnline
3535
{
3636
std::vector<std::pair<VisualisationEvent, EVisualisationGroup>> res;
3737
if (getEventCount() == 2) {
38-
return res; // 2 means there are no real data = we have only "virtual" positions
38+
this->setRunNumber(-1); // No available data to display
39+
return res; // 2 means there are no real data = we have only "virtual" positions
3940
}
4041
if (no < getEventCount()) {
4142
assert(no >= 0);

EventVisualisation/View/include/EventVisualisationView/Options.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class Options
3030
bool mJSON; // -j
3131
bool mOnline; // -o (must specify -d!)
3232
bool mRandomTracks; // -r
33+
std::string mOptionsFileName; // -p /home/ed/.o2eve_config_v2
3334
std::string mFileName; // -f 'data.root'
3435
std::string mDataFolder; // -d './'
3536
std::string mSavedDataFolder; // -s './'
@@ -54,6 +55,7 @@ class Options
5455
std::string dataFolder() { return this->mDataFolder; }
5556
std::string imageFolder() { return this->mImageFolder; }
5657
std::string savedDataFolder() { return this->mSavedDataFolder; }
58+
std::string optionsFileName() { return this->mOptionsFileName; }
5759
std::string fileName() { return this->mFileName; }
5860
bool randomTracks() { return this->mRandomTracks; }
5961
long memoryLimit() { return this->mMemoryLimit; }

EventVisualisation/View/src/EventManager.cxx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,21 @@ void EventManager::displayCurrentEvent()
119119
restoreVisualisationSettings();
120120
}
121121

122-
if (this->mShowDate) {
123-
multiView->getAnnotationTop()->SetText(
124-
TString::Format("Run %d %s\n%s", dataSource->getRunNumber(), std::string(parameters::GRPECS::RunTypeNames[dataSource->getRunType()]).c_str(), dataSource->getFileTime().c_str()));
122+
if (dataSource->getRunNumber() != -1) {
123+
if (this->mShowDate) {
124+
multiView->getAnnotationTop()->SetText(
125+
TString::Format("Run %d %s\n%s", dataSource->getRunNumber(),
126+
std::string(parameters::GRPECS::RunTypeNames[dataSource->getRunType()]).c_str(),
127+
dataSource->getFileTime().c_str()));
128+
} else {
129+
multiView->getAnnotationTop()->SetText(TString::Format("Run %d", dataSource->getRunNumber()));
130+
}
131+
auto detectors = detectors::DetID::getNames(dataSource->getDetectorsMask());
132+
multiView->getAnnotationBottom()->SetText(
133+
TString::Format("TFOrbit: %d\nDetectors: %s", dataSource->getFirstTForbit(), detectors.c_str()));
125134
} else {
126-
multiView->getAnnotationTop()->SetText(TString::Format("Run %d", dataSource->getRunNumber()));
135+
multiView->getAnnotationTop()->SetText("No Available Data to Display");
127136
}
128-
auto detectors = detectors::DetID::getNames(dataSource->getDetectorsMask());
129-
multiView->getAnnotationBottom()->SetText(TString::Format("TFOrbit: %d\nDetectors: %s", dataSource->getFirstTForbit(), detectors.c_str()));
130137
}
131138
multiView->redraw3D();
132139
}

EventVisualisation/View/src/Options.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ bool Options::processCommandLine(int argc, char* argv[])
6262
"json,j", bpo::value<decltype(this->mJSON)>()->zero_tokens()->default_value(false), "use json files as a source")(
6363
"memorylimit,m", bpo::value<decltype(this->mMemoryLimit)>()->default_value(-1), "memory usage limit (MB) - app will terminate if it is exceeded (pass -1 for no limit)")(
6464
"online,o", bpo::value<decltype(this->mOnline)>()->zero_tokens()->default_value(false), "use online json files as a source")(
65-
"optionsfilename,p", bpo::value<std::string>()->default_value("o2eve.json"), "name of the options file")(
65+
"optionsfilename,p", bpo::value<std::string>()->default_value(""), "name of the options file")(
6666
"randomtracks,r", bpo::value<decltype(this->mRandomTracks)>()->zero_tokens()->default_value(false), "use random tracks")(
6767
"saveddatafolder,s", bpo::value<decltype(this->mSavedDataFolder)>()->default_value(""), "name of the saved data folder")(
6868
"hidedplgui", bpo::value<decltype(this->mHideDplGUI)>()->zero_tokens()->default_value(false), "hide DPL GUI when processing AODs")(
@@ -95,7 +95,7 @@ bool Options::processCommandLine(int argc, char* argv[])
9595
this->mJSON = varmap["json"].as<decltype(this->mJSON)>();
9696
this->mMemoryLimit = varmap["memorylimit"].as<decltype(this->mMemoryLimit)>();
9797
this->mOnline = varmap["online"].as<decltype(this->mOnline)>();
98-
auto optionsFileName = varmap["optionsfilename"].as<std::string>();
98+
this->mOptionsFileName = varmap["optionsfilename"].as<std::string>();
9999
this->mRandomTracks = varmap["randomtracks"].as<decltype(this->mRandomTracks)>();
100100
this->mSavedDataFolder = varmap["saveddatafolder"].as<decltype(this->mSavedDataFolder)>();
101101
this->mHideDplGUI = varmap["hidedplgui"].as<decltype(this->mHideDplGUI)>();

EventVisualisation/View/src/main.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ int main(int argc, char** argv)
4242
srand(static_cast<unsigned int>(time(nullptr)));
4343

4444
TEnv settings;
45+
ConfigurationManager::setOptionsFileName(Options::Instance()->optionsFileName());
4546
ConfigurationManager::getInstance().getConfig(settings);
4647

4748
std::array<const char*, 7> keys = {"Gui.DefaultFont", "Gui.MenuFont", "Gui.MenuHiFont",

0 commit comments

Comments
 (0)