Jpp - 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
software
JAAnet
JWeightKM3BUU.hh
Go to the documentation of this file.
1
#ifndef __JAANET__JWEIGHTKM3BUU__
2
#define __JAANET__JWEIGHTKM3BUU__
3
4
#include "
km3net-dataformat/offline/Head.hh
"
5
#include "
km3net-dataformat/offline/Evt.hh
"
6
7
#include "
JLang/JException.hh
"
8
#include "
JLang/JClonable.hh
"
9
10
#include "
JAAnet/JHead.hh
"
11
#include "
JAAnet/JFlux.hh
"
12
#include "
JAAnet/JFluxHelper.hh
"
13
#include "
JAAnet/JHeadToolkit.hh
"
14
#include "
JAAnet/JWeightEvent.hh
"
15
16
/**
17
* \author bjung
18
*/
19
20
namespace
JAANET {
21
22
using
JLANG::JClonable
;
23
using
JLANG::JIndexOutOfRange
;
24
using
JLANG::JNullPointerException
;
25
26
27
/**
28
* Implementation of event weighting for KM3BUU data.
29
*/
30
struct
JWeightKM3BUU
:
31
public
JClonable
<JWeightEvent, JWeightKM3BUU>,
32
public
JFluxHelper
33
{
34
/**
35
* Default constructor.
36
*/
37
JWeightKM3BUU
() :
38
JFluxHelper
(),
39
W
(0.0)
40
{}
41
42
43
/**
44
* Constructor.
45
*
46
* \param header header
47
*/
48
JWeightKM3BUU
(
const
JHead
& header) :
49
JFluxHelper
()
50
{
51
configure
(header);
52
}
53
54
55
/**
56
* Constructor.
57
*
58
* \param header header
59
* \param flux flux
60
*/
61
JWeightKM3BUU
(
const
JHead
& header,
62
const
JFlux
&
flux
)
63
{
64
configure
(header);
65
JFluxHelper::configure
(flux);
66
}
67
68
69
/**
70
* Copy constructor.
71
*
72
* \param object original object
73
*/
74
JWeightKM3BUU
(
const
JWeightKM3BUU
&
object
)
75
{
76
this->
W
=
object
.W;
77
JFluxHelper::configure
(*(
object
.
get
()));
78
}
79
80
81
/**
82
* Weight configuration.
83
*
84
* \param header header
85
*/
86
void
configure
(
const
JHead
& header)
override
87
{
88
const
double
N
= header.
genvol
.
numberOfEvents
;
89
const
double
dt = (header.
time_interval
.
t2
- header.
time_interval
.
t1
> 0.0 ?
90
header.
time_interval
.
t2
- header.
time_interval
.
t1
:
91
header.
tgen
.
numberOfSeconds
);
92
93
if
(
check
(header) && N > 0.0 && dt > 0.0) {
94
95
W
= 1.0 / N / dt;
96
97
}
else
{
98
99
THROW
(
JValueOutOfRange
,
"JWeightKM3BUU::configure(): Provided header is inconsistent with KM3BUU."
);
100
}
101
}
102
103
104
/**
105
* Check whether header is consistent with this event weighter.
106
*
107
* \param header header
108
* \return true if consistent; else false
109
*/
110
bool
check
(
const
JHead
& header)
const override
111
{
112
return
is_km3buu
(header);
113
}
114
115
116
/**
117
* Get weight of given event.
118
*
119
* \param evt event
120
* \return weight [Hz]
121
*/
122
double
getWeight
(
const
Evt
& evt)
const override
123
{
124
if
(
is_valid
() && evt.
w
.size() > 1) {
125
126
return
W
* evt.
w
[1] *
getFlux
(evt);
127
128
}
else
if
(evt.
w
.size() > 2) {
129
130
return
W
* evt.
w
[2];
131
132
}
else
{
133
134
if
(!
is_valid
()) {
135
THROW
(
JNullPointerException
,
"JWeightKM3BUU::getWeight(): Unspecified flux function."
);
136
}
else
{
137
THROW
(
JIndexOutOfRange
,
"JWeightKM3BUU::getWeight(): Empty "
<< (evt.
w
.size() < 3 ?
"w2-"
:
"w3-"
) <<
"weight."
);
138
}
139
}
140
}
141
142
143
private
:
144
145
double
W
;
146
};
147
}
148
149
#endif
JAANET::JWeightKM3BUU::JWeightKM3BUU
JWeightKM3BUU()
Default constructor.
Definition:
JWeightKM3BUU.hh:37
JAANET::JWeightKM3BUU::JWeightKM3BUU
JWeightKM3BUU(const JHead &header)
Constructor.
Definition:
JWeightKM3BUU.hh:48
JAANET::JHead::genvol
JAANET::genvol genvol
Definition:
JHead.hh:1408
JException.hh
Exceptions.
JAANET::is_km3buu
bool is_km3buu(const JHead &header)
Check for generator.
Definition:
JHeadToolkit.hh:114
JFlux.hh
JAANET::time_interval::t1
double t1
Start time in seconds.
Definition:
JHead.hh:1043
JFluxHelper.hh
JAANET::JFluxHelper::configure
void configure(const JFlux &function)
Flux configuration.
Definition:
JFluxHelper.hh:51
JAANET::JWeightKM3BUU::configure
void configure(const JHead &header) override
Weight configuration.
Definition:
JWeightKM3BUU.hh:86
JAANET::genvol::numberOfEvents
double numberOfEvents
Number of events.
Definition:
JHead.hh:654
THROW
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition:
JException.hh:670
JAANET::time_interval::t2
double t2
Stop time in seconds.
Definition:
JHead.hh:1044
Evt::w
std::vector< double > w
MC: Weights w[0]=w1, w[1]=w2, w[2]]=w3 (see e.g. Tag list)
Definition:
Evt.hh:39
JAANET::JWeightKM3BUU::JWeightKM3BUU
JWeightKM3BUU(const JHead &header, const JFlux &flux)
Constructor.
Definition:
JWeightKM3BUU.hh:61
JLANG::JAbstractPointer::is_valid
bool is_valid() const
Check validity of pointer.
Definition:
JAbstractPointer.hh:83
JClonable.hh
JWeightEvent.hh
JLANG::JNullPointerException
Exception for null pointer operation.
Definition:
JException.hh:216
JAANET::flux
Neutrino flux.
Definition:
JHead.hh:839
JAANET::JFluxHelper
Helper class for event weighing.
Definition:
JFluxHelper.hh:23
JLANG::JClonable
Template class for object cloning.
Definition:
JClonable.hh:20
JAANET::JWeightKM3BUU::W
double W
Definition:
JWeightKM3BUU.hh:145
JAANET::JFluxHelper::getFlux
double getFlux(const Evt &evt) const
Get flux of given event.
Definition:
JFluxHelper.hh:63
JAANET::JWeightKM3BUU::check
bool check(const JHead &header) const override
Check whether header is consistent with this event weighter.
Definition:
JWeightKM3BUU.hh:110
JAANET::JFlux
Low-level interface for retrieving flux corresponding to an event.
Definition:
JFlux.hh:22
JAANET::JHead
Monte Carlo run header.
Definition:
JHead.hh:1113
JAANET::JHead::time_interval
JAANET::time_interval time_interval
Definition:
JHead.hh:1417
JAANET::JWeightKM3BUU
Implementation of event weighting for KM3BUU data.
Definition:
JWeightKM3BUU.hh:30
Evt.hh
JAANET::JHead::tgen
JAANET::tgen tgen
Definition:
JHead.hh:1416
JHeadToolkit.hh
JLANG::JValueOutOfRange
Exception for accessing a value in a collection that is outside of its range.
Definition:
JException.hh:162
JLANG::JIndexOutOfRange
Exception for accessing an index in a collection that is outside of its range.
Definition:
JException.hh:90
JAANET::tgen::numberOfSeconds
double numberOfSeconds
Time in seconds.
Definition:
JHead.hh:1014
Head.hh
N
then usage $script[input file[working directory[option]]] nWhere option can be N
Definition:
JMuonPostfit.sh:37
Evt
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition:
Evt.hh:19
JHead.hh
JAANET::JWeightKM3BUU::JWeightKM3BUU
JWeightKM3BUU(const JWeightKM3BUU &object)
Copy constructor.
Definition:
JWeightKM3BUU.hh:74
JAANET::JWeightKM3BUU::getWeight
double getWeight(const Evt &evt) const override
Get weight of given event.
Definition:
JWeightKM3BUU.hh:122
Generated by
1.8.5