Jpp
18.3.0
the software that should make you happy
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JTrigger
examples/JTrigger/JDAQHit.cc
Go to the documentation of this file.
1
2
#include <string>
3
#include <iostream>
4
#include <iomanip>
5
#include <limits>
6
#include <map>
7
8
#include "
JDAQ/JDAQEventIO.hh
"
9
10
#include "
JSupport/JMultipleFileScanner.hh
"
11
#include "
JSupport/JSupport.hh
"
12
13
#include "
Jeep/JParser.hh
"
14
#include "
Jeep/JMessage.hh
"
15
16
17
/**
18
* \file
19
*
20
* Example program to count event data.
21
* \author mdejong
22
*/
23
int
main
(
int
argc,
char
**argv)
24
{
25
using namespace
std;
26
using namespace
JPP;
27
using namespace
KM3NETDAQ;
28
29
JMultipleFileScanner<JDAQEvent>
inputFile;
30
JLimit_t
& numberOfEvents = inputFile.
getLimit
();
31
int
debug
;
32
33
try
{
34
35
JParser<>
zap(
"Example program to count event data."
);
36
37
zap[
'f'
] =
make_field
(inputFile);
38
zap[
'n'
] =
make_field
(numberOfEvents) = JLimit::max();
39
zap[
'd'
] =
make_field
(
debug
) = 1;
40
41
zap(argc, argv);
42
}
43
catch
(
const
exception& error) {
44
FATAL
(error.what() << endl);
45
}
46
47
48
struct
counter_type
{
49
50
counter_type
() :
51
trigger (0),
52
snapshot()
53
{}
54
55
int
trigger;
56
int
snapshot;
57
};
58
59
map<int, counter_type>
counter;
60
61
while
(inputFile.hasNext()) {
62
63
STATUS
(
"event: "
<< setw(10) << inputFile.getCounter() <<
'\r'
);
DEBUG
(endl);
64
65
JDAQEvent
*
event
= inputFile.
next
();
66
67
{
68
typedef
JDAQTriggeredHit
JHit_t
;
69
70
for
(
JDAQEvent::const_iterator<JHit_t>
hit = event->begin<JHit_t>(); hit != event->end<JHit_t>(); ++hit) {
71
counter[hit->getModuleID()].trigger += 1;
72
}
73
}
74
75
{
76
typedef
JDAQSnapshotHit
JHit_t
;
77
78
for
(
JDAQEvent::const_iterator<JHit_t>
hit = event->begin<JHit_t>(); hit != event->end<JHit_t>(); ++hit) {
79
counter[hit->getModuleID()].snapshot += 1;
80
}
81
}
82
}
83
STATUS
(endl);
84
85
for
(
map<int, counter_type>::const_iterator
i
= counter.begin();
i
!= counter.end(); ++
i
) {
86
cout << setw(10) <<
i
->first <<
' '
87
<< setw (8) <<
i
->second.trigger <<
' '
88
<< setw (8) <<
i
->second.snapshot << endl;
89
}
90
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1514
KM3NETDAQ::JDAQKeyHit
DAQ key hit.
Definition:
JDAQKeyHit.hh:19
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JSupport.hh
ROOT TTree parameter settings of various packages.
std::map
Definition:
JSTDTypes.hh:16
STATUS
#define STATUS(A)
Definition:
JMessage.hh:63
KM3NETDAQ::JDAQEvent::const_iterator
Template const_iterator.
Definition:
JDAQEvent.hh:66
JROOT::counter_type
Long64_t counter_type
Type definition for counter.
Definition:
JROOT/JCounter.hh:24
i
then rm i
Definition:
JEvtReweightMupageParameterScan.sh:309
JSUPPORT::JLimit
Auxiliary class for defining the range of iterations of objects.
Definition:
JLimit.hh:41
KM3NETDAQ::JDAQEvent
DAQ Event.
Definition:
JDAQEvent.hh:30
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1989
KM3NETDAQ::JDAQTriggeredHit
DAQ triggered hit.
Definition:
JDAQTriggeredHit.hh:20
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...
JSUPPORT::JMultipleFileScanner
General purpose class for object reading from a list of file names.
Definition:
JMultipleFileScanner.hh:202
JParser.hh
Utility class to parse command line options.
JSIRENE::JHit_t
Auxiliary class to set-up Hit.
Definition:
JSirene.hh:57
JSUPPORT::JLimit::getLimit
const JLimit & getLimit() const
Get limit.
Definition:
JLimit.hh:84
JDAQEventIO.hh
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
KM3NETDAQ::JDAQTriggerCounter::next
JTriggerCounter_t next()
Increment trigger counter.
Definition:
JDAQTriggerCounter.hh:121
DEBUG
#define DEBUG(A)
Message macros.
Definition:
JMessage.hh:62
Generated by
1.8.5