BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtRelBreitWignerBarrierFact.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// Dvoretskii June 03, 2002 Reimplemented rollMass()
19//
20//------------------------------------------------------------------------
21#include "EvtPatches.hh"
22
23#include "EvtPatches.hh"
24
25#include "EvtPredGen.hh"
26
27#include "EvtAmpPdf.hh"
28#include "EvtIntervalFlatPdf.hh"
29#include "EvtMassAmp.hh"
30#include "EvtPDL.hh"
33#include "EvtSpinType.hh"
34#include "EvtTwoBodyVertex.hh"
35#include <algorithm>
37
39
41 double maxRange,
43 : EvtAbsLineShape( mass, width, maxRange, sp ) { // double mDaug1, double mDaug2, int l) {
44
45 _includeDecayFact = true;
46 _includeBirthFact = true;
47 _mass = mass;
48 _width = width;
49 _spin = sp;
50 _blatt = 3.0;
51 _maxRange = maxRange;
52 _errorCond = false;
53
54 double maxdelta = 15.0 * width;
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
67 _massMax = mass + maxdelta;
68 if ( _massMin < 0. ) _massMin = 0.;
69}
70
73 : EvtAbsLineShape( x ) {
74 _massMax = x._massMax;
75 _massMin = x._massMin;
76 _blatt = x._blatt;
77 _maxRange = x._maxRange;
78 _includeDecayFact = x._includeDecayFact;
79 _includeBirthFact = x._includeBirthFact;
80 _errorCond = x._errorCond;
81}
82
85 _mass = x._mass;
86 _width = x._width;
87 _spin = x._spin;
88 _massMax = x._massMax;
89 _massMin = x._massMin;
90 _blatt = x._blatt;
91 _maxRange = x._maxRange;
92 _includeDecayFact = x._includeDecayFact;
93 _includeBirthFact = x._includeBirthFact;
94 _errorCond = x._errorCond;
95
96 return *this;
97}
98
103
104double EvtRelBreitWignerBarrierFact::getMassProb( double mass, double massPar, int nDaug,
105 double* massDau ) {
106
107 _errorCond = false;
108 // return EvtAbsLineShape::getMassProb(mass,massPar,nDaug,massDau);
109 if ( nDaug != 2 ) return EvtAbsLineShape::getMassProb( mass, massPar, nDaug, massDau );
110
111 double dTotMass = 0.;
112
113 int i;
114 for ( i = 0; i < nDaug; i++ ) { dTotMass += massDau[i]; }
115 // report(INFO,"EvtGen") << mass << " " << massPar << " " << dTotMass << " "<< endl;
116 // if ( (mass-dTotMass)<0.0001 ) return 0.;
117 // report(INFO,"EvtGen") << mass << " " << dTotMass << endl;
118 if ( ( mass < dTotMass ) ) return 0.;
119
120 if ( _width < 0.0001 ) return 1.;
121
122 if ( massPar > 0.0000000001 )
123 {
124 if ( mass > massPar ) return 0.;
125 }
126
127 if ( _errorCond ) return 0.;
128
129 // we did all the work in getRandMass
130 return 1.;
131}
132
133double EvtRelBreitWignerBarrierFact::getRandMass( EvtId* parId, int nDaug, EvtId* dauId,
134 EvtId* othDaugId, double maxMass,
135 double* dauMasses ) {
136 if ( nDaug != 2 )
137 {
138 if ( fabs( _addFactorPn ) > 0.00000001 ) EvtAbsLineShape::addFactorPn( _addFactorPn );
139 double themass =
140 EvtAbsLineShape::getRandMass( parId, nDaug, dauId, othDaugId, maxMass, dauMasses );
141 return themass;
142 }
143
144 if ( _width < 0.00001 ) return _mass;
145
146 // first figure out L - take the lowest allowed.
147
148 EvtSpinType::spintype spinD1 = EvtPDL::getSpinType( dauId[0] );
149 EvtSpinType::spintype spinD2 = EvtPDL::getSpinType( dauId[1] );
150
151 int t1 = EvtSpinType::getSpin2( spinD1 );
152 int t2 = EvtSpinType::getSpin2( spinD2 );
153 int t3 = EvtSpinType::getSpin2( _spin );
154
155 int Lmin = -10;
156
157 // the user has overridden the partial wave to use.
158 for ( int vC = 0; vC < _userSetPW.size(); vC++ )
159 {
160 if ( dauId[0] == _userSetPWD1[vC] && dauId[1] == _userSetPWD2[vC] )
161 Lmin = 2 * _userSetPW[vC];
162 if ( dauId[0] == _userSetPWD2[vC] && dauId[1] == _userSetPWD1[vC] )
163 Lmin = 2 * _userSetPW[vC];
164 }
165
166 // allow for special cases.
167 if ( Lmin < -1 )
168 {
169
170 // There are some things I don't know how to deal with
171 if ( t3 > 4 )
172 return EvtAbsLineShape::getRandMass( parId, nDaug, dauId, othDaugId, maxMass,
173 dauMasses );
174 if ( t1 > 4 )
175 return EvtAbsLineShape::getRandMass( parId, nDaug, dauId, othDaugId, maxMass,
176 dauMasses );
177 if ( t2 > 4 )
178 return EvtAbsLineShape::getRandMass( parId, nDaug, dauId, othDaugId, maxMass,
179 dauMasses );
180
181 // figure the min and max allowwed "spins" for the daughters state
182 Lmin = std::max( t3 - t2 - t1, std::max( t2 - t3 - t1, t1 - t3 - t2 ) );
183 if ( Lmin < 0 ) Lmin = 0;
184 assert( Lmin == 0 || Lmin == 2 || Lmin == 4 );
185 }
186
187 // double massD1=EvtPDL::getMeanMass(dauId[0]);
188 // double massD2=EvtPDL::getMeanMass(dauId[1]);
189 double massD1 = dauMasses[0];
190 double massD2 = dauMasses[1];
191
192 // I'm not sure how to define the vertex factor here - so retreat to nonRel code.
193 if ( ( massD1 + massD2 ) > _mass )
194 return EvtAbsLineShape::getRandMass( parId, nDaug, dauId, othDaugId, maxMass, dauMasses );
195
196 // parent vertex factor not yet implemented
197 double massOthD = -10.;
198 double massParent = -10.;
199 int birthl = -10;
200 if ( othDaugId )
201 {
202 EvtSpinType::spintype spinOth = EvtPDL::getSpinType( *othDaugId );
203 EvtSpinType::spintype spinPar = EvtPDL::getSpinType( *parId );
204
205 int tt1 = EvtSpinType::getSpin2( spinOth );
206 int tt2 = EvtSpinType::getSpin2( spinPar );
207 int tt3 = EvtSpinType::getSpin2( _spin );
208
209 // figure the min and max allowwed "spins" for the daughters state
210 if ( ( tt1 <= 4 ) && ( tt2 <= 4 ) )
211 {
212 birthl = std::max( tt3 - tt2 - tt1, std::max( tt2 - tt3 - tt1, tt1 - tt3 - tt2 ) );
213 if ( birthl < 0 ) birthl = 0;
214
215 massOthD = EvtPDL::getMeanMass( *othDaugId );
216 massParent = EvtPDL::getMeanMass( *parId );
217 }
218
219 // allow user to override
220 for ( size_t vC = 0; vC < _userSetBirthPW.size(); vC++ )
221 {
222 if ( *othDaugId == _userSetBirthOthD[vC] && *parId == _userSetBirthPar[vC] )
223 { birthl = 2 * _userSetBirthPW[vC]; }
224 }
225 }
226 double massM = _massMax;
227 if ( ( maxMass > -0.5 ) && ( maxMass < massM ) ) massM = maxMass;
228
229 // special case... if the parent mass is _fixed_ we can do a little better
230 // and only for a two body decay as that seems to be where we have problems
231
232 // Define relativistic propagator amplitude
233
234 EvtTwoBodyVertex vd( massD1, massD2, _mass, Lmin / 2 );
235 vd.set_f( _blatt );
237 EvtMassAmp amp( bw, vd );
238 if ( _includeDecayFact )
239 {
240 amp.addDeathFact();
241 amp.addDeathFactFF();
242 }
243
244 if ( fabs( _addFactorPn ) > 0.00000001 )
245 {
246 // std::cout<<"EvtRelBreitWignerBarrierFact "<< _addFactorPn<<std::endl;
248 }
249 if ( massParent > -1. )
250 {
251 if ( _includeBirthFact )
252 {
253
254 EvtTwoBodyVertex vb( _mass, massOthD, massParent, birthl / 2 );
255 if ( _applyFixForSP8 ) vb.set_f( _blatt );
256 amp.setBirthVtx( vb );
257 amp.addBirthFact();
258 amp.addBirthFactFF();
259 }
260 }
261
262 EvtAmpPdf<EvtPoint1D> pdf( amp );
263
264 // Estimate maximum and create predicate for accept reject
265
266 double tempMaxLoc = _mass;
267 if ( maxMass > -0.5 && maxMass < _mass ) tempMaxLoc = maxMass;
268 double tempMax = _massMax;
269 if ( maxMass > -0.5 && maxMass < _massMax ) tempMax = maxMass;
270 double tempMinMass = _massMin;
271 if ( massD1 + massD2 > _massMin ) tempMinMass = massD1 + massD2;
272
273 // redo sanity check - is there a solution to our problem.
274 // if not return an error condition that is caught by the
275 // mass prob calculation above.
276 if ( tempMinMass > tempMax )
277 {
278 _errorCond = true;
279 return tempMinMass;
280 }
281
282 if ( tempMaxLoc < tempMinMass ) tempMaxLoc = tempMinMass;
283
284 double safetyFactor = 1.2;
285 if ( _applyFixForSP8 ) safetyFactor = 1.4;
286
287 EvtPdfMax<EvtPoint1D> max( safetyFactor *
288 pdf.evaluate( EvtPoint1D( tempMinMass, tempMax, tempMaxLoc ) ) );
289
290 EvtPdfPred<EvtPoint1D> pred( pdf );
291 pred.setMax( max );
292
293 EvtIntervalFlatPdf flat( tempMinMass, tempMax );
294 EvtPdfGen<EvtPoint1D> gen( flat );
296
297 EvtPoint1D point = predgen();
298 return point.value();
299}
double mass
#define max(a, b)
std::vector< EvtId > _userSetBirthOthD
EvtSpinType::spintype _spin
virtual double getMassProb(double mass, double massPar, int nDaug, double *massDau)
std::vector< EvtId > _userSetPWD1
std::vector< int > _userSetPW
void addFactorPn(double factor=0.)
virtual double getRandMass(EvtId *parId, int nDaug, EvtId *dauId, EvtId *othDaugId, double maxMass, double *dauMasses)
std::vector< int > _userSetBirthPW
std::vector< EvtId > _userSetPWD2
std::vector< EvtId > _userSetBirthPar
Definition EvtId.hh:27
void addDeathFactFF()
Definition EvtMassAmp.hh:44
void setBirthVtx(const EvtTwoBodyVertex &vb)
Definition EvtMassAmp.hh:39
void addBirthFactFF()
Definition EvtMassAmp.hh:43
void addBirthFact()
Definition EvtMassAmp.hh:41
void addFactorPn(double factor)
Definition EvtMassAmp.hh:46
void addDeathFact()
Definition EvtMassAmp.hh:42
static double getMeanMass(EvtId i)
Definition EvtPDL.hh:43
static EvtSpinType::spintype getSpinType(EvtId i)
Definition EvtPDL.hh:66
void setMax(const EvtPdfMax< T > &max)
Definition EvtPdf.hh:151
double evaluate(const T &p) const
Definition EvtPdf.hh:64
double value() const
Definition EvtPoint1D.hh:25
double getMassProb(double mass, double massPar, int nDaug, double *massDau)
EvtRelBreitWignerBarrierFact & operator=(const EvtRelBreitWignerBarrierFact &x)
double getRandMass(EvtId *parId, int nDaug, EvtId *dauId, EvtId *othDaugId, double maxMass, double *dauMasses)
static int getSpin2(spintype stype)
void set_f(double R)