BOSS
8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtSingleParticle2.cc
Go to the documentation of this file.
1
//--------------------------------------------------------------------------
2
//
3
// Environment:
4
// This software is part of the EvtGen package developed jointly
5
// for the BaBar and CLEO collaborations. If you use all or part
6
// of it, please give an appropriate acknowledgement.
7
//
8
// Copyright Information: See EvtGen/COPYRIGHT
9
// Copyright (C) 1998 Caltech, UCSB
10
//
11
// Module: EvtSingleParticle.cc
12
//
13
// Description: Special model to generate single particles.
14
//
15
// Modification history:
16
//
17
// RYD Febuary 17,1998 Module created
18
//
19
//------------------------------------------------------------------------
20
//
21
#include "
EvtSingleParticle2.hh
"
22
#include "
../EvtGenBase/EvtConst.hh
"
23
#include "
../EvtGenBase/EvtPDL.hh
"
24
#include "
../EvtGenBase/EvtParticle.hh
"
25
#include "
../EvtGenBase/EvtPatches.hh
"
26
#include "
../EvtGenBase/EvtRandom.hh
"
27
#include "
../EvtGenBase/EvtReport.hh
"
28
#include <stdlib.h>
29
#include <string>
30
using
std::endl;
31
32
EvtSingleParticle2::~EvtSingleParticle2
() {}
33
34
void
EvtSingleParticle2::getName
( std::string& model_name ) { model_name =
"SINGLE2"
; }
35
36
EvtDecayBase
*
EvtSingleParticle2::clone
() {
return
new
EvtSingleParticle2
(); }
37
38
void
EvtSingleParticle2::init
() {
39
40
// turn off checks for charge conservation
41
disableCheckQ
();
42
43
if
( (
getNArg
() == 6 ) || (
getNArg
() == 4 ) || (
getNArg
() == 2 ) )
44
{
45
46
if
(
getNArg
() == 6 )
47
{
48
// copy the arguments into eaiser to remember names!
49
50
pxymin =
getArg
( 0 );
51
pxymax =
getArg
( 1 );
52
53
thetamin =
getArg
( 2 );
54
thetamax =
getArg
( 3 );
55
56
phimin =
getArg
( 4 );
57
phimax =
getArg
( 5 );
58
}
59
60
if
(
getNArg
() == 4 )
61
{
62
// copy the arguments into eaiser to remember names!
63
pxymin =
getArg
( 0 );
64
pxymax =
getArg
( 1 );
65
66
thetamin =
getArg
( 2 );
67
thetamax =
getArg
( 3 );
68
69
phimin = 0.0;
70
phimax =
EvtConst::twoPi
;
71
}
72
73
if
(
getNArg
() == 2 )
74
{
75
// copy the arguments into eaiser to remember names!
76
pxymin =
getArg
( 0 );
77
pxymax =
getArg
( 1 );
78
79
thetamin = 0.376383;
80
thetamax = 2.76521;
//|cos(theta)|<0.93
81
82
phimin = 0.0;
83
phimax =
EvtConst::twoPi
;
84
}
85
}
86
else
87
{
88
89
report
(
ERROR
,
"EvtGen"
) <<
"EvtSingleParticle generator expected "
90
<<
" 5, 3, or 1 arguments but found:"
<<
getNArg
() << endl;
91
report
(
ERROR
,
"EvtGen"
) <<
"Will terminate execution!"
<< endl;
92
::abort();
93
}
94
95
report
(
INFO
,
"EvtGen"
) <<
"The single particle generator has been configured:"
<< endl;
96
report
(
INFO
,
"EvtGen"
) << thetamax <<
" > theta > "
<< thetamin << endl;
97
report
(
INFO
,
"EvtGen"
) << phimax <<
" > phi > "
<< phimin << endl;
98
}
99
100
void
EvtSingleParticle2::decay
(
EvtParticle
* p ) {
101
102
EvtParticle
* d;
103
EvtVector4R
p4;
104
105
double
mass
=
EvtPDL::getMass
(
getDaug
( 0 ) );
106
107
p->
makeDaughters
(
getNDaug
(),
getDaugs
() );
108
d = p->
getDaug
( 0 );
109
110
// generate flat distribution in p
111
// we are now in the parents restframe! This means the
112
// restframe of the e+e- collison.
113
114
double
theta;
115
if
( thetamax == thetamin ) { theta = thetamax; }
116
else
theta =
EvtRandom::Flat
( thetamin, thetamax );
117
double
phi;
118
if
( phimin == phimax ) { phi = phimin; }
119
else
phi =
EvtRandom::Flat
( phimin, phimax );
120
double
pxy;
121
if
( pxymin == pxymax ) { pxy = pxymin; }
122
else
pxy =
EvtRandom::Flat
( pxymin, pxymax );
123
124
pmag = pxy /
sin
( theta );
125
cthetamax =
cos
( thetamax );
126
cthetamin =
cos
( thetamin );
127
double
cthetalab;
128
129
// do{
130
// generate flat distribution in costheta
131
132
p4.
set
( sqrt(
mass
*
mass
+ pmag * pmag ), pmag *
cos
( phi ) *
sin
( theta ),
133
pmag *
sin
( phi ) *
sin
( theta ), pmag *
cos
( theta ) );
134
d->
init
(
getDaug
( 0 ), p4 );
135
// get 4 vector in the lab frame!
136
EvtVector4R
p4lab = d->
getP4Lab
();
137
cthetalab = p4lab.
get
( 3 ) / p4lab.
d3mag
();
138
// }while (cthetalab>cthetamax||cthetalab<cthetamin);
139
140
return
;
141
}
mass
double mass
Definition
CosmicGenerator.cxx:128
EvtConst.hh
EvtPDL.hh
EvtParticle.hh
EvtPatches.hh
EvtRandom.hh
report
ostream & report(Severity severity, const char *facility)
Definition
EvtReport.cc:34
EvtReport.hh
ERROR
@ ERROR
Definition
EvtReport.hh:49
INFO
@ INFO
Definition
EvtReport.hh:52
EvtSingleParticle2.hh
sin
double sin(const BesAngle a)
Definition
InstallArea/x86_64-el9-gcc13-dbg/include/MdcGeom/BesAngle.h:185
cos
double cos(const BesAngle a)
Definition
InstallArea/x86_64-el9-gcc13-dbg/include/MdcGeom/BesAngle.h:187
EvtConst::twoPi
static const double twoPi
Definition
EvtConst.hh:28
EvtDecayBase::getArg
double getArg(int j)
Definition
EvtDecayBase.cc:520
EvtDecayBase::EvtDecayBase
EvtDecayBase()
Definition
EvtDecayBase.cc:205
EvtDecayBase::disableCheckQ
void disableCheckQ()
Definition
EvtDecayBase.hh:65
EvtDecayBase::getNDaug
int getNDaug()
Definition
EvtDecayBase.hh:67
EvtDecayBase::getNArg
int getNArg()
Definition
EvtDecayBase.hh:70
EvtDecayBase::getDaugs
EvtId * getDaugs()
Definition
EvtDecayBase.hh:68
EvtDecayBase::getDaug
EvtId getDaug(int i)
Definition
EvtDecayBase.hh:69
EvtPDL::getMass
static double getMass(EvtId i)
Definition
EvtPDL.hh:44
EvtParticle
Definition
EvtParticle.hh:42
EvtParticle::makeDaughters
void makeDaughters(int ndaug, EvtId *id)
Definition
EvtParticle.cc:1150
EvtParticle::init
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
EvtParticle::getP4Lab
EvtVector4R getP4Lab()
Definition
EvtParticle.cc:694
EvtParticle::getDaug
EvtParticle * getDaug(int i)
Definition
EvtParticle.cc:80
EvtRandom::Flat
static double Flat()
Definition
EvtRandom.cc:69
EvtSingleParticle2::getName
void getName(std::string &name)
Definition
EvtSingleParticle2.cc:34
EvtSingleParticle2::init
void init()
Definition
EvtSingleParticle2.cc:38
EvtSingleParticle2::decay
void decay(EvtParticle *p)
Definition
EvtSingleParticle2.cc:100
EvtSingleParticle2::clone
EvtDecayBase * clone()
Definition
EvtSingleParticle2.cc:36
EvtSingleParticle2::~EvtSingleParticle2
virtual ~EvtSingleParticle2()
Definition
EvtSingleParticle2.cc:32
EvtSingleParticle2::EvtSingleParticle2
EvtSingleParticle2()
Definition
EvtSingleParticle2.hh:31
EvtVector4R
Definition
EvtVector4R.hh:29
EvtVector4R::get
double get(int i) const
Definition
EvtVector4R.hh:171
EvtVector4R::d3mag
double d3mag() const
Definition
EvtVector4R.cc:168
EvtVector4R::set
void set(int i, double d)
Definition
EvtVector4R.hh:173
8.0.0
BOSS_Gen
BesEvtGen
src
EvtGen
EvtGenModels
EvtSingleParticle2.cc
Generated by
1.16.1