ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Generators
Pythia8_i
src
UserHooks
WZPolarization.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
Pythia8_i/UserHooksFactory.h
"
5
#include "
UserHooksUtils.h
"
6
#include "
UserSetting.h
"
7
#include "Pythia8/PhaseSpace.h"
8
9
namespace
Pythia8
{
10
11
13
//
14
// Polarisation state set via Main:spareMode1 = 0,1,2,3,4
15
// for isotropic, longitudinal, transverse, and trans+, trans-.
16
struct
WZPolarization
:
public
UserHooks {
17
18
WZPolarization
() :
m_polmode
(
"WZPolarization:mode"
, 1) { }
19
20
bool
canVetoResonanceDecays
() {
return
true
; }
21
22
bool
doVetoResonanceDecays
(
Event
&
process
) {
23
const
int
polmode =
m_polmode
(settingsPtr);
24
25
for
(
int
i = 1; i <
process
.size(); ++i) {
26
// Select vector bosons
27
Particle& v =
process
[i];
28
if
(v.id() != 23 && v.idAbs() != 24)
continue
;
29
const
Vec4 pv = v.p();
30
31
// Find W/Z daughter particles
32
Particle& d1 =
process
[v.daughter1()];
33
Particle& d2 =
process
[v.daughter2()];
34
35
// Get daughter momenta in the boson rest frame
36
Vec4 pd1 = d1.p();
37
Vec4 pd2 = d2.p();
38
pd1.bstback(pv);
39
pd2.bstback(pv);
40
41
// Randomly reorient and rejection-sample decay configuration
42
// (done inline here, rather than reboosting to the W/Z frame on each decay-hook iteration)
43
while
(
true
) {
44
45
// Random reorientation
46
const
double
dtheta = std::acos(2*
rand01
() - 1);
47
const
double
dphi = 2*
M_PI
*
rand01
();
48
pd1.rot(dtheta, dphi);
49
pd2.rot(dtheta, dphi);
50
51
// Angle w.r.t. W/Z flight direction, in rest-frame
52
const
double
th =
theta
(pv, pd1);
53
54
// Accept/reject the angle according to the polarisation being modelled
55
if
(polmode == 0) {
// Isotropic
56
break
;
// it's already been isotropically randomised
57
}
else
if
(polmode == 1) {
// Longitudinal
58
if
(
rand01
() <
sqr
(std::sin(th)))
break
;
59
}
else
if
(polmode == 2) {
// Trans-sum
60
if
(
rand01
() < (1 +
sqr
(std::cos(th)))/2)
break
;
61
}
else
if
(polmode == 3) {
// Trans+
62
if
(
rand01
() <
sqr
(1 + std::cos(th))/4)
break
;
63
}
else
if
(polmode == 4) {
// Trans-
64
if
(
rand01
() <
sqr
(1 - std::cos(th))/4)
break
;
65
}
66
}
67
68
// Boost the vectors back to the lab frame
69
pd1.bst(pv); d1.p(pd1);
70
pd2.bst(pv); d2.p(pd2);
71
72
}
73
74
return
false
;
75
}
76
77
double
sqr
(
double
x
) {
return
x
*
x
; }
78
79
double
rand01
() {
return
rndmPtr->flat(); }
80
81
Pythia8_UserHooks::UserSetting<int>
m_polmode
;
82
83
};
84
85
86
Pythia8_UserHooks::UserHooksFactory::Creator<Pythia8::WZPolarization>
WZPOL
(
"WZPolarization"
);
87
88
}
M_PI
#define M_PI
Definition
ActiveFraction.h:14
theta
Scalar theta() const
theta method
Definition
AmgMatrixBasePlugin.h:75
sqr
#define sqr(t)
Definition
PolygonTriangulator.cxx:113
UserHooksFactory.h
UserHooksUtils.h
UserSetting.h
x
#define x
Pythia8_UserHooks::UserHooksFactory::Creator
Definition
UserHooksFactory.h:54
Pythia8_UserHooks::UserSetting
Definition
UserSetting.h:17
process
const std::string process
Definition
fbtTestBasics.cxx:76
Pythia8
Author: James Monk (jmonk@cern.ch).
Definition
IPythia8Custom.h:10
Pythia8::WZPOL
Pythia8_UserHooks::UserHooksFactory::Creator< Pythia8::WZPolarization > WZPOL("WZPolarization")
Event
Definition
trigbs_orderedMerge.cxx:42
Pythia8::WZPolarization::WZPolarization
WZPolarization()
Definition
WZPolarization.cxx:18
Pythia8::WZPolarization::m_polmode
Pythia8_UserHooks::UserSetting< int > m_polmode
Definition
WZPolarization.cxx:81
Pythia8::WZPolarization::canVetoResonanceDecays
bool canVetoResonanceDecays()
Definition
WZPolarization.cxx:20
Pythia8::WZPolarization::doVetoResonanceDecays
bool doVetoResonanceDecays(Event &process)
Definition
WZPolarization.cxx:22
Pythia8::WZPolarization::rand01
double rand01()
Definition
WZPolarization.cxx:79
Pythia8::WZPolarization::sqr
double sqr(double x)
Definition
WZPolarization.cxx:77
Generated on
for ATLAS Offline Software by
1.17.0