Jpp  18.0.0-rc.3
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JDetachPMTs.cc
Go to the documentation of this file.
1 #include <string>
2 
3 #include "JDetector/JDetector.hh"
5 #include "JSupport/JMeta.hh"
6 
7 #include "Jeep/JParser.hh"
8 #include "Jeep/JMessage.hh"
9 
10 
11 /**
12  * \file
13  *
14  * Auxiliary program to detach PMTs from detector.
15  *
16  * \author mdejong
17  */
18 int main(int argc, char **argv)
19 {
20 
21  using namespace std;
22  using namespace JPP;
23 
24  string detectorFile;
25  string outputFile;
26  int debug;
27 
28  try {
29 
30  JParser<> zap("Auxiliary program to detach PMTs from detector.");
31 
32  zap['a'] = make_field(detectorFile, "detector file");
33  zap['o'] = make_field(outputFile, "detector file without PMTs");
34  zap['d'] = make_field(debug) = 0;
35 
36  zap(argc, argv);
37  }
38  catch(const exception &error) {
39  FATAL(error.what() << endl);
40  }
41 
42  JDetector detector;
43 
44  try {
45  load(detectorFile, detector);
46  }
47  catch(const JException& error) {
48  FATAL(error);
49  }
50 
51  detector.comment.add(JMeta(argc,argv));
52 
53  if (detector.setToLatestVersion()) {
54  NOTICE("Set detector version to " << detector.getVersion() << endl);
55  }
56 
57  for (JDetector::iterator module = detector.begin(); module != detector.end(); ++module) {
58 
59  DEBUG("Detach PMTs in module " << setw(10) << module->getID() << endl);
60 
61  module->clear();
62  }
63 
64  try {
66  }
67  catch(const JException& error) {
68  FATAL(error);
69  }
70 }
Utility class to parse command line options.
Definition: JParser.hh:1514
int main(int argc, char *argv[])
Definition: Main.cc:15
string outputFile
Data structure for detector geometry and calibration.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
ROOT I/O of application specific meta data.
#define NOTICE(A)
Definition: JMessage.hh:64
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Utility class to parse command line options.
do set_variable DETECTOR_TXT $WORKDIR detector
int debug
debug level
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62