Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JEditDisable.cc File Reference
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include "JAcoustics/JTransmission_t.hh"
#include "JDetector/JDetector.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JDetector/JModuleRouter.hh"
#include "JSupport/JMeta.hh"
#include "Jeep/JContainer.hh"
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int argc,
char ** argv )
Author
mdejong

Auxiliary program to merge disable files.

Definition at line 25 of file JEditDisable.cc.

26{
27 using namespace std;
28 using namespace JPP;
29
30 typedef JContainer< vector<JTransmission_t> > container_type;
31
32 string inputFile;
33 string outputFile;
34 string detectorFile;
35 bool squash;
36 int debug;
37
38 try {
39
40 JParser<> zap("Auxiliary program to merge disable files.");
41
42 zap['f'] = make_field(inputFile, "disable input file");
43 zap['o'] = make_field(outputFile, "disable output file");
44 zap['a'] = make_field(detectorFile, "detector file") = "";
45 zap['q'] = make_field(squash, "squash meta data");
46 zap['d'] = make_field(debug) = 1;
47
48 zap(argc, argv);
49 }
50 catch(const exception &error) {
51 FATAL(error.what() << endl);
52 }
53
54
55 container_type data;
56
57 data.load(inputFile.c_str());
58
59 if (squash) {
60 data.comment.clear();
61 }
62
63 data.comment.add(JMeta(argc, argv));
64
65 if (!data.empty()) {
66
67 if (detectorFile != "") {
68
70
71 try {
72 load(detectorFile, detector);
73 }
74 catch(const JException& error) {
75 FATAL(error);
76 }
77
78 const JModuleRouter router(detector);
79
80 for (container_type::iterator i = data.begin(); i != data.end(); ) {
81 if (router.hasModule(i->rx))
82 ++i;
83 else
84 i = data.erase(i);
85 }
86 }
87 }
88
89 data.store(outputFile.c_str());
90}
string outputFile
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Detector data structure.
Definition JDetector.hh:96
Router for direct addressing of module data in detector data structure.
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.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Detector file.
Definition JHead.hh:227
Auxiliary wrapper for I/O of container with optional comment (see JComment).
Definition JContainer.hh:42
Auxiliary class for ROOT I/O of application specific meta data.
Definition JMeta.hh:72