Jpp
Functions
getLocation.cc File Reference
#include <string>
#include <iostream>
#include <iomanip>
#include "JDetector/JDetector.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JDetector/JModuleRouter.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to print module location for a given module iddentifier.

Author
mdejong

Definition in file getLocation.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 19 of file getLocation.cc.

20 {
21  using namespace std;
22  using namespace JPP;
23 
24  string detectorFile;
26  int debug;
27 
28  try {
29 
30  JParser<> zap("Auxiliary program to print module location for a given module iddentifier."
31  "\nInteractive mode in absence of option -M <module>.");
32 
33  zap['a'] = make_field(detectorFile, "Detector file");
34  zap['M'] = make_field(id, "Module identifier") = JModuleIdentifier();
35  zap['d'] = make_field(debug) = 1;
36 
37  zap(argc, argv);
38  }
39  catch(const exception &error) {
40  FATAL(error.what() << endl);
41  }
42 
43 
44  JDetector detector;
45 
46  try {
47  load(detectorFile, detector);
48  }
49  catch(const JException& error) {
50  FATAL(error);
51  }
52 
53  const JModuleRouter router(detector);
54 
55  if (id != JModuleIdentifier()) {
56 
57  cout << router.getModule(id).getLocation() << endl;
58 
59  } else {
60 
61  while (cin >> id && id != JModuleIdentifier()) {
62  cout << router.getModule(id).getLocation() << endl;
63  }
64  }
65 }
JDETECTOR::JModuleIdentifier
JLANG::JObjectID JModuleIdentifier
Definition: JModuleIdentifier.hh:16
JDETECTOR::load
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
Definition: JDetectorToolkit.hh:456
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
debug
int debug
debug level
Definition: JSirene.cc:59
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
std
Definition: jaanetDictionary.h:36
FATAL
#define FATAL(A)
Definition: JMessage.hh:67