ATLAS Offline Software
Loading...
Searching...
No Matches
main.cxx File Reference
#include "RunVP1Light/VP1LightRun.h"
#include <QSettings>
#include <QString>
#include <QDir>
#include <QDebug>
#include <QCommandLineParser>
#include <iostream>
#include <stdlib.h>
#include <fstream>
Include dependency graph for graphics/VP1/RunVP1Light/src/main.cxx:

Go to the source code of this file.

Functions

int main (int argc, char **argv)

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 23 of file graphics/VP1/RunVP1Light/src/main.cxx.

24{
25 QStringList arguments;
26 for (int i = 0; i<=argc; i++){
27 arguments << argv[i];
28 }
29
30 QCommandLineParser parser;
31
32 // An database directory option
33 QCommandLineOption databaseDirectoryOption(QStringList() << "d" << "database-directory", "Use geometry database <file>.", "default");
34 parser.addOption(databaseDirectoryOption);
35
36 // An AOD directory option
37 QCommandLineOption AODDirectoryOption(QStringList() << "x" << "xaod-directory", "Use xAOD file <file>.", "default");
38 parser.addOption(AODDirectoryOption);
39
40 // Print help
41 QCommandLineOption helpOption(QStringList() << "h" << "help", "Show help.");
42 parser.addOption(helpOption);
43
44 // Process the command line arguments given by the user
45 parser.process(arguments);
46
47 bool helpIsSet = parser.isSet(helpOption);
48 bool dbIsSet = parser.isSet(databaseDirectoryOption);
49 bool AODIsSet = parser.isSet(AODDirectoryOption);
50 QString dbDir = parser.value(databaseDirectoryOption);
51 QString aodDir = parser.value(AODDirectoryOption);
52
53 //If help option is set, display help and exit VP1Light
54 if(helpIsSet){
55 qInfo() << "Usage";
56 qInfo() << " ";
57 qInfo() << " vp1light [options]";
58 qInfo() << " ";
59 qInfo() << "Add path to geometry database or AOD file as options. Alternatively they can be set inside VP1Light.";
60 qInfo() << " ";
61 qInfo() << "Options:";
62 qInfo() << " -h, --help = Show help.";
63 qInfo() << " -d, --database-directory <path-to-DB> = Specify geometry database file.";
64 qInfo() << " -x, --xaod-directory <path-to-xAOD> = Specify xAOD file.";
65 return 0;
66 }
67
68 // Save settings
69 QSettings settings("ATLAS", "VP1Light");
70 if(dbIsSet){
71 settings.setValue("db/path", dbDir);
72 settings.setValue("db/dbByEnv", "1");
73 }
74 else{
75 settings.setValue("db/dbByEnv", "");
76 }
77 if(AODIsSet){
78 settings.setValue("aod/path", aodDir);
79 settings.setValue("aod/aodByEnv", "1");
80 }
81 else{
82 settings.setValue("aod/aodByEnv", "");
83 }
84
85 // Disable expert settings by default
86 if(settings.value("ExpertSettings/notFirstStart").toString().isEmpty()){
87 settings.setValue("ExpertSettings/notFirstStart","1");
88 settings.setValue("ExpertSettings/enableExpertSettings","");
89 }
90
91
92 VP1LightRun vp1light("my first VP1Light test");
93
94 vp1light.initialize();
95 while ( vp1light.execute());
96}