Jpp
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JAAnet
JWeightFileScanner.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
8
#include "
JSupport/JMultipleFileScanner.hh
"
9
#include "
JSupport/JLimit.hh
"
10
#include "
JSupport/JWeightFileScannerSet.hh
"
11
12
#include "
Jeep/JParser.hh
"
13
#include "
Jeep/JMessage.hh
"
14
15
16
/**
17
* \file
18
* Example program for weighing of Monte Carlo events.
19
*
20
* \author bjung
21
*/
22
int
main
(
int
argc,
char
**argv)
23
{
24
using namespace
std;
25
using namespace
JPP;
26
27
JMultipleFileScanner_t
inputFiles;
28
JLimit
numberOfEvents;
29
int
debug
;
30
31
try
{
32
33
JParser<>
zap;
34
35
zap[
'f'
] =
make_field
(inputFiles);
36
zap[
'n'
] =
make_field
(numberOfEvents) = JLimit::max();
37
zap[
'd'
] =
make_field
(
debug
) = 1;
38
39
zap(argc, argv);
40
}
41
catch
(
const
exception& error) {
42
FATAL
(error.what() << endl);
43
}
44
45
46
JWeightFileScannerSet<>
scanners(inputFiles, numberOfEvents);
47
48
for
(
JWeightFileScannerSet<>::iterator
scanner = scanners.begin(); scanner != scanners.end(); ++scanner) {
49
50
if
(scanner->simul.size() > 0) {
51
STATUS
(
"Scanning "
<< scanner->simul[0].program <<
" files..."
<< endl);
52
}
53
54
STATUS
(
LEFT
(20) <<
"event"
<<
LEFT
(10) <<
"weight"
<< endl);
55
56
while
(scanner->hasNext()) {
57
58
const
Evt
*
event
= scanner->next();
59
const
double
weight
= scanner->getWeight(*event);
60
61
STATUS
(
LEFT
(20) << scanner->getCounter() <<
62
FIXED
(15,20) << weight <<
'\r'
);
DEBUG
(endl);
63
}
64
}
65
66
return
0;
67
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1500
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
STATUS
#define STATUS(A)
Definition:
JMessage.hh:63
FIXED
Auxiliary data structure for floating point format specification.
Definition:
JManip.hh:445
JSUPPORT::JWeightFileScannerSet
Auxiliary class for organising Monte Carlo file scanners.
Definition:
JWeightFileScannerSet.hh:34
JSUPPORT::JWeightFileScannerSet::iterator
std::vector< value_type >::iterator iterator
Definition:
JWeightFileScannerSet.hh:40
JSUPPORT::JLimit
Auxiliary class for defining the range of iterations of objects.
Definition:
JLimit.hh:41
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1961
debug
int debug
debug level
Definition:
JSirene.cc:63
JMessage.hh
General purpose messaging.
JWeightFileScannerSet.hh
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_t
Auxiliary base class for list of file names.
Definition:
JMultipleFileScanner.hh:44
JLANG::LEFT
Definition:
JTwosome.hh:18
Evt.hh
JParser.hh
Utility class to parse command line options.
Head.hh
JLimit.hh
Auxiliaries for defining the range of iterations of objects.
Evt
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition:
Evt.hh:19
JTRIGGER::weight
std::vector< double > weight
Definition:
JAlgorithm.hh:428
DEBUG
#define DEBUG(A)
Message macros.
Definition:
JMessage.hh:62
Generated by
1.8.5