Jpp 20.0.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JMergePMTParameters.cc File Reference

Auxiliary program to merge PMT parameters files. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <iterator>
#include "JDetector/JPMTParametersMap.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 merge PMT parameters files.

Author
mdejong

Definition in file JMergePMTParameters.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 20 of file JMergePMTParameters.cc.

21{
22 using namespace std;
23 using namespace JPP;
24
25 vector<string> pmtParameters;
26 string outputFile;
27 int debug;
28
29 try {
30
31 JParser<> zap("Auxiliary program to merge PMT parameters files.");
32
33 zap['P'] = make_field(pmtParameters, "PMT simulation data (or corresponding file name)");
34 zap['o'] = make_field(outputFile);
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
44 JPMTParametersMap parameters;
45
46 for (size_t i = 0; i != pmtParameters.size(); ++i) {
47
48 JPMTParametersMap buffer;
49
50 buffer.load(pmtParameters[i].c_str());
51
52 if (i == 0)
53 parameters = buffer;
54 else
55 copy(buffer.begin(), buffer.end(), inserter(parameters, parameters.end()));
56 }
57
58
59 parameters.comment.add(JMeta(argc, argv));
60
61 parameters.store(outputFile.c_str());
62}
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
Auxiliary class for map of PMT parameters.
Utility class to parse command line options.
Definition JParser.hh:1698
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition JHead.cc:163
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JComment & add(const std::string &comment)
Add comment.
Definition JComment.hh:100
void store(const char *file_name) const
Store to output file.
void load(const char *file_name)
Load from input file.
Auxiliary class for ROOT I/O of application specific meta data.
Definition JMeta.hh:72