Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JPrintMultiHeader.cc File Reference

Auxiliary program to print Monte Carlo run headers. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "km3net-dataformat/offline/MultiHead.hh"
#include "JAAnet/JHead.hh"
#include "JAAnet/JAAnetDictionary.hh"
#include "JSupport/JSingleFileScanner.hh"
#include "JSupport/JSupport.hh"
#include "JROOT/JSonObjectOutput.hh"
#include "JLang/JStreamObjectOutput.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 print Monte Carlo run headers.

Author
mdejong

Definition in file JPrintMultiHeader.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 27 of file JPrintMultiHeader.cc.

28{
29 using namespace std;
30 using namespace JPP;
31
33 bool print_as_head;
34 bool print_as_json;
35 int debug;
36
37 try {
38
39 JParser<> zap("Auxiliary program to print Monte Carlo run headers.");
40
41 zap['f'] = make_field(inputFile);
42 zap['H'] = make_field(print_as_head);
43 zap['J'] = make_field(print_as_json);
44 zap['d'] = make_field(debug) = 1;
45
46 zap(argc, argv);
47 }
48 catch(const exception &error) {
49 FATAL(error.what() << endl);
50 }
51
52 typedef JTYPELIST<Head, JHead>::typelist typelist;
53 typedef JObjectOutput<typelist>* output_type;
54
55 output_type out = (print_as_json ?
56 (output_type) new JSonObjectOutput <typelist>(cout) :
57 (output_type) new JStreamObjectOutput<typelist>(cout));
58
59 while (inputFile.hasNext()) {
60
61 const MultiHead* head = inputFile.next();
62
63 for (MultiHead::const_iterator i = head->begin(); i != head->end(); ++i) {
64
65 if (print_as_head)
66 out->put(*i);
67 else
68 out->put(JHead(*i));
69 }
70 }
71
72 delete out;
73}
#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
Template interface of object output for single data type.
Template implementation of stream output for single data type.
Utility class to parse command line options.
Definition JParser.hh:1698
Object reading from a list of files.
virtual bool hasNext() override
Check availability of next element.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Type list.
Definition JTypeList.hh:23