ATLAS Offline Software
Loading...
Searching...
No Matches
WZPolarization.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
5#include "UserHooksUtils.h"
6#include "UserSetting.h"
7#include "Pythia8/PhaseSpace.h"
8
9namespace 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
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
82
83 };
84
85
87
88}
#define M_PI
Scalar theta() const
theta method
#define sqr(t)
#define x
const std::string process
Author: James Monk (jmonk@cern.ch)
Pythia8_UserHooks::UserHooksFactory::Creator< Pythia8::WZPolarization > WZPOL("WZPolarization")
Pythia8_UserHooks::UserSetting< int > m_polmode
bool doVetoResonanceDecays(Event &process)