Jpp  18.2.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JPrintHeader.cc File Reference

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

#include <string>
#include <iostream>
#include <iomanip>
#include "km3net-dataformat/offline/Head.hh"
#include "JAAnet/JHead.hh"
#include "JAAnet/JAAnetDictionary.hh"
#include "JSupport/JMultipleFileScanner.hh"
#include "JSupport/JMonteCarloFileSupportkit.hh"
#include "JSupport/JSupport.hh"
#include "JROOT/JRootPrinter.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 sum of Monte Carlo run headers.

Author
mdejong

Definition in file JPrintHeader.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 29 of file JPrintHeader.cc.

30 {
31  using namespace std;
32  using namespace JPP;
33 
35  string key;
36  bool print_as_head;
37  bool print_as_json;
38  int debug;
39 
40  try {
41 
42  JParser<> zap("Auxiliary program to print sum of Monte Carlo run headers.");
43 
44  zap['f'] = make_field(inputFile);
45  zap['k'] = make_field(key) = "";
46  zap['H'] = make_field(print_as_head);
47  zap['J'] = make_field(print_as_json);
48  zap['d'] = make_field(debug) = 1;
49 
50  zap(argc, argv);
51  }
52  catch(const exception &error) {
53  FATAL(error.what() << endl);
54  }
55 
56  const JHead header = getHeader(inputFile);
57 
58  if (key == "") {
59 
60  Head buffer;
61 
62  copy(header, buffer);
63 
64  typedef JTYPELIST<Head, JHead>::typelist typelist;
65  typedef JObjectOutput<typelist>* output_type;
66 
67  output_type out = (print_as_json ?
68  (output_type) new JSonObjectOutput <typelist>(cout) :
69  (output_type) new JStreamObjectOutput<typelist>(cout));
70 
71  if (print_as_head)
72  out->put(buffer);
73  else
74  out->put(header);
75 
76  delete out;
77 
78  } else {
79 
81  }
82 }
Utility class to parse command line options.
Definition: JParser.hh:1514
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
Type list.
Definition: JTypeList.hh:22
Monte Carlo run header.
Definition: JHead.hh:1234
T & getInstance(const T &object)
Get static instance from temporary object.
Definition: JObject.hh:75
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
Template implementation of stream output for single data type.
print
Definition: JConvertDusj.sh:44
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Definition: Head.hh:65
#define FATAL(A)
Definition: JMessage.hh:67
General purpose class for object reading from a list of file names.
Template implementation of stream output for single data type.
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:162
Template interface of object output for single data type.
virtual bool put(const T &object)=0
Object output.
int debug
debug level