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

Auxiliary program to detach PMTs from detector. More...

#include <string>
#include "JDetector/JDetector.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JSupport/JMeta.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 detach PMTs from detector.

Author
mdejong

Definition in file JDetachPMTs.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 18 of file JDetachPMTs.cc.

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 
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 }
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:70
Utility class to parse command line options.
Definition: JParser.hh:1517
General exception.
Definition: JException.hh:23
Detector data structure.
Definition: JDetector.hh:89
string outputFile
Detector file.
Definition: JHead.hh:226
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
#define NOTICE(A)
Definition: JMessage.hh:64
#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
int debug
debug level
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62