Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
getPMT.cc
Go to the documentation of this file.
1 #include <string>
2 #include <iostream>
3 #include <iomanip>
4 
5 #include "JDetector/JDetector.hh"
8 
9 #include "Jeep/JParser.hh"
10 #include "Jeep/JMessage.hh"
11 
12 
13 /**
14  * \file
15  *
16  * Auxiliary program to print module identifier for a given PMT identifier.
17  * \author mdejong
18  */
19 int main(int argc, char **argv)
20 {
21  using namespace std;
22  using namespace JPP;
23 
24  string detectorFile;
25  int PMT;
26  int debug;
27 
28  try {
29 
30  JParser<> zap("Auxiliary program to print module identifier for a given PMT identifier.");
31 
32  zap['a'] = make_field(detectorFile);
33  zap['P'] = make_field(PMT);
34  zap['d'] = make_field(debug) = 1;
35 
36  zap(argc, argv);
37  }
38  catch(const exception &error) {
39  FATAL(error.what() << endl);
40  }
41 
42 
43  JDetector detector;
44 
45  try {
46  load(detectorFile, detector);
47  }
48  catch(const JException& error) {
49  FATAL(error);
50  }
51 
52  const JPMTRouter router(detector);
53 
54  cout << setw(10) << router.getParentModule(PMT).getID() << endl;
55 }
Utility class to parse command line options.
Definition: JParser.hh:1410
Data structure for detector geometry and calibration.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1836
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
Direct access to PMT in detector data structure.
int debug
debug level
Definition: JSirene.cc:59
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:65
Utility class to parse command line options.
JDAQPMTIdentifier PMT
Command line options.
int main(int argc, char *argv[])
Definition: Main.cpp:15