Jpp  master_rocky
the software that should make you happy
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  bool squash;
27  int debug;
28 
29  try {
30 
31  JParser<> zap("Auxiliary program to detach PMTs from detector.");
32 
33  zap['a'] = make_field(detectorFile, "detector file");
34  zap['o'] = make_field(outputFile, "detector file without PMTs");
35  zap['q'] = make_field(squash, "squash meta data");
36  zap['d'] = make_field(debug) = 0;
37 
38  zap(argc, argv);
39  }
40  catch(const exception &error) {
41  FATAL(error.what() << endl);
42  }
43 
45 
46  try {
47  load(detectorFile, detector);
48  }
49  catch(const JException& error) {
50  FATAL(error);
51  }
52 
53  if (squash) {
54  detector.comment.clear();
55  }
56 
57  detector.comment.add(JMeta(argc,argv));
58 
59  if (detector.setToLatestVersion()) {
60  NOTICE("Set detector version to " << detector.getVersion() << endl);
61  }
62 
63  for (JDetector::iterator module = detector.begin(); module != detector.end(); ++module) {
64 
65  DEBUG("Detach PMTs in module " << setw(10) << module->getID() << endl);
66 
67  module->clear();
68  }
69 
70  try {
72  }
73  catch(const JException& error) {
74  FATAL(error);
75  }
76 }
string outputFile
int main(int argc, char **argv)
Definition: JDetachPMTs.cc:18
Data structure for detector geometry and calibration.
General purpose messaging.
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
#define NOTICE(A)
Definition: JMessage.hh:64
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
ROOT I/O of application specific meta data.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
Detector data structure.
Definition: JDetector.hh:96
General exception.
Definition: JException.hh:24
Utility class to parse command line options.
Definition: JParser.hh:1698
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
Detector file.
Definition: JHead.hh:227
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:72