Jpp
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JSupport
JTreeScanner.cc
Go to the documentation of this file.
1
2
3
#include <string>
4
#include <iostream>
5
#include <iomanip>
6
#include <limits>
7
8
#include "TROOT.h"
9
#include "TFile.h"
10
#include "TH1D.h"
11
12
#include "
JDAQ/JDAQEventIO.hh
"
13
#include "
JDAQ/JDAQSummarysliceIO.hh
"
14
#include "
JDAQ/JDAQEvaluator.hh
"
15
16
#include "
JSupport/JMultipleFileScanner.hh
"
17
#include "
JSupport/JTreeScanner.hh
"
18
#include "
JSupport/JSupport.hh
"
19
20
#include "
Jeep/JParser.hh
"
21
#include "
Jeep/JMessage.hh
"
22
23
24
/**
25
* \file
26
*
27
* Program to test ordered reading using JSUPPORT::JTreeScanner.
28
* \author mdejong
29
*/
30
int
main
(
int
argc,
char
**argv)
31
{
32
using namespace
std;
33
using namespace
JPP;
34
using namespace
KM3NETDAQ;
35
36
JMultipleFileScanner<>
inputFile;
37
JLimit_t
& numberOfEvents = inputFile.
getLimit
();
38
string
outputFile
;
39
int
debug
;
40
41
try
{
42
43
JParser<>
zap(
"Program to test ordered reading from a ROOT TTree."
);
44
45
zap[
'f'
] =
make_field
(inputFile);
46
zap[
'n'
] =
make_field
(numberOfEvents) = JLimit::max();
47
zap[
'o'
] =
make_field
(
outputFile
) =
"histogram.root"
;
48
zap[
'd'
] =
make_field
(
debug
) = 2;
49
50
zap(argc, argv);
51
}
52
catch
(
const
exception& error) {
53
FATAL
(error.what() << endl);
54
}
55
56
57
TFile out(
outputFile
.c_str(),
"recreate"
);
58
59
TH1D h0(
"h0"
, NULL, 401, -200.5, +200.5);
60
TH1D
h1
(
"h1"
, NULL, 401, -200.5, +200.5);
61
62
63
JTreeScanner<JDAQSummaryslice, JDAQEvaluator>::debug
=
debug
;
64
65
JTreeScanner<JDAQSummaryslice, JDAQEvaluator>
scan(inputFile);
66
67
int
frame_index = 0;
68
69
for
(
JTreeScanner<JDAQEvent, JDAQEvaluator>
in
(inputFile);
in
.hasNext(); ) {
70
71
STATUS
(
"event: "
<< setw(10) <<
in
.getCounter() <<
'\r'
);
DEBUG
(endl);
72
73
JDAQEvent
*
event
=
in
.next();
74
Long64_t index = scan.find(*event);
75
76
JDAQSummaryslice
* summary = scan.getEntry(index);
77
78
h0.Fill(event ->
getFrameIndex
() - frame_index);
79
h1.Fill(summary->
getFrameIndex
() -
event
->getFrameIndex());
80
81
frame_index =
event
->getFrameIndex();
82
}
83
84
out.Write();
85
out.Close();
86
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1493
JSupport.hh
ROOT TTree parameter settings.
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
h1
then for HISTOGRAM in h0 h1
Definition:
JMatrixNZ.sh:69
outputFile
string outputFile
Definition:
JDAQTimesliceSelector.cc:37
JSUPPORT::JTreeScanner
Template definition for direct access of elements in ROOT TChain.
Definition:
JTreeScanner.hh:91
KM3NETDAQ::JDAQChronometer::getFrameIndex
int getFrameIndex() const
Get frame index.
Definition:
JDAQChronometer.hh:132
JSUPPORT::JLimit
Auxiliary class for defining the range of iterations of objects.
Definition:
JLimit.hh:41
KM3NETDAQ::JDAQEvent
DAQ Event.
Definition:
JDAQEvent.hh:30
KM3NETDAQ::getFrameIndex
int getFrameIndex(const double t_ns)
Get frame index for a given time in ns.
Definition:
JDAQClock.hh:251
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1954
JDAQSummarysliceIO.hh
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...
JTreeScanner.hh
JSUPPORT::JMultipleFileScanner<>
JParser.hh
Utility class to parse command line options.
JDAQEvaluator.hh
JSUPPORT::JLimit::getLimit
const JLimit & getLimit() const
Get limit.
Definition:
JLimit.hh:73
KM3NETDAQ::JDAQSummaryslice
Data summary slice.
Definition:
JDAQSummaryslice.hh:25
JDAQEventIO.hh
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