1 //--------------------------------------------------------------------------
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.
8 // Copyright Information: See EvtGen/COPYRIGHT
9 // Copyright (C) 1998 Caltech, UCSB
11 // Module: EvtLineShape.cc
13 // Description: Store particle properties for one particle.
15 // Modification history:
17 // Lange March 10, 2001 Module created
19 //------------------------------------------------------------------------
21 #include "EvtGenBase/EvtPatches.hh"
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"
36 EvtAbsLineShape::EvtAbsLineShape() {
39 EvtAbsLineShape::~EvtAbsLineShape() {
42 EvtAbsLineShape::EvtAbsLineShape(double mass, double width, double maxRange, EvtSpinType::spintype sp) {
44 _includeDecayFact = false;
45 _includeBirthFact = false;
46 _applyFixForSP8 = false;
51 double maxdelta=15.0*width;
52 //if ( width>0.001 ) {
53 // if ( 5.0*width < 0.6 ) maxdelta = 0.6;
55 if ( maxRange > 0.00001 ) {
56 _massMax=mass+maxdelta;
57 _massMin=mass-maxRange;
60 _massMax=mass+maxdelta;
61 _massMin=mass-15.0*width;
63 if ( _massMin< 0. ) _massMin=0.;
64 _massMax=mass+maxdelta;
67 EvtAbsLineShape::EvtAbsLineShape(const EvtAbsLineShape& x){
69 _includeDecayFact = x._includeDecayFact;
70 _includeBirthFact = x._includeBirthFact;
76 _maxRange=x._maxRange;
77 _applyFixForSP8 = x._applyFixForSP8;
80 EvtAbsLineShape& EvtAbsLineShape::operator=(const EvtAbsLineShape& x){
82 _includeDecayFact = x._includeDecayFact;
83 _includeBirthFact = x._includeBirthFact;
89 _maxRange=x._maxRange;
90 _applyFixForSP8 = x._applyFixForSP8;
94 EvtAbsLineShape* EvtAbsLineShape::clone() {
96 return new EvtAbsLineShape(*this);
100 double EvtAbsLineShape::rollMass() {
105 if ( _width < 0.0001 ) {
109 ymin = atan( 2.0*(_massMin-_mass)/_width);
110 ymax = atan( 2.0*(_massMax-_mass)/_width);
112 temp= ( _mass + ((_width/2.0)*tan(EvtRandom::Flat(ymin,ymax))));
117 double EvtAbsLineShape::getRandMass(EvtId *parId, int nDaug, EvtId *dauId, EvtId *othDaugId, double maxMass, double *dauMasses) {
119 if ( _width< 0.0001) return _mass;
120 //its not flat - but generated according to a BW
122 if (maxMass>0&&maxMass<_massMin) {
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;
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);
136 return ( _mass + ((_width/2.0)*tan(EvtRandom::Flat(ymin,ymax))));
137 // return EvtRandom::Flat(_massMin,_massMax);
140 double EvtAbsLineShape::getMassProb(double mass, double massPar, int nDaug, double *massDau) {
145 for (i=0; i<nDaug; i++) {
146 dTotMass+=massDau[i];
148 //report(INFO,"EvtGen") << mass << " " << massPar << " " << dTotMass << " "<< endl;
149 // if ( (mass-dTotMass)<0.0001 ) return 0.;
150 if ( (mass<dTotMass) ) return 0.;
152 if ( _width< 0.0001) return 1.;
154 // no parent - lets not panic
155 if ( massPar>0.0000000001 ) {
156 if ( mass > massPar) return 0.;
158 //Otherwise return the right value.
159 //Fortunately we have generated events according to a non-rel BW, so
161 //EvtPropBreitWigner bw(_mass,_width);
162 //EvtPropFactor<EvtTwoBodyVertex> f(bw);
163 //EvtComplex fm=f.eval(mass);
164 //EvtComplex fm0=f.eval(_mass);
165 //return (abs(fm)*abs(fm))/(abs(fm0)*abs(fm0));