Jpp
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JAAnet
JABCnet.cc
Go to the documentation of this file.
1
#include <string>
2
#include <iostream>
3
#include <iomanip>
4
5
#include "
km3net-dataformat/offline/Head.hh
"
6
#include "
km3net-dataformat/offline/Evt.hh
"
7
#include "
km3net-dataformat/offline/Hit.hh
"
8
#include "
JDAQ/JDAQEventIO.hh
"
9
10
#include "
JSupport/JMultipleFileScanner.hh
"
11
#include "
JSupport/JTriggeredFileScanner.hh
"
12
#include "
JSupport/JMonteCarloFileSupportkit.hh
"
13
#include "
JSupport/JSupport.hh
"
14
15
#include "
Jeep/JPrint.hh
"
16
#include "
Jeep/JParser.hh
"
17
#include "
Jeep/JMessage.hh
"
18
19
20
/**
21
* \file
22
*
23
* Example program to read Monte Carlo events.
24
* \author mdejong
25
*/
26
int
main
(
int
argc,
char
**argv)
27
{
28
using namespace
std;
29
using namespace
JPP;
30
using namespace
KM3NETDAQ;
31
32
JMultipleFileScanner<>
inputFile;
33
JLimit_t
numberOfEvents;
34
int
debug
;
35
36
try
{
37
38
JParser<>
zap(
"Example program to read Monte Carlo events."
);
39
40
zap[
'f'
] =
make_field
(inputFile,
"list of files"
);
41
zap[
'n'
] =
make_field
(numberOfEvents,
"number of events to read from file(s)"
) = JLimit::max();
42
zap[
'd'
] =
make_field
(
debug
,
"debug level"
) = 3;
43
44
zap(argc, argv);
45
}
46
catch
(
const
exception &error) {
47
FATAL
(error.what() << endl);
48
}
49
50
51
{
52
// template argument corresponds to objects which will be read from file(s)
53
54
JMultipleFileScanner<Evt>
in
(inputFile, numberOfEvents);
55
56
while
(in.
hasNext
()) {
57
58
STATUS
(
"event: "
<< setw(10) << in.
getCounter
() <<
'\r'
);
DEBUG
(endl);
59
60
Evt
*
event
= in.
next
();
// pointer to Monte Carlo event
61
62
DEBUG
(
"Monte Carlo event "
<< event->mc_id << endl);
63
}
64
STATUS
(endl);
65
}
66
67
{
68
// optional template argument(s) will be read in parallel to DAQ events
69
70
JTriggeredFileScanner<>
in
(inputFile, numberOfEvents);
71
72
while
(in.
hasNext
()) {
73
74
STATUS
(
"event: "
<< setw(10) << in.
getCounter
() <<
'\r'
);
DEBUG
(endl);
75
76
JTriggeredFileScanner<>::multi_pointer_type
ps = in.
next
();
77
78
const
JDAQEvent
* tev = ps;
// pointer to DAQ event
79
const
Evt
*
event
= ps;
// pointer to corresponding Monte Carlo event
80
81
DEBUG
(
"DAQ event "
<< tev->
getCounter
() << endl);
82
DEBUG
(
"Monte Carlo event "
<< event->mc_id << endl);
83
}
84
STATUS
(endl);
85
}
86
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1493
JSUPPORT::JMultipleFileScanner::next
virtual const pointer_type & next()
Get next element.
Definition:
JMultipleFileScanner.hh:398
JSupport.hh
ROOT TTree parameter settings.
JTriggeredFileScanner.hh
Synchronously read DAQ events and Monte Carlo events (and optionally other events).
STATUS
#define STATUS(A)
Definition:
JMessage.hh:63
in
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition:
JSirene.sh:45
JSUPPORT::JTriggeredFileScanner
Auxiliary class to synchronously read DAQ events and Monte Carlo events (and optionally other events)...
Definition:
JTriggeredFileScanner.hh:39
JSUPPORT::JTriggeredFileScanner::hasNext
virtual bool hasNext()
Constructor.
Definition:
JTriggeredFileScanner.hh:72
JSUPPORT::JTriggeredFileScanner::next
virtual const multi_pointer_type & next()
Get next element.
Definition:
JTriggeredFileScanner.hh:92
JSUPPORT::JLimit
Auxiliary class for defining the range of iterations of objects.
Definition:
JLimit.hh:41
JPrint.hh
I/O formatting auxiliaries.
KM3NETDAQ::JDAQEvent
DAQ Event.
Definition:
JDAQEvent.hh:30
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1954
debug
int debug
debug level
Definition:
JSirene.cc:61
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JMultipleFileScanner.hh
Scanning of objects from multiple files according a format that follows from the extension of each fi...
JMonteCarloFileSupportkit.hh
JSUPPORT::JMultipleFileScanner::hasNext
virtual bool hasNext()
Check availability of next element.
Definition:
JMultipleFileScanner.hh:350
Evt.hh
JSUPPORT::JMultipleFileScanner<>
JParser.hh
Utility class to parse command line options.
JSUPPORT::JMultipleFileScanner::getCounter
counter_type getCounter() const
Get counter.
Definition:
JMultipleFileScanner.hh:323
JDAQEventIO.hh
Hit.hh
Head.hh
JLANG::JMultiPointer
General purpose class for multiple pointers.
Definition:
JMultiPointer.hh:22
KM3NETDAQ::JDAQTriggerCounter::getCounter
JTriggerCounter_t getCounter() const
Get trigger counter.
Definition:
JDAQTriggerCounter.hh:99
Evt
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition:
Evt.hh:19
DEBUG
#define DEBUG(A)
Message macros.
Definition:
JMessage.hh:62
main
int main(int argc, char *argv[])
Definition:
Main.cpp:15
Generated by
1.8.5