EvtGen 2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Loading...
Searching...
No Matches
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
22
24#include "EvtGenBase/EvtPDL.hh"
29
30#include <ctype.h>
31#include <iostream>
32#include <math.h>
33#include <stdlib.h>
34
35using namespace std;
36
37EvtAbsLineShape::EvtAbsLineShape( double mass, double width, double maxRange,
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
73
86
88{
89 return new EvtAbsLineShape( *this );
90}
91
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}
109double 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
141double 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}
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=nullptr)
Definition EvtReport.cpp:32
@ EVTGEN_DEBUG
Definition EvtReport.hh:53
virtual EvtAbsLineShape * clone()
virtual double getMassProb(double mass, double massPar, int nDaug, double *massDau)
EvtAbsLineShape()=default
EvtAbsLineShape & operator=(const EvtAbsLineShape &x)
virtual double getRandMass(EvtId *parId, int nDaug, EvtId *dauId, EvtId *othDaugId, double maxMass, double *dauMasses)
EvtSpinType::spintype m_spin
virtual double rollMass()
Definition EvtId.hh:27
static std::string name(EvtId i)
Definition EvtPDL.cpp:376
static double Flat()
Definition EvtRandom.cpp:95