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