DD4hep  1.31.0
Detector Description Toolkit for High Energy Physics
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
display.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 
14 // Framework include files
15 #include "run_plugin.h"
16 
17 //______________________________________________________________________________
18 int main(int argc,char** argv) {
19  std::vector<const char*> av;
20  std::string level, visopt, opt, detector;
21  bool dry = false, help = false;
22  for(int i=0; i<argc; ++i) {
23  if ( i==1 && argv[i][0] != '-' ) av.emplace_back("-input");
24  if ( strncmp(argv[i],"-load-only",4) == 0 ) dry = true, av.emplace_back(argv[i]);
25  else if ( strncmp(argv[i],"-dry-run",4) == 0 ) dry = true, av.emplace_back(argv[i]);
26  else if ( strncmp(argv[i],"-h",2) == 0 ) help = true;
27  else if ( strncmp(argv[i],"-help",4) == 0 ) help = true;
28  else if ( strncmp(argv[i],"--help",4) == 0 ) help = true;
29  else if ( strncmp(argv[i],"-visopt",4) == 0 ) visopt = argv[++i];
30  else if ( strncmp(argv[i],"-level", 4) == 0 ) level = argv[++i];
31  else if ( strncmp(argv[i],"-option",4) == 0 ) opt = argv[++i];
32  else if ( strncmp(argv[i],"-detector",4) == 0 ) detector = argv[++i];
33  else av.emplace_back(argv[i]);
34  }
35  if ( !dry ) {
36  av.emplace_back("-interactive");
37  av.emplace_back("-plugin");
38  av.emplace_back("DD4hep_GeometryDisplay");
39  if ( help ) av.emplace_back("-help");
40  if ( !opt.empty() ) av.emplace_back("-opt"), av.emplace_back(opt.c_str());
41  if ( !level.empty() ) av.emplace_back("-level"), av.emplace_back(level.c_str());
42  if ( !visopt.empty() ) av.emplace_back("-visopt"), av.emplace_back(visopt.c_str());
43  if ( !detector.empty() ) av.emplace_back("-detector"), av.emplace_back(detector.c_str());
44  }
45  return dd4hep::execute::main_plugins("DD4hep_GeometryDisplay", av.size(), (char**)&av[0]);
46 }
main
int main(int argc, char **argv)
Definition: display.cpp:18
help
void help(std::string argv0)
Definition: listcomponents.cpp:29
run_plugin.h
dd4hep::execute::main_plugins
int main_plugins(const char *name, int argc, char **argv)
Main entry point as a program.
Definition: run_plugin.h:426