Jpp  pmt_effective_area_update_2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
getPMTStatus.cc File Reference

Auxiliary program to print module location for a given module identifier. More...

#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 identifier.

Author
mdejong

Definition in file getPMTStatus.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 19 of file getPMTStatus.cc.

20 {
21  using namespace std;
22  using namespace JPP;
23 
24  string detectorFile;
25  JPMTIdentifier id;
26  int debug;
27 
28  try {
29 
30  JParser<> zap("Auxiliary program to print PMT status for a given PMT identifier."
31  "\nInteractive mode in absence of option -P <PMT>.");
32 
33  zap['a'] = make_field(detectorFile, "Detector file");
34  zap['P'] = make_field(id, "PMT identifier") = JPMTIdentifier();
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 
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 != JPMTIdentifier()) {
56 
57  if (router.hasModule(id.getModuleID())) {
58  router.getModule(id.getModuleID()).getPMT(id.getPMTAddress()).getStatus().print(cout);
59  }
60 
61  } else {
62 
63  while (cin >> id && id != JPMTIdentifier()) {
64 
65  if (router.hasModule(id.getModuleID())) {
66  router.getModule(id.getModuleID()).getPMT(id.getPMTAddress()).getStatus().print(cout);
67  }
68  }
69  }
70 }
Utility class to parse command line options.
Definition: JParser.hh:1500
General exception.
Definition: JException.hh:23
Detector data structure.
Definition: JDetector.hh:81
Router for direct addressing of module data in detector data structure.
Detector file.
Definition: JHead.hh:196
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:63
#define FATAL(A)
Definition: JMessage.hh:67
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
do set_variable DETECTOR_TXT $WORKDIR detector