EvtGen
2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Toggle main menu visibility
Loading...
Searching...
No Matches
src
EvtGenBase
EvtAbsLineShape.cpp
Go to the documentation of this file.
1
2
/***********************************************************************
3
* Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
4
* *
5
* This file is part of EvtGen. *
6
* *
7
* EvtGen is free software: you can redistribute it and/or modify *
8
* it under the terms of the GNU General Public License as published by *
9
* the Free Software Foundation, either version 3 of the License, or *
10
* (at your option) any later version. *
11
* *
12
* EvtGen is distributed in the hope that it will be useful, *
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15
* GNU General Public License for more details. *
16
* *
17
* You should have received a copy of the GNU General Public License *
18
* along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
19
***********************************************************************/
20
21
#include "
EvtGenBase/EvtAbsLineShape.hh
"
22
23
#include "
EvtGenBase/EvtComplex.hh
"
24
#include "
EvtGenBase/EvtPDL.hh
"
25
#include "
EvtGenBase/EvtPropBreitWigner.hh
"
26
#include "
EvtGenBase/EvtRandom.hh
"
27
#include "
EvtGenBase/EvtReport.hh
"
28
#include "
EvtGenBase/EvtTwoBodyVertex.hh
"
29
30
#include <ctype.h>
31
#include <iostream>
32
#include <math.h>
33
#include <stdlib.h>
34
35
using namespace
std;
36
37
EvtAbsLineShape::EvtAbsLineShape
(
double
mass,
double
width,
double
maxRange,
38
EvtSpinType::spintype
sp )
39
{
40
m_includeDecayFact
=
false
;
41
m_includeBirthFact
=
false
;
42
m_mass
= mass;
43
m_width
= width;
44
m_spin
= sp;
45
m_maxRange
= maxRange;
46
double
maxdelta = 15.0 * width;
47
//if ( width>0.001 ) {
48
// if ( 5.0*width < 0.6 ) maxdelta = 0.6;
49
//}
50
if
( maxRange > 0.00001 ) {
51
m_massMax
= mass + maxdelta;
52
m_massMin
= mass - maxRange;
53
}
else
{
54
m_massMax
= mass + maxdelta;
55
m_massMin
= mass - 15.0 * width;
56
}
57
if
(
m_massMin
< 0. )
58
m_massMin
= 0.;
59
m_massMax
= mass + maxdelta;
60
}
61
62
EvtAbsLineShape::EvtAbsLineShape
(
const
EvtAbsLineShape
& x )
63
{
64
m_includeDecayFact
= x.
m_includeDecayFact
;
65
m_includeBirthFact
= x.
m_includeBirthFact
;
66
m_mass
= x.
m_mass
;
67
m_massMax
= x.
m_massMax
;
68
m_massMin
= x.
m_massMin
;
69
m_width
= x.
m_width
;
70
m_spin
= x.
m_spin
;
71
m_maxRange
= x.
m_maxRange
;
72
}
73
74
EvtAbsLineShape
&
EvtAbsLineShape::operator=
(
const
EvtAbsLineShape
& x )
75
{
76
m_includeDecayFact
= x.
m_includeDecayFact
;
77
m_includeBirthFact
= x.
m_includeBirthFact
;
78
m_mass
= x.
m_mass
;
79
m_massMax
= x.
m_massMax
;
80
m_massMin
= x.
m_massMin
;
81
m_width
= x.
m_width
;
82
m_spin
= x.
m_spin
;
83
m_maxRange
= x.
m_maxRange
;
84
return
*
this
;
85
}
86
87
EvtAbsLineShape
*
EvtAbsLineShape::clone
()
88
{
89
return
new
EvtAbsLineShape
( *
this
);
90
}
91
92
double
EvtAbsLineShape::rollMass
()
93
{
94
double
ymin, ymax;
95
double
temp;
96
97
if
(
m_width
< 0.0001 ) {
98
return
m_mass
;
99
}
else
{
100
ymin = atan( 2.0 * (
m_massMin
-
m_mass
) /
m_width
);
101
ymax = atan( 2.0 * (
m_massMax
-
m_mass
) /
m_width
);
102
103
temp = (
m_mass
+
104
( (
m_width
/ 2.0 ) * tan(
EvtRandom::Flat
( ymin, ymax ) ) ) );
105
106
return
temp;
107
}
108
}
109
double
EvtAbsLineShape::getRandMass
(
EvtId
* parId,
int
/* nDaug */
,
110
EvtId
*
/*dauId*/
,
EvtId
*
/*othDaugId*/
,
111
double
maxMass,
double
*
/*dauMasses*/
)
112
{
113
if
(
m_width
< 0.0001 )
114
return
m_mass
;
115
//its not flat - but generated according to a BW
116
117
if
( maxMass > 0 && maxMass <
m_massMin
) {
118
EvtGenReport
(
EVTGEN_DEBUG
,
"EvtGen"
)
119
<<
"In EvtAbsLineShape::getRandMass:"
<< endl;
120
EvtGenReport
(
EVTGEN_DEBUG
,
"EvtGen"
)
121
<<
"Cannot create a particle with a minimal mass of "
<<
m_massMin
122
<<
" from a "
<<
EvtPDL::name
( *parId )
123
<<
" decay with available left-over mass-energy "
<< maxMass
124
<<
". Returning 0.0 mass. The rest of this decay chain will probably fail..."
125
<< endl;
126
return
0.0;
127
}
128
129
double
mMin =
m_massMin
;
130
double
mMax =
m_massMax
;
131
if
( maxMass > -0.5 && maxMass < mMax )
132
mMax = maxMass;
133
double
ymin = atan( 2.0 * ( mMin -
m_mass
) /
m_width
);
134
double
ymax = atan( 2.0 * ( mMax -
m_mass
) /
m_width
);
135
136
return
(
m_mass
+
137
( (
m_width
/ 2.0 ) * tan(
EvtRandom::Flat
( ymin, ymax ) ) ) );
138
// return EvtRandom::Flat(m_massMin,m_massMax);
139
}
140
141
double
EvtAbsLineShape::getMassProb
(
double
mass,
double
massPar,
int
nDaug,
142
double
* massDau )
143
{
144
double
dTotMass = 0.;
145
if
( nDaug > 1 ) {
146
int
i;
147
for
( i = 0; i < nDaug; i++ ) {
148
dTotMass += massDau[i];
149
}
150
//EvtGenReport(EVTGEN_INFO,"EvtGen") << mass << " " << massPar << " " << dTotMass << " "<< endl;
151
// if ( (mass-dTotMass)<0.0001 ) return 0.;
152
if
( ( mass < dTotMass ) )
153
return
0.;
154
}
155
if
(
m_width
< 0.0001 )
156
return
1.;
157
158
// no parent - lets not panic
159
if
( massPar > 0.0000000001 ) {
160
if
( mass > massPar )
161
return
0.;
162
}
163
//Otherwise return the right value.
164
//Fortunately we have generated events according to a non-rel BW, so
165
//just return..
166
//EvtPropBreitWigner bw(m_mass,m_width);
167
//EvtPropFactor<EvtTwoBodyVertex> f(bw);
168
//EvtComplex fm=f.eval(mass);
169
//EvtComplex fm0=f.eval(m_mass);
170
//return (abs(fm)*abs(fm))/(abs(fm0)*abs(fm0));
171
return
1.0;
172
}
EvtAbsLineShape.hh
EvtComplex.hh
EvtPDL.hh
EvtPropBreitWigner.hh
EvtRandom.hh
EvtReport.hh
EvtGenReport
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=nullptr)
Definition
EvtReport.cpp:32
EVTGEN_DEBUG
@ EVTGEN_DEBUG
Definition
EvtReport.hh:53
EvtTwoBodyVertex.hh
EvtAbsLineShape::m_massMax
double m_massMax
Definition
EvtAbsLineShape.hh:79
EvtAbsLineShape::clone
virtual EvtAbsLineShape * clone()
Definition
EvtAbsLineShape.cpp:87
EvtAbsLineShape::m_includeBirthFact
bool m_includeBirthFact
Definition
EvtAbsLineShape.hh:76
EvtAbsLineShape::getMassProb
virtual double getMassProb(double mass, double massPar, int nDaug, double *massDau)
Definition
EvtAbsLineShape.cpp:141
EvtAbsLineShape::EvtAbsLineShape
EvtAbsLineShape()=default
EvtAbsLineShape::m_massMin
double m_massMin
Definition
EvtAbsLineShape.hh:78
EvtAbsLineShape::m_includeDecayFact
bool m_includeDecayFact
Definition
EvtAbsLineShape.hh:75
EvtAbsLineShape::operator=
EvtAbsLineShape & operator=(const EvtAbsLineShape &x)
Definition
EvtAbsLineShape.cpp:74
EvtAbsLineShape::getRandMass
virtual double getRandMass(EvtId *parId, int nDaug, EvtId *dauId, EvtId *othDaugId, double maxMass, double *dauMasses)
Definition
EvtAbsLineShape.cpp:109
EvtAbsLineShape::m_spin
EvtSpinType::spintype m_spin
Definition
EvtAbsLineShape.hh:94
EvtAbsLineShape::m_width
double m_width
Definition
EvtAbsLineShape.hh:80
EvtAbsLineShape::m_mass
double m_mass
Definition
EvtAbsLineShape.hh:77
EvtAbsLineShape::rollMass
virtual double rollMass()
Definition
EvtAbsLineShape.cpp:92
EvtAbsLineShape::m_maxRange
double m_maxRange
Definition
EvtAbsLineShape.hh:81
EvtId
Definition
EvtId.hh:27
EvtPDL::name
static std::string name(EvtId i)
Definition
EvtPDL.cpp:376
EvtRandom::Flat
static double Flat()
Definition
EvtRandom.cpp:95
EvtSpinType::spintype
spintype
Definition
EvtSpinType.hh:29
Generated by
1.17.0