herwig
is hosted by
Hepforge
,
IPPP Durham
Herwig
7.3.0
Decay
PhaseSpaceChannel.h
1
// -*- C++ -*-
2
//
3
// PhaseSpaceChannel.h is a part of Herwig - A multi-purpose Monte Carlo event generator
4
// Copyright (C) 2002-2019 The Herwig Collaboration
5
//
6
// Herwig is licenced under version 3 of the GPL, see COPYING for details.
7
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
8
//
9
#ifndef Herwig_PhaseSpaceChannel_H
10
#define Herwig_PhaseSpaceChannel_H
11
//
12
// This is the declaration of the PhaseSpaceChannel class.
13
//
14
15
#include "
ThePEG/Config/ThePEG.h
"
16
#include "ThePEG/PDT/ParticleData.h"
17
#include "ThePEG/Persistency/PersistentOStream.h"
18
#include "ThePEG/Persistency/PersistentIStream.h"
19
#include "ThePEG/Utilities/EnumIO.h"
20
#include "PhaseSpaceMode.fh"
21
#include "ThePEG/MatrixElement/Tree2toNDiagram.h"
22
23
namespace
Herwig
{
24
25
using namespace
ThePEG
;
26
52
class
PhaseSpaceChannel
{
53
54
public
:
55
56
friend
PersistentOStream
;
57
friend
PersistentIStream
;
58
62
struct
PhaseSpaceResonance
{
63
67
enum
Jacobian
{BreitWigner,Power,OnShell};
68
72
PhaseSpaceResonance
() {};
76
PhaseSpaceResonance
(
cPDPtr
part) :
particle
(part),
mass2
(
sqr
(part->mass())),
mWidth
(part->mass()*part->width()),
77
jacobian
(BreitWigner),
power
(0.),
children
(make_pair(0,0))
78
{};
82
cPDPtr
particle
;
83
87
Energy2
mass2
;
88
92
Energy2
mWidth
;
93
97
Jacobian
jacobian
;
98
102
double
power
;
103
107
pair<int,int>
children
;
108
112
vector<int>
descendents
;
113
114
};
115
116
public
:
117
121
PhaseSpaceChannel
() :
weight_
(1.),
initialized_
(false),
skipFirst_
(false) {};
122
126
PhaseSpaceChannel
(tPhaseSpaceModePtr inm,
bool
skip=
false
);
127
132
PhaseSpaceChannel
&
operator ,
(
tPDPtr
res) {
133
if
(
intermediates_
.size()==1&&
skipFirst_
) {
134
skipFirst_
=
false
;
135
}
136
else
137
intermediates_
.push_back(
PhaseSpaceResonance
(res));
138
if
(
iAdd_
<0)
return
*
this
;
139
if
(
intermediates_
[
iAdd_
].children.first==0)
140
intermediates_
[
iAdd_
].children.first = 1-int(
intermediates_
.size());
141
else
142
intermediates_
[
iAdd_
].children.second = 1-int(
intermediates_
.size());
143
iAdd_
=-1;
144
return
*
this
;
145
}
146
151
PhaseSpaceChannel
&
operator ,
(
int
o) {
152
if
(
iAdd_
<0)
iAdd_
= o;
153
else
if
(o>=0) {
154
if
(
intermediates_
[
iAdd_
].children.first==0)
155
intermediates_
[
iAdd_
].children.first = o;
156
else
157
intermediates_
[
iAdd_
].children.second = o;
158
iAdd_
=-1;
159
}
160
else
if
(o<0) {
161
assert(
false
);
162
}
163
return
*
this
;
164
}
165
169
void
setJacobian
(
unsigned
int
ires,
PhaseSpaceResonance::Jacobian
jac,
double
power) {
170
intermediates_
[ires].jacobian = jac;
171
intermediates_
[ires].power = power;
172
}
173
174
public
:
175
179
void
init
(tPhaseSpaceModePtr mode);
180
184
void
initrun
(tPhaseSpaceModePtr mode);
185
189
bool
checkKinematics
();
190
194
const
double
&
weight
()
const
{
return
weight_
;}
195
199
void
weight
(
double
in) {
weight_
=in;}
200
210
void
resetIntermediate
(
tcPDPtr
part,Energy mass,Energy width) {
211
if
(!part)
return
;
212
for
(
PhaseSpaceResonance
& res :
intermediates_
) {
213
if
(res.particle!=part)
continue
;
214
res.mass2 =
sqr
(mass);
215
res.mWidth = mass*width;
216
}
217
}
218
227
vector<Lorentz5Momentum>
generateMomenta
(
const
Lorentz5Momentum & pin,
228
const
vector<Energy> & massext)
const
;
229
230
238
double
generateWeight
(
const
vector<Lorentz5Momentum> & output)
const
;
239
251
void
generateIntermediates
(
bool
cc,
const
Particle
& in,
ParticleVector
& out);
252
256
ThePEG::Ptr<ThePEG::Tree2toNDiagram>::pointer
createDiagram
()
const
;
257
258
public
:
259
265
inline
friend
PersistentOStream
&
operator<<
(
PersistentOStream
& os,
266
const
PhaseSpaceChannel
& x) {
267
os << x.
weight_
<< x.
initialized_
<< x.
intermediates_
;
268
return
os;
269
}
270
276
inline
friend
PersistentIStream
&
operator>>
(
PersistentIStream
& is,
277
PhaseSpaceChannel
& x) {
278
is >> x.
weight_
>> x.
initialized_
>> x.
intermediates_
;
279
return
is;
280
}
281
286
friend
ostream &
operator<<
(ostream & os,
const
PhaseSpaceChannel
& channel);
287
288
private
:
289
293
void
findChildren
(
const
PhaseSpaceResonance
& res,
294
vector<int> & children) {
295
if
(res.
children
.first>0)
296
children.push_back(res.
children
.first);
297
else
298
findChildren
(
intermediates_
[abs(res.
children
.first)],children);
299
if
(!res.
particle
)
return
;
300
if
(res.
children
.second>0)
301
children.push_back(res.
children
.second);
302
else
303
findChildren
(
intermediates_
[abs(res.
children
.second)],children);
304
}
305
315
void
twoBodyDecay
(
const
Lorentz5Momentum & p,
316
const
Energy m1,
const
Energy m2,
317
Lorentz5Momentum & p1, Lorentz5Momentum & p2)
const
;
318
327
Energy
generateMass
(
const
PhaseSpaceResonance
& res,
328
Energy lower,Energy upper,
329
const
double
& rnd)
const
;
330
338
InvEnergy2
massWeight
(
const
PhaseSpaceResonance
& res,
339
Energy moff,Energy lower,Energy upper)
const
;
341
347
double
atanhelper
(
const
PhaseSpaceResonance
& res, Energy limit)
const
;
348
349
private
:
350
354
tPhaseSpaceModePtr
mode_
;
355
359
vector<PhaseSpaceResonance>
intermediates_
;
360
364
int
iAdd_
= -1;
365
369
double
weight_
;
370
374
bool
initialized_
;
375
379
bool
skipFirst_
;
380
381
};
382
383
389
inline
PersistentOStream
&
operator<<
(
PersistentOStream
& os,
390
const
PhaseSpaceChannel::PhaseSpaceResonance
& x) {
391
os << x.
particle
<<
ounit
(x.
mass2
,GeV2) <<
ounit
(x.
mWidth
,GeV2)
392
<<
oenum
(x.
jacobian
) << x.
power
<< x.
children
<< x.
descendents
;
393
return
os;
394
}
395
401
inline
PersistentIStream
&
operator>>
(
PersistentIStream
& is,
402
PhaseSpaceChannel::PhaseSpaceResonance
& x) {
403
is >> x.
particle
>>
iunit
(x.
mass2
,GeV2) >>
iunit
(x.
mWidth
,GeV2)
404
>>
ienum
(x.
jacobian
) >> x.
power
>> x.
children
>> x.
descendents
;
405
return
is;
406
}
407
412
ostream &
operator<<
(ostream & os,
const
PhaseSpaceChannel
& channel);
413
417
class
PhaseSpaceError
:
public
Exception
{};
418
419
}
420
421
#endif
/* Herwig_PhaseSpaceChannel_H */
ThePEG.h
Herwig::PhaseSpaceChannel
This class is designed to store the information needed for a given phase-space channel for use by the...
Definition:
PhaseSpaceChannel.h:52
Herwig::PhaseSpaceChannel::generateMomenta
vector< Lorentz5Momentum > generateMomenta(const Lorentz5Momentum &pin, const vector< Energy > &massext) const
Generate the momenta of the external particles.
Herwig::PhaseSpaceChannel::intermediates_
vector< PhaseSpaceResonance > intermediates_
The intermediates.
Definition:
PhaseSpaceChannel.h:359
Herwig::PhaseSpaceChannel::skipFirst_
bool skipFirst_
Wheter or not to skiip the first resonance.
Definition:
PhaseSpaceChannel.h:379
Herwig::PhaseSpaceChannel::weight_
double weight_
The weight.
Definition:
PhaseSpaceChannel.h:369
Herwig::PhaseSpaceChannel::iAdd_
int iAdd_
Integer to keep track of what we are adding.
Definition:
PhaseSpaceChannel.h:364
Herwig::PhaseSpaceChannel::weight
const double & weight() const
The weight.
Definition:
PhaseSpaceChannel.h:194
Herwig::PhaseSpaceChannel::init
void init(tPhaseSpaceModePtr mode)
Initialize the channel.
Herwig::PhaseSpaceChannel::checkKinematics
bool checkKinematics()
Check the kinematics.
Herwig::PhaseSpaceChannel::resetIntermediate
void resetIntermediate(tcPDPtr part, Energy mass, Energy width)
Reset the properties of an intermediate particle.
Definition:
PhaseSpaceChannel.h:210
Herwig::PhaseSpaceChannel::PhaseSpaceChannel
PhaseSpaceChannel(tPhaseSpaceModePtr inm, bool skip=false)
Constructor with incoming particles.
Herwig::PhaseSpaceChannel::createDiagram
ThePEG::Ptr< ThePEG::Tree2toNDiagram >::pointer createDiagram() const
Create a diagrams for the channel.
Herwig::PhaseSpaceChannel::operator,
PhaseSpaceChannel & operator,(tPDPtr res)
If less than zero indicate that this channel is competed.
Definition:
PhaseSpaceChannel.h:132
Herwig::PhaseSpaceChannel::atanhelper
double atanhelper(const PhaseSpaceResonance &res, Energy limit) const
Helper function for the weight calculation.
Herwig::PhaseSpaceChannel::generateMass
Energy generateMass(const PhaseSpaceResonance &res, Energy lower, Energy upper, const double &rnd) const
Generate the mass of a resonance.
Herwig::PhaseSpaceChannel::initrun
void initrun(tPhaseSpaceModePtr mode)
Initialize the channel.
Herwig::PhaseSpaceChannel::generateWeight
double generateWeight(const vector< Lorentz5Momentum > &output) const
Generate the weight for this channel given a phase space configuration.
Herwig::PhaseSpaceChannel::generateIntermediates
void generateIntermediates(bool cc, const Particle &in, ParticleVector &out)
Generate the final-state particles including the intermediate resonances.
Herwig::PhaseSpaceChannel::initialized_
bool initialized_
Whether or not its been initialized.
Definition:
PhaseSpaceChannel.h:374
Herwig::PhaseSpaceChannel::mode_
tPhaseSpaceModePtr mode_
Pointer to the phase-space mode.
Definition:
PhaseSpaceChannel.h:354
Herwig::PhaseSpaceChannel::twoBodyDecay
void twoBodyDecay(const Lorentz5Momentum &p, const Energy m1, const Energy m2, Lorentz5Momentum &p1, Lorentz5Momentum &p2) const
Calculate the momenta for a two body decay The return value indicates success or failure.
Herwig::PhaseSpaceChannel::operator>>
friend PersistentIStream & operator>>(PersistentIStream &is, PhaseSpaceChannel &x)
Input operator to allow persistently written data to be read in.
Definition:
PhaseSpaceChannel.h:276
Herwig::PhaseSpaceChannel::weight
void weight(double in)
Set the weight.
Definition:
PhaseSpaceChannel.h:199
Herwig::PhaseSpaceChannel::massWeight
InvEnergy2 massWeight(const PhaseSpaceResonance &res, Energy moff, Energy lower, Energy upper) const
Return the weight for a given resonance.
Herwig::PhaseSpaceChannel::operator<<
friend PersistentOStream & operator<<(PersistentOStream &os, const PhaseSpaceChannel &x)
Output operator to allow the structure to be persistently written.
Definition:
PhaseSpaceChannel.h:265
Herwig::PhaseSpaceChannel::PhaseSpaceChannel
PhaseSpaceChannel()
Default constructior.
Definition:
PhaseSpaceChannel.h:121
Herwig::PhaseSpaceChannel::operator<<
friend ostream & operator<<(ostream &os, const PhaseSpaceChannel &channel)
A friend output operator to allow the channel to be outputted for debugging purposes.
Herwig::PhaseSpaceChannel::setJacobian
void setJacobian(unsigned int ires, PhaseSpaceResonance::Jacobian jac, double power)
Set the jacobian for a given resonance.
Definition:
PhaseSpaceChannel.h:169
Herwig::PhaseSpaceChannel::findChildren
void findChildren(const PhaseSpaceResonance &res, vector< int > &children)
Find the external particles which are the children of a given resonance.
Definition:
PhaseSpaceChannel.h:293
Herwig::PhaseSpaceError
exception for this class and those inheriting from it
Definition:
PhaseSpaceChannel.h:417
ThePEG::Exception
ThePEG::Particle
ThePEG::PersistentIStream
ThePEG::PersistentOStream
Herwig
-*- C++ -*-
Definition:
BasicConsistency.h:17
ThePEG
ThePEG::tPDPtr
ThePEG::Ptr< ParticleData >::transient_pointer tPDPtr
ThePEG::iunit
IUnit< T, UT > iunit(T &t, const UT &ut)
ThePEG::operator>>
PersistentIStream & operator>>(PersistentIStream &is, HandlerGroup< HDLR > &hg)
ThePEG::ienum
IEnum< T > ienum(T &t)
ThePEG::oenum
OEnum< T > oenum(const T &t)
ThePEG::ParticleVector
vector< PPtr > ParticleVector
ThePEG::tcPDPtr
ThePEG::Ptr< ParticleData >::transient_const_pointer tcPDPtr
ThePEG::operator<<
ostream & operator<<(ostream &, const Collision &)
ThePEG::sqr
constexpr auto sqr(const T &x) -> decltype(x *x)
ThePEG::cPDPtr
ThePEG::Ptr< ParticleData >::const_pointer cPDPtr
ThePEG::ounit
OUnit< T, UT > ounit(const T &t, const UT &ut)
Herwig::PhaseSpaceChannel::PhaseSpaceResonance
Struct for the intermediates in the phase-space channel.
Definition:
PhaseSpaceChannel.h:62
Herwig::PhaseSpaceChannel::PhaseSpaceResonance::Jacobian
Jacobian
Enum for the jacobians.
Definition:
PhaseSpaceChannel.h:67
Herwig::PhaseSpaceChannel::PhaseSpaceResonance::mass2
Energy2 mass2
Mass squared.
Definition:
PhaseSpaceChannel.h:87
Herwig::PhaseSpaceChannel::PhaseSpaceResonance::jacobian
Jacobian jacobian
Type of jacobian.
Definition:
PhaseSpaceChannel.h:97
Herwig::PhaseSpaceChannel::PhaseSpaceResonance::power
double power
The power for a power law.
Definition:
PhaseSpaceChannel.h:102
Herwig::PhaseSpaceChannel::PhaseSpaceResonance::children
pair< int, int > children
The children.
Definition:
PhaseSpaceChannel.h:107
Herwig::PhaseSpaceChannel::PhaseSpaceResonance::mWidth
Energy2 mWidth
Mass times width.
Definition:
PhaseSpaceChannel.h:92
Herwig::PhaseSpaceChannel::PhaseSpaceResonance::PhaseSpaceResonance
PhaseSpaceResonance(cPDPtr part)
The constructor.
Definition:
PhaseSpaceChannel.h:76
Herwig::PhaseSpaceChannel::PhaseSpaceResonance::PhaseSpaceResonance
PhaseSpaceResonance()
The constructor.
Definition:
PhaseSpaceChannel.h:72
Herwig::PhaseSpaceChannel::PhaseSpaceResonance::particle
cPDPtr particle
The particle.
Definition:
PhaseSpaceChannel.h:82
Herwig::PhaseSpaceChannel::PhaseSpaceResonance::descendents
vector< int > descendents
The final descendents.
Definition:
PhaseSpaceChannel.h:112
Generated on Thu Jun 20 2024 17:50:52 for Herwig by
1.9.6