ATLAS Offline Software
graphics/VP1/RunVP1Light/src/main.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Author: Riccardo.Maria.Bianchi@cern.ch, Apr 2017
6 // Update: Apr 2019
7 
9 
10 // Qt includes
11 #include <QSettings>
12 #include <QString>
13 #include <QDir>
14 #include <QDebug>
15 // #include <QCoreApplication>
16 #include <QCommandLineParser>
17 
18 // C++ includes
19 #include <iostream>
20 #include <stdlib.h>
21 #include <fstream>
22 
23 int main(int argc, char** argv)
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 }
VP1LightRun
Definition: VP1LightRun.h:26
VP1LightRun::initialize
bool initialize()
Definition: VP1LightRun.cxx:46
VP1LightRun.h
python.CaloAddPedShiftConfig.parser
parser
Definition: CaloAddPedShiftConfig.py:41
FPGAOutputValidationConfig.arguments
arguments
Definition: FPGAOutputValidationConfig.py:146
lumiFormat.i
int i
Definition: lumiFormat.py:85
LArCellNtuple.argv
argv
Definition: LArCellNtuple.py:152
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:19
VP1LightRun::execute
bool execute()
Definition: VP1LightRun.cxx:87
main
int main(int argc, char **argv)
Definition: graphics/VP1/RunVP1Light/src/main.cxx:23