herwig
is hosted by
Hepforge
,
IPPP Durham
Herwig
7.3.0
PDT
GenericMassGenerator.h
1
// -*- C++ -*-
2
//
3
// GenericMassGenerator.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_GenericMassGenerator_H
10
#define HERWIG_GenericMassGenerator_H
11
//
12
// This is the declaration of the GenericMassGenerator class.
13
//
14
#include "ThePEG/PDT/MassGenerator.h"
15
#include "ThePEG/Repository/EventGenerator.h"
16
#include "ThePEG/PDT/ParticleData.h"
17
#include "GenericMassGenerator.fh"
18
#include "ThePEG/PDT/WidthGenerator.h"
19
#include "GenericWidthGenerator.fh"
20
#include "ThePEG/Repository/CurrentGenerator.h"
21
22
namespace
Herwig
{
23
using namespace
ThePEG
;
24
28
class
ModelGenerator;
29
56
class
GenericMassGenerator
:
public
MassGenerator
{
57
61
friend
class
ModelGenerator
;
62
63
public
:
64
68
GenericMassGenerator
();
69
73
virtual
~GenericMassGenerator
();
74
81
void
persistentOutput
(
PersistentOStream
& os)
const
;
82
88
void
persistentInput
(
PersistentIStream
& is,
int
version);
90
94
static
void
Init
();
95
96
public
:
97
103
bool
accept
(
const
ParticleData
& part)
const
;
104
112
Energy
mass
(
const
ParticleData
& part)
const
{
113
return
mass
(part,
lowerMass_
,
upperMass_
);
114
}
115
123
Energy
mass
(
const
ParticleData
& part,
124
const
Energy low,
const
Energy upp)
const
{
125
if
(upp<low)
return
low;
126
Energy output;
127
int
ntry=0;
double
wgt=0.;
128
do
{
129
++ntry;
130
output=
mass
(wgt,part,low,upp,3);
131
if
(wgt>
maxWgt_
)
maxWgt_
=wgt;
132
}
133
while
(
maxWgt_
*(
UseRandom::rnd
())>wgt&&ntry<
nGenerate_
);
134
return
(ntry>=
nGenerate_
) ?
mass_
: output;
135
}
136
144
Energy
mass
(
double
& wgt,
const
ParticleData
& part,
145
double
r=
UseRandom::rnd
())
const
{
146
return
mass
(wgt,part,
lowerMass_
,
upperMass_
,r);
147
}
148
158
Energy
mass
(
double
& wgt,
const
ParticleData
& part,
159
const
Energy low,
const
Energy upp,
160
double
r=
UseRandom::rnd
())
const
{
161
return
mass
(wgt,part,low,upp,
BWShape_
,r);
162
}
163
169
virtual
double
weight
(Energy q)
const
{
170
return
weight
(q,
BWShape_
);
171
}
172
176
virtual
InvEnergy2
BreitWignerWeight
(Energy q) {
177
return
BreitWignerWeight
(q,
BWShape_
);
178
}
180
184
virtual
void
dataBaseOutput
(ofstream &,
bool
);
185
186
public
:
187
195
pair<Energy,Energy>
width
(Energy q,
int
shape)
const
;
196
200
Energy
lowerLimit
()
const
{
return
lowerMass_
;}
201
205
Energy
upperLimit
()
const
{
return
upperMass_
;}
206
210
Energy
nominalMass
()
const
{
return
mass_
;}
211
215
Energy
nominalWidth
()
const
{
return
width_
;}
216
217
protected
:
218
228
virtual
Energy
mass
(
double
& wgt,
const
ParticleData
& ,
229
const
Energy low,
const
Energy upp,
int
shape,
230
double
r=
UseRandom::rnd
())
const
{
231
// calculate the mass square using fixed width BW
232
Energy lo=max(low,
lowerMass_
),up=min(upp,
upperMass_
);
233
double
rhomin=atan2((lo*lo-
mass2_
),
mWidth_
);
234
double
rhomax=atan2((up*up-
mass2_
),
mWidth_
)-rhomin;
235
double
rho=rhomin+rhomax*r;
236
Energy2 q2 =
mass2_
+
mWidth_
*tan(rho);
237
Energy q =
sqrt
(q2);
238
wgt = rhomax*
weight
(q,shape);
239
// return the mass
240
return
q;
241
}
242
251
Energy
mass
(
double
& wgt,
const
ParticleData
& part,
int
shape,
252
double
r=
UseRandom::rnd
())
const
{
253
return
mass
(wgt,part,
lowerMass_
,
upperMass_
,shape,r);
254
}
255
262
inline
virtual
double
weight
(Energy q,
int
shape)
const
{
263
Energy2 q2 = q*q;
264
Energy4 sq=
sqr
(q2-
mass2_
);
265
pair<Energy,Energy> gam=
width
(q,shape);
266
// finish the calculation of the width
267
Energy2 num;
268
if
(shape==2) num =
mass_
*gam.first;
269
else
if
(shape==3) num =
mass_
*gam.first;
270
else
num = q *gam.first;
271
Energy4 den = (shape==2) ? sq+
mass2_
*gam.second*gam.second : sq+q2*gam.second*gam.second;
272
return
num/den*(sq+
mWidth_
*
mWidth_
)/
Constants::pi
/
mWidth_
;
273
}
274
278
virtual
InvEnergy2
BreitWignerWeight
(Energy q,
int
shape)
const
{
279
Energy2 q2 = q*q;
280
Energy4 sq=
sqr
(q2-
mass2_
);
281
pair<Energy,Energy> gam=
width
(q,shape);
282
// finish the calculation of the width
283
Energy2 num;
284
if
(shape==2) num =
mass_
*gam.first;
285
else
if
(shape==3) num =
mass_
*gam.first;
286
else
num = q *gam.first;
287
Energy4 den = (shape==2) ? sq+
mass2_
*gam.second*gam.second : sq+q2*gam.second*gam.second;
288
return
num/den/
Constants::pi
;
289
}
290
294
tcPDPtr
particle
()
const
{
return
particle_
;}
295
299
void
particle
(
tPDPtr
in) {
particle_
= in;}
300
301
protected
:
302
309
virtual
IBPtr
clone
()
const
;
310
315
virtual
IBPtr
fullclone
()
const
;
317
318
protected
:
319
327
virtual
void
doinit
();
328
333
virtual
void
dofinish
();
334
344
virtual
void
rebind
(
const
TranslationMap
& trans)
345
;
346
352
virtual
IVector
getReferences
();
354
355
private
:
356
360
GenericMassGenerator
&
operator=
(
const
GenericMassGenerator
&) =
delete
;
361
362
private
:
363
367
void
setParticle
(
string
);
368
372
string
getParticle
()
const
;
373
374
private
:
375
379
mutable
double
maxWgt_
;
380
384
int
BWShape_
;
385
389
int
nGenerate_
;
390
391
private
:
392
396
tPDPtr
particle_
;
397
401
Energy
lowerMass_
;
402
406
Energy
upperMass_
;
407
411
Energy
mass_
;
412
416
Energy
width_
;
417
421
Energy2
mass2_
;
422
426
Energy2
mWidth_
;
427
431
int
nInitial_
;
432
436
bool
initialize_
;
437
441
bool
output_
;
442
446
WidthGeneratorPtr
widthGen_
;
447
451
GenericWidthGeneratorPtr
widthGenB_
;
452
456
bool
widthOpt_
;
457
458
};
459
460
}
461
462
463
#endif
/* HERWIG_GenericMassGenerator_H */
Herwig::GenericMassGenerator
The GenericMassGenerator class is a simple class for the generation of particle masses in Herwig.
Definition:
GenericMassGenerator.h:56
Herwig::GenericMassGenerator::BreitWignerWeight
virtual InvEnergy2 BreitWignerWeight(Energy q)
Return the full weight.
Definition:
GenericMassGenerator.h:176
Herwig::GenericMassGenerator::~GenericMassGenerator
virtual ~GenericMassGenerator()
Destructor.
Herwig::GenericMassGenerator::accept
bool accept(const ParticleData &part) const
Return true if this mass generator can handle the given particle type.
Herwig::GenericMassGenerator::clone
virtual IBPtr clone() const
Make a simple clone of this object.
Herwig::GenericMassGenerator::output_
bool output_
Whether or not to output the data to a file.
Definition:
GenericMassGenerator.h:441
Herwig::GenericMassGenerator::dofinish
virtual void dofinish()
Finalize this object.
Herwig::GenericMassGenerator::nominalMass
Energy nominalMass() const
Default mass.
Definition:
GenericMassGenerator.h:210
Herwig::GenericMassGenerator::rebind
virtual void rebind(const TranslationMap &trans)
Rebind pointer to other Interfaced objects.
Herwig::GenericMassGenerator::upperMass_
Energy upperMass_
Upper limit on the particle's mass.
Definition:
GenericMassGenerator.h:406
Herwig::GenericMassGenerator::BreitWignerWeight
virtual InvEnergy2 BreitWignerWeight(Energy q, int shape) const
Return the full weight.
Definition:
GenericMassGenerator.h:278
Herwig::GenericMassGenerator::upperLimit
Energy upperLimit() const
Upper limit on the mass.
Definition:
GenericMassGenerator.h:205
Herwig::GenericMassGenerator::weight
virtual double weight(Energy q) const
Weight for the factor.
Definition:
GenericMassGenerator.h:169
Herwig::GenericMassGenerator::widthOpt_
bool widthOpt_
Option for the treatment of the width.
Definition:
GenericMassGenerator.h:456
Herwig::GenericMassGenerator::BWShape_
int BWShape_
parameter controlling the shape of the Breit-Wigner
Definition:
GenericMassGenerator.h:384
Herwig::GenericMassGenerator::dataBaseOutput
virtual void dataBaseOutput(ofstream &, bool)
Output the initialisation info for the database.
Herwig::GenericMassGenerator::mass2_
Energy2 mass2_
Mass of the particle squared.
Definition:
GenericMassGenerator.h:421
Herwig::GenericMassGenerator::mass
Energy mass(const ParticleData &part, const Energy low, const Energy upp) const
Generate a mass using specified limits.
Definition:
GenericMassGenerator.h:123
Herwig::GenericMassGenerator::weight
virtual double weight(Energy q, int shape) const
Weight for the factor.
Definition:
GenericMassGenerator.h:262
Herwig::GenericMassGenerator::doinit
virtual void doinit()
Initialize this object after the setup phase before saving and EventGenerator to disk.
Herwig::GenericMassGenerator::width_
Energy width_
Width of the particle.
Definition:
GenericMassGenerator.h:416
Herwig::GenericMassGenerator::lowerMass_
Energy lowerMass_
Lower limit on the particle's mass.
Definition:
GenericMassGenerator.h:401
Herwig::GenericMassGenerator::setParticle
void setParticle(string)
Helper function for the interface.
Herwig::GenericMassGenerator::widthGen_
WidthGeneratorPtr widthGen_
Pointer to the width generator.
Definition:
GenericMassGenerator.h:446
Herwig::GenericMassGenerator::mass
virtual Energy mass(double &wgt, const ParticleData &, const Energy low, const Energy upp, int shape, double r=UseRandom::rnd()) const
Return a mass with the weight using the specified limits.
Definition:
GenericMassGenerator.h:228
Herwig::GenericMassGenerator::GenericMassGenerator
GenericMassGenerator()
Default constructor.
Herwig::GenericMassGenerator::initialize_
bool initialize_
Whether or not to initialize the GenericMassGenerator.
Definition:
GenericMassGenerator.h:436
Herwig::GenericMassGenerator::nominalWidth
Energy nominalWidth() const
Default Width.
Definition:
GenericMassGenerator.h:215
Herwig::GenericMassGenerator::mWidth_
Energy2 mWidth_
Mass of the particle times the width.
Definition:
GenericMassGenerator.h:426
Herwig::GenericMassGenerator::getReferences
virtual IVector getReferences()
Return a vector of all pointers to Interfaced objects used in this object.
Herwig::GenericMassGenerator::mass
Energy mass(double &wgt, const ParticleData &part, int shape, double r=UseRandom::rnd()) const
Return a mass with the weight using the default limits.
Definition:
GenericMassGenerator.h:251
Herwig::GenericMassGenerator::particle
void particle(tPDPtr in)
Set the particle.
Definition:
GenericMassGenerator.h:299
Herwig::GenericMassGenerator::persistentOutput
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
Herwig::GenericMassGenerator::mass
Energy mass(double &wgt, const ParticleData &part, const Energy low, const Energy upp, double r=UseRandom::rnd()) const
Return a mass with the weight using the specified limits.
Definition:
GenericMassGenerator.h:158
Herwig::GenericMassGenerator::maxWgt_
double maxWgt_
The maximum weight for unweighting when generating the mass.
Definition:
GenericMassGenerator.h:379
Herwig::GenericMassGenerator::mass
Energy mass(const ParticleData &part) const
Generate a mass using the default limits.
Definition:
GenericMassGenerator.h:112
Herwig::GenericMassGenerator::persistentInput
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
Herwig::GenericMassGenerator::mass
Energy mass(double &wgt, const ParticleData &part, double r=UseRandom::rnd()) const
Return a mass with the weight using the default limits.
Definition:
GenericMassGenerator.h:144
Herwig::GenericMassGenerator::fullclone
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
Herwig::GenericMassGenerator::nGenerate_
int nGenerate_
Number of attempts to generate the mass.
Definition:
GenericMassGenerator.h:389
Herwig::GenericMassGenerator::getParticle
string getParticle() const
Helper function for the interface.
Herwig::GenericMassGenerator::widthGenB_
GenericWidthGeneratorPtr widthGenB_
Pointer to the width generator.
Definition:
GenericMassGenerator.h:451
Herwig::GenericMassGenerator::width
pair< Energy, Energy > width(Energy q, int shape) const
The running width.
Herwig::GenericMassGenerator::operator=
GenericMassGenerator & operator=(const GenericMassGenerator &)=delete
Private and non-existent assignment operator.
Herwig::GenericMassGenerator::particle_
tPDPtr particle_
Pointer to the particle.
Definition:
GenericMassGenerator.h:396
Herwig::GenericMassGenerator::Init
static void Init()
Standard Init function used to initialize the interfaces.
Herwig::GenericMassGenerator::lowerLimit
Energy lowerLimit() const
Lower limit on the mass.
Definition:
GenericMassGenerator.h:200
Herwig::GenericMassGenerator::particle
tcPDPtr particle() const
Accesss to the particle.
Definition:
GenericMassGenerator.h:294
Herwig::GenericMassGenerator::mass_
Energy mass_
Mass of the particle.
Definition:
GenericMassGenerator.h:411
Herwig::GenericMassGenerator::nInitial_
int nInitial_
Number of weights to generate when initializing.
Definition:
GenericMassGenerator.h:431
Herwig::ModelGenerator
This class is designed to store the particles in some model and then call the appropriate function to...
Definition:
ModelGenerator.h:31
ThePEG::MassGenerator
ThePEG::ParticleData
ThePEG::PersistentIStream
ThePEG::PersistentOStream
ThePEG::Rebinder
ThePEG::UseRandom::rnd
static double rnd()
Herwig
-*- C++ -*-
Definition:
BasicConsistency.h:17
ThePEG::Constants::pi
constexpr double pi
ThePEG
ThePEG::tPDPtr
ThePEG::Ptr< ParticleData >::transient_pointer tPDPtr
ThePEG::sqrt
double sqrt(int x)
ThePEG::IBPtr
ThePEG::Ptr< InterfacedBase >::pointer IBPtr
ThePEG::tcPDPtr
ThePEG::Ptr< ParticleData >::transient_const_pointer tcPDPtr
ThePEG::sqr
constexpr auto sqr(const T &x) -> decltype(x *x)
ThePEG::IVector
vector< IBPtr > IVector
Generated on Thu Jun 20 2024 17:50:53 for Herwig by
1.9.6