BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtAbsLineShape.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: EvtLineShape.cc
12//
13// Description: Store particle properties for one particle.
14//
15// Modification history:
16//
17// Lange March 10, 2001 Module created
18//
19//------------------------------------------------------------------------
20//
21#include "EvtAbsLineShape.hh"
22#include "EvtComplex.hh"
23#include "EvtPDL.hh"
24#include "EvtPatches.hh"
25#include "EvtPropBreitWigner.hh"
26#include "EvtRandom.hh"
27#include "EvtReport.hh"
28#include "EvtTwoBodyVertex.hh"
29#include <algorithm>
30#include <ctype.h>
31#include <fstream>
32#include <iostream>
33#include <math.h>
34#include <stdlib.h>
35using std::fstream;
36using namespace std; ///////////
37
39
41
42EvtAbsLineShape::EvtAbsLineShape( double mass, double width, double maxRange,
44
45 _includeDecayFact = false;
46 _includeBirthFact = false;
47 _applyFixForSP8 = false;
48 _mass = mass;
49 _width = width;
50 _spin = sp;
51 _maxRange = maxRange;
52 double maxdelta = 15.0 * width;
53 // if ( width>0.001 ) {
54 // if ( 5.0*width < 0.6 ) maxdelta = 0.6;
55 // }
56 if ( maxRange > 0.00001 )
57 {
58 _massMax = mass + maxdelta;
59 _massMin = mass - maxRange;
60 }
61 else
62 {
63 _massMax = mass + maxdelta;
64 _massMin = mass - 15.0 * width;
65 }
66 if ( _massMin < 0. ) _massMin = 0.;
67 _massMax = mass + maxdelta;
68}
69
71
72 _includeDecayFact = x._includeDecayFact;
73 _includeBirthFact = x._includeBirthFact;
74 _mass = x._mass;
75 _massMax = x._massMax;
76 _massMin = x._massMin;
77 _width = x._width;
78 _spin = x._spin;
79 _maxRange = x._maxRange;
80 _applyFixForSP8 = x._applyFixForSP8;
81}
82
84
85 _includeDecayFact = x._includeDecayFact;
86 _includeBirthFact = x._includeBirthFact;
87 _mass = x._mass;
88 _massMax = x._massMax;
89 _massMin = x._massMin;
90 _width = x._width;
91 _spin = x._spin;
92 _maxRange = x._maxRange;
93 _applyFixForSP8 = x._applyFixForSP8;
94 return *this;
95}
96
98
100
101 double ymin, ymax;
102 double temp;
103
104 if ( _width < 0.0001 ) { return _mass; }
105 else
106 {
107 ymin = atan( 2.0 * ( _massMin - _mass ) / _width );
108 ymax = atan( 2.0 * ( _massMax - _mass ) / _width );
109
110 temp = ( _mass + ( ( _width / 2.0 ) * tan( EvtRandom::Flat( ymin, ymax ) ) ) );
111
112 return temp;
113 }
114}
115double EvtAbsLineShape::getRandMass( EvtId* parId, int nDaug, EvtId* dauId, EvtId* othDaugId,
116 double maxMass, double* dauMasses ) {
117
118 if ( _width < 0.0001 ) return _mass;
119 // its not flat - but generated according to a BW
120
121 if ( maxMass > 0 && maxMass < _massMin )
122 {
123 report( ERROR, "EvtGen" ) << "In EvtAbsLineShape::getRandMass" << endl;
124 report( ERROR, "EvtGen" ) << "Decaying particle " << EvtPDL::name( *parId )
125 << " with mass " << maxMass << endl;
126 report( ERROR, "EvtGen" ) << " to particle"
127 << " with a minimal mass of " << _massMin << endl;
128 }
129
130 double mMin = _massMin;
131 double mMax = _massMax;
132 if ( maxMass > -0.5 && maxMass < mMax ) mMax = maxMass;
133 double ymin = atan( 2.0 * ( mMin - _mass ) / _width );
134 double ymax = atan( 2.0 * ( mMax - _mass ) / _width );
135
136loop:
137 double themass = ( _mass + ( ( _width / 2.0 ) * tan( EvtRandom::Flat( ymin, ymax ) ) ) );
138
139 if ( fabs( _addFactorPn ) > 0.00000001 )
140 { // addFactorPn, pingrg-2010-1-10
141 double massOthD = EvtPDL::getMeanMass( *othDaugId );
142 double massParent = EvtPDL::getMeanMass( *parId );
143 double phsp, maxp, maxp1, maxp2;
144 if ( themass + massOthD < massParent )
145 {
146 EvtTwoBodyVertex vb( themass, massOthD, massParent, 1.0 );
147 phsp = vb.pD();
148 }
149 else { return themass; }
150
151 if ( ( massOthD + mMax ) < massParent )
152 {
153 EvtTwoBodyVertex vb1( massOthD, mMax, massParent, 1 );
154 EvtTwoBodyVertex vb2( massOthD, mMin, massParent, 1 );
155 maxp = vb1.pD();
156 maxp1 = pow( maxp, _addFactorPn * 2.0 );
157 maxp = vb2.pD();
158 maxp2 = pow( maxp, _addFactorPn * 2.0 );
159 maxp = max( maxp1, maxp2 );
160 }
161 else { return themass; }
162
163 double wt = pow( phsp, _addFactorPn * 2.0 ) / maxp;
164 double rdm = EvtRandom::Flat( 0.0, 1.0 );
165
166 if ( rdm > wt ) goto loop;
167 }
168
169 return themass;
170 // return EvtRandom::Flat(_massMin,_massMax);
171}
172
173double EvtAbsLineShape::getMassProb( double mass, double massPar, int nDaug,
174 double* massDau ) {
175
176 double dTotMass = 0.;
177 if ( nDaug > 1 )
178 {
179 int i;
180 for ( i = 0; i < nDaug; i++ ) { dTotMass += massDau[i]; }
181 // report(INFO,"EvtGen") << mass << " " << massPar << " " << dTotMass << " "<< endl;
182 // if ( (mass-dTotMass)<0.0001 ) return 0.;
183 if ( ( mass < dTotMass ) ) return 0.;
184 }
185 if ( _width < 0.0001 ) return 1.;
186
187 // no parent - lets not panic
188 if ( massPar > 0.0000000001 )
189 {
190 if ( mass > massPar ) return 0.;
191 }
192 // Otherwise return the right value.
193 // Fortunately we have generated events according to a non-rel BW, so
194 // just return..
195 // EvtPropBreitWigner bw(_mass,_width);
196 // EvtPropFactor<EvtTwoBodyVertex> f(bw);
197 // EvtComplex fm=f.eval(mass);
198 // EvtComplex fm0=f.eval(_mass);
199 // return (abs(fm)*abs(fm))/(abs(fm0)*abs(fm0));
200 return 1.0;
201}
double mass
#define max(a, b)
ostream & report(Severity severity, const char *facility)
Definition EvtReport.cc:34
@ ERROR
Definition EvtReport.hh:49
virtual EvtAbsLineShape * clone()
EvtSpinType::spintype _spin
virtual double getMassProb(double mass, double massPar, int nDaug, double *massDau)
virtual ~EvtAbsLineShape()
EvtAbsLineShape & operator=(const EvtAbsLineShape &x)
virtual double getRandMass(EvtId *parId, int nDaug, EvtId *dauId, EvtId *othDaugId, double maxMass, double *dauMasses)
virtual double rollMass()
Definition EvtId.hh:27
static double getMeanMass(EvtId i)
Definition EvtPDL.hh:43
static std::string name(EvtId i)
Definition EvtPDL.hh:70
static double Flat()
Definition EvtRandom.cc:69
static double Flat(double min, double max)
Definition EvtRandom.cc:55
double pD() const