Line data Source code
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 "EvtGenBase/EvtPatches.hh"
22 : #include <iostream>
23 : #include <stdlib.h>
24 : #include <ctype.h>
25 : #include <math.h>
26 : #include "EvtGenBase/EvtAbsLineShape.hh"
27 : #include "EvtGenBase/EvtRandom.hh"
28 : #include "EvtGenBase/EvtComplex.hh"
29 : #include "EvtGenBase/EvtTwoBodyVertex.hh"
30 : #include "EvtGenBase/EvtPropBreitWigner.hh"
31 : #include "EvtGenBase/EvtPDL.hh"
32 : #include "EvtGenBase/EvtReport.hh"
33 :
34 : using namespace std;
35 :
36 0 : EvtAbsLineShape::EvtAbsLineShape() {
37 0 : }
38 :
39 0 : EvtAbsLineShape::~EvtAbsLineShape() {
40 0 : }
41 :
42 0 : EvtAbsLineShape::EvtAbsLineShape(double mass, double width, double maxRange, EvtSpinType::spintype sp) {
43 :
44 0 : _includeDecayFact = false;
45 0 : _includeBirthFact = false;
46 0 : _mass=mass;
47 0 : _width=width;
48 0 : _spin=sp;
49 0 : _maxRange=maxRange;
50 0 : double maxdelta=15.0*width;
51 : //if ( width>0.001 ) {
52 : // if ( 5.0*width < 0.6 ) maxdelta = 0.6;
53 : //}
54 0 : if ( maxRange > 0.00001 ) {
55 0 : _massMax=mass+maxdelta;
56 0 : _massMin=mass-maxRange;
57 0 : }
58 : else{
59 : _massMax=mass+maxdelta;
60 0 : _massMin=mass-15.0*width;
61 : }
62 0 : if ( _massMin< 0. ) _massMin=0.;
63 0 : _massMax=mass+maxdelta;
64 0 : }
65 :
66 0 : EvtAbsLineShape::EvtAbsLineShape(const EvtAbsLineShape& x){
67 :
68 0 : _includeDecayFact = x._includeDecayFact;
69 0 : _includeBirthFact = x._includeBirthFact;
70 0 : _mass=x._mass;
71 0 : _massMax=x._massMax;
72 0 : _massMin=x._massMin;
73 0 : _width=x._width;
74 0 : _spin=x._spin;
75 0 : _maxRange=x._maxRange;
76 0 : }
77 :
78 : EvtAbsLineShape& EvtAbsLineShape::operator=(const EvtAbsLineShape& x){
79 :
80 0 : _includeDecayFact = x._includeDecayFact;
81 0 : _includeBirthFact = x._includeBirthFact;
82 0 : _mass=x._mass;
83 0 : _massMax=x._massMax;
84 0 : _massMin=x._massMin;
85 0 : _width=x._width;
86 0 : _spin=x._spin;
87 0 : _maxRange=x._maxRange;
88 0 : return *this;
89 : }
90 :
91 : EvtAbsLineShape* EvtAbsLineShape::clone() {
92 :
93 0 : return new EvtAbsLineShape(*this);
94 : }
95 :
96 :
97 : double EvtAbsLineShape::rollMass() {
98 :
99 : double ymin, ymax;
100 : double temp;
101 :
102 0 : if ( _width < 0.0001 ) {
103 0 : return _mass;
104 : }
105 : else{
106 0 : ymin = atan( 2.0*(_massMin-_mass)/_width);
107 0 : ymax = atan( 2.0*(_massMax-_mass)/_width);
108 :
109 0 : temp= ( _mass + ((_width/2.0)*tan(EvtRandom::Flat(ymin,ymax))));
110 :
111 0 : return temp;
112 : }
113 0 : }
114 : double EvtAbsLineShape::getRandMass(EvtId *parId, int /* nDaug */, EvtId * /*dauId*/, EvtId */*othDaugId*/, double maxMass, double */*dauMasses*/) {
115 :
116 0 : if ( _width< 0.0001) return _mass;
117 : //its not flat - but generated according to a BW
118 :
119 0 : if (maxMass>0&&maxMass<_massMin) {
120 0 : report(Severity::Debug,"EvtGen") << "In EvtAbsLineShape::getRandMass:"<<endl;
121 0 : report(Severity::Debug,"EvtGen") << "Cannot create a particle with a minimal mass of "
122 0 : << _massMin << " from a "<<EvtPDL::name(*parId)
123 0 : << " decay with available left-over mass-energy " << maxMass
124 0 : << ". Returning 0.0 mass. The rest of this decay chain will probably fail..." << endl;
125 0 : return 0.0;
126 : }
127 :
128 0 : double mMin=_massMin;
129 0 : double mMax=_massMax;
130 0 : if ( maxMass>-0.5 && maxMass< mMax) mMax=maxMass;
131 0 : double ymin = atan( 2.0*(mMin-_mass)/_width);
132 0 : double ymax = atan( 2.0*(mMax-_mass)/_width);
133 :
134 0 : return ( _mass + ((_width/2.0)*tan(EvtRandom::Flat(ymin,ymax))));
135 : // return EvtRandom::Flat(_massMin,_massMax);
136 0 : };
137 :
138 : double EvtAbsLineShape::getMassProb(double mass, double massPar, int nDaug, double *massDau) {
139 :
140 : double dTotMass=0.;
141 0 : if ( nDaug>1) {
142 : int i;
143 0 : for (i=0; i<nDaug; i++) {
144 0 : dTotMass+=massDau[i];
145 : }
146 : //report(Severity::Info,"EvtGen") << mass << " " << massPar << " " << dTotMass << " "<< endl;
147 : // if ( (mass-dTotMass)<0.0001 ) return 0.;
148 0 : if ( (mass<dTotMass) ) return 0.;
149 0 : }
150 0 : if ( _width< 0.0001) return 1.;
151 :
152 : // no parent - lets not panic
153 0 : if ( massPar>0.0000000001 ) {
154 0 : if ( mass > massPar) return 0.;
155 : }
156 : //Otherwise return the right value.
157 : //Fortunately we have generated events according to a non-rel BW, so
158 : //just return..
159 : //EvtPropBreitWigner bw(_mass,_width);
160 : //EvtPropFactor<EvtTwoBodyVertex> f(bw);
161 : //EvtComplex fm=f.eval(mass);
162 : //EvtComplex fm0=f.eval(_mass);
163 : //return (abs(fm)*abs(fm))/(abs(fm0)*abs(fm0));
164 0 : return 1.0;
165 0 : }
166 :
167 :
|