Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JMultiHead.cc
Go to the documentation of this file.
1
2#include <string>
3#include <iostream>
4#include <iomanip>
5#include <cmath>
6
7#include "TROOT.h"
8#include "TFile.h"
9
13
17#include "JSupport/JSupport.hh"
18#include "JSupport/JMeta.hh"
19
20#include "Jeep/JParser.hh"
21#include "Jeep/JMessage.hh"
22
23
24/**
25 * \file
26 *
27 * Example program to add MultiHead.
28 * \author mdejong
29 */
30int main(int argc, char **argv)
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
Recording of objects on file according a format that follows from the file name extension.
General purpose messaging.
#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
ROOT I/O of application specific meta data.
int main(int argc, char **argv)
Definition JMultiHead.cc:30
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
ROOT TTree parameter settings of various packages.
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