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

Example program to add MultiHead. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <cmath>
#include "TROOT.h"
#include "TFile.h"
#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/MultiHead.hh"
#include "km3net-dataformat/offline/Evt.hh"
#include "JSupport/JMultipleFileScanner.hh"
#include "JSupport/JFileRecorder.hh"
#include "JSupport/JMonteCarloFileSupportkit.hh"
#include "JSupport/JSupport.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

Example program to add MultiHead.

Author
mdejong

Definition in file JMultiHead.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 30 of file JMultiHead.cc.

31{
32 using namespace std;
33 using namespace JPP;
34
37 JLimit_t& numberOfEvents = inputFile.getLimit();
38 int debug;
39
40 try {
41
42 JParser<> zap("Example program to add MultiHead.");
43
44 zap['f'] = make_field(inputFile);
45 zap['n'] = make_field(numberOfEvents) = JLimit::max();
46 zap['o'] = make_field(outputFile);
47 zap['d'] = make_field(debug) = 2;
48
49 zap(argc, argv);
50 }
51 catch(const exception& error) {
52 FATAL(error.what() << endl);
53 }
54
55
56 outputFile.open();
57
58 outputFile.put(JMeta(argc, argv));
59
60 Head header;
61
62 try {
63
64 header = getHeader(inputFile);
65
66 MultiHead buffer;
67
68 buffer.push_back(header);
69
70 outputFile.put(header);
71 outputFile.put(buffer);
72
73 } catch(const exception& error) {
74 FATAL("Missing header." << endl);
75 }
76
77 while (inputFile.hasNext()) {
78
79 STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
80
81 const Evt* evt = inputFile.next();
82
83 outputFile.put(*evt);
84 }
85 STATUS(endl);
86
87 outputFile.close();
88}
string outputFile
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define STATUS(A)
Definition JMessage.hh:63
#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
Utility class to parse command line options.
Definition JParser.hh:1698
Object writing to file.
General purpose class for object reading from a list of file names.
virtual bool hasNext() override
Check availability of next element.
counter_type getCounter() const
Get counter.
virtual const pointer_type & next() override
Get next element.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition Evt.hh:21
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Definition Head.hh:65
Auxiliary class for defining the range of iterations of objects.
Definition JLimit.hh:45
static counter_type max()
Get maximum counter value.
Definition JLimit.hh:128
Auxiliary class for ROOT I/O of application specific meta data.
Definition JMeta.hh:72