Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F19245080
test_decay.cc
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
test_decay.cc
View Options
/**
* \authors The HEJ collaboration (see AUTHORS for details)
* \date 2019
* \copyright GPLv2 or later
*
* \brief Test classification for (invalid) W decays
*/
#include
"HEJ/Event.hh"
#include
"hej_test.hh"
namespace
{
const
fastjet
::
JetDefinition
jet_def
{
fastjet
::
JetAlgorithm
::
antikt_algorithm
,
0.4
};
const
double
min_jet_pt
{
30.
};
HEJ
::
Event
::
EventData
new_event
()
{
HEJ
::
Event
::
EventData
ev
;
ev
.
outgoing
.
push_back
({
HEJ
::
ParticleID
::
gluon
,
{
-
11
,
-
96
,
-
76
,
123
},
{}});
ev
.
outgoing
.
push_back
({
HEJ
::
ParticleID
::
gluon
,
{
-
15
,
-
70
,
-
22
,
75
},
{}});
ev
.
outgoing
.
push_back
({
HEJ
::
ParticleID
::
gluon
,
{
68
,
93
,
-
20
,
117
},
{}});
ev
.
outgoing
.
push_back
({
HEJ
::
ParticleID
::
gluon
,
{
-
12
,
95
,
56
,
111
},
{}});
ev
.
outgoing
.
push_back
({
HEJ
::
ParticleID
::
gluon
,
{
-
30
,
-
22
,
25
,
45
},
{}});
ev
.
incoming
[
0
]
=
{
HEJ
::
ParticleID
::
gluon
,
{
0
,
0
,
-
254
,
254
},
{}};
ev
.
incoming
[
1
]
=
{
HEJ
::
ParticleID
::
gluon
,
{
0
,
0
,
217
,
217
},
{}};
return
ev
;
}
bool
test_event
(
HEJ
::
Event
::
EventData
data
,
bool
const
valid
){
using
namespace
HEJ
::
event_type
;
EventType
const
expected
{
valid
?
FKL
:
bad_final_state
};
shuffle_particles
(
data
);
auto
const
ev
=
std
::
move
(
data
).
cluster
(
jet_def
,
min_jet_pt
);
if
(
ev
.
type
()
!=
expected
){
std
::
cerr
<<
"Event does not match expectation, expected "
<<
name
(
expected
)
<<
"
\n
"
<<
ev
<<
std
::
endl
;
return
false
;
}
return
true
;
}
}
// namespace anonymous
int
main
()
{
using
namespace
HEJ
::
pid
;
auto
ev
=
new_event
();
// basic FKL
test_event
(
ev
,
true
);
// W position shouldn't matter
for
(
auto
const
W_type
:
{
Wp
,
Wm
}){
for
(
size_t
w_pos
=
1
;
w_pos
<
ev
.
outgoing
.
size
()
-
1
;
++
w_pos
){
ev
=
new_event
();
ev
.
outgoing
[
w_pos
].
type
=
W_type
;
ev
.
outgoing
.
back
().
type
=
(
W_type
==
Wp
)
?
d
:
u
;
ev
.
incoming
.
back
().
type
=
(
W_type
==
Wp
)
?
u
:
d
;
// no decay
if
(
!
test_event
(
ev
,
false
))
return
EXIT_FAILURE
;
// working decay
ev
.
decays
[
w_pos
]
=
decay_W
(
ev
.
outgoing
[
w_pos
]);
if
(
!
test_event
(
ev
,
true
))
return
EXIT_FAILURE
;
// swapped W+ <-> W-
ev
.
decays
[
w_pos
].
at
(
0
).
type
=
static_cast
<
ParticleID
>
(
-
ev
.
decays
[
w_pos
].
at
(
0
).
type
);
ev
.
decays
[
w_pos
].
at
(
1
).
type
=
static_cast
<
ParticleID
>
(
-
ev
.
decays
[
w_pos
].
at
(
1
).
type
);
if
(
!
test_event
(
ev
,
false
))
return
EXIT_FAILURE
;
ev
.
decays
[
w_pos
].
at
(
0
).
type
=
static_cast
<
ParticleID
>
(
-
ev
.
decays
[
w_pos
].
at
(
0
).
type
);
ev
.
decays
[
w_pos
].
at
(
1
).
type
=
static_cast
<
ParticleID
>
(
-
ev
.
decays
[
w_pos
].
at
(
1
).
type
);
// replace e -> mu (normal)
ev
.
decays
[
w_pos
].
at
(
0
).
type
=
static_cast
<
ParticleID
>
(
ev
.
decays
[
w_pos
].
at
(
0
).
type
+
2
);
if
(
!
test_event
(
ev
,
false
))
return
EXIT_FAILURE
;
ev
.
decays
[
w_pos
].
at
(
0
).
type
=
static_cast
<
ParticleID
>
(
ev
.
decays
[
w_pos
].
at
(
0
).
type
-
2
);
// replace e -> mu (anti)
ev
.
decays
[
w_pos
].
at
(
1
).
type
=
static_cast
<
ParticleID
>
(
ev
.
decays
[
w_pos
].
at
(
1
).
type
-
2
);
if
(
!
test_event
(
ev
,
false
))
return
EXIT_FAILURE
;
// all mu
ev
.
decays
[
w_pos
].
at
(
0
).
type
=
static_cast
<
ParticleID
>
(
ev
.
decays
[
w_pos
].
at
(
0
).
type
+
2
);
if
(
!
test_event
(
ev
,
true
))
return
EXIT_FAILURE
;
ev
.
decays
[
w_pos
].
at
(
0
).
type
=
static_cast
<
ParticleID
>
(
ev
.
decays
[
w_pos
].
at
(
0
).
type
-
2
);
ev
.
decays
[
w_pos
].
at
(
1
).
type
=
static_cast
<
ParticleID
>
(
ev
.
decays
[
w_pos
].
at
(
1
).
type
+
2
);
// partonic
ev
.
decays
[
w_pos
].
at
(
0
).
type
=
static_cast
<
ParticleID
>
(
ev
.
decays
[
w_pos
].
at
(
0
).
type
-
10
);
ev
.
decays
[
w_pos
].
at
(
1
).
type
=
static_cast
<
ParticleID
>
(
ev
.
decays
[
w_pos
].
at
(
1
).
type
+
10
);
if
(
!
test_event
(
ev
,
false
))
return
EXIT_FAILURE
;
ev
.
decays
[
w_pos
].
at
(
0
).
type
=
static_cast
<
ParticleID
>
(
ev
.
decays
[
w_pos
].
at
(
0
).
type
+
10
);
ev
.
decays
[
w_pos
].
at
(
1
).
type
=
static_cast
<
ParticleID
>
(
ev
.
decays
[
w_pos
].
at
(
1
).
type
-
10
);
// double check that we undid all changes
if
(
!
test_event
(
ev
,
true
))
return
EXIT_FAILURE
;
// 1->3 decay
ev
.
decays
[
w_pos
].
emplace_back
(
HEJ
::
Particle
{
photon
,
fastjet
::
PseudoJet
(
0
,
0
,
0
,
0
),
{}}
);
if
(
!
test_event
(
ev
,
false
))
return
EXIT_FAILURE
;
ev
.
decays
[
w_pos
].
pop_back
();
// second decay
ev
.
decays
[
0
]
=
decay_W
(
ev
.
outgoing
[
0
]);
ev
.
decays
[
0
].
at
(
0
).
type
=
ev
.
outgoing
[
0
].
type
;
ev
.
decays
[
0
].
at
(
1
).
type
=
gluon
;
if
(
!
test_event
(
ev
,
false
))
return
EXIT_FAILURE
;
}
}
return
EXIT_SUCCESS
;
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Tue, Sep 30, 4:48 AM (12 h, 9 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6533008
Default Alt Text
test_decay.cc (4 KB)
Attached To
Mode
rHEJ HEJ
Attached
Detach File
Event Timeline
Log In to Comment