diff --git a/EvtGen/EvtGen.hh b/EvtGen/EvtGen.hh --- a/EvtGen/EvtGen.hh +++ b/EvtGen/EvtGen.hh @@ -23,8 +23,8 @@ #include "EvtGenBase/EvtPDL.hh" -#include #include +#include class EvtParticle; class EvtRandomEngine; @@ -38,14 +38,16 @@ class EvtGen { public: EvtGen( const std::string& decayName, const std::string& pdtTableName, - EvtRandomEngine* randomEngine = 0, EvtAbsRadCorr* isrEngine = 0, - const std::list* extraModels = 0, int mixingType = 1, - bool useXml = false ); + EvtRandomEngine* randomEngine = nullptr, + EvtAbsRadCorr* isrEngine = nullptr, + const std::list* extraModels = nullptr, + int mixingType = 1, bool useXml = false ); EvtGen( const std::string& decayName, std::istream& pdtTableData, - EvtRandomEngine* randomEngine = 0, EvtAbsRadCorr* isrEngine = 0, - const std::list* extraModels = 0, int mixingType = 1, - bool useXml = false ); + EvtRandomEngine* randomEngine = nullptr, + EvtAbsRadCorr* isrEngine = nullptr, + const std::list* extraModels = nullptr, + int mixingType = 1, bool useXml = false ); ~EvtGen(); @@ -53,16 +55,15 @@ EvtHepMCEvent* generateDecay( int PDGid, EvtVector4R refFrameP4, EvtVector4R translation, - EvtSpinDensity* spinDensity = 0 ); + EvtSpinDensity* spinDensity = nullptr ); void generateDecay( EvtParticle* p ); private: - void initialize( const std::string& decayName, std::istream& pdtTable, - EvtRandomEngine* randomEngine = 0, - EvtAbsRadCorr* isrEngine = 0, - const std::list* extraModels = 0, + EvtRandomEngine* randomEngine = nullptr, + EvtAbsRadCorr* isrEngine = nullptr, + const std::list* extraModels = nullptr, int mixingType = 1, bool useXml = false ); EvtPDL _pdl; diff --git a/EvtGenBase/EvtAmp.hh b/EvtGenBase/EvtAmp.hh --- a/EvtGenBase/EvtAmp.hh +++ b/EvtGenBase/EvtAmp.hh @@ -52,29 +52,35 @@ EvtAmp& operator=( const EvtAmp& amp ); /** - * sets the amplitudes calculated in the decay objects - */ - void vertex( const EvtComplex& amp ); + * sets the amplitudes calculated in the decay objects + */ + void vertex( const EvtComplex& amp ) { _amp[0] = amp; } /** - * sets the amplitudes calculated in the decay objects - */ - void vertex( int i1, const EvtComplex& amp ); + * sets the amplitudes calculated in the decay objects + */ + void vertex( int i1, const EvtComplex& amp ) { _amp[i1] = amp; } /** - * sets the amplitudes calculated in the decay objects - */ - void vertex( int i1, int i2, const EvtComplex& amp ); + * sets the amplitudes calculated in the decay objects + */ + void vertex( int i1, int i2, const EvtComplex& amp ) + { + _amp[i1 + i2 * _nstate[0]] = amp; + } /** - * sets the amplitudes calculated in the decay objects - */ - void vertex( int i1, int i2, int i3, const EvtComplex& amp ); + * sets the amplitudes calculated in the decay objects + */ + void vertex( int i1, int i2, int i3, const EvtComplex& amp ) + { + _amp[i1 + ( i2 + i3 * _nstate[1] ) * _nstate[0]] = amp; + } /** - * sets the amplitudes calculated in the decay objects - */ - void vertex( int* i1, const EvtComplex& amp ); + * sets the amplitudes calculated in the decay objects + */ + void vertex( int* i1, const EvtComplex& amp ) { setAmp( i1, amp ); } void dump(); @@ -86,8 +92,10 @@ void setNState( int parent_states, int* daug_states ); // the amplitudes - EvtComplex _amp[125]; - + union { + double _dummybuf[125 * 2]; + EvtComplex _amp[125]; + }; // the number of daughters int _ndaug; diff --git a/EvtGenBase/EvtComplex.hh b/EvtGenBase/EvtComplex.hh --- a/EvtGenBase/EvtComplex.hh +++ b/EvtGenBase/EvtComplex.hh @@ -48,6 +48,8 @@ inline friend double imag( const EvtComplex& c ); inline friend EvtComplex exp( const EvtComplex& c ); friend std::ostream& operator<<( std::ostream& s, const EvtComplex& c ); + inline friend EvtComplex operator&( const EvtComplex&, const EvtComplex& ); + inline friend EvtComplex operator|( const EvtComplex&, const EvtComplex& ); public: EvtComplex() : _rpart( 0.0 ), _ipart( 0.0 ) {} @@ -60,8 +62,8 @@ } inline EvtComplex& operator*=( double d ); inline EvtComplex& operator/=( double d ); - EvtComplex& operator*=( EvtComplex c ); - EvtComplex& operator/=( EvtComplex c ); + inline EvtComplex& operator*=( EvtComplex c ); + inline EvtComplex& operator/=( EvtComplex c ); inline EvtComplex& operator=( const EvtComplex& c ); inline EvtComplex& operator+=( const EvtComplex& c ); inline EvtComplex& operator-=( const EvtComplex& c ); @@ -168,6 +170,22 @@ c1._rpart * c2._ipart + c1._ipart * c2._rpart ); } +// conj(c1)*c2 -- don't forget that the operators "&" and "|" has +// priority less than the arithmetic operations -- explicit brackets +// around are necessary! +EvtComplex operator&( const EvtComplex& c1, const EvtComplex& c2 ) +{ + return EvtComplex( c1._rpart * c2._rpart + c1._ipart * c2._ipart, + c1._rpart * c2._ipart - c1._ipart * c2._rpart ); +} + +// c1*conj(c2) +EvtComplex operator|( const EvtComplex& c1, const EvtComplex& c2 ) +{ + return EvtComplex( c1._rpart * c2._rpart + c1._ipart * c2._ipart, + c1._ipart * c2._rpart - c1._rpart * c2._ipart ); +} + EvtComplex operator-( const EvtComplex& c1, const EvtComplex& c2 ) { return EvtComplex( c1._rpart - c2._rpart, c1._ipart - c2._ipart ); @@ -242,4 +260,27 @@ return exp( c._rpart ) * EvtComplex( cos( c._ipart ), sin( c._ipart ) ); } +inline EvtComplex& EvtComplex::operator*=( EvtComplex c ) +{ + double r = _rpart * c._rpart - _ipart * c._ipart; + double i = _rpart * c._ipart + _ipart * c._rpart; + + _rpart = r; + _ipart = i; + + return *this; +} + +inline EvtComplex& EvtComplex::operator/=( EvtComplex c ) +{ + double inv = 1.0 / ( c._rpart * c._rpart + c._ipart * c._ipart ); + + double r = inv * ( _rpart * c._rpart + _ipart * c._ipart ); + double i = inv * ( _ipart * c._rpart - _rpart * c._ipart ); + + _rpart = r; + _ipart = i; + + return *this; +} #endif diff --git a/EvtGenBase/EvtDecayProb.hh b/EvtGenBase/EvtDecayProb.hh --- a/EvtGenBase/EvtDecayProb.hh +++ b/EvtGenBase/EvtDecayProb.hh @@ -34,8 +34,8 @@ inline void setWeight( double weight ) { _weight = weight; } private: - double _prob {1.0}; - double _weight {1.0}; + double _prob{ 1.0 }; + double _weight{ 1.0 }; }; #endif diff --git a/EvtGenBase/EvtDiLog.hh b/EvtGenBase/EvtDiLog.hh --- a/EvtGenBase/EvtDiLog.hh +++ b/EvtGenBase/EvtDiLog.hh @@ -46,6 +46,6 @@ 0.00000000434545063, -0.00000000060578480, 0.00000000008612098, -0.00000000001244332, 0.00000000000182256, -0.00000000000027007, 0.00000000000004042, -0.00000000000000610, 0.00000000000000093, - -0.00000000000000014, 0.00000000000000002}; + -0.00000000000000014, 0.00000000000000002 }; } // namespace EvtDiLog #endif // EVTGENBASE_EVTDILOG_HH diff --git a/EvtGenBase/EvtDiracSpinor.hh b/EvtGenBase/EvtDiracSpinor.hh --- a/EvtGenBase/EvtDiracSpinor.hh +++ b/EvtGenBase/EvtDiracSpinor.hh @@ -62,28 +62,34 @@ public: inline EvtDiracSpinor(); - EvtDiracSpinor( const EvtComplex& sp0, const EvtComplex& sp1, - const EvtComplex& sp2, const EvtComplex& sp3 ); + inline EvtDiracSpinor( const EvtComplex& sp0, const EvtComplex& sp1, + const EvtComplex& sp2, const EvtComplex& sp3 ); inline EvtDiracSpinor( const EvtDiracSpinor& dspinor ); inline EvtDiracSpinor& operator=( const EvtDiracSpinor& dspinor ); inline EvtDiracSpinor& operator+=( const EvtDiracSpinor& u2 ); inline EvtDiracSpinor& operator-=( const EvtDiracSpinor& u2 ); - void set( const EvtComplex& sp0, const EvtComplex& sp1, - const EvtComplex& sp2, const EvtComplex& sp3 ); - void set_spinor( int i, const EvtComplex& sp ); - const EvtComplex& get_spinor( int i ) const; + inline void set( const EvtComplex& sp0, const EvtComplex& sp1, + const EvtComplex& sp2, const EvtComplex& sp3 ); + inline void set_spinor( int i, const EvtComplex& sp ); + inline EvtComplex get_spinor( int i ) const; EvtDiracSpinor conj() const; void applyRotateEuler( double alpha, double beta, double gamma ); void applyBoostTo( const EvtVector4R& p4 ); void applyBoostTo( const EvtVector3R& boost ); EvtDiracSpinor adjoint() const; + inline EvtComplex operator[]( int i ) const { return spinor[i]; } + inline EvtComplex& operator[]( int i ) { return spinor[i]; } + private: EvtComplex spinor[4]; }; +void EvtLeptonVandACurrents( EvtVector4C&, EvtVector4C&, const EvtDiracSpinor&, + const EvtDiracSpinor& ); + EvtDiracSpinor::EvtDiracSpinor() { spinor[0] = EvtComplex(); @@ -100,6 +106,31 @@ spinor[3] = dspinor.spinor[3]; } +EvtDiracSpinor::EvtDiracSpinor( const EvtComplex& sp0, const EvtComplex& sp1, + const EvtComplex& sp2, const EvtComplex& sp3 ) +{ + set( sp0, sp1, sp2, sp3 ); +} + +void EvtDiracSpinor::set( const EvtComplex& sp0, const EvtComplex& sp1, + const EvtComplex& sp2, const EvtComplex& sp3 ) +{ + spinor[0] = sp0; + spinor[1] = sp1; + spinor[2] = sp2; + spinor[3] = sp3; +} + +void EvtDiracSpinor::set_spinor( int i, const EvtComplex& sp ) +{ + spinor[i] = sp; +} + +EvtComplex EvtDiracSpinor::get_spinor( int i ) const +{ + return spinor[i]; +} + EvtDiracSpinor& EvtDiracSpinor::operator=( const EvtDiracSpinor& dspinor ) { spinor[0] = dspinor.spinor[0]; diff --git a/EvtGenBase/EvtGenKine.hh b/EvtGenBase/EvtGenKine.hh --- a/EvtGenBase/EvtGenKine.hh +++ b/EvtGenBase/EvtGenKine.hh @@ -23,15 +23,19 @@ class EvtVector4R; class EvtParticle; +class EvtLinSample; class EvtGenKine { public: - static double PhaseSpace( int ndaug, double mass[30], EvtVector4R p4[30], - double mp ); + static double PhaseSpace( int ndaug, const double mass[30], + EvtVector4R p4[30], double mp ); static double PhaseSpacePole( double M, double m1, double m2, double m3, double a, EvtVector4R p4[10] ); + static double PhaseSpacePole2( double M, double m1, double m2, double m3, + EvtVector4R p4[10], const EvtLinSample& ); + /* * Function which takes two invariant masses squared in 3-body decay and * parent after makeDaughters() and generateMassTree() and diff --git a/EvtGenBase/EvtLinSample.hh b/EvtGenBase/EvtLinSample.hh new file mode 100644 --- /dev/null +++ b/EvtGenBase/EvtLinSample.hh @@ -0,0 +1,20 @@ +#ifndef EVTLINSAMPLE_HH +#define EVTLINSAMPLE_HH + +#include +struct EvtPointf { + float x, y; +}; + +struct EvtLinSample { + EvtLinSample() {} + EvtLinSample( const char* ); + EvtLinSample( const std::vector& _v ) { init( _v ); } + void init( const std::vector& _v ); + std::pair operator()( double ) const; + + std::vector v; + std::vector I; +}; + +#endif diff --git a/EvtGenBase/EvtMTRandomEngine.hh b/EvtGenBase/EvtMTRandomEngine.hh --- a/EvtGenBase/EvtMTRandomEngine.hh +++ b/EvtGenBase/EvtMTRandomEngine.hh @@ -31,11 +31,10 @@ virtual double random(); - private: - std::mt19937 engine_; + virtual unsigned long urandom(); - typedef std::uniform_real_distribution URDist; - URDist distribution_; + private: + std::mt19937_64 engine_; }; #endif diff --git a/EvtGenBase/EvtModel.hh b/EvtGenBase/EvtModel.hh --- a/EvtGenBase/EvtModel.hh +++ b/EvtGenBase/EvtModel.hh @@ -55,7 +55,7 @@ inline EvtModel& EvtModel::instance() { - if ( _instance == 0 ) + if ( _instance == nullptr ) _instance = new EvtModel; return *_instance; } diff --git a/EvtGenBase/EvtPDL.hh b/EvtGenBase/EvtPDL.hh --- a/EvtGenBase/EvtPDL.hh +++ b/EvtGenBase/EvtPDL.hh @@ -26,10 +26,10 @@ #include "EvtGenBase/EvtSpinType.hh" #include "EvtGenBase/EvtStringHash.hh" +#include #include -#include #include -#include +#include const int SPIN_NAME_LENGTH = 100; diff --git a/EvtGenBase/EvtParticle.hh b/EvtGenBase/EvtParticle.hh --- a/EvtGenBase/EvtParticle.hh +++ b/EvtGenBase/EvtParticle.hh @@ -180,7 +180,7 @@ /** * Iterates over the particles in a decay chain. */ - EvtParticle* nextIter( EvtParticle* rootOfTree = 0 ); + EvtParticle* nextIter( EvtParticle* rootOfTree = nullptr ); /** * Makes stdhep list @@ -365,7 +365,7 @@ /** * Get forward spin density matrix. */ - EvtSpinDensity getSpinDensityForward() { return _rhoForward; } + const EvtSpinDensity& getSpinDensityForward() const { return _rhoForward; } /** * Set backward spin density matrix. diff --git a/EvtGenBase/EvtParticleDecay.hh b/EvtGenBase/EvtParticleDecay.hh --- a/EvtGenBase/EvtParticleDecay.hh +++ b/EvtGenBase/EvtParticleDecay.hh @@ -27,14 +27,14 @@ public: EvtParticleDecay() { - _decay = 0; + _decay = nullptr; _brfrsum = 0.0; _massmin = 0.0; } ~EvtParticleDecay() { - if ( _decay != 0 ) + if ( _decay != nullptr ) delete _decay; } diff --git a/EvtGenBase/EvtParticleDecayList.hh b/EvtGenBase/EvtParticleDecayList.hh --- a/EvtGenBase/EvtParticleDecayList.hh +++ b/EvtGenBase/EvtParticleDecayList.hh @@ -29,7 +29,7 @@ public: EvtParticleDecayList() { - _decaylist = 0; + _decaylist = nullptr; _nmode = 0; _rawbrfrsum = 0; } diff --git a/EvtGenBase/EvtPdf.hh b/EvtGenBase/EvtPdf.hh --- a/EvtGenBase/EvtPdf.hh +++ b/EvtGenBase/EvtPdf.hh @@ -144,9 +144,9 @@ public: typedef T result_type; - EvtPdfGen() : _pdf( 0 ) {} + EvtPdfGen() : _pdf( nullptr ) {} EvtPdfGen( const EvtPdfGen& other ) : - _pdf( other._pdf ? other._pdf->clone() : 0 ) + _pdf( other._pdf ? other._pdf->clone() : nullptr ) { } EvtPdfGen( const EvtPdf& pdf ) : _pdf( pdf.clone() ) {} diff --git a/EvtGenBase/EvtRandom.hh b/EvtGenBase/EvtRandom.hh --- a/EvtGenBase/EvtRandom.hh +++ b/EvtGenBase/EvtRandom.hh @@ -34,6 +34,8 @@ static double random(); + static unsigned long urandom(); + //This class does not take ownership of the random engine; //the caller needs to make sure that the engine is not //destroyed. diff --git a/EvtGenBase/EvtRandomEngine.hh b/EvtGenBase/EvtRandomEngine.hh --- a/EvtGenBase/EvtRandomEngine.hh +++ b/EvtGenBase/EvtRandomEngine.hh @@ -31,6 +31,8 @@ virtual double random() = 0; + virtual unsigned long urandom() = 0; + private: }; diff --git a/EvtGenBase/EvtReport.hh b/EvtGenBase/EvtReport.hh --- a/EvtGenBase/EvtReport.hh +++ b/EvtGenBase/EvtReport.hh @@ -54,7 +54,8 @@ }; // function declaration -std::ostream& EvtGenReport( EvtGenSeverity severity, const char* facility = 0 ); +std::ostream& EvtGenReport( EvtGenSeverity severity, + const char* facility = nullptr ); // inline function definitions diff --git a/EvtGenBase/EvtSimpleRandomEngine.hh b/EvtGenBase/EvtSimpleRandomEngine.hh --- a/EvtGenBase/EvtSimpleRandomEngine.hh +++ b/EvtGenBase/EvtSimpleRandomEngine.hh @@ -31,6 +31,8 @@ double random() override; + unsigned long urandom() override; + private: unsigned long int _next; }; diff --git a/EvtGenBase/EvtSpinAmp.hh b/EvtGenBase/EvtSpinAmp.hh --- a/EvtGenBase/EvtSpinAmp.hh +++ b/EvtGenBase/EvtSpinAmp.hh @@ -64,7 +64,7 @@ EvtSpinAmp& operator-=( const EvtSpinAmp& ); // Direct Product - EvtSpinAmp operator*(const EvtSpinAmp&)const; + EvtSpinAmp operator*( const EvtSpinAmp& ) const; EvtSpinAmp& operator*=( const EvtSpinAmp& ); EvtSpinAmp& operator*=( const EvtComplex& ); diff --git a/EvtGenBase/EvtSpinDensity.hh b/EvtGenBase/EvtSpinDensity.hh --- a/EvtGenBase/EvtSpinDensity.hh +++ b/EvtGenBase/EvtSpinDensity.hh @@ -22,29 +22,77 @@ #define EVTSPINDENSITY_HH #include "EvtGenBase/EvtComplex.hh" +#include + // Description: This class holds a spin density matrix, it is // a complex nxn matrix. class EvtSpinDensity { public: + EvtSpinDensity() : dim( 0 ), rho( nullptr ) {} + EvtSpinDensity( int n ) : dim( 0 ), rho( nullptr ) { setDim( n ); } EvtSpinDensity( const EvtSpinDensity& density ); EvtSpinDensity& operator=( const EvtSpinDensity& density ); virtual ~EvtSpinDensity(); - EvtSpinDensity(); void setDim( int n ); - int getDim() const; - void set( int i, int j, const EvtComplex& rhoij ); - const EvtComplex& get( int i, int j ) const; - double normalizedProb( const EvtSpinDensity& d ); + int getDim() const { return dim; } + void set( int i, int j, const EvtComplex& rhoij ) + { + assert( i < dim && j < dim ); + rho[i * dim + j] = rhoij; + } + EvtComplex get( int i, int j ) const + { + assert( i < dim && j < dim ); + return rho[i * dim + j]; + } + EvtComplex operator()( int i, int j ) const + { + assert( i < dim && j < dim ); + return rho[i * dim + j]; + } + EvtComplex& operator()( int i, int j ) + { + assert( i < dim && j < dim ); + return rho[i * dim + j]; + } + EvtSpinDensity& operator-=( const EvtSpinDensity& d ) + { + assert( dim == d.dim ); + for ( int i = 0; i < dim * dim; i++ ) + rho[i] -= d.rho[i]; + return *this; + } + EvtSpinDensity& operator+=( const EvtSpinDensity& d ) + { + assert( dim == d.dim ); + for ( int i = 0; i < dim * dim; i++ ) + rho[i] += d.rho[i]; + return *this; + } + double normalizedProb( const EvtSpinDensity& d ) const; friend std::ostream& operator<<( std::ostream& s, const EvtSpinDensity& d ); void setDiag( int n ); - int check(); private: - EvtComplexPtrPtr rho; int dim; + EvtComplex* rho; }; +inline EvtSpinDensity operator-( const EvtSpinDensity& a, const EvtSpinDensity& b ) +{ + EvtSpinDensity t( a ); + t -= b; + return t; +} + +inline EvtSpinDensity operator+( const EvtSpinDensity& a, const EvtSpinDensity& b ) +{ + EvtSpinDensity t( a ); + t -= b; + return t; +} + #endif diff --git a/EvtGenBase/EvtStreamInputIterator.hh b/EvtGenBase/EvtStreamInputIterator.hh --- a/EvtGenBase/EvtStreamInputIterator.hh +++ b/EvtGenBase/EvtStreamInputIterator.hh @@ -40,10 +40,10 @@ typedef const Point* pointer; typedef const Point& reference; - EvtStreamInputIterator() : _counter( 0 ) {} + EvtStreamInputIterator() : _counter( nullptr ) {} EvtStreamInputIterator( const EvtStreamInputIterator& other ) : - _counter( other._counter ? other._counter->clone() : 0 ), + _counter( other._counter ? other._counter->clone() : nullptr ), _currentValue( other._currentValue ) { } diff --git a/EvtGenBase/EvtTensor4C.hh b/EvtGenBase/EvtTensor4C.hh --- a/EvtGenBase/EvtTensor4C.hh +++ b/EvtGenBase/EvtTensor4C.hh @@ -33,6 +33,11 @@ EvtTensor4C directProd( const EvtVector4R& c1, const EvtVector4R& c2 ); EvtTensor4C directProd( const EvtVector4C& c1, const EvtVector4C& c2 ); EvtTensor4C directProd( const EvtVector4C& c1, const EvtVector4R& c2 ); + EvtTensor4C asymProd( const EvtVector4R&, const EvtVector4R& ); + EvtVector4R asymProd( const EvtVector4R& a, const EvtVector4R& b, + const EvtVector4R& c ); + EvtVector4C asymProd( const EvtVector4C& a, const EvtVector4R& b, + const EvtVector4R& c ); } // namespace EvtGenFunctions class EvtTensor4C final { @@ -42,6 +47,8 @@ const EvtVector4C& c2 ); friend EvtTensor4C EvtGenFunctions::directProd( const EvtVector4C& c1, const EvtVector4R& c2 ); + friend EvtTensor4C EvtGenFunctions::asymProd( const EvtVector4R&, + const EvtVector4R& ); friend EvtTensor4C rotateEuler( const EvtTensor4C& e, double alpha, double beta, double gamma ); @@ -89,6 +96,7 @@ EvtVector4C cont2( const EvtVector4C& v4 ) const; EvtVector4C cont1( const EvtVector4R& v4 ) const; EvtVector4C cont2( const EvtVector4R& v4 ) const; + EvtTensor4C& addScaled( EvtComplex, const EvtTensor4C& ); private: EvtComplex t[4][4]; diff --git a/EvtGenBase/EvtVector4C.hh b/EvtGenBase/EvtVector4C.hh --- a/EvtGenBase/EvtVector4C.hh +++ b/EvtGenBase/EvtVector4C.hh @@ -45,9 +45,9 @@ friend EvtVector4C operator-( const EvtVector4C& v1, const EvtVector4C& v2 ); public: - EvtVector4C(); - EvtVector4C( const EvtComplex&, const EvtComplex&, const EvtComplex&, - const EvtComplex& ); + inline EvtVector4C(){}; + inline EvtVector4C( const EvtComplex&, const EvtComplex&, const EvtComplex&, + const EvtComplex& ); inline void set( int, const EvtComplex& ); inline void set( const EvtComplex&, const EvtComplex&, const EvtComplex&, const EvtComplex& ); @@ -70,6 +70,15 @@ EvtComplex v[4]; }; +inline EvtVector4C::EvtVector4C( const EvtComplex& e0, const EvtComplex& e1, + const EvtComplex& e2, const EvtComplex& e3 ) +{ + v[0] = e0; + v[1] = e1; + v[2] = e2; + v[3] = e3; +} + EvtVector4C rotateEuler( const EvtVector4C& e, double alpha, double beta, double gamma ); EvtVector4C boostTo( const EvtVector4C& e, const EvtVector4R p4 ); diff --git a/EvtGenBase/EvtVectorParticle.hh b/EvtGenBase/EvtVectorParticle.hh --- a/EvtGenBase/EvtVectorParticle.hh +++ b/EvtGenBase/EvtVectorParticle.hh @@ -33,12 +33,12 @@ void init( EvtId part_n, double e, double px, double py, double pz ); void init( EvtId part_n, const EvtVector4R& p ) override; - void init( EvtId part_n, const EvtVector4R& p, const EvtVector4C&, - const EvtVector4C&, const EvtVector4C& ); - EvtVector4C epsParent( int i ) const override - { - return boostTo( _eps[i], this->getP4() ); - } + // void init( EvtId part_n, const EvtVector4R& p, const EvtVector4C&, + // const EvtVector4C&, const EvtVector4C& ); + EvtVector4C epsParent( int i ) const override; + // { + // return boostTo( _eps[i], this->getP4() ); + // } EvtVector4C eps( int i ) const override { return _eps[i]; } EvtSpinDensity rotateToHelicityBasis() const override; EvtSpinDensity rotateToHelicityBasis( double alpha, double beta, diff --git a/EvtGenModels/EvtBTo3hCP.hh b/EvtGenModels/EvtBTo3hCP.hh --- a/EvtGenModels/EvtBTo3hCP.hh +++ b/EvtGenModels/EvtBTo3hCP.hh @@ -28,7 +28,6 @@ class EvtBTo3hCP { public: - void EvtKpipi( double alpha, double beta, int iset, EvtVector4R& p_K_plus, EvtVector4R& p_pi_minus, EvtVector4R& p_gamma_1, EvtVector4R& p_gamma_2, double& Real_B0, double& Imag_B0, @@ -97,8 +96,8 @@ NatKrho; double alphaCP = 1.365; double betaCP = 0.362; - double MA2 = 27.927981186; - double MB2 = 27.929242450; + double MA2 = 27.927981186; + double MB2 = 27.929242450; double MC2 = 28.153482608; double pi = 3.141592653; double Mass_rho = 0.770; diff --git a/EvtGenModels/EvtFlatSqDalitz.hh b/EvtGenModels/EvtFlatSqDalitz.hh --- a/EvtGenModels/EvtFlatSqDalitz.hh +++ b/EvtGenModels/EvtFlatSqDalitz.hh @@ -30,7 +30,6 @@ class EvtFlatSqDalitz : public EvtDecayIncoherent { public: - std::string getName() override; EvtDecayBase* clone() override; diff --git a/EvtGenModels/EvtFourBodyPhsp.hh b/EvtGenModels/EvtFourBodyPhsp.hh --- a/EvtGenModels/EvtFourBodyPhsp.hh +++ b/EvtGenModels/EvtFourBodyPhsp.hh @@ -21,11 +21,11 @@ #ifndef EVTFOURBODYPHSP_HH #define EVTFOURBODYPHSP_HH -#include +#include "EvtGenBase/EvtDecayProb.hh" + #include #include - -#include "EvtGenBase/EvtDecayProb.hh" +#include class EvtParticle; @@ -84,9 +84,9 @@ Shape m_boundaryShape; - bool m_stableMother{true}; - bool m_stableDaughters{true}; - bool m_fixedBoundary{true}; + bool m_stableMother{ true }; + bool m_stableDaughters{ true }; + bool m_fixedBoundary{ true }; }; #endif diff --git a/EvtGenModels/EvtIntervalDecayAmp.hh b/EvtGenModels/EvtIntervalDecayAmp.hh --- a/EvtGenModels/EvtIntervalDecayAmp.hh +++ b/EvtGenModels/EvtIntervalDecayAmp.hh @@ -44,7 +44,7 @@ template class EvtIntervalDecayAmp : public EvtDecayAmp { public: - EvtIntervalDecayAmp() : _probMax( 0. ), _nScan( 0 ), _fact( 0 ) {} + EvtIntervalDecayAmp() : _probMax( 0. ), _nScan( 0 ), _fact( nullptr ) {} EvtIntervalDecayAmp( const EvtIntervalDecayAmp& other ) : _probMax( other._probMax ), _nScan( other._nScan ), COPY_PTR( _fact ) diff --git a/EvtGenModels/EvtModelReg.hh b/EvtGenModels/EvtModelReg.hh --- a/EvtGenModels/EvtModelReg.hh +++ b/EvtGenModels/EvtModelReg.hh @@ -27,7 +27,7 @@ class EvtModelReg { public: - EvtModelReg( const std::list* extraModels = 0 ); + EvtModelReg( const std::list* extraModels = nullptr ); private: }; diff --git a/EvtGenModels/EvtMultibody.hh b/EvtGenModels/EvtMultibody.hh --- a/EvtGenModels/EvtMultibody.hh +++ b/EvtGenModels/EvtMultibody.hh @@ -29,8 +29,8 @@ public: EvtMultibody() { - _decayTree = NULL; - _ilist = NULL; + _decayTree = nullptr; + _ilist = nullptr; } ~EvtMultibody(); diff --git a/EvtGenModels/EvtPi0Dalitz.hh b/EvtGenModels/EvtPi0Dalitz.hh --- a/EvtGenModels/EvtPi0Dalitz.hh +++ b/EvtGenModels/EvtPi0Dalitz.hh @@ -36,7 +36,7 @@ void decay( EvtParticle* p ) override; private: - double m_poleSize{ 0.00000002 }; + double m_poleSize{ 1 }; // Following are rho mass and width, but in order to keep consistency // with what was done before do not use data from particle table. diff --git a/EvtGenModels/EvtRareLbToLllFFBase.hh b/EvtGenModels/EvtRareLbToLllFFBase.hh --- a/EvtGenModels/EvtRareLbToLllFFBase.hh +++ b/EvtGenModels/EvtRareLbToLllFFBase.hh @@ -63,8 +63,10 @@ virtual ~EvtRareLbToLllFFBase(){}; protected: - double calculateVdotV( const EvtParticle& parent, const EvtParticle& lambda ) const; - double calculateVdotV( const EvtParticle&, const EvtParticle&, double qsq ) const; + double calculateVdotV( const EvtParticle& parent, + const EvtParticle& lambda ) const; + double calculateVdotV( const EvtParticle&, const EvtParticle&, + double qsq ) const; EvtIdSet natural_; }; diff --git a/EvtGenBase/EvtMTRandomEngine.hh b/EvtGenModels/EvtbTosllBSZFF.hh copy from EvtGenBase/EvtMTRandomEngine.hh copy to EvtGenModels/EvtbTosllBSZFF.hh --- a/EvtGenBase/EvtMTRandomEngine.hh +++ b/EvtGenModels/EvtbTosllBSZFF.hh @@ -18,24 +18,23 @@ * along with EvtGen. If not, see . * ***********************************************************************/ -#ifndef EVTMTRANDOMENGINE_HH -#define EVTMTRANDOMENGINE_HH +#ifndef EVTBTOSLLBSZFF_HH +#define EVTBTOSLLBSZFF_HH -#include "EvtGenBase/EvtRandomEngine.hh" +#include "EvtGenModels/EvtbTosllFF.hh" -#include +class EvtId; -class EvtMTRandomEngine : public EvtRandomEngine { - public: - EvtMTRandomEngine( unsigned int seed = 1430957218 ); - - virtual double random(); +// Description: Form factors for b->sll according to Aoife Bharucha, David M. Straub, Roman Zwicky +// https://arxiv.org/abs/1503.05534 - private: - std::mt19937 engine_; +class EvtbTosllBSZFF : public EvtbTosllFF { + public: + EvtbTosllBSZFF() {} - typedef std::uniform_real_distribution URDist; - URDist distribution_; + void getVectorFF( EvtId parent, EvtId vmeson, double q2, double vmesonmass, + double& a1, double& a2, double& a0, double& v, double& t1, + double& t2, double& t3 ) override; }; #endif diff --git a/EvtGenModels/EvtMultibody.hh b/EvtGenModels/EvtbTosllNP.hh copy from EvtGenModels/EvtMultibody.hh copy to EvtGenModels/EvtbTosllNP.hh --- a/EvtGenModels/EvtMultibody.hh +++ b/EvtGenModels/EvtbTosllNP.hh @@ -18,33 +18,32 @@ * along with EvtGen. If not, see . * ***********************************************************************/ -#ifndef EVTMULTIBODY_HH -#define EVTMULTIBODY_HH +#ifndef EVTBTOSLLNP_HH +#define EVTBTOSLLNP_HH #include "EvtGenBase/EvtDecayAmp.hh" -#include "EvtGenBase/EvtMTree.hh" -#include "EvtGenBase/EvtSpinAmp.hh" -class EvtMultibody : public EvtDecayAmp { - public: - EvtMultibody() - { - _decayTree = NULL; - _ilist = NULL; - } - ~EvtMultibody(); +#include + +class EvtbTosllFF; +class EvtbTosllAmp; +class EvtParticle; +// Description:Implementation of the b->sll decays according to Rusa and Rahul + +class EvtbTosllNP : public EvtDecayAmp { + public: std::string getName() override; EvtDecayBase* clone() override; + void decay( EvtParticle* p ) override; void init() override; void initProbMax() override; - void decay( EvtParticle* p ) override; - private: - EvtMTree* _decayTree; - int* _ilist; + std::unique_ptr _calcamp; + std::unique_ptr _ffmodel; + double _poleSize; }; #endif diff --git a/EvtGenModels/EvtMultibody.hh b/EvtGenModels/EvtbTosllNPR.hh copy from EvtGenModels/EvtMultibody.hh copy to EvtGenModels/EvtbTosllNPR.hh --- a/EvtGenModels/EvtMultibody.hh +++ b/EvtGenModels/EvtbTosllNPR.hh @@ -18,33 +18,34 @@ * along with EvtGen. If not, see . * ***********************************************************************/ -#ifndef EVTMULTIBODY_HH -#define EVTMULTIBODY_HH +#ifndef EVTBTOSLLNPR_HH +#define EVTBTOSLLNPR_HH #include "EvtGenBase/EvtDecayAmp.hh" -#include "EvtGenBase/EvtMTree.hh" -#include "EvtGenBase/EvtSpinAmp.hh" +#include "EvtGenBase/EvtLinSample.hh" -class EvtMultibody : public EvtDecayAmp { - public: - EvtMultibody() - { - _decayTree = NULL; - _ilist = NULL; - } - ~EvtMultibody(); +#include + +class EvtbTosllFF; +class EvtbTosllAmp; +class EvtParticle; +// Description: Implementation of the b->sll decays with resonances according to Rusa and Rahul + +class EvtbTosllNPR : public EvtDecayAmp { + public: std::string getName() override; EvtDecayBase* clone() override; + void decay( EvtParticle* p ) override; void init() override; void initProbMax() override; - void decay( EvtParticle* p ) override; - private: - EvtMTree* _decayTree; - int* _ilist; + std::unique_ptr _calcamp; + std::unique_ptr _ffmodel; + double _poleSize; + EvtLinSample _ls; }; #endif diff --git a/EvtGenBase/EvtSpinDensity.hh b/EvtGenModels/EvtbTosllVectorAmpNP.hh copy from EvtGenBase/EvtSpinDensity.hh copy to EvtGenModels/EvtbTosllVectorAmpNP.hh --- a/EvtGenBase/EvtSpinDensity.hh +++ b/EvtGenModels/EvtbTosllVectorAmpNP.hh @@ -18,33 +18,38 @@ * along with EvtGen. If not, see . * ***********************************************************************/ -#ifndef EVTSPINDENSITY_HH -#define EVTSPINDENSITY_HH +#ifndef EVTBTOSLLVECTORAMPNP_HH +#define EVTBTOSLLVECTORAMPNP_HH + #include "EvtGenBase/EvtComplex.hh" -// Description: This class holds a spin density matrix, it is -// a complex nxn matrix. +#include "EvtGenModels/EvtbTosllAmp.hh" + +#include +#include + +class EvtAmp; +class EvtParticle; +class EvtbTosllFF; -class EvtSpinDensity { +class EvtbTosllVectorAmpNP : public EvtbTosllAmp { public: - EvtSpinDensity( const EvtSpinDensity& density ); - EvtSpinDensity& operator=( const EvtSpinDensity& density ); - virtual ~EvtSpinDensity(); - - EvtSpinDensity(); - void setDim( int n ); - int getDim() const; - void set( int i, int j, const EvtComplex& rhoij ); - const EvtComplex& get( int i, int j ) const; - double normalizedProb( const EvtSpinDensity& d ); - friend std::ostream& operator<<( std::ostream& s, const EvtSpinDensity& d ); - void setDiag( int n ); - - int check(); - - private: - EvtComplexPtrPtr rho; - int dim; + EvtbTosllVectorAmpNP() : + m_c7p( 0 ), m_c9p( 0 ), m_c10p( 0 ), m_cS( 0 ), m_cP( 0 ) + { + } + void CalcAmp( EvtParticle* parent, EvtAmp& amp, + EvtbTosllFF* formFactors ) override; + + EvtComplex m_dc7; // delta C_7eff -- addition to NNLO SM value + EvtComplex m_dc9; // delta C_9eff -- addition to NNLO SM value + EvtComplex m_dc10; // delta C_10eff -- addition to NNLO SM value + EvtComplex m_c7p; // C'_7eff -- right hand polarizations + EvtComplex m_c9p; // C'_9eff -- right hand polarizations + EvtComplex m_c10p; // c'_10eff -- right hand polarizations + EvtComplex m_cS; // (C_S - C'_S) -- scalar right and left polarizations + EvtComplex m_cP; // (C_P - C'_P) -- pseudo-scalar right and left polarizations + std::vector>> m_reso; // resonance contribution }; #endif diff --git a/src/EvtGen.cpp b/src/EvtGen.cpp --- a/src/EvtGen.cpp +++ b/src/EvtGen.cpp @@ -91,7 +91,7 @@ { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Initializing EvtGen" << endl; - if ( randomEngine == 0 ) { + if ( randomEngine == nullptr ) { static EvtSimpleRandomEngine defaultRandomEngine; EvtRandom::setRandomEngine( &defaultRandomEngine ); EvtGenReport( EVTGEN_INFO, "EvtGen" ) @@ -123,7 +123,7 @@ // Set the radiative correction engine - if ( isrEngine != 0 ) { + if ( isrEngine != nullptr ) { EvtRadCorr::setRadCorrEngine( isrEngine ); } else { @@ -164,9 +164,9 @@ EvtVector4R translation, EvtSpinDensity* spinDensity ) { - EvtParticle* theParticle( 0 ); + EvtParticle* theParticle( nullptr ); - if ( spinDensity == 0 ) { + if ( spinDensity == nullptr ) { theParticle = EvtParticleFactory::particleFactory( EvtPDL::evtIdFromStdHep( PDGId ), refFrameP4 ); } else { diff --git a/src/EvtGenBase/EvtAmp.cpp b/src/EvtGenBase/EvtAmp.cpp --- a/src/EvtGenBase/EvtAmp.cpp +++ b/src/EvtGenBase/EvtAmp.cpp @@ -141,64 +141,31 @@ EvtSpinDensity EvtAmp::getSpinDensity() { + int np = _pstates; EvtSpinDensity rho; - rho.setDim( _pstates ); - - EvtComplex temp; - - int i, j, n; - - if ( _pstates == 1 ) { - if ( _nontrivial == 0 ) { - rho.set( 0, 0, _amp[0] * conj( _amp[0] ) ); - return rho; - } - - n = 1; - - temp = EvtComplex( 0.0 ); - - for ( i = 0; i < _nontrivial; i++ ) { + rho.setDim( np ); + if ( np == 1 ) { + double a = abs2( _amp[0] ); + int n = 1; + for ( int i = 0; i < _nontrivial; i++ ) n *= _nstate[i]; - } - - for ( i = 0; i < n; i++ ) { - temp += _amp[i] * conj( _amp[i] ); - } - - rho.set( 0, 0, temp ); - ; - - return rho; - - } - - else { - for ( i = 0; i < _pstates; i++ ) { - for ( j = 0; j < _pstates; j++ ) { - temp = EvtComplex( 0.0 ); - - int kk; - - int allloop = 1; - for ( kk = 0; kk < _ndaug; kk++ ) { - allloop *= dstates[kk]; - } - - for ( kk = 0; kk < allloop; kk++ ) { - temp += _amp[_pstates * kk + i] * - conj( _amp[_pstates * kk + j] ); - } - - // if (_nontrivial>3){ - //EvtGenReport(EVTGEN_ERROR,"EvtGen") << "Can't handle so many states in EvtAmp!"<getId() == B0 || parent->getId() == B0B || - parent->getId() == BS || parent->getId() == BSB ) ) { + if ( ( parent != nullptr ) && + ( parent->getId() == B0 || parent->getId() == B0B || + parent->getId() == BS || parent->getId() == BSB ) ) { incoherentmix = true; } if ( incoherentmix ) parent = parent->getParent(); - if ( parent == 0 || parent->getId() != UPS4S ) { + if ( parent == nullptr || parent->getId() != UPS4S ) { //Need to make this more general, but for now //assume no parent. If we have parent of B we //need to charge conj. full decay tree. - if ( parent != 0 ) { + if ( parent != nullptr ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "p=" << EvtPDL::name( p->getId() ) << " parent=" << EvtPDL::name( parent->getId() ) << endl; } - assert( parent == 0 ); + assert( parent == nullptr ); p->setLifetime(); t = p->getLifetime(); bool needToChargeConj = false; @@ -231,7 +232,7 @@ } } - if ( parent != 0 ) { + if ( parent != nullptr ) { //if (entryCount>1){ // EvtGenReport(EVTGEN_INFO,"EvtGen") << "Double CP decay:"<getParent(); - if ( parent != 0 && ( parent->getId() == BS0 || parent->getId() == BSB ) ) { + if ( parent != nullptr && + ( parent->getId() == BS0 || parent->getId() == BSB ) ) { if ( parent->getId() == BS0 ) otherb = BSB; if ( parent->getId() == BSB ) @@ -407,7 +409,8 @@ static double ctau = ctauL < ctauH ? ctauH : ctauL; t = -log( EvtRandom::Flat() ) * ctau; EvtParticle* parent = p->getParent(); - if ( parent != 0 && ( parent->getId() == D0 || parent->getId() == D0B ) ) { + if ( parent != nullptr && + ( parent->getId() == D0 || parent->getId() == D0B ) ) { if ( parent->getId() == D0 ) otherb = D0B; if ( parent->getId() == D0B ) @@ -429,7 +432,7 @@ EvtParticle* parent = p->getParent(); - if ( parent == 0 || parent->getId() != UPS4 ) { + if ( parent == nullptr || parent->getId() != UPS4 ) { //EvtGenReport(EVTGEN_ERROR,"EvtGen") << // "Warning CP violation with B having no parent!"<getLifetime(); diff --git a/src/EvtGenBase/EvtComplex.cpp b/src/EvtGenBase/EvtComplex.cpp --- a/src/EvtGenBase/EvtComplex.cpp +++ b/src/EvtGenBase/EvtComplex.cpp @@ -31,27 +31,3 @@ s << "(" << c._rpart << "," << c._ipart << ")"; return s; } - -EvtComplex& EvtComplex::operator*=( EvtComplex c ) -{ - double r = _rpart * c._rpart - _ipart * c._ipart; - double i = _rpart * c._ipart + _ipart * c._rpart; - - _rpart = r; - _ipart = i; - - return *this; -} - -EvtComplex& EvtComplex::operator/=( EvtComplex c ) -{ - double inv = 1.0 / ( c._rpart * c._rpart + c._ipart * c._ipart ); - - double r = inv * ( _rpart * c._rpart + _ipart * c._ipart ); - double i = inv * ( _ipart * c._rpart - _rpart * c._ipart ); - - _rpart = r; - _ipart = i; - - return *this; -} diff --git a/src/EvtGenBase/EvtCyclic3.cpp b/src/EvtGenBase/EvtCyclic3.cpp --- a/src/EvtGenBase/EvtCyclic3.cpp +++ b/src/EvtGenBase/EvtCyclic3.cpp @@ -331,7 +331,7 @@ return "C"; } assert( 0 ); - return 0; // sngh + return nullptr; // sngh } const char* EvtCyclic3::c_str( Pair i ) @@ -345,7 +345,7 @@ return "AB"; } assert( 0 ); - return 0; // sngh + return nullptr; // sngh } const char* EvtCyclic3::c_str( Perm p ) diff --git a/src/EvtGenBase/EvtDecayAmp.cpp b/src/EvtGenBase/EvtDecayAmp.cpp --- a/src/EvtGenBase/EvtDecayAmp.cpp +++ b/src/EvtGenBase/EvtDecayAmp.cpp @@ -34,217 +34,64 @@ { //original default value int ntimes = 10000; - int more; - EvtSpinDensity rho; double prob, prob_max; - _amp2.init( p->getId(), getNDaug(), getDaugs() ); - do { _daugsDecayedByParentModel = false; _weight = 1.0; decay( p ); - rho = _amp2.getSpinDensity(); - + // std::cout<<"phase space loop "<getName()<getSpinDensityForward()<<" "<getSpinDensityForward().normalizedProb( rho ); - - if ( prob < 0.0 ) { - EvtGenReport( EVTGEN_ERROR, "EvtGen" ) - << "Negative prob:" << p->getId().getId() << " " - << p->getChannel() << endl; - - EvtGenReport( EVTGEN_ERROR, "EvtGen" ) << "rho_forward:" << endl; - EvtGenReport( EVTGEN_ERROR, "EvtGen" ) << p->getSpinDensityForward(); - EvtGenReport( EVTGEN_ERROR, "EvtGen" ) << "rho decay:" << endl; - EvtGenReport( EVTGEN_ERROR, "EvtGen" ) << rho << endl; - } - - if ( prob != prob ) { - EvtGenReport( EVTGEN_DEBUG, "EvtGen" ) - << "Forward density matrix:" << endl; - EvtGenReport( EVTGEN_DEBUG, "EvtGen" ) << p->getSpinDensityForward(); - - EvtGenReport( EVTGEN_DEBUG, "EvtGen" ) - << "Decay density matrix:" << endl; - EvtGenReport( EVTGEN_DEBUG, "EvtGen" ) << rho; - - EvtGenReport( EVTGEN_DEBUG, "EvtGen" ) << "prob:" << prob << endl; - - EvtGenReport( EVTGEN_DEBUG, "EvtGen" ) - << "Particle:" << EvtPDL::name( p->getId() ).c_str() << endl; - EvtGenReport( EVTGEN_DEBUG, "EvtGen" ) - << "channel :" << p->getChannel() << endl; - EvtGenReport( EVTGEN_DEBUG, "EvtGen" ) - << "Momentum:" << p->getP4() << " " << p->mass() << endl; - if ( p->getParent() != 0 ) { - EvtGenReport( EVTGEN_DEBUG, "EvtGen" ) - << "parent:" - << EvtPDL::name( p->getParent()->getId() ).c_str() << endl; - EvtGenReport( EVTGEN_DEBUG, "EvtGen" ) - << "parent channel :" << p->getParent()->getChannel() - << endl; - - size_t i; - EvtGenReport( EVTGEN_DEBUG, "EvtGen" ) << "parent daughters :"; - for ( i = 0; i < p->getParent()->getNDaug(); i++ ) { - EvtGenReport( EVTGEN_DEBUG, "" ) - << EvtPDL::name( p->getParent()->getDaug( i )->getId() ) - .c_str() - << " "; - } - EvtGenReport( EVTGEN_DEBUG, "" ) << endl; - - EvtGenReport( EVTGEN_DEBUG, "EvtGen" ) << "daughters :"; - for ( size_t i = 0; i < p->getNDaug(); i++ ) { - EvtGenReport( EVTGEN_DEBUG, "" ) - << EvtPDL::name( p->getDaug( i )->getId() ).c_str() - << " "; - } - EvtGenReport( EVTGEN_DEBUG, "" ) << endl; - - EvtGenReport( EVTGEN_DEBUG, "EvtGen" ) - << "daughter momenta :" << endl; - ; - for ( size_t i = 0; i < p->getNDaug(); i++ ) { - EvtGenReport( EVTGEN_DEBUG, "" ) - << p->getDaug( i )->getP4() << " " - << p->getDaug( i )->mass(); - EvtGenReport( EVTGEN_DEBUG, "" ) << endl; - } - } - } - + // std::cout<setDecayProb( prob / prob_max ); - more = prob < EvtRandom::Flat( prob_max ); - + // std::cout<<"more "<getSpinDensityForward() << endl; - EvtGenReport( EVTGEN_DEBUG, "EvtGen" ) - << "Is therefore accepting the last event!" << endl; - EvtGenReport( EVTGEN_DEBUG, "EvtGen" ) - << "Decay of particle:" << EvtPDL::name( p->getId() ).c_str() - << "(channel:" << p->getChannel() << ") with mass " << p->mass() - << endl; - - for ( size_t ii = 0; ii < p->getNDaug(); ii++ ) { - EvtGenReport( EVTGEN_DEBUG, "EvtGen" ) - << "Daughter " << ii << ":" - << EvtPDL::name( p->getDaug( ii )->getId() ).c_str() - << " with mass " << p->getDaug( ii )->mass() << endl; - } - } - - EvtSpinDensity rho_list[10]; - - rho_list[0] = p->getSpinDensityForward(); - - EvtAmp ampcont; - - if ( _amp2._pstates != 1 ) { - ampcont = _amp2.contract( 0, p->getSpinDensityForward() ); - } else { - ampcont = _amp2; - } - // it may be that the parent decay model has already // done the decay - this should be rare and the // model better know what it is doing.. if ( !daugsDecayedByParentModel() ) { if ( recursive ) { + EvtSpinDensity rho_list[10]; + rho_list[0] = p->getSpinDensityForward(); + EvtAmp ampcont; + if ( _amp2._pstates != 1 ) { + ampcont = _amp2.contract( 0, p->getSpinDensityForward() ); + } else { + ampcont = _amp2; + } + // std::cout<<"kuku "<getName()<getNDaug(); i++ ) { + // std::cout<<"loop "<getName()<<" "<getName()<<" "<getId() ).c_str() << " " - << p->getChannel() << " " << i << endl; - - p->printTree(); - - for ( size_t idaug = 0; idaug < p->getNDaug(); idaug++ ) { - EvtParticle* daughter = p->getDaug( idaug ); - if ( daughter != 0 ) { - daughter->printTree(); - } - } - - EvtParticle* pParent = p->getParent(); - if ( pParent != 0 ) { - EvtGenReport( EVTGEN_ERROR, "EvtGen" ) - << "Parent:" - << EvtPDL::name( pParent->getId() ).c_str() << endl; - - EvtParticle* grandParent = pParent->getParent(); - - if ( grandParent != 0 ) { - EvtGenReport( EVTGEN_ERROR, "EvtGen" ) - << "GrandParent:" - << EvtPDL::name( grandParent->getId() ).c_str() - << endl; - } - } - - EvtGenReport( EVTGEN_ERROR, "EvtGen" ) - << " EvtSpinDensity rho: " << rho; - - _amp2.dump(); - - for ( size_t ii = 0; ii < i + 1; ii++ ) { - EvtGenReport( EVTGEN_ERROR, "EvtGen" ) - << "rho_list[" << ii << "] = " << rho_list[ii]; - } - - EvtGenReport( EVTGEN_ERROR, "EvtGen" ) - << "-------Done with error-------" << endl; - } - + // std::cout<<"dau "<getDaug( i )->setSpinDensityForward( rho ); + // std::cout<<"step b"<getDaug( i )->decay(); - + // std::cout<<"step a"<getDaug( i )->getSpinDensityBackward(); - if ( _amp2.dstates[i] != 1 ) { ampcont = ampcont.contract( _amp2._dnontrivial[i], rho_list[i + 1] ); } } - p->setSpinDensityBackward( _amp2.getBackwardSpinDensity( rho_list ) ); - - if ( !p->getSpinDensityBackward().check() ) { - EvtGenReport( EVTGEN_ERROR, "EvtGen" ) - << "rho_backward failed Check" << p->getId().getId() << " " - << p->getChannel() << endl; - - EvtGenReport( EVTGEN_ERROR, "EvtGen" ) - << p->getSpinDensityBackward(); - } } } diff --git a/src/EvtGenBase/EvtDecayBase.cpp b/src/EvtGenBase/EvtDecayBase.cpp --- a/src/EvtGenBase/EvtDecayBase.cpp +++ b/src/EvtGenBase/EvtDecayBase.cpp @@ -621,7 +621,7 @@ i++; } - char** tc = 0; + char** tc = nullptr; double result = strtod( _args[j].c_str(), tc ); if ( _storedArgs.size() < j + 1 ) { // then store the argument's value diff --git a/src/EvtGenBase/EvtDecayParm.cpp b/src/EvtGenBase/EvtDecayParm.cpp --- a/src/EvtGenBase/EvtDecayParm.cpp +++ b/src/EvtGenBase/EvtDecayParm.cpp @@ -51,22 +51,22 @@ EvtDecayParm::EvtDecayParm() { - itsfcn = 0; + itsfcn = nullptr; itsndaug = 0; itsnarg = 0; - itsdaugs = 0; - itsargs = 0; + itsdaugs = nullptr; + itsargs = nullptr; modelname = "**********"; } EvtDecayParm::~EvtDecayParm() { - if ( itsdaugs != 0 ) { + if ( itsdaugs != nullptr ) { delete[] itsdaugs; } - if ( itsargs != 0 ) { + if ( itsargs != nullptr ) { delete[] itsargs; } } diff --git a/src/EvtGenBase/EvtDecayTable.cpp b/src/EvtGenBase/EvtDecayTable.cpp --- a/src/EvtGenBase/EvtDecayTable.cpp +++ b/src/EvtGenBase/EvtDecayTable.cpp @@ -58,9 +58,9 @@ EvtDecayTable* EvtDecayTable::getInstance() { - static EvtDecayTable* theDecayTable = 0; + static EvtDecayTable* theDecayTable = nullptr; - if ( theDecayTable == 0 ) { + if ( theDecayTable == nullptr ) { theDecayTable = new EvtDecayTable(); } @@ -91,7 +91,7 @@ partnum = p->getId().getAlias(); if ( _decaytable[partnum].getNMode() == 0 ) - return 0; + return nullptr; return _decaytable[partnum].getDecayModel( p ); } @@ -1445,7 +1445,7 @@ EvtDecayBase* EvtDecayTable::findDecayModel( int aliasInt, int modeInt ) { - EvtDecayBase* theModel( 0 ); + EvtDecayBase* theModel( nullptr ); if ( aliasInt >= 0 && aliasInt < (int)EvtPDL::entries() ) { theModel = _decaytable[aliasInt].getDecayModel( modeInt ); diff --git a/src/EvtGenBase/EvtDiracParticle.cpp b/src/EvtGenBase/EvtDiracParticle.cpp --- a/src/EvtGenBase/EvtDiracParticle.cpp +++ b/src/EvtGenBase/EvtDiracParticle.cpp @@ -46,29 +46,30 @@ ::abort(); } + double px = p4.get( 1 ), py = p4.get( 2 ), pz = p4.get( 3 ), e = p4.get( 0 ); + double p2 = px * px + py * py + pz * pz, m2 = e * e - p2, m = sqrt( m2 ), + em = e + m; + double t = sqrt( em ), q = 1 / t; + double ux = px * q, uy = py * q, uz = pz * q; + double lm = sqrt( 2.0 * m ); + EvtComplex o( 0.0, 0.0 ), l( lm, 0.0 ); + EvtComplex uxy( ux, uy ), cxy = conj( uxy ); if ( EvtPDL::getStdHep( part_n ) > 0 ) { - _spinorRest[0].set( EvtComplex( sqrt( 2.0 * mass() ), 0.0 ), - EvtComplex( 0.0, 0.0 ), EvtComplex( 0.0, 0.0 ), - EvtComplex( 0.0, 0.0 ) ); - _spinorRest[1].set( EvtComplex( 0.0, 0.0 ), - EvtComplex( sqrt( 2.0 * mass() ), 0.0 ), - EvtComplex( 0.0, 0.0 ), EvtComplex( 0.0, 0.0 ) ); - - _spinorParent[0] = boostTo( _spinorRest[0], p4 ); - _spinorParent[1] = boostTo( _spinorRest[1], p4 ); - + _spinorRest[0].set( l, o, o, o ); + _spinorRest[1].set( o, l, o, o ); + _spinorParent[0].set( t, 0, uz, uxy ); + _spinorParent[1].set( 0, t, cxy, -uz ); } else { - _spinorRest[0].set( EvtComplex( 0.0, 0.0 ), EvtComplex( 0.0, 0.0 ), - EvtComplex( sqrt( 2.0 * mass() ), 0.0 ), - EvtComplex( 0.0, 0.0 ) ); - _spinorRest[1].set( EvtComplex( 0.0, 0.0 ), EvtComplex( 0.0, 0.0 ), - EvtComplex( 0.0, 0.0 ), - EvtComplex( sqrt( 2.0 * mass() ), 0.0 ) ); - - _spinorParent[0] = boostTo( _spinorRest[0], p4 ); - _spinorParent[1] = boostTo( _spinorRest[1], p4 ); + _spinorRest[0].set( o, o, l, o ); + _spinorRest[1].set( o, o, o, l ); + _spinorParent[0].set( uz, uxy, t, 0 ); + _spinorParent[1].set( cxy, -uz, 0, t ); } + // EvtDiracSpinor s0 = boostTo( _spinorRest[0], p4 ); + // EvtDiracSpinor s1 = boostTo( _spinorRest[1], p4 ); + // std::cout<< EvtPDL::getStdHep( part_n )<<" "<<_spinorParent[0] - s0<<" "<<_spinorParent[1] - s1 < using std::ostream; -EvtDiracSpinor::EvtDiracSpinor( const EvtComplex& sp0, const EvtComplex& sp1, - const EvtComplex& sp2, const EvtComplex& sp3 ) -{ - set( sp0, sp1, sp2, sp3 ); -} - -void EvtDiracSpinor::set( const EvtComplex& sp0, const EvtComplex& sp1, - const EvtComplex& sp2, const EvtComplex& sp3 ) -{ - spinor[0] = sp0; - spinor[1] = sp1; - spinor[2] = sp2; - spinor[3] = sp3; -} - -void EvtDiracSpinor::set_spinor( int i, const EvtComplex& sp ) -{ - spinor[i] = sp; -} - ostream& operator<<( ostream& s, const EvtDiracSpinor& sp ) { s << "[" << sp.spinor[0] << "," << sp.spinor[1] << "," << sp.spinor[2] @@ -58,11 +38,6 @@ return s; } -const EvtComplex& EvtDiracSpinor::get_spinor( int i ) const -{ - return spinor[i]; -} - EvtDiracSpinor rotateEuler( const EvtDiracSpinor& sp, double alpha, double beta, double gamma ) { @@ -87,6 +62,7 @@ void EvtDiracSpinor::applyBoostTo( const EvtVector4R& p4 ) { +#if 0 double e = p4.get( 0 ); EvtVector3R boost( p4.get( 1 ) / e, p4.get( 2 ) / e, p4.get( 3 ) / e ); @@ -94,10 +70,25 @@ applyBoostTo( boost ); return; +#else + double px = p4.get( 1 ), py = p4.get( 2 ), pz = p4.get( 3 ), e = p4.get( 0 ); + double p2 = px * px + py * py + pz * pz, m2 = e * e - p2, m = sqrt( m2 ), + em = e + m; + double f2 = sqrt( 0.5 / ( em * m ) ), f1 = f2 * em; + double bx = f2 * px, by = f2 * py, bz = f2 * pz; + EvtComplex t = spinor[0], x = spinor[1], y = spinor[2], z = spinor[3], + bxy( bx, by ); + + spinor[0] = f1 * t + ( bxy & z ) + bz * y; + spinor[1] = f1 * x + ( bxy * y ) - bz * z; + spinor[2] = f1 * y + ( bxy & x ) + bz * t; + spinor[3] = f1 * z + ( bxy * t ) - bz * x; +#endif } void EvtDiracSpinor::applyBoostTo( const EvtVector3R& boost ) { +#if 0 double bx, by, bz, gamma, b2, f1, f2; EvtComplex spinorp[4]; @@ -135,6 +126,22 @@ spinor[3] = spinorp[3]; return; +#else + double bx = boost.get( 0 ), by = boost.get( 1 ), bz = boost.get( 2 ); + double b2 = bx * bx + by * by + bz * bz, c2 = 1 - b2, c = sqrt( c2 ); + double f2 = sqrt( 0.5 / ( c2 + c ) ); + bx *= f2; + by *= f2; + bz *= f2; + double f1 = f2 + f2 * c; + EvtComplex t = spinor[0], x = spinor[1], y = spinor[2], z = spinor[3], + bxy( bx, by ); + + spinor[0] = f1 * t + ( bxy & z ) + bz * y; + spinor[1] = f1 * x + ( bxy * y ) - bz * z; + spinor[2] = f1 * y + ( bxy & x ) + bz * t; + spinor[3] = f1 * z + ( bxy * t ) - bz * x; +#endif } void EvtDiracSpinor::applyRotateEuler( double alpha, double beta, double gamma ) @@ -178,175 +185,385 @@ EvtVector4C EvtLeptonVACurrent( const EvtDiracSpinor& d, const EvtDiracSpinor& dp ) { - //Old code; below is a new specialized code that does it more efficiently. - //EvtGammaMatrix mat; - //EvtVector4C temp; - //mat.va0(); - //temp.set(0,d*(mat*dp)); - //mat.va1(); - //temp.set(1,d*(mat*dp)); - //mat.va2(); - //temp.set(2,d*(mat*dp)); - //mat.va3(); - //temp.set(3,d*(mat*dp)); - //return temp; - - EvtComplex u02 = ::conj( d.spinor[0] - d.spinor[2] ); - EvtComplex u13 = ::conj( d.spinor[1] - d.spinor[3] ); - - EvtComplex v02 = dp.spinor[0] - dp.spinor[2]; - EvtComplex v13 = dp.spinor[1] - dp.spinor[3]; + // Old code; below is a new specialized code that does it more efficiently. + // EvtVector4C tmp; + // tmp.set(0,d*(EvtGammaMatrix::va0()*dp)); + // tmp.set(1,d*(EvtGammaMatrix::va1()*dp)); + // tmp.set(2,d*(EvtGammaMatrix::va2()*dp)); + // tmp.set(3,d*(EvtGammaMatrix::va3()*dp)); + // return tmp; + + EvtComplex u02( real( d[0] ) - real( d[2] ), imag( d[2] ) - imag( d[0] ) ); + EvtComplex u13( real( d[1] ) - real( d[3] ), imag( d[3] ) - imag( d[1] ) ); + + EvtComplex v02 = dp[2] - dp[0]; + EvtComplex v13 = dp[1] - dp[3]; EvtComplex a = u02 * v02; EvtComplex b = u13 * v13; EvtComplex c = u02 * v13; EvtComplex e = u13 * v02; - - return EvtVector4C( a + b, -( c + e ), EvtComplex( 0, 1 ) * ( c - e ), b - a ); + EvtComplex ce = c + e; + EvtVector4C res( b - a, e - c, EvtComplex( -imag( ce ), real( ce ) ), b + a ); + // std::cout<< res - tmp <conj(); // first conjugate, then multiply with gamma0 - EvtGammaMatrix g0 = EvtGammaMatrix::g0(); - EvtDiracSpinor result; // automatically initialized to 0 - - for ( int i = 0; i < 4; ++i ) - for ( int j = 0; j < 4; ++j ) - result.spinor[i] += d.spinor[j] * g0._gamma[i][j]; - - return result; + // EvtDiracSpinor d = this->conj(); // first conjugate, then multiply with gamma0 + // EvtGammaMatrix g0 = EvtGammaMatrix::g0(); + // EvtDiracSpinor result; // automatically initialized to 0 + + // for ( int i = 0; i < 4; ++i ) + // for ( int j = 0; j < 4; ++j ) + // result.spinor[i] += d.spinor[j] * g0._gamma[i][j]; + + // return result; + const EvtDiracSpinor& d = *this; + double a0r = real( d[0] ), a0i = imag( d[0] ); + double a1r = real( d[1] ), a1i = imag( d[1] ); + double a2r = real( d[2] ), a2i = imag( d[2] ); + double a3r = real( d[3] ), a3i = imag( d[3] ); + return EvtDiracSpinor( EvtComplex( a0r, -a0i ), EvtComplex( a1r, -a1i ), + EvtComplex( -a2r, a2i ), EvtComplex( -a3r, a3i ) ); } EvtComplex operator*( const EvtDiracSpinor& d, const EvtDiracSpinor& dp ) { - int i; - EvtComplex temp; + // int i; + // EvtComplex temp; - temp = EvtComplex( 0.0, 0.0 ); + // temp = EvtComplex( 0.0, 0.0 ); - for ( i = 0; i < 4; i++ ) { - temp += conj( d.get_spinor( i ) ) * dp.get_spinor( i ); - } - return temp; + // for ( i = 0; i < 4; i++ ) { + // temp += conj( d.get_spinor( i ) ) * dp.get_spinor( i ); + // } + // return temp; + + double a0r = real( d[0] ), a0i = imag( d[0] ); + double a1r = real( d[1] ), a1i = imag( d[1] ); + double a2r = real( d[2] ), a2i = imag( d[2] ); + double a3r = real( d[3] ), a3i = imag( d[3] ); + + double b0r = real( dp[0] ), b0i = imag( dp[0] ); + double b1r = real( dp[1] ), b1i = imag( dp[1] ); + double b2r = real( dp[2] ), b2i = imag( dp[2] ); + double b3r = real( dp[3] ), b3i = imag( dp[3] ); + + double w0r = a0r * b0r + a0i * b0i, w0i = a0r * b0i - a0i * b0r; + double w1r = a1r * b1r + a1i * b1i, w1i = a1r * b1i - a1i * b1r; + double w2r = a2r * b2r + a2i * b2i, w2i = a2r * b2i - a2i * b2r; + double w3r = a3r * b3r + a3i * b3i, w3i = a3r * b3i - a3i * b3r; + + return EvtComplex( w0r + w1r + ( w2r + w3r ), w0i + w1i + ( w2i + w3i ) ); } diff --git a/src/EvtGenBase/EvtExtGeneratorCommandsTable.cpp b/src/EvtGenBase/EvtExtGeneratorCommandsTable.cpp --- a/src/EvtGenBase/EvtExtGeneratorCommandsTable.cpp +++ b/src/EvtGenBase/EvtExtGeneratorCommandsTable.cpp @@ -32,9 +32,9 @@ EvtExtGeneratorCommandsTable* EvtExtGeneratorCommandsTable::getInstance() { - static EvtExtGeneratorCommandsTable* theCommandMap = 0; + static EvtExtGeneratorCommandsTable* theCommandMap = nullptr; - if ( theCommandMap == 0 ) { + if ( theCommandMap == nullptr ) { theCommandMap = new EvtExtGeneratorCommandsTable(); } diff --git a/src/EvtGenBase/EvtGenKine.cpp b/src/EvtGenBase/EvtGenKine.cpp --- a/src/EvtGenBase/EvtGenKine.cpp +++ b/src/EvtGenBase/EvtGenKine.cpp @@ -21,324 +21,912 @@ #include "EvtGenBase/EvtGenKine.hh" #include "EvtGenBase/EvtConst.hh" +#include "EvtGenBase/EvtLinSample.hh" #include "EvtGenBase/EvtParticle.hh" #include "EvtGenBase/EvtPatches.hh" #include "EvtGenBase/EvtRandom.hh" #include "EvtGenBase/EvtReport.hh" #include "EvtGenBase/EvtVector4R.hh" +#include #include -#include using std::endl; -double EvtPawt( double a, double b, double c ) +inline void orderdouble( double* x, int i, int j ) { - double temp = ( a * a - ( b + c ) * ( b + c ) ) * - ( a * a - ( b - c ) * ( b - c ) ); + auto t = std::min( x[i], x[j] ); + x[j] = std::max( x[i], x[j] ); + x[i] = t; +} - if ( temp <= 0 ) { - return 0.0; - } +#define Od( i, j ) orderdouble( x, i, j ) - return sqrt( temp ) / ( 2.0 * a ); +void sort15( double* x ) +{ + Od( 0, 1 ); + Od( 2, 3 ); + Od( 4, 5 ); + Od( 6, 7 ); + Od( 8, 9 ); + Od( 10, 11 ); + Od( 12, 13 ); + Od( 0, 2 ); + Od( 4, 6 ); + Od( 8, 10 ); + Od( 12, 14 ); + Od( 1, 3 ); + Od( 5, 7 ); + Od( 9, 11 ); + Od( 0, 4 ); + Od( 8, 12 ); + Od( 1, 5 ); + Od( 9, 13 ); + Od( 2, 6 ); + Od( 10, 14 ); + Od( 3, 7 ); + Od( 0, 8 ); + Od( 1, 9 ); + Od( 2, 10 ); + Od( 3, 11 ); + Od( 4, 12 ); + Od( 5, 13 ); + Od( 6, 14 ); + Od( 5, 10 ); + Od( 6, 9 ); + Od( 3, 12 ); + Od( 13, 14 ); + Od( 7, 11 ); + Od( 1, 2 ); + Od( 4, 8 ); + Od( 1, 4 ); + Od( 7, 13 ); + Od( 2, 8 ); + Od( 11, 14 ); + Od( 2, 4 ); + Od( 5, 6 ); + Od( 9, 10 ); + Od( 11, 13 ); + Od( 3, 8 ); + Od( 7, 12 ); + Od( 6, 8 ); + Od( 10, 12 ); + Od( 3, 5 ); + Od( 7, 9 ); + Od( 3, 4 ); + Od( 5, 6 ); + Od( 7, 8 ); + Od( 9, 10 ); + Od( 11, 12 ); + Od( 6, 7 ); + Od( 8, 9 ); } -double EvtGenKine::PhaseSpace( int ndaug, double mass[30], EvtVector4R p4[30], - double mp ) +void sort14( double* x ) +{ + Od( 0, 1 ); + Od( 2, 3 ); + Od( 4, 5 ); + Od( 6, 7 ); + Od( 8, 9 ); + Od( 10, 11 ); + Od( 12, 13 ); + Od( 0, 2 ); + Od( 4, 6 ); + Od( 8, 10 ); + Od( 1, 3 ); + Od( 5, 7 ); + Od( 9, 11 ); + Od( 0, 4 ); + Od( 8, 12 ); + Od( 1, 5 ); + Od( 9, 13 ); + Od( 2, 6 ); + Od( 3, 7 ); + Od( 0, 8 ); + Od( 1, 9 ); + Od( 2, 10 ); + Od( 3, 11 ); + Od( 4, 12 ); + Od( 5, 13 ); + Od( 5, 10 ); + Od( 6, 9 ); + Od( 3, 12 ); + Od( 7, 11 ); + Od( 1, 2 ); + Od( 4, 8 ); + Od( 1, 4 ); + Od( 7, 13 ); + Od( 2, 8 ); + Od( 2, 4 ); + Od( 5, 6 ); + Od( 9, 10 ); + Od( 11, 13 ); + Od( 3, 8 ); + Od( 7, 12 ); + Od( 6, 8 ); + Od( 10, 12 ); + Od( 3, 5 ); + Od( 7, 9 ); + Od( 3, 4 ); + Od( 5, 6 ); + Od( 7, 8 ); + Od( 9, 10 ); + Od( 11, 12 ); + Od( 6, 7 ); + Od( 8, 9 ); +} -// N body phase space routine. Send parent with -// daughters already defined ( Number and masses ) -// Returns four vectors in parent frame. +void sort13( double* x ) +{ + Od( 1, 3 ); + Od( 5, 11 ); + Od( 4, 7 ); + Od( 8, 9 ); + Od( 0, 12 ); + Od( 6, 10 ); + Od( 1, 4 ); + Od( 6, 8 ); + Od( 9, 10 ); + Od( 11, 12 ); + Od( 0, 5 ); + Od( 3, 7 ); + Od( 1, 2 ); + Od( 5, 9 ); + Od( 10, 12 ); + Od( 0, 6 ); + Od( 8, 11 ); + Od( 0, 1 ); + Od( 4, 5 ); + Od( 3, 8 ); + Od( 2, 6 ); + Od( 1, 2 ); + Od( 3, 4 ); + Od( 6, 7 ); + Od( 8, 9 ); + Od( 5, 11 ); + Od( 1, 3 ); + Od( 6, 10 ); + Od( 2, 4 ); + Od( 5, 8 ); + Od( 9, 11 ); + Od( 7, 12 ); + Od( 2, 3 ); + Od( 4, 6 ); + Od( 7, 10 ); + Od( 4, 5 ); + Od( 7, 9 ); + Od( 10, 11 ); + Od( 6, 8 ); + Od( 3, 4 ); + Od( 5, 6 ); + Od( 7, 8 ); + Od( 9, 10 ); + Od( 6, 7 ); + Od( 8, 9 ); +} +void sort12( double* x ) { - double energy, p3, alpha, beta; + Od( 0, 1 ); + Od( 2, 3 ); + Od( 4, 5 ); + Od( 6, 7 ); + Od( 8, 9 ); + Od( 10, 11 ); + Od( 1, 3 ); + Od( 5, 7 ); + Od( 9, 11 ); + Od( 0, 2 ); + Od( 4, 6 ); + Od( 8, 10 ); + Od( 5, 9 ); + Od( 6, 10 ); + Od( 1, 2 ); + Od( 7, 11 ); + Od( 0, 4 ); + Od( 1, 5 ); + Od( 9, 10 ); + Od( 2, 6 ); + Od( 3, 7 ); + Od( 4, 8 ); + Od( 5, 9 ); + Od( 1, 2 ); + Od( 6, 10 ); + Od( 0, 4 ); + Od( 7, 11 ); + Od( 3, 8 ); + Od( 1, 4 ); + Od( 7, 10 ); + Od( 2, 3 ); + Od( 5, 6 ); + Od( 8, 9 ); + Od( 3, 5 ); + Od( 6, 8 ); + Od( 2, 4 ); + Od( 7, 9 ); + Od( 3, 4 ); + Od( 5, 6 ); + Od( 7, 8 ); +} - if ( ndaug == 1 ) { - p4[0].set( mass[0], 0.0, 0.0, 0.0 ); - return 1.0; - } +void sort11( double* x ) +{ + Od( 0, 9 ); + Od( 1, 8 ); + Od( 2, 7 ); + Od( 3, 6 ); + Od( 4, 5 ); + Od( 0, 3 ); + Od( 4, 10 ); + Od( 1, 2 ); + Od( 6, 9 ); + Od( 7, 8 ); + Od( 0, 1 ); + Od( 2, 3 ); + Od( 5, 8 ); + Od( 9, 10 ); + Od( 6, 7 ); + Od( 1, 2 ); + Od( 4, 6 ); + Od( 8, 10 ); + Od( 5, 9 ); + Od( 0, 4 ); + Od( 7, 8 ); + Od( 1, 5 ); + Od( 2, 9 ); + Od( 3, 6 ); + Od( 1, 4 ); + Od( 5, 7 ); + Od( 2, 3 ); + Od( 6, 9 ); + Od( 2, 4 ); + Od( 6, 7 ); + Od( 8, 9 ); + Od( 3, 5 ); + Od( 3, 4 ); + Od( 5, 6 ); + Od( 7, 8 ); +} - if ( ndaug == 2 ) { - //Two body phase space +void sort10( double* x ) +{ + Od( 1, 8 ); + Od( 0, 4 ); + Od( 5, 9 ); + Od( 3, 7 ); + Od( 2, 6 ); + Od( 0, 3 ); + Od( 6, 9 ); + Od( 4, 7 ); + Od( 0, 1 ); + Od( 3, 6 ); + Od( 8, 9 ); + Od( 2, 5 ); + Od( 1, 5 ); + Od( 7, 9 ); + Od( 0, 2 ); + Od( 4, 8 ); + Od( 1, 2 ); + Od( 3, 4 ); + Od( 5, 6 ); + Od( 7, 8 ); + Od( 1, 3 ); + Od( 6, 8 ); + Od( 2, 4 ); + Od( 5, 7 ); + Od( 2, 3 ); + Od( 6, 7 ); + Od( 4, 6 ); + Od( 3, 5 ); + Od( 4, 5 ); +} - energy = ( mp * mp + mass[0] * mass[0] - mass[1] * mass[1] ) / - ( 2.0 * mp ); +void sort9( double* x ) +{ + Od( 1, 2 ); + Od( 4, 5 ); + Od( 7, 8 ); + Od( 0, 1 ); + Od( 3, 4 ); + Od( 6, 7 ); + Od( 1, 2 ); + Od( 4, 5 ); + Od( 7, 8 ); + Od( 3, 6 ); + Od( 0, 3 ); + Od( 5, 8 ); + Od( 4, 7 ); + Od( 3, 6 ); + Od( 2, 5 ); + Od( 1, 4 ); + Od( 1, 3 ); + Od( 5, 8 ); + Od( 4, 7 ); + Od( 2, 6 ); + Od( 5, 7 ); + Od( 2, 3 ); + Od( 4, 6 ); + Od( 3, 4 ); + Od( 5, 6 ); +} - p3 = 0.0; - if ( energy > mass[0] ) { - p3 = sqrt( energy * energy - mass[0] * mass[0] ); - } +void sort8( double* x ) +{ + Od( 0, 1 ); + Od( 2, 3 ); + Od( 4, 5 ); + Od( 6, 7 ); + Od( 1, 3 ); + Od( 5, 7 ); + Od( 0, 2 ); + Od( 4, 6 ); + Od( 1, 2 ); + Od( 5, 6 ); + Od( 3, 7 ); + Od( 2, 6 ); + Od( 1, 5 ); + Od( 0, 4 ); + Od( 3, 5 ); + Od( 2, 4 ); + Od( 1, 2 ); + Od( 3, 4 ); + Od( 5, 6 ); +} - p4[0].set( energy, 0.0, 0.0, p3 ); +void sort7( double* x ) +{ + Od( 1, 2 ); + Od( 3, 4 ); + Od( 5, 6 ); + Od( 0, 2 ); + Od( 4, 6 ); + Od( 3, 5 ); + Od( 2, 6 ); + Od( 1, 5 ); + Od( 0, 4 ); + Od( 2, 5 ); + Od( 0, 3 ); + Od( 2, 4 ); + Od( 1, 3 ); + Od( 0, 1 ); + Od( 2, 3 ); + Od( 4, 5 ); +} - energy = mp - energy; - p3 = -1.0 * p3; - p4[1].set( energy, 0.0, 0.0, p3 ); +void sort6( double* x ) +{ + Od( 0, 1 ); + Od( 2, 3 ); + Od( 4, 5 ); + Od( 0, 2 ); + Od( 3, 5 ); + Od( 1, 4 ); + Od( 0, 1 ); + Od( 2, 3 ); + Od( 4, 5 ); + Od( 1, 2 ); + Od( 3, 4 ); + Od( 2, 3 ); +} - //Now rotate four vectors. +void sort5( double* x ) +{ + Od( 1, 2 ); + Od( 3, 4 ); + Od( 1, 3 ); + Od( 0, 2 ); + Od( 2, 4 ); + Od( 0, 3 ); + Od( 0, 1 ); + Od( 2, 3 ); + Od( 1, 2 ); +} - alpha = EvtRandom::Flat( EvtConst::twoPi ); - beta = acos( EvtRandom::Flat( -1.0, 1.0 ) ); +void sort4( double* x ) +{ + Od( 0, 1 ); + Od( 2, 3 ); + Od( 0, 2 ); + Od( 1, 3 ); + Od( 1, 2 ); +} - p4[0].applyRotateEuler( alpha, beta, -alpha ); - p4[1].applyRotateEuler( alpha, beta, -alpha ); +void sort3( double* x ) +{ + Od( 0, 1 ); + Od( 1, 2 ); + Od( 0, 1 ); +} - return 1.0; - } +void sort2( double* x ) +{ + Od( 0, 1 ); +} - if ( ndaug != 2 ) { - double wtmax = 0.0; - double pm[5][30], pmin, pmax, psum, rnd[30]; - double ran, wt, pa, costh, sinth, phi, p[4][30], be[4], bep, temp; - int i, il, ilr, i1, il1u, il1, il2r, ilu; - int il2 = 0; +void sort1( double* ) +{ +} - for ( i = 0; i < ndaug; i++ ) { - pm[4][i] = 0.0; - rnd[i] = 0.0; - } +typedef void( fun_t )( double* ); +fun_t* sortfuns[] = { sort1, sort2, sort3, sort4, sort5, + sort6, sort7, sort8, sort9, sort10, + sort11, sort12, sort13, sort14, sort15 }; - pm[0][0] = mp; - pm[1][0] = 0.0; - pm[2][0] = 0.0; - pm[3][0] = 0.0; - pm[4][0] = mp; +inline double sqr( double x ) +{ + return x * x; +} - psum = 0.0; - for ( i = 1; i < ndaug + 1; i++ ) { - psum = psum + mass[i - 1]; - } +// return s = sin and c = cos of phi = k/2^32*2*M_PI +// tested that |s|<=1 and |c|<=1 +// max |s^2 + c^2 - 1| <= 4.440892e-16 +// max relative difference |s-s_true|/s_true < 1.716228e-15 +void __attribute__( ( noinline ) ) +usincos( unsigned long kw, double& s, double& c ) +{ + const static double st[] = { 0, + 4.90676743274180142550e-2, + 9.80171403295606019942e-2, + 1.46730474455361751659e-1, + 1.95090322016128267848e-1, + 2.42980179903263889948e-1, + 2.90284677254462367636e-1, + 3.36889853392220050689e-1, + 3.82683432365089771728e-1, + 4.27555093430282094321e-1, + 4.71396736825997648556e-1, + 5.14102744193221726594e-1, + 5.55570233019602224743e-1, + 5.95699304492433343467e-1, + 6.34393284163645498215e-1, + 6.71558954847018400625e-1, + 7.07106781186547524401e-1, + 7.40951125354959091176e-1, + 7.73010453362736960811e-1, + 8.03207531480644909807e-1, + 8.31469612302545237079e-1, + 8.57728610000272069902e-1, + 8.81921264348355029713e-1, + 9.03989293123443331586e-1, + 9.23879532511286756128e-1, + 9.41544065183020778413e-1, + 9.56940335732208864936e-1, + 9.70031253194543992604e-1, + 9.80785280403230449126e-1, + 9.89176509964780973452e-1, + 9.95184726672196886245e-1, + 9.98795456205172392715e-1, + 1 }; + double x = (long)( kw << ( 5 + 2 ) ), x2 = x * x; + static const double as[3] = { 2.661032484442617284e-21, + -3.140503474026838861e-63, + 1.111886075860967104e-105 }, + ac[3] = { -3.540546941629423600e-42, + 2.089245440416171469e-84, + -4.931274944723895814e-127 }; + unsigned k = (unsigned long)kw >> 32; + int jk = ( k + ( 1 << 24 ) ) << 1, mask = jk >> 31, + absj = ( ( jk >> 26 ) ^ mask ) - mask; + double s0 = st[absj], c0 = st[32 - absj]; + static const double sign[2] = { 1, -1 }; + s0 *= sign[( k + 0 ) >> 31]; + c0 *= sign[( k + ( 1 << 30 ) ) >> 31]; + double sn = ( as[0] + x2 * ( as[1] + x2 * ( as[2] ) ) ); + double dcs = x * ( ac[0] + x2 * ( ac[1] + x2 * ( ac[2] ) ) ); + s = s0 + x * ( sn * c0 + dcs * s0 ); + c = c0 + x * ( dcs * c0 - sn * s0 ); +} - pm[4][ndaug - 1] = mass[ndaug - 1]; +// return s = sin and c = cos of phi = r*2*M_PI +// 0 <= r < 1 +// minimal nonzero r is supposed to be 2^-53 +void rsincos( double r, double& s, double& c ) +{ + long kw = r * 9007199254740992ul; + usincos( kw << 11, s, c ); +} - switch ( ndaug ) { - case 1: - wtmax = 1.0 / 16.0; - break; - case 2: - wtmax = 1.0 / 150.0; - break; - case 3: - wtmax = 1.0 / 2.0; - break; - case 4: - wtmax = 1.0 / 5.0; - break; - case 5: - wtmax = 1.0 / 15.0; - break; - case 6: - wtmax = 1.0 / 15.0; - break; - case 7: - wtmax = 1.0 / 15.0; - break; - case 8: - wtmax = 1.0 / 15.0; - break; - case 9: - wtmax = 1.0 / 15.0; - break; - case 10: - wtmax = 1.0 / 15.0; - break; - case 11: - wtmax = 1.0 / 15.0; - break; - case 12: - wtmax = 1.0 / 15.0; - break; - case 13: - wtmax = 1.0 / 15.0; - break; - case 14: - wtmax = 1.0 / 15.0; - break; - case 15: - wtmax = 1.0 / 15.0; - break; - default: - EvtGenReport( EVTGEN_ERROR, "EvtGen" ) - << "too many daughters for phase space..." << ndaug << " " - << mp << endl; - ; - break; - } +double EvtGenKine::PhaseSpace( int ndaug, const double mass[30], + EvtVector4R p4[30], double mp ) - pmax = mp - psum + mass[ndaug - 1]; +// N body phase space routine. Send parent with +// daughters already defined ( Number and masses ) +// Returns four vectors in parent frame. - pmin = 0.0; +{ + // Maximal weight scale -- based on numerical experiments + const static double wtscale[] = { + 1.000000e+00, 1.000000e+00, 5.000707e-01, 1.924501e-01, 6.249988e-02, + 1.789312e-02, 4.632982e-03, 1.104825e-03, 2.450442e-04, 5.095439e-05, + 1.022054e-05, 1.834890e-06, 3.216923e-07, 5.540728e-08, 9.468573e-09 }; - for ( ilr = 2; ilr < ndaug + 1; ilr++ ) { - il = ndaug + 1 - ilr; - pmax = pmax + mass[il - 1]; - pmin = pmin + mass[il + 1 - 1]; - wtmax = wtmax * EvtPawt( pmax, pmin, mass[il - 1] ); + if ( ndaug == 1 ) { + p4[0].set( mass[0], 0.0, 0.0, 0.0 ); + } else if ( ndaug == 2 ) { + //Two body phase space + double en = ( mp * mp + mass[0] * mass[0] - mass[1] * mass[1] ) / + ( 2.0 * mp ); + double p3 = ( en > mass[0] ) ? sqrt( en * en - mass[0] * mass[0] ) : 0; + + //Now uniformly distribute over sphere + double s, c; + usincos( EvtRandom::urandom(), s, c ); + double z = EvtRandom::random() * 2 - 1, r = sqrt( 1 - z * z ); + double pt = p3 * r, px = pt * c, py = pt * s, pz = p3 * z; + p4[0].set( en, px, py, pz ); + p4[1].set( mp - en, -px, -py, -pz ); + } else if ( ndaug == 3 ) { +#define ipck( i, j, k ) ( i | ( j << 2 ) | ( k << 4 ) ) + const static unsigned char indx[9] = { ipck( 2, 1, 0 ), + ipck( 2, 0, 1 ), + 0, + ipck( 1, 2, 0 ), + 0, + ipck( 0, 2, 1 ), + 0, + ipck( 1, 0, 2 ), + ipck( 0, 1, 2 ) }; +#undef ipck + double m0 = mass[0], m1 = mass[1], m2 = mass[2]; + unsigned i0 = ( m0 > m1 ) + ( m0 > m2 ); + unsigned i1 = ( m1 >= m0 ) + ( m1 > m2 ); + unsigned i2 = ( m2 >= m0 ) + ( m2 >= m1 ); + unsigned I = i0 + 3 * ( i1 + 3 * i2 ), J = indx[( I - 5 ) >> 1], + j0 = J & 3, j1 = ( J >> 2 ) & 3, j2 = ( J >> 4 ) & 3; + double wtmax = wtscale[ndaug - 1] * wtscale[ndaug - 1]; + auto order = []( double& a, double& b ) -> void { + auto t = std::max( a, b ); + a = std::min( a, b ); + b = t; + }; + order( m0, m1 ); + order( m1, m2 ); + double u0 = m0 + m1, v0 = m0 - m1, M1max = mp - m2, M02 = sqr( M1max ); + double u02 = u0 * u0, v02 = v0 * v0; + order( m0, m1 ); + double u1 = u0 + m2, v1 = u0 - m2, M12 = sqr( mp ), dE = mp - u1; + if ( dE <= 0 ) { + printf( "Not enough energy: Mtot = %f Etot = %f\n", u1, mp ); + exit( -1 ); } + wtmax /= M12 * M02; + wtmax *= ( M02 - u02 ) * ( M02 - v02 ) * ( M12 - u1 * u1 ) * + ( M12 - v1 * v1 ); + double wt, wtd, R, M1, p0, p1; do { - rnd[0] = 1.0; - il1u = ndaug - 1; - - for ( il1 = 2; il1 < il1u + 1; il1++ ) { - ran = EvtRandom::Flat(); - for ( il2r = 2; il2r < il1 + 1; il2r++ ) { - il2 = il1 + 1 - il2r; - if ( ran <= rnd[il2 - 1] ) - goto two39; - rnd[il2 + 1 - 1] = rnd[il2 - 1]; - } - two39: - rnd[il2 + 1 - 1] = ran; - } + M1 = u0 + dE * EvtRandom::random(); + R = wtmax * sqr( EvtRandom::random() ); + double M02 = M1 * M1; + p0 = ( M02 - u02 ) * ( M02 - v02 ); + double u1 = M1 + m2, v1 = M1 - m2; + p1 = ( M12 - u1 * u1 ) * ( M12 - v1 * v1 ); + wt = p0 * p1; + wtd = M02 * M12; + } while ( wt < wtd * R ); + double iM1 = 1 / M1; + p0 = sqrt( p0 ) * 0.5 * iM1; + p1 = sqrt( p1 ) / ( 2 * mp ); + + // for tree particle decay all momenta lie in a plane so let us + // generate momenta in the x-y plane with the third particle + // momentum along x-axis and then randomly rotate them + double E3 = sqrt( p1 * p1 + m2 * m2 ); + double E12 = mp - E3; + + // energies of particles 1 and 2 in their rest frame where they are back-to-back + double E1 = sqrt( p0 * p0 + m0 * m0 ), E2 = sqrt( p0 * p0 + m1 * m1 ); + + // projection on the x-y plane of uniform rotations in 3D + double cth = EvtRandom::random() * 2 - 1, sth = sqrt( 1 - cth * cth ); + double px = p0 * cth, py = p0 * sth; + + // boost 1 and 2 particle into the 1-2-3 rest frame + double g = E12 * iM1, gb = p1 * iM1; + double gpx = g * px, gbpx = gb * px; + double v0x = gpx - gb * E1, v0e = g * E1 - gbpx; + double v1x = -gpx - gb * E2, v1e = g * E2 + gbpx; + double v2x = p1; + + double x, y; + usincos( EvtRandom::urandom(), x, y ); + double c, s; + usincos( EvtRandom::urandom(), c, s ); + double u = EvtRandom::random() * 2, z = u - 1, r = sqrt( 1 - z * z ); + double Rx = s * y - c * x, Ry = c * y + s * x, ux = u * x, uy = u * y; + double R00 = ux * Rx + c, R01 = s - ux * Ry, R10 = uy * Rx - s, + R11 = c - uy * Ry, R20 = -r * Rx, R21 = r * Ry; + double pyx = R01 * py, pyy = R11 * py, pyz = R21 * py; + + p4[j0].set( v0e, R00 * v0x + pyx, R10 * v0x + pyy, R20 * v0x + pyz ); + p4[j1].set( v1e, R00 * v1x - pyx, R10 * v1x - pyy, R20 * v1x - pyz ); + p4[j2].set( E3, R00 * v2x, R10 * v2x, R20 * v2x ); + } else if ( ndaug < 16 ) { + const int nmax = 15; + double M[nmax], rndf[nmax], p[nmax - 1]; + const double* m = mass; + + double E0 = 0.0; + for ( int i = 0; i < ndaug; i++ ) { + E0 += m[i]; + M[i] = m[i]; + } + double dE = mp - E0; + if ( dE <= 0 ) { + printf( "Not enough energy: Mtot = %f Etot = %f\n", E0, mp ); + exit( -1 ); + } + rndf[0] = 0.0; + rndf[ndaug - 1] = 1; + + double wtmax = wtscale[ndaug - 1] * wtscale[ndaug - 1]; + // std::sort(M, M + ndaug, std::less()); + sortfuns[ndaug - 1]( M ); + m = M; + double Mmin = 0.0, Mmax = dE + m[0], wtmaxd = 1.0; + for ( int i = 0; i < ndaug - 1; i++ ) { + Mmin += m[i]; + Mmax += m[i + 1]; + double u = Mmin + m[i + 1], v = Mmin - m[i + 1], M2 = Mmax * Mmax; + wtmax *= ( M2 - u * u ) * ( M2 - v * v ); + wtmaxd *= M2; + } + wtmax /= wtmaxd; + m = mass; + fun_t* sortfun = sortfuns[ndaug - 3]; + double wt, wtd, R; + do { + for ( int i = 1; i < ndaug - 1; i++ ) + rndf[i] = EvtRandom::random(); + sortfun( rndf + 1 ); - rnd[ndaug - 1] = 0.0; wt = 1.0; - for ( ilr = 2; ilr < ndaug + 1; ilr++ ) { - il = ndaug + 1 - ilr; - pm[4][il - 1] = pm[4][il + 1 - 1] + mass[il - 1] + - ( rnd[il - 1] - rnd[il + 1 - 1] ) * ( mp - psum ); - wt = wt * - EvtPawt( pm[4][il - 1], pm[4][il + 1 - 1], mass[il - 1] ); - } - if ( wt > wtmax ) { - EvtGenReport( EVTGEN_ERROR, "EvtGen" ) - << "wtmax to small in EvtPhaseSpace with " << ndaug - << " daughters" << endl; - ; - } - } while ( wt < EvtRandom::Flat( wtmax ) ); - - ilu = ndaug - 1; - - for ( il = 1; il < ilu + 1; il++ ) { - pa = EvtPawt( pm[4][il - 1], pm[4][il + 1 - 1], mass[il - 1] ); - costh = EvtRandom::Flat( -1.0, 1.0 ); - sinth = sqrt( 1.0 - costh * costh ); - phi = EvtRandom::Flat( EvtConst::twoPi ); - p[1][il - 1] = pa * sinth * cos( phi ); - p[2][il - 1] = pa * sinth * sin( phi ); - p[3][il - 1] = pa * costh; - pm[1][il + 1 - 1] = -p[1][il - 1]; - pm[2][il + 1 - 1] = -p[2][il - 1]; - pm[3][il + 1 - 1] = -p[3][il - 1]; - p[0][il - 1] = sqrt( pa * pa + mass[il - 1] * mass[il - 1] ); - pm[0][il + 1 - 1] = sqrt( pa * pa + - pm[4][il + 1 - 1] * pm[4][il + 1 - 1] ); + wtd = 1.0; + R = wtmax * sqr( EvtRandom::random() ); + double M0 = m[0]; + int i = 1; + do { + double f = rndf[i] - rndf[i - 1]; + double m1 = m[i], M1 = m1 + M0 + f * dE; + double ma = M0 + m1, ms = M0 - m1, M2 = M1 * M1; + double t = ( M2 - ma * ma ) * ( M2 - ms * ms ); + wt *= t; + wtd *= M2; + p[i - 1] = t; + M[i] = M1; + M0 = M1; + } while ( ++i < ndaug ); + } while ( wt < wtd * R ); + + if ( wt > wtd * wtmax ) { + printf( "Warning: current weight is higher than supposed maximum: %e > %e\n", + sqrt( wt / wtd ), sqrt( wtmax ) ); } - p[0][ndaug - 1] = pm[0][ndaug - 1]; - p[1][ndaug - 1] = pm[1][ndaug - 1]; - p[2][ndaug - 1] = pm[2][ndaug - 1]; - p[3][ndaug - 1] = pm[3][ndaug - 1]; - - for ( ilr = 2; ilr < ndaug + 1; ilr++ ) { - il = ndaug + 1 - ilr; - be[0] = pm[0][il - 1] / pm[4][il - 1]; - be[1] = pm[1][il - 1] / pm[4][il - 1]; - be[2] = pm[2][il - 1] / pm[4][il - 1]; - be[3] = pm[3][il - 1] / pm[4][il - 1]; - - for ( i1 = il; i1 < ndaug + 1; i1++ ) { - bep = be[1] * p[1][i1 - 1] + be[2] * p[2][i1 - 1] + - be[3] * p[3][i1 - 1] + be[0] * p[0][i1 - 1]; - temp = ( p[0][i1 - 1] + bep ) / ( be[0] + 1.0 ); - p[1][i1 - 1] = p[1][i1 - 1] + temp * be[1]; - p[2][i1 - 1] = p[2][i1 - 1] + temp * be[2]; - p[3][i1 - 1] = p[3][i1 - 1] + temp * be[3]; - p[0][i1 - 1] = bep; - } + double* iM = rndf; + for ( int i = 0; i < ndaug - 1; i++ ) { + iM[i + 1] = 1 / M[i + 1]; + p[i] = sqrt( p[i] ) * ( 0.5 * iM[i + 1] ); } - for ( ilr = 0; ilr < ndaug; ilr++ ) { - p4[ilr].set( p[0][ilr], p[1][ilr], p[2][ilr], p[3][ilr] ); - } + p4[0].set( sqrt( p[0] * p[0] + m[0] * m[0] ), 0, p[0], 0 ); + int i = 1; + while ( 1 ) { + p4[i].set( sqrt( p[i - 1] * p[i - 1] + m[i] * m[i] ), 0, -p[i - 1], + 0 ); + + double cz = EvtRandom::random() * 2 - 1, sz = sqrt( 1 - cz * cz ); + double sy, cy; + usincos( EvtRandom::urandom(), sy, cy ); + for ( int j = 0; j <= i; j++ ) { + double x = p4[j].get( 1 ), y = p4[j].get( 2 ), z = p4[j].get( 3 ); + double xp = cz * x - sz * y, + yp = sz * x + cz * y; // rotation around z + double zp = sy * xp + cy * z; + xp = cy * xp - sy * z; // rotation around y + p4[j].set( 1, xp ); + p4[j].set( 2, yp ); + p4[j].set( 3, zp ); + } + + if ( i == ( ndaug - 1 ) ) + break; - return 1.0; + double E = sqrt( p[i] * p[i] + M[i] * M[i] ), gamma = E * iM[i], + betagamma = p[i] * iM[i]; + for ( int j = 0; j <= i; j++ ) { + double e = p4[j].get( 0 ), py = p4[j].get( 2 ); + p4[j].set( 0, gamma * e + betagamma * py ); + p4[j].set( 2, gamma * py + betagamma * e ); + } + i++; + } + } else { + printf( "No more than 15 particles! Ndaughter = %d", ndaug ); + exit( -1 ); } return 1.0; } -double EvtGenKine::PhaseSpacePole( double M, double m1, double m2, double m3, - double a, EvtVector4R p4[10] ) +double PhaseSpacePole1( double M, double m1, double m2, double m3, double a, + EvtVector4R p4[10] ) // generate kinematics for 3 body decays, pole for the m1,m2 mass. - { - //f1 = 1 (phasespace) - //f2 = a*(1/m12sq)^2 - - double m12sqmax = ( M - m3 ) * ( M - m3 ); - double m12sqmin = ( m1 + m2 ) * ( m1 + m2 ); - - double m13sqmax = ( M - m2 ) * ( M - m2 ); - double m13sqmin = ( m1 + m3 ) * ( m1 + m3 ); - - double v1 = ( m12sqmax - m12sqmin ) * ( m13sqmax - m13sqmin ); - double v2 = a * ( 1.0 / m12sqmin - 1.0 / m12sqmax ) * ( m13sqmax - m13sqmin ); - + //f1 = 1 (phasespace) + //f2 = a*(1/(p4[0]+p4[1])^2) + + double m12sqmin = ( m1 + m2 ) * ( m1 + m2 ), + m12sqmax = ( M - m3 ) * ( M - m3 ); + double m13sqmin = ( m1 + m3 ) * ( m1 + m3 ), + m13sqmax = ( M - m2 ) * ( M - m2 ); + double d12 = m12sqmax - m12sqmin, d13 = m13sqmax - m13sqmin; + double M2 = M * M, m32 = m3 * m3, m12 = m1 * m1, m22 = m2 * m2; + double c0 = M2 - m32, c1 = m12 - m22, c2 = m32 + m12; + double ab12 = log( m12sqmax / m12sqmin ); // \int_m12sqmin^m12sqmax dx/x + double r = d12 / ( d12 + a * ab12 ); double m12sq, m13sq; + do { + double z0 = EvtRandom::random(), z1 = EvtRandom::random(), + z2 = EvtRandom::random(); + m13sq = m13sqmin + z0 * d13; + m12sq = ( r > z1 ) ? m12sqmin + z2 * d12 : m12sqmin * exp( z2 * ab12 ); + double E3s = c0 - m12sq, E1s = m12sq + c1; + double w = 2 * m12sq, e = 4 * m12sq; + double A = ( m13sq - c2 ) * w - E3s * E1s; + double B = ( E3s * E3s - e * m32 ) * ( E1s * E1s - e * m12 ); + if ( A * A < B ) + break; + } while ( true ); + double iM = 0.5 / M; + double E2 = ( M2 + m22 - m13sq ) * iM; + double E3 = ( M2 + m32 - m12sq ) * iM; + double E1 = M - E2 - E3; + double p1 = sqrt( E1 * E1 - m12 ); + double p3 = sqrt( E3 * E3 - m32 ); + double cost13 = ( 2.0 * E1 * E3 + ( m12 + m32 - m13sq ) ) / ( 2.0 * p1 * p3 ); + + double px = p1 * cost13; + double v0x = px; + double v1x = -px - p3; + double py = p1 * sqrt( 1.0 - cost13 * cost13 ); + double v2x = p3; + + double x, y; + usincos( EvtRandom::urandom(), x, y ); + double c, s; + usincos( EvtRandom::urandom(), c, s ); + double u = EvtRandom::random() * 2, z = u - 1, t = sqrt( 1 - z * z ); + double Rx = s * y - c * x, Ry = c * y + s * x, ux = u * x, uy = u * y; + double R00 = ux * Rx + c, R01 = s - ux * Ry, R10 = uy * Rx - s, + R11 = c - uy * Ry, R20 = -t * Rx, R21 = t * Ry; + double pyx = R01 * py, pyy = R11 * py, pyz = R21 * py; + + p4[0].set( E1, R00 * v0x + pyx, R10 * v0x + pyy, R20 * v0x + pyz ); + p4[1].set( E2, R00 * v1x - pyx, R10 * v1x - pyy, R20 * v1x - pyz ); + p4[2].set( E3, R00 * v2x, R10 * v2x, R20 * v2x ); + + return 1.0 + a / m12sq; +} - double r = v1 / ( v1 + v2 ); - - double m13min, m13max; - +double EvtGenKine::PhaseSpacePole2( double M, double m1, double m2, double m3, + EvtVector4R* p4, const EvtLinSample& g ) +{ + // static linsample g("b2sllprob_wide.dat"); + // static linsample g("b2sllprob_amp.dat"); + + double m13sqmin = ( m1 + m3 ) * ( m1 + m3 ), + m13sqmax = ( M - m2 ) * ( M - m2 ); + double d13 = m13sqmax - m13sqmin; + double M2 = M * M, m32 = m3 * m3, m12 = m1 * m1, m22 = m2 * m2; + double c0 = M2 - m32, c1 = m12 - m22, c2 = m32 + m12; + double m12sq, m13sq, w; do { - m13sq = EvtRandom::Flat( m13sqmin, m13sqmax ); - - if ( r > EvtRandom::Flat() ) { - m12sq = EvtRandom::Flat( m12sqmin, m12sqmax ); - } else { - m12sq = 1.0 / - ( 1.0 / m12sqmin - - EvtRandom::Flat() * ( 1.0 / m12sqmin - 1.0 / m12sqmax ) ); - } + double z0 = EvtRandom::random(), z1 = EvtRandom::random(); + m13sq = m13sqmin + z0 * d13; + auto t = g( z1 ); + m12sq = t.first; + w = t.second; + double E3s = c0 - m12sq, E1s = m12sq + c1; + double w = 2 * m12sq, e = 4 * m12sq; + double A = ( m13sq - c2 ) * w - E3s * E1s; + double B = ( E3s * E3s - e * m32 ) * ( E1s * E1s - e * m12 ); + if ( A * A < B ) + break; + } while ( true ); + double iM = 0.5 / M; + double E2 = ( M2 + m22 - m13sq ) * iM; + double E3 = ( M2 + m32 - m12sq ) * iM; + double E1 = M - E2 - E3; + double p1 = sqrt( E1 * E1 - m12 ); + double p3 = sqrt( E3 * E3 - m32 ); + double cost13 = ( 2.0 * E1 * E3 + ( m12 + m32 - m13sq ) ) / ( 2.0 * p1 * p3 ); + + double px = p1 * cost13; + double v0x = px; + double v1x = -px - p3; + double py = p1 * sqrt( 1.0 - cost13 * cost13 ); + double v2x = p3; + + double x, y; + usincos( EvtRandom::urandom(), x, y ); + double c, s; + usincos( EvtRandom::urandom(), c, s ); + double u = EvtRandom::random() * 2, z = u - 1, t = sqrt( 1 - z * z ); + double Rx = s * y - c * x, Ry = c * y + s * x, ux = u * x, uy = u * y; + double R00 = ux * Rx + c, R01 = s - ux * Ry, R10 = uy * Rx - s, + R11 = c - uy * Ry, R20 = -t * Rx, R21 = t * Ry; + double pyx = R01 * py, pyy = R11 * py, pyz = R21 * py; + + p4[0].set( E1, R00 * v0x + pyx, R10 * v0x + pyy, R20 * v0x + pyz ); + p4[1].set( E2, R00 * v1x - pyx, R10 * v1x - pyy, R20 * v1x - pyz ); + p4[2].set( E3, R00 * v2x, R10 * v2x, R20 * v2x ); + + return w; +} - //kinematically allowed? - double E3star = ( M * M - m12sq - m3 * m3 ) / sqrt( 4 * m12sq ); - double E1star = ( m12sq + m1 * m1 - m2 * m2 ) / sqrt( 4 * m12sq ); - double p3star = sqrt( E3star * E3star - m3 * m3 ); - double p1star = sqrt( E1star * E1star - m1 * m1 ); - m13max = ( E3star + E1star ) * ( E3star + E1star ) - - ( p3star - p1star ) * ( p3star - p1star ); - m13min = ( E3star + E1star ) * ( E3star + E1star ) - - ( p3star + p1star ) * ( p3star + p1star ); +double EvtGenKine::PhaseSpacePole( double M, double m1, double m2, double m3, + double a, EvtVector4R p4[10] ) - } while ( m13sq < m13min || m13sq > m13max ); +// generate kinematics for 3 body decays, pole for the m1,m2 mass. - double E2 = ( M * M + m2 * m2 - m13sq ) / ( 2.0 * M ); - double E3 = ( M * M + m3 * m3 - m12sq ) / ( 2.0 * M ); +{ + // return PhaseSpacePole2(M, m1, m2, m3, p4); + // return PhaseSpacePole1(M, m1, m2, m3, a, p4); + //f1 = 1 (phasespace) + //f2 = a*(1/m12sq)^2 = a*(1/(p4[0]+p4[1])^4) + + double m12sqmin = ( m1 + m2 ) * ( m1 + m2 ), + m12sqmax = ( M - m3 ) * ( M - m3 ); + double m13sqmin = ( m1 + m3 ) * ( m1 + m3 ), + m13sqmax = ( M - m2 ) * ( M - m2 ); + double d12 = m12sqmax - m12sqmin, d13 = m13sqmax - m13sqmin; + double M2 = M * M, m32 = m3 * m3, m12 = m1 * m1, m22 = m2 * m2; + double c0 = M2 - m32, c1 = m12 - m22, c2 = m32 + m12; + double a12 = 1.0 / m12sqmin, ab12 = a12 - 1.0 / m12sqmax; + double r = d12 / ( d12 + a * ab12 ); + double m12sq, m13sq; + do { + double z0 = EvtRandom::random(), z1 = EvtRandom::random(), + z2 = EvtRandom::random(); + m13sq = m13sqmin + z0 * d13; + m12sq = ( r > z1 ) ? m12sqmin + z2 * d12 : 1.0 / ( a12 - z2 * ab12 ); + double E3s = c0 - m12sq, E1s = m12sq + c1; + double w = 2 * m12sq, e = 4 * m12sq; + double A = ( m13sq - c2 ) * w - E3s * E1s; + double B = ( E3s * E3s - e * m32 ) * ( E1s * E1s - e * m12 ); + if ( A * A < B ) + break; + } while ( true ); + double iM = 0.5 / M; + double E2 = ( M2 + m22 - m13sq ) * iM; + double E3 = ( M2 + m32 - m12sq ) * iM; double E1 = M - E2 - E3; - double p1mom = sqrt( E1 * E1 - m1 * m1 ); - double p3mom = sqrt( E3 * E3 - m3 * m3 ); - double cost13 = ( 2.0 * E1 * E3 + m1 * m1 + m3 * m3 - m13sq ) / - ( 2.0 * p1mom * p3mom ); - - //EvtGenReport(EVTGEN_INFO,"EvtGen") << m13sq << endl; - //EvtGenReport(EVTGEN_INFO,"EvtGen") << m12sq << endl; - //EvtGenReport(EVTGEN_INFO,"EvtGen") << E1 << endl; - //EvtGenReport(EVTGEN_INFO,"EvtGen") << E2 << endl; - //EvtGenReport(EVTGEN_INFO,"EvtGen") << E3 << endl; - //EvtGenReport(EVTGEN_INFO,"EvtGen") << p1mom << endl; - //EvtGenReport(EVTGEN_INFO,"EvtGen") << p3mom << endl; - //EvtGenReport(EVTGEN_INFO,"EvtGen") << cost13 << endl; - - p4[2].set( E3, 0.0, 0.0, p3mom ); - p4[0].set( E1, p1mom * sqrt( 1.0 - cost13 * cost13 ), 0.0, p1mom * cost13 ); - p4[1].set( E2, -p1mom * sqrt( 1.0 - cost13 * cost13 ), 0.0, - -p1mom * cost13 - p3mom ); - - //EvtGenReport(EVTGEN_INFO,"EvtGen") << "p4:"<clear(); delete _theEvent; - _theEvent = 0; + _theEvent = nullptr; } } @@ -56,7 +56,7 @@ // Rather, it uses the base particle to construct the event. this->deleteEvent(); - if ( baseParticle == 0 ) { + if ( baseParticle == nullptr ) { return; } @@ -77,9 +77,9 @@ int frameType ) { // Create an HepMC GenParticle, with the 4-momenta in the frame given by the frameType integer - GenParticlePtr genParticle{nullptr}; + GenParticlePtr genParticle{ nullptr }; - if ( theParticle != 0 ) { + if ( theParticle != nullptr ) { // Set the particle status integer to either stable or decayed int status( EvtHepMCEvent::STABLE ); int nDaug = theParticle->getNDaug(); @@ -127,7 +127,8 @@ // be the same GenParticle pointer, hence the reason for using it as a 2nd argument // in this function. - if ( _theEvent == 0 || inEvtParticle == 0 || inGenParticle == 0 ) { + if ( _theEvent == nullptr || inEvtParticle == nullptr || + inGenParticle == nullptr ) { return; } @@ -150,7 +151,7 @@ GenParticlePtr genDaughter = this->createGenParticle( evtDaughter, EvtHepMCEvent::LAB ); - if ( genDaughter != 0 ) { + if ( genDaughter != nullptr ) { // Add a new GenParticle (outgoing) particle daughter to the vertex theVertex->add_particle_out( genDaughter ); @@ -164,7 +165,7 @@ } // Have daughter products - } // hepMCDaughter != 0 + } // hepMCDaughter != nullptr } // Loop over daughters } @@ -173,13 +174,13 @@ { FourVector vertexCoord( 0.0, 0.0, 0.0, 0.0 ); - if ( theParticle != 0 && theParticle->getNDaug() != 0 ) { + if ( theParticle != nullptr && theParticle->getNDaug() != 0 ) { // Get the position (t,x,y,z) of the EvtParticle, offset by the translation vector. // This position will be the point where the particle decays. So we ask // the position of the (1st) daughter particle. EvtParticle* daugParticle = theParticle->getDaug( 0 ); - if ( daugParticle != 0 ) { + if ( daugParticle != nullptr ) { EvtVector4R vtxPosition = daugParticle->get4Pos() + _translation; // Create the HepMC 4 vector of the position (x,y,z,t) diff --git a/src/EvtGenBase/EvtIdSet.cpp b/src/EvtGenBase/EvtIdSet.cpp --- a/src/EvtGenBase/EvtIdSet.cpp +++ b/src/EvtGenBase/EvtIdSet.cpp @@ -445,9 +445,7 @@ { int combLen = _numInList + set1.sizeOfSet(); int uniqueLen = 0; - EvtId* combSet; - - combSet = new EvtId[combLen]; + EvtId* combSet = new EvtId[combLen]; int i; for ( i = 0; i < combLen; i++ ) { @@ -468,17 +466,17 @@ combSet[uniqueLen] = _list[i]; uniqueLen += 1; } + } - delete _list; - _list = new EvtId[uniqueLen]; - - _numInList = uniqueLen; - for ( i = 0; i < _numInList; i++ ) { - _list[i] = combSet[i]; - } + delete[] _list; + _list = new EvtId[uniqueLen]; - delete combSet; + _numInList = uniqueLen; + for ( i = 0; i < _numInList; i++ ) { + _list[i] = combSet[i]; } + + delete[] combSet; } int EvtIdSet::sizeOfSet() const diff --git a/src/EvtGenBase/EvtLinSample.cpp b/src/EvtGenBase/EvtLinSample.cpp new file mode 100644 --- /dev/null +++ b/src/EvtGenBase/EvtLinSample.cpp @@ -0,0 +1,58 @@ +#include "EvtGenBase/EvtLinSample.hh" + +#include +#include +#include +#include + +EvtLinSample::EvtLinSample( const char* fname ) +{ + std::ifstream IN( fname ); + float x, y; + while ( IN >> x >> y ) { + v.push_back( { x, y } ); + } + std::cout << "Point read -- " << v.size() << std::endl; + I.push_back( 0 ); + for ( unsigned i = 0; i < v.size() - 1; i++ ) { + I.push_back( ( v[i + 1].y + v[i + 0].y ) * ( v[i + 1].x - v[i + 0].x ) + + I.back() ); + } + double norm = 1 / I.back(); + for ( unsigned i = 0; i < v.size(); i++ ) + I[i] *= norm; +} + +void EvtLinSample::init( const std::vector& _v ) +{ + v = _v; + std::cout << "Point provided -- " << v.size() << std::endl; + I.push_back( 0 ); + for ( unsigned i = 0; i < v.size() - 1; i++ ) { + I.push_back( ( v[i + 1].y + v[i + 0].y ) * ( v[i + 1].x - v[i + 0].x ) + + I.back() ); + } + double norm = 1 / I.back(); + for ( unsigned i = 0; i < v.size(); i++ ) + I[i] *= norm; +} + +std::pair EvtLinSample::operator()( double r ) const +{ + int j = upper_bound( I.begin(), I.end(), r ) - I.begin(); + double dI = I[j] - I[j - 1]; + r = ( r - I[j - 1] ) / dI; + double f0 = v[j - 1].y, f1 = v[j].y, x0 = v[j - 1].x, x1 = v[j].x, + df = f1 - f0, dx = x1 - x0, z; + if ( fabs( df ) > f0 * 1e-3 ) { + z = ( f1 * x0 - x1 * f0 + dx * sqrt( df * ( f0 + f1 ) * r + f0 * f0 ) ) / + df; + } else { + if ( f0 > f1 ) { + z = x0 + ( r * dx ) * ( f1 - r * df ) / f0; + } else { + z = x1 - ( r * dx ) * ( f0 + r * df ) / f1; + } + } + return std::make_pair( z, f0 + ( df / dx ) * ( z - x0 ) ); +} diff --git a/src/EvtGenBase/EvtMHelAmp.cpp b/src/EvtGenBase/EvtMHelAmp.cpp --- a/src/EvtGenBase/EvtMHelAmp.cpp +++ b/src/EvtGenBase/EvtMHelAmp.cpp @@ -34,7 +34,7 @@ { _id = id; _twospin = EvtSpinType::getSpin2( EvtPDL::getSpinType( id ) ); - _parent = NULL; + _parent = nullptr; _lineshape = lineshape; _elem = elem; @@ -82,7 +82,7 @@ EvtVector4R d = _children[0]->get4vector( product ); double phi, theta; - if ( _parent == NULL ) { + if ( _parent == nullptr ) { // This means that we're calculating the first level and we need to just // calculate the polar and azymuthal angles daughters in rest frame of // this (root) particle (this is automatic). @@ -97,7 +97,7 @@ // See if we have a grandparent - if no then the z-axis is defined by // the z-axis of the root particle - EvtVector4R g = _parent->getparent() == NULL + EvtVector4R g = _parent->getparent() == nullptr ? EvtVector4R( 0.0, 0.0, 0.0, 1.0 ) : _parent->getparent()->get4vector( product ); diff --git a/src/EvtGenBase/EvtMTRandomEngine.cpp b/src/EvtGenBase/EvtMTRandomEngine.cpp --- a/src/EvtGenBase/EvtMTRandomEngine.cpp +++ b/src/EvtGenBase/EvtMTRandomEngine.cpp @@ -25,8 +25,7 @@ #include -EvtMTRandomEngine::EvtMTRandomEngine( unsigned int seed ) : - engine_( seed ), distribution_( URDist( 0.0, 1.0 ) ) +EvtMTRandomEngine::EvtMTRandomEngine( unsigned int seed ) : engine_( seed ) { EvtGenReport( EVTGEN_INFO, "EvtMTRandomEngine" ) << "Mersenne-Twister random number generator with seed = " << seed @@ -35,5 +34,11 @@ double EvtMTRandomEngine::random() { - return distribution_( engine_ ); + return (long)( engine_() >> 1 ) * ( 1.0 / ( 1ul << 63 ) ); + // return distribution_( engine_ ); +} + +unsigned long EvtMTRandomEngine::urandom() +{ + return engine_(); } diff --git a/src/EvtGenBase/EvtMTree.cpp b/src/EvtGenBase/EvtMTree.cpp --- a/src/EvtGenBase/EvtMTree.cpp +++ b/src/EvtGenBase/EvtMTree.cpp @@ -86,8 +86,8 @@ const vector& amps, const vector& children ) { - EvtMRes* resonance = NULL; - EvtMLineShape* lineshape = NULL; + EvtMRes* resonance = nullptr; + EvtMLineShape* lineshape = nullptr; if ( ls == "BREITWIGNER" ) { lineshape = new EvtMBreitWigner( id, lsarg ); @@ -219,7 +219,7 @@ while ( amp_iter != amp_end ) { const char* nptr; - char* endptr = NULL; + char* endptr = nullptr; double amp = 0.0, phase = 0.0; nptr = ( *amp_iter ).c_str(); @@ -403,7 +403,6 @@ ret = true; return ret; - } void EvtMTree::addtree( const string& str ) diff --git a/src/EvtGenBase/EvtModel.cpp b/src/EvtGenBase/EvtModel.cpp --- a/src/EvtGenBase/EvtModel.cpp +++ b/src/EvtGenBase/EvtModel.cpp @@ -38,7 +38,7 @@ #include using std::fstream; -EvtModel* EvtModel::_instance = 0; +EvtModel* EvtModel::_instance = nullptr; EvtModel::EvtModel() { @@ -46,15 +46,15 @@ EvtDecayBase* EvtModel::getFcn( std::string model_name ) { - EvtDecayBase* model = 0; + EvtDecayBase* model = nullptr; if ( _modelNameHash.find( model_name ) != _modelNameHash.end() ) { model = _modelNameHash[model_name]; } - if ( model == 0 ) { + if ( model == nullptr ) { EvtGenReport( EVTGEN_ERROR, "EvtGen" ) << "Did not find the right model:" << model_name.c_str() << "\n"; - return 0; + return nullptr; } return model->clone(); @@ -91,12 +91,12 @@ void EvtModel::storeCommand( std::string cmd, std::string cnfgstr ) { - EvtDecayBase* model = 0; + EvtDecayBase* model = nullptr; if ( _commandNameHash.find( cmd ) != _commandNameHash.end() ) { model = _commandNameHash[cmd]; } - assert( model != 0 ); + assert( model != nullptr ); model->command( cnfgstr ); } diff --git a/src/EvtGenBase/EvtMultiChannelParser.cpp b/src/EvtGenBase/EvtMultiChannelParser.cpp --- a/src/EvtGenBase/EvtMultiChannelParser.cpp +++ b/src/EvtGenBase/EvtMultiChannelParser.cpp @@ -121,7 +121,7 @@ void EvtMultiChannelParser::parse( const std::vector& v ) { // place holder for strtod - char** tc = 0; + char** tc = nullptr; // Get PDF maximum or number of points to // use in the scan. @@ -200,7 +200,7 @@ EvtComplex& c, int& format ) { // place holder for strtod - char** tc = 0; + char** tc = nullptr; std::string coefString = v[i++]; assert( coefString == std::string( "COEFFICIENT" ) ); @@ -233,7 +233,7 @@ const std::vector& v ) { // place holder for strtod - char** tc = 0; + char** tc = nullptr; double value = 0; if ( v[i] == std::string( "COEFFICIENT" ) ) { diff --git a/src/EvtGenBase/EvtNonresonantAmp.cpp b/src/EvtGenBase/EvtNonresonantAmp.cpp --- a/src/EvtGenBase/EvtNonresonantAmp.cpp +++ b/src/EvtGenBase/EvtNonresonantAmp.cpp @@ -39,7 +39,7 @@ EvtCyclic3::Pair pair2, double par2, EvtSpinType::spintype spin ) : EvtAmplitude(), - _dalitzSpace{dp}, + _dalitzSpace{ dp }, _type( type ), _pair1( pair1 ), _pair2( pair2 ), diff --git a/src/EvtGenBase/EvtParser.cpp b/src/EvtGenBase/EvtParser.cpp --- a/src/EvtGenBase/EvtParser.cpp +++ b/src/EvtGenBase/EvtParser.cpp @@ -34,8 +34,8 @@ { _ntoken = 0; _lengthoftokenlist = 0; - _tokenlist = 0; - _linelist = 0; + _tokenlist = nullptr; + _linelist = nullptr; } EvtParser::~EvtParser() diff --git a/src/EvtGenBase/EvtParticle.cpp b/src/EvtGenBase/EvtParticle.cpp --- a/src/EvtGenBase/EvtParticle.cpp +++ b/src/EvtGenBase/EvtParticle.cpp @@ -60,7 +60,7 @@ EvtParticle::EvtParticle() { _ndaug = 0; - _parent = 0; + _parent = nullptr; _channel = -10; _t = 0.0; _genlifetime = 1; @@ -68,7 +68,7 @@ _isInit = false; _validP4 = false; _isDecayed = false; - _decayProb = 0; + _decayProb = nullptr; _intAttributes.clear(); _dblAttributes.clear(); // _mix=false; @@ -101,7 +101,9 @@ void EvtParticle::setLifetime() { if ( _genlifetime ) { - _t = -log( EvtRandom::Flat() ) * EvtPDL::getctau( getId() ); + _t = EvtPDL::getctau( getId() ); + if ( _t > 0 ) + _t *= -log( EvtRandom::Flat() ); } } @@ -248,7 +250,7 @@ // carefull - the parent mass might be fixed in stone.. EvtParticle* par = p->getParent(); double parMass = -1.; - if ( par != 0 ) { + if ( par != nullptr ) { if ( par->hasValidP4() ) parMass = par->mass(); for ( size_t i = 0; i < par->getNDaug(); i++ ) { @@ -271,8 +273,8 @@ } } - EvtId* dauId = 0; - double* dauMasses = 0; + EvtId* dauId = nullptr; + double* dauMasses = nullptr; if ( _ndaug > 0 ) { dauId = new EvtId[_ndaug]; dauMasses = new double[_ndaug]; @@ -281,8 +283,8 @@ dauMasses[j] = p->getDaug( j )->mass(); } } - EvtId* parId = 0; - EvtId* othDauId = 0; + EvtId* parId = nullptr; + EvtId* othDauId = nullptr; EvtParticle* tempPar = p->getParent(); if ( tempPar ) { parId = new EvtId( tempPar->getId() ); @@ -391,8 +393,8 @@ } int j; - EvtId* dauId = 0; - double* dauMasses = 0; + EvtId* dauId = nullptr; + double* dauMasses = nullptr; int nDaugT = p->getNDaug(); if ( nDaugT > 0 ) { dauId = new EvtId[nDaugT]; @@ -403,8 +405,8 @@ } } - EvtId* parId = 0; - EvtId* othDauId = 0; + EvtId* parId = nullptr; + EvtId* othDauId = nullptr; EvtParticle* tempPar = p->getParent(); if ( tempPar ) { parId = new EvtId( tempPar->getId() ); @@ -496,7 +498,7 @@ decayer = EvtDecayTable::getInstance()->getDecayFunc( p ); } //now we have accepted a set of masses - time - if ( decayer != 0 ) { + if ( decayer != nullptr ) { decayer->makeDecay( p ); } else { p->_rhoBackward.setDiag( p->getSpinStates() ); @@ -564,7 +566,7 @@ } int nDaug = p->getNDaug(); - double* dMasses = 0; + double* dMasses = nullptr; int i; if ( nDaug > 0 ) { @@ -761,7 +763,7 @@ temp = this->getP4(); ptemp = this; - while ( ptemp->getParent() != 0 ) { + while ( ptemp->getParent() != nullptr ) { ptemp = ptemp->getParent(); mom = ptemp->getP4(); temp = boostTo( temp, mom ); @@ -777,7 +779,7 @@ temp = this->_pBeforeFSR; ptemp = this; - while ( ptemp->getParent() != 0 ) { + while ( ptemp->getParent() != nullptr ) { ptemp = ptemp->getParent(); mom = ptemp->getP4(); temp = boostTo( temp, mom ); @@ -798,12 +800,12 @@ temp.set( 0.0, 0.0, 0.0, 0.0 ); ptemp = getParent(); - if ( ptemp == 0 ) + if ( ptemp == nullptr ) return temp; temp = ( ptemp->_t / ptemp->mass() ) * ( ptemp->getP4() ); - while ( ptemp->getParent() != 0 ) { + while ( ptemp->getParent() != nullptr ) { ptemp = ptemp->getParent(); mom = ptemp->getP4(); temp = boostTo( temp, mom ); @@ -826,8 +828,8 @@ do { bpart = current->_parent; - if ( bpart == 0 ) - return 0; + if ( bpart == nullptr ) + return nullptr; i = 0; while ( bpart->_daug[i] != current ) { i++; @@ -835,7 +837,7 @@ if ( bpart == rootOfTree ) { if ( i + 1 == bpart->_ndaug ) - return 0; + return nullptr; } i++; @@ -1270,7 +1272,7 @@ void EvtParticle::setDecayProb( double prob ) { - if ( _decayProb == 0 ) + if ( _decayProb == nullptr ) _decayProb = new double; *_decayProb = prob; } diff --git a/src/EvtGenBase/EvtParticleDecay.cpp b/src/EvtGenBase/EvtParticleDecay.cpp --- a/src/EvtGenBase/EvtParticleDecay.cpp +++ b/src/EvtGenBase/EvtParticleDecay.cpp @@ -36,7 +36,7 @@ using std::fstream; void EvtParticleDecay::printSummary() { - if ( _decay != 0 ) + if ( _decay != nullptr ) _decay->printSummary(); } diff --git a/src/EvtGenBase/EvtParticleDecayList.cpp b/src/EvtGenBase/EvtParticleDecayList.cpp --- a/src/EvtGenBase/EvtParticleDecayList.cpp +++ b/src/EvtGenBase/EvtParticleDecayList.cpp @@ -79,7 +79,7 @@ delete _decaylist[i]; } - if ( _decaylist != 0 ) + if ( _decaylist != nullptr ) delete[] _decaylist; } @@ -99,17 +99,17 @@ } delete[] _decaylist; - _decaylist = 0; + _decaylist = nullptr; _nmode = 0; _rawbrfrsum = 0.0; } EvtDecayBase* EvtParticleDecayList::getDecayModel( int imode ) { - EvtDecayBase* theModel( 0 ); + EvtDecayBase* theModel( nullptr ); if ( imode >= 0 && imode < _nmode ) { EvtParticleDecay* theDecay = _decaylist[imode]; - if ( theDecay != 0 ) { + if ( theDecay != nullptr ) { theModel = theDecay->getDecayModel(); } } @@ -128,10 +128,10 @@ } if ( getNMode() == 0 ) { - return 0; + return nullptr; } if ( getRawBrfrSum() < 0.00000001 ) { - return 0; + return nullptr; } if ( getNMode() == 1 ) { @@ -208,7 +208,7 @@ << " with mass:" << p->mass() << " will throw event away! " << endl; EvtStatus::setRejectFlag(); - return 0; + return nullptr; } void EvtParticleDecayList::setNMode( int nmode ) @@ -220,7 +220,7 @@ << "Error _nmode not equal to zero!!!" << endl; ::abort(); } - if ( _decaylist != 0 ) { + if ( _decaylist != nullptr ) { delete[] _decaylist; } _decaylist = _decaylist_new; @@ -304,7 +304,7 @@ delete[] _decaylist; } - if ( ( _nmode == 0 ) && ( _decaylist != 0 ) ) + if ( ( _nmode == 0 ) && ( _decaylist != nullptr ) ) delete[] _decaylist; _nmode++; diff --git a/src/EvtGenBase/EvtParticleFactory.cpp b/src/EvtGenBase/EvtParticleFactory.cpp --- a/src/EvtGenBase/EvtParticleFactory.cpp +++ b/src/EvtGenBase/EvtParticleFactory.cpp @@ -91,7 +91,7 @@ ::abort(); - return 0; + return nullptr; } EvtParticle* EvtParticleFactory::particleFactory( EvtId id, EvtVector4R p4, @@ -195,7 +195,7 @@ ::abort(); - return 0; + return nullptr; } EvtParticle* EvtParticleFactory::particleFactory( EvtId id, EvtVector4R p4 ) diff --git a/src/EvtGenBase/EvtPto3PAmp.cpp b/src/EvtGenBase/EvtPto3PAmp.cpp --- a/src/EvtGenBase/EvtPto3PAmp.cpp +++ b/src/EvtGenBase/EvtPto3PAmp.cpp @@ -59,7 +59,7 @@ _pairRes( other._pairRes ), _spin( other._spin ), _typeN( other._typeN ), - _prop( ( other._prop ) ? (EvtPropagator*)other._prop->clone() : 0 ), + _prop( ( other._prop ) ? (EvtPropagator*)other._prop->clone() : nullptr ), _g0( other._g0 ), _min( other._min ), _max( other._max ), diff --git a/src/EvtGenBase/EvtPto3PAmpFactory.cpp b/src/EvtGenBase/EvtPto3PAmpFactory.cpp --- a/src/EvtGenBase/EvtPto3PAmpFactory.cpp +++ b/src/EvtGenBase/EvtPto3PAmpFactory.cpp @@ -79,7 +79,7 @@ } else if ( vv[0] == "NONRES_EXP" ) { typeNRes = EvtPto3PAmp::NONRES_EXP; pairRes = strToPair( vv[1].c_str() ); - alpha = strtod( vv[2].c_str(), 0 ); + alpha = strtod( vv[2].c_str(), nullptr ); } else assert( 0 ); pdf = std::make_unique( _dp ); @@ -88,11 +88,11 @@ } else if ( vv[0] == "LASS" || vv[0] == "LASS_ELASTIC" || vv[0] == "LASS_RESONANT" ) { pairRes = strToPair( vv[1].c_str() ); - double m0 = strtod( vv[2].c_str(), 0 ); - double g0 = strtod( vv[3].c_str(), 0 ); - double a = strtod( vv[4].c_str(), 0 ); - double r = strtod( vv[5].c_str(), 0 ); - double cutoff = strtod( vv[6].c_str(), 0 ); + double m0 = strtod( vv[2].c_str(), nullptr ); + double g0 = strtod( vv[3].c_str(), nullptr ); + double a = strtod( vv[4].c_str(), nullptr ); + double r = strtod( vv[5].c_str(), nullptr ); + double cutoff = strtod( vv[6].c_str(), nullptr ); pdf = std::make_unique( _dp, m0, g0, pairRes ); amp = std::make_unique( &_dp, pairRes, m0, g0, a, r, cutoff, vv[0] ); @@ -146,8 +146,8 @@ } } - mR = strtod( vv[3].c_str(), 0 ); - gR = strtod( vv[4].c_str(), 0 ); + mR = strtod( vv[3].c_str(), nullptr ); + gR = strtod( vv[4].c_str(), nullptr ); i = 4; } else { // For a valid particle get spin, mass and width @@ -165,8 +165,8 @@ printf( "Setting m(%s)=%s g(%s)=%s\n", vv[2].c_str(), vv[3].c_str(), vv[2].c_str(), vv[4].c_str() ); - mR = strtod( vv[3].c_str(), 0 ); - gR = strtod( vv[4].c_str(), 0 ); + mR = strtod( vv[3].c_str(), nullptr ); + gR = strtod( vv[4].c_str(), nullptr ); i = 4; } } @@ -212,9 +212,9 @@ double m1a = _dp.m( first( pairRes ) ); double m1b = _dp.m( second( pairRes ) ); // 2nd channel - double g2 = strtod( vv[++i].c_str(), 0 ); - double m2a = strtod( vv[++i].c_str(), 0 ); - double m2b = strtod( vv[++i].c_str(), 0 ); + double g2 = strtod( vv[++i].c_str(), nullptr ); + double m2a = strtod( vv[++i].c_str(), nullptr ); + double m2b = strtod( vv[++i].c_str(), nullptr ); EvtPropFlatte prop( mR, gR, m1a, m1b, g2, m2a, m2b ); partAmp = std::make_unique( _dp, pairAng, pairRes, spinR, prop, EvtPto3PAmp::FLATTE ); @@ -227,7 +227,7 @@ if ( vv[i + 1] == "DVFF" ) { i++; if ( vv[++i] == "BLATTWEISSKOPF" ) { - double R = strtod( vv[++i].c_str(), 0 ); + double R = strtod( vv[++i].c_str(), nullptr ); partAmp->set_fd( R ); } else assert( 0 ); @@ -240,7 +240,7 @@ if ( vv[++i] == "BLATTWEISSKOPF" ) { if ( _verbose ) printf( "BVFF=%s\n", vv[i].c_str() ); - double R = strtod( vv[++i].c_str(), 0 ); + double R = strtod( vv[++i].c_str(), nullptr ); partAmp->set_fb( R ); } else assert( 0 ); @@ -254,7 +254,7 @@ i++; if ( vv[i + 1] == "MIN" ) { i++; - double min = strtod( vv[++i].c_str(), 0 ); + double min = strtod( vv[++i].c_str(), nullptr ); if ( _verbose ) std::cout << "CUTOFF MIN = " << min << " " << minwidths << std::endl; @@ -263,7 +263,7 @@ partAmp->setmin( min ); } else if ( vv[i + 1] == "MAX" ) { i++; - double max = strtod( vv[++i].c_str(), 0 ); + double max = strtod( vv[++i].c_str(), nullptr ); if ( _verbose ) std::cout << "CUTOFF MAX = " << max << " " << minwidths << std::endl; @@ -281,7 +281,7 @@ i++; if ( vv[i + 1] == "MIN" ) { i++; - double min = strtod( vv[++i].c_str(), 0 ); + double min = strtod( vv[++i].c_str(), nullptr ); if ( _verbose ) std::cout << "CUTOFF MIN = " << min << std::endl; //ensure against cutting off too close to the resonance @@ -289,7 +289,7 @@ partAmp->setmin( min ); } else if ( vv[i + 1] == "MAX" ) { i++; - double max = strtod( vv[++i].c_str(), 0 ); + double max = strtod( vv[++i].c_str(), nullptr ); if ( _verbose ) std::cout << "CUTOFF MAX = " << max << std::endl; //ensure against cutting off too close to the resonance diff --git a/src/EvtGenBase/EvtRadCorr.cpp b/src/EvtGenBase/EvtRadCorr.cpp --- a/src/EvtGenBase/EvtRadCorr.cpp +++ b/src/EvtGenBase/EvtRadCorr.cpp @@ -28,13 +28,13 @@ #include using std::endl; -EvtAbsRadCorr* EvtRadCorr::_fsrEngine = 0; +EvtAbsRadCorr* EvtRadCorr::_fsrEngine = nullptr; bool EvtRadCorr::_alwaysRadCorr = false; bool EvtRadCorr::_neverRadCorr = false; EvtRadCorr::EvtRadCorr() { - _fsrEngine = 0; + _fsrEngine = nullptr; _alwaysRadCorr = false; _neverRadCorr = false; } @@ -43,7 +43,7 @@ { if ( _fsrEngine ) delete _fsrEngine; - _fsrEngine = 0; + _fsrEngine = nullptr; } void EvtRadCorr::setRadCorrEngine( EvtAbsRadCorr* fsrEngine ) @@ -53,7 +53,7 @@ void EvtRadCorr::doRadCorr( EvtParticle* p ) { - if ( _fsrEngine == 0 ) { + if ( _fsrEngine == nullptr ) { EvtGenReport( EVTGEN_ERROR, "EvtGen" ) << "No RadCorr model available in " << "EvtRadCorr::doRadCorr()." << endl; diff --git a/src/EvtGenBase/EvtRandom.cpp b/src/EvtGenBase/EvtRandom.cpp --- a/src/EvtGenBase/EvtRandom.cpp +++ b/src/EvtGenBase/EvtRandom.cpp @@ -32,7 +32,7 @@ using std::endl; -EvtRandomEngine* EvtRandom::_randomEngine = 0; +EvtRandomEngine* EvtRandom::_randomEngine = nullptr; void EvtRandom::setRandomEngine( EvtRandomEngine* randomEngine ) { @@ -41,7 +41,7 @@ double EvtRandom::random() { - if ( _randomEngine == 0 ) { + if ( _randomEngine == nullptr ) { EvtGenReport( EVTGEN_ERROR, "EvtGen" ) << "No random engine available in " << "EvtRandom::random()." << endl; @@ -51,6 +51,11 @@ return _randomEngine->random(); } +unsigned long EvtRandom::urandom() +{ + return _randomEngine->urandom(); +} + // Random number routine to generate numbers between // min and max. By djl on July 27, 1995. double EvtRandom::Flat( double min, double max ) diff --git a/src/EvtGenBase/EvtReport.cpp b/src/EvtGenBase/EvtReport.cpp --- a/src/EvtGenBase/EvtReport.cpp +++ b/src/EvtGenBase/EvtReport.cpp @@ -34,7 +34,7 @@ { int printNoFacility = 1; - if ( ( facility == 0 ) && ( printNoFacility == 1 ) ) { + if ( ( facility == nullptr ) && ( printNoFacility == 1 ) ) { cout << "There is no `facility' implemented in `report'" << endl; printNoFacility = 0; } diff --git a/src/EvtGenBase/EvtSemiLeptonicBaryonAmp.cpp b/src/EvtGenBase/EvtSemiLeptonicBaryonAmp.cpp --- a/src/EvtGenBase/EvtSemiLeptonicBaryonAmp.cpp +++ b/src/EvtGenBase/EvtSemiLeptonicBaryonAmp.cpp @@ -439,7 +439,7 @@ FormFactors->getdiracff( par_num, bar_num, q2, baryonmass, &f1, &f2, &f3, &g1, &g2, &g3 ); - const double form_fact[6] = {f1, f2, f3, g1, g2, g3}; + const double form_fact[6] = { f1, f2, f3, g1, g2, g3 }; EvtVector4C b11, b12, b21, b22, l1, l2; @@ -548,7 +548,7 @@ FormFactors->getraritaff( par_num, bar_num, q2, baryonmass, &f1, &f2, &f3, &f4, &g1, &g2, &g3, &g4 ); - const double form_fact[8] = {f1, f2, f3, f4, g1, g2, g3, g4}; + const double form_fact[8] = { f1, f2, f3, f4, g1, g2, g3, g4 }; EvtId l_num = parent->getDaug( 1 )->getId(); diff --git a/src/EvtGenBase/EvtSemiLeptonicVectorAmp.cpp b/src/EvtGenBase/EvtSemiLeptonicVectorAmp.cpp --- a/src/EvtGenBase/EvtSemiLeptonicVectorAmp.cpp +++ b/src/EvtGenBase/EvtSemiLeptonicVectorAmp.cpp @@ -33,6 +33,15 @@ #include "EvtGenBase/EvtVector4C.hh" using std::endl; +double gmn( int m, int n ) +{ + if ( m != n ) + return 0; + if ( m > 0 ) + return -1; + return 1; +} + void EvtSemiLeptonicVectorAmp::CalcAmp( EvtParticle* parent, EvtAmp& amp, EvtSemiLeptonicFF* FormFactors ) { @@ -118,9 +127,40 @@ } } - EvtVector4C et0 = tds.cont1( parent->getDaug( 0 )->epsParent( 0 ).conj() ); - EvtVector4C et1 = tds.cont1( parent->getDaug( 0 )->epsParent( 1 ).conj() ); - EvtVector4C et2 = tds.cont1( parent->getDaug( 0 )->epsParent( 2 ).conj() ); + EvtParticle* D = parent->getDaug( 0 ); + EvtVector4C t0 = D->epsParent( 0 ), t1 = D->epsParent( 1 ), + t2 = D->epsParent( 2 ); + /* + EvtVector4R k = D->getP4(); + std::cout< +#include #include #include #include @@ -34,119 +34,73 @@ EvtSpinDensity::EvtSpinDensity( const EvtSpinDensity& density ) { dim = 0; - rho = 0; - - int i, j; + rho = nullptr; setDim( density.dim ); - - for ( i = 0; i < dim; i++ ) { - for ( j = 0; j < dim; j++ ) { - rho[i][j] = density.rho[i][j]; - } - } + // memmove(rho,density.rho,dim*dim*sizeof(EvtComplex)); + for ( int i = 0; i < dim * dim; i++ ) + rho[i] = density.rho[i]; } EvtSpinDensity& EvtSpinDensity::operator=( const EvtSpinDensity& density ) { - int i, j; setDim( density.dim ); - - for ( i = 0; i < dim; i++ ) { - for ( j = 0; j < dim; j++ ) { - rho[i][j] = density.rho[i][j]; - } - } - + // memmove(rho,density.rho,dim*dim*sizeof(EvtComplex)); + for ( int i = 0; i < dim * dim; i++ ) + rho[i] = density.rho[i]; return *this; } EvtSpinDensity::~EvtSpinDensity() { - if ( dim != 0 ) { - int i; - for ( i = 0; i < dim; i++ ) - delete[] rho[i]; - } - - delete[] rho; + if ( dim != 0 ) + delete[] rho; } -EvtSpinDensity::EvtSpinDensity() -{ - dim = 0; - rho = 0; -} +// EvtSpinDensity::EvtSpinDensity() +// { +// dim = 0; +// rho = 0; +// } void EvtSpinDensity::setDim( int n ) { if ( dim == n ) return; if ( dim != 0 ) { - int i; - for ( i = 0; i < dim; i++ ) - delete[] rho[i]; delete[] rho; - rho = 0; + rho = nullptr; dim = 0; } if ( n == 0 ) return; dim = n; - rho = new EvtComplexPtr[n]; - int i; - for ( i = 0; i < n; i++ ) { - rho[i] = new EvtComplex[n]; - } -} - -int EvtSpinDensity::getDim() const -{ - return dim; -} - -void EvtSpinDensity::set( int i, int j, const EvtComplex& rhoij ) -{ - assert( i < dim && j < dim ); - rho[i][j] = rhoij; -} - -const EvtComplex& EvtSpinDensity::get( int i, int j ) const -{ - assert( i < dim && j < dim ); - return rho[i][j]; + rho = new EvtComplex[n * n]; } void EvtSpinDensity::setDiag( int n ) { setDim( n ); - int i, j; - - for ( i = 0; i < n; i++ ) { - for ( j = 0; j < n; j++ ) { - rho[i][j] = EvtComplex( 0.0 ); - } - rho[i][i] = EvtComplex( 1.0 ); - } + for ( int i = 0; i < n * n; i++ ) + rho[i] = 0; + for ( int i = 0; i < n; i++ ) + rho[i * dim + i] = 1.0; } -double EvtSpinDensity::normalizedProb( const EvtSpinDensity& d ) +double EvtSpinDensity::normalizedProb( const EvtSpinDensity& d ) const { - int i, j; - EvtComplex prob( 0.0, 0.0 ); - double norm = 0.0; - if ( dim != d.dim ) { EvtGenReport( EVTGEN_ERROR, "EvtGen" ) << "Not matching dimensions in NormalizedProb" << endl; ::abort(); } - for ( i = 0; i < dim; i++ ) { - norm += real( rho[i][i] ); - for ( j = 0; j < dim; j++ ) { - prob += rho[i][j] * d.rho[i][j]; - } - } + double norm = 0.0; + for ( int i = 0; i < dim; i++ ) + norm += real( rho[i * dim + i] ); + + EvtComplex prob; + for ( int i = 0, imax = dim * dim; i < imax; i++ ) + prob += rho[i] * d.rho[i]; if ( imag( prob ) > 0.00000001 * real( prob ) ) { EvtGenReport( EVTGEN_ERROR, "EvtGen" ) @@ -172,13 +126,13 @@ double trace( 0.0 ); for ( i = 0; i < dim; i++ ) { - trace += abs( rho[i][i] ); + trace += abs( rho[i * dim + i] ); } for ( i = 0; i < dim; i++ ) { - if ( real( rho[i][i] ) < 0.0 ) + if ( real( rho[i * dim + i] ) < 0.0 ) return 0; - if ( imag( rho[i][i] ) * 1000000.0 > trace ) { + if ( imag( rho[i * dim + i] ) * 1000000.0 > trace ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << *this << endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << trace << endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Failing 1" << endl; @@ -188,13 +142,15 @@ for ( i = 0; i < dim; i++ ) { for ( j = i + 1; j < dim; j++ ) { - if ( fabs( real( rho[i][j] - rho[j][i] ) ) > - 0.00000001 * ( abs( rho[i][i] ) + abs( rho[j][j] ) ) ) { + if ( fabs( real( rho[i * dim + j] - rho[j * dim + i] ) ) > + 0.00000001 * + ( abs( rho[i * dim + i] ) + abs( rho[j * dim + j] ) ) ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Failing 2" << endl; return 0; } - if ( fabs( imag( rho[i][j] + rho[j][i] ) ) > - 0.00000001 * ( abs( rho[i][i] ) + abs( rho[j][j] ) ) ) { + if ( fabs( imag( rho[i * dim + j] + rho[j * dim + i] ) ) > + 0.00000001 * + ( abs( rho[i * dim + i] ) + abs( rho[j * dim + j] ) ) ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Failing 3" << endl; return 0; } @@ -206,14 +162,12 @@ ostream& operator<<( ostream& s, const EvtSpinDensity& d ) { - int i, j; - s << endl; s << "Dimension:" << d.dim << endl; - for ( i = 0; i < d.dim; i++ ) { - for ( j = 0; j < d.dim; j++ ) { - s << d.rho[i][j] << " "; + for ( int i = 0; i < d.dim; i++ ) { + for ( int j = 0; j < d.dim; j++ ) { + s << d.get( i, j ) << " "; } s << endl; } diff --git a/src/EvtGenBase/EvtTensor4C.cpp b/src/EvtGenBase/EvtTensor4C.cpp --- a/src/EvtGenBase/EvtTensor4C.cpp +++ b/src/EvtGenBase/EvtTensor4C.cpp @@ -272,7 +272,7 @@ for ( i = 0; i < 4; i++ ) { for ( j = 0; j < 4; j++ ) { - t[i][j] *= EvtComplex( d, 0.0 ); + t[i][j] *= d; } } return *this; @@ -280,12 +280,12 @@ EvtTensor4C operator*( const EvtTensor4C& t1, double d ) { - return EvtTensor4C( t1 ) *= EvtComplex( d, 0.0 ); + return EvtTensor4C( t1 ) *= d; } EvtTensor4C operator*( double d, const EvtTensor4C& t1 ) { - return EvtTensor4C( t1 ) *= EvtComplex( d, 0.0 ); + return EvtTensor4C( t1 ) *= d; } EvtComplex cont( const EvtTensor4C& t1, const EvtTensor4C& t2 ) @@ -553,3 +553,120 @@ } } } + +EvtTensor4C& EvtTensor4C::addScaled( EvtComplex s, const EvtTensor4C& a ) +{ + EvtComplex* u0 = reinterpret_cast( t ); + const EvtComplex* u1 = reinterpret_cast( a.t ); + for ( int i = 0; i < 16; i++ ) + u0[i] += s * u1[i]; + return *this; +} + +EvtTensor4C EvtGenFunctions::asymProd( const EvtVector4R& a, const EvtVector4R& b ) +{ + // t_{ij} = eps_{ijkl} a^{k} b^{l} + // eps_{ijkl} is the Levi-Civita symbol -- antisymmetric tensor + + EvtTensor4C res; + EvtComplex( &t )[4][4] = res.t; + double t01 = a.get( 2 ) * b.get( 3 ) - a.get( 3 ) * b.get( 2 ); + t[0][1] = t01; + t[1][0] = -t01; + double t02 = a.get( 3 ) * b.get( 1 ) - a.get( 1 ) * b.get( 3 ); + t[0][2] = t02; + t[2][0] = -t02; + double t03 = a.get( 1 ) * b.get( 2 ) - a.get( 2 ) * b.get( 1 ); + t[0][3] = t03; + t[3][0] = -t03; + double t12 = a.get( 0 ) * b.get( 3 ) - a.get( 3 ) * b.get( 0 ); + t[1][2] = t12; + t[2][1] = -t12; + double t13 = a.get( 2 ) * b.get( 0 ) - a.get( 0 ) * b.get( 2 ); + t[1][3] = t13; + t[3][1] = -t13; + double t23 = a.get( 0 ) * b.get( 1 ) - a.get( 1 ) * b.get( 0 ); + t[2][3] = t23; + t[3][2] = -t23; + return res; +} + +EvtVector4R EvtGenFunctions::asymProd( const EvtVector4R& _a, + const EvtVector4R& _b, + const EvtVector4R& _c ) +{ + // t_{ij} = eps_{ijkl} a^{j} b^{k} c^{l} + // eps_{ijkl} is the Levi-Civita symbol -- antisymmetric tensor + + double a[4] = { _a.get( 0 ), _a.get( 1 ), _a.get( 2 ), _a.get( 3 ) }; + /* + double b[4] = {_b.get(0), _b.get(1), _b.get(2), _b.get(3)}; + double c[4] = {_c.get(0), _c.get(1), _c.get(2), _c.get(3)}; + double t[4] = {0}; + + t[0] += a[1]*b[2]*c[3]; + t[0] -= a[1]*b[3]*c[2]; + t[0] -= a[2]*b[1]*c[3]; + t[0] += a[2]*b[3]*c[1]; + t[0] += a[3]*b[1]*c[2]; + t[0] -= a[3]*b[2]*c[1]; + + t[1] -= a[0]*b[2]*c[3]; + t[1] += a[0]*b[3]*c[2]; + t[1] += a[2]*b[0]*c[3]; + t[1] -= a[2]*b[3]*c[0]; + t[1] -= a[3]*b[0]*c[2]; + t[1] += a[3]*b[2]*c[0]; + + t[2] += a[0]*b[1]*c[3]; + t[2] -= a[0]*b[3]*c[1]; + t[2] -= a[1]*b[0]*c[3]; + t[2] += a[1]*b[3]*c[0]; + t[2] += a[3]*b[0]*c[1]; + t[2] -= a[3]*b[1]*c[0]; + + t[3] -= a[0]*b[1]*c[2]; + t[3] += a[0]*b[2]*c[1]; + t[3] += a[1]*b[0]*c[2]; + t[3] -= a[1]*b[2]*c[0]; + t[3] -= a[2]*b[0]*c[1]; + t[3] += a[2]*b[1]*c[0]; + + EvtVector4R res(t[0],t[1],t[2],t[3]); + // std::cout< using std::ostream; -EvtVector4C::EvtVector4C() -{ - v[0] = EvtComplex( 0.0 ); - v[1] = EvtComplex( 0.0 ); - v[2] = EvtComplex( 0.0 ); - v[3] = EvtComplex( 0.0 ); -} - -EvtVector4C::EvtVector4C( const EvtComplex& e0, const EvtComplex& e1, - const EvtComplex& e2, const EvtComplex& e3 ) -{ - v[0] = e0; - v[1] = e1; - v[2] = e2; - v[3] = e3; -} - EvtVector4C rotateEuler( const EvtVector4C& rs, double alpha, double beta, double gamma ) { @@ -80,50 +63,24 @@ void EvtVector4C::applyBoostTo( const EvtVector3R& boost ) { - double bx, by, bz, gamma, b2; - - bx = boost.get( 0 ); - by = boost.get( 1 ); - bz = boost.get( 2 ); - - double bxx = bx * bx; - double byy = by * by; - double bzz = bz * bz; - - b2 = bxx + byy + bzz; - - if ( b2 == 0.0 ) { - return; - } + double bx = boost.get( 0 ); + double by = boost.get( 1 ); + double bz = boost.get( 2 ); + double b2 = bx * bx + by * by + bz * bz; assert( b2 < 1.0 ); - gamma = 1.0 / sqrt( 1 - b2 ); - - double gb2 = ( gamma - 1.0 ) / b2; - - double gb2xy = gb2 * bx * by; - double gb2xz = gb2 * bx * bz; - double gb2yz = gb2 * by * bz; - - double gbx = gamma * bx; - double gby = gamma * by; - double gbz = gamma * bz; - - EvtComplex e2 = v[0]; - EvtComplex px2 = v[1]; - EvtComplex py2 = v[2]; - EvtComplex pz2 = v[3]; + double gamma2 = 1 / ( 1 - b2 ); + double gamma = sqrt( gamma2 ); + double F = gamma2 / ( gamma + 1 ); - v[0] = gamma * e2 + gbx * px2 + gby * py2 + gbz * pz2; + EvtComplex bp = bx * v[1] + by * v[2] + bz * v[3]; + EvtComplex c = F * bp + gamma * v[0]; - v[1] = gbx * e2 + gb2 * bxx * px2 + px2 + gb2xy * py2 + gb2xz * pz2; - - v[2] = gby * e2 + gb2 * byy * py2 + py2 + gb2xy * px2 + gb2yz * pz2; - - v[3] = gbz * e2 + gb2 * bzz * pz2 + pz2 + gb2yz * py2 + gb2xz * px2; - - return; + v[1] += c * bx; + v[2] += c * by; + v[3] += c * bz; + v[0] = gamma * ( v[0] + bp ); } void EvtVector4C::applyRotateEuler( double phi, double theta, double ksi ) diff --git a/src/EvtGenBase/EvtVectorParticle.cpp b/src/EvtGenBase/EvtVectorParticle.cpp --- a/src/EvtGenBase/EvtVectorParticle.cpp +++ b/src/EvtGenBase/EvtVectorParticle.cpp @@ -56,21 +56,21 @@ setLifetime(); } -void EvtVectorParticle::init( EvtId part_n, const EvtVector4R& p4, - const EvtVector4C& epsin1, - const EvtVector4C& epsin2, - const EvtVector4C& epsin3 ) -{ - _validP4 = true; - setp( p4 ); - setpart_num( part_n ); - - _eps[0] = epsin1; - _eps[1] = epsin2; - _eps[2] = epsin3; - - setLifetime(); -} +// void EvtVectorParticle::init( EvtId part_n, const EvtVector4R& p4, +// const EvtVector4C& epsin1, +// const EvtVector4C& epsin2, +// const EvtVector4C& epsin3 ) +// { +// _validP4 = true; +// setp( p4 ); +// setpart_num( part_n ); + +// _eps[0] = epsin1; +// _eps[1] = epsin2; +// _eps[2] = epsin3; + +// setLifetime(); +// } EvtSpinDensity EvtVectorParticle::rotateToHelicityBasis() const { @@ -121,3 +121,30 @@ return R; } + +EvtVector4C EvtVectorParticle::epsParent( int i ) const +{ + /* + assuming that polarization vectors have this structure: + _eps[0] = ( 0.0, 1.0, 0.0, 0.0 ); + _eps[1] = ( 0.0, 0.0, 1.0, 0.0 ); + _eps[2] = ( 0.0, 0.0, 0.0, 1.0 ); + boost them into the parent frame + */ + const EvtVector4R& p = getP4(); + int j = i + 1; + double e = p.get( 0 ), px = p.get( 1 ), py = p.get( 2 ), pz = p.get( 3 ); + double m2 = ( e * e - px * px ) - ( py * py + pz * pz ), m = sqrt( m2 ); + double pj = p.get( j ), c = pj / ( m * e + m2 ); + double v0 = c * ( e + m ); + double v1 = c * px; + double v2 = c * py; + double v3 = c * pz; + EvtVector4C t; + t.set( v0, v1, v2, v3 ); + t.set( j, t.get( j ) + 1 ); + return t; + // EvtVector4C o = boostTo( _eps[i], p ); + // std::cout<<"epsParent "<second; - if ( theGenerator != 0 ) { + if ( theGenerator != nullptr ) { theGenerator->initialise(); } } diff --git a/src/EvtGenExternal/EvtExternalGenList.cpp b/src/EvtGenExternal/EvtExternalGenList.cpp --- a/src/EvtGenExternal/EvtExternalGenList.cpp +++ b/src/EvtGenExternal/EvtExternalGenList.cpp @@ -41,7 +41,7 @@ // PYTHIA8DATA environment variable which should be set to the // xmldoc Pythia directory char* pythiaDataDir = getenv( "PYTHIA8DATA" ); - if ( pythiaDataDir != 0 ) { + if ( pythiaDataDir != nullptr ) { pythiaXmlDir = pythiaDataDir; } } diff --git a/src/EvtGenExternal/EvtPythia.cpp b/src/EvtGenExternal/EvtPythia.cpp --- a/src/EvtGenExternal/EvtPythia.cpp +++ b/src/EvtGenExternal/EvtPythia.cpp @@ -39,7 +39,7 @@ // Set the Pythia engine to a null pointer at first. // When we do the decay, we retrieve the pointer to the Pythia engine // and use that for all decays. All clones will use the same Pythia engine. - _pythiaEngine = 0; + _pythiaEngine = nullptr; } EvtPythia::~EvtPythia() diff --git a/src/EvtGenExternal/EvtPythiaEngine.cpp b/src/EvtGenExternal/EvtPythiaEngine.cpp --- a/src/EvtGenExternal/EvtPythiaEngine.cpp +++ b/src/EvtGenExternal/EvtPythiaEngine.cpp @@ -65,7 +65,7 @@ << "Creating alias Pythia generator" << endl; _aliasPythiaGen = std::make_unique( xmlDir, false ); - _thePythiaGenerator = 0; + _thePythiaGenerator = nullptr; _daugPDGVector.clear(); _daugP4Vector.clear(); @@ -159,7 +159,7 @@ this->initialise(); } - if ( theParticle == 0 ) { + if ( theParticle == nullptr ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Error in EvtPythiaEngine::doDecay. The mother particle is null. Not doing any Pythia decay." << endl; @@ -286,7 +286,7 @@ void EvtPythiaEngine::createDaughterEvtParticles( EvtParticle* theParent ) { - if ( theParent == 0 ) { + if ( theParent == nullptr ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Error in EvtPythiaEngine::createDaughterEvtParticles. The parent is null" << endl; @@ -334,7 +334,7 @@ EvtDecayBase* decayModel = EvtDecayTable::getInstance()->findDecayModel( aliasInt, pythiaModeInt ); - if ( decayModel != 0 ) { + if ( decayModel != nullptr ) { int nModeDaug = decayModel->getNDaug(); // We need to make sure that the number of daughters match @@ -389,7 +389,7 @@ EvtParticle* theDaughter = theParent->getDaug( iDaug ); // Set the correct 4-momentum for each daughter particle. - if ( theDaughter != 0 ) { + if ( theDaughter != nullptr ) { EvtId theDaugId = daugAliasIdVect[iDaug]; const EvtVector4R theDaugP4 = _daugP4Vector[iDaug]; theDaughter->init( theDaugId, theDaugP4 ); @@ -443,7 +443,7 @@ // Check that the PDG code is not zero/null and exclude other // special cases, e.g. those reserved for internal generator use - if ( entry_generic != 0 && this->validPDGCode( PDGCode ) ) { + if ( entry_generic != nullptr && this->validPDGCode( PDGCode ) ) { entry_generic->setM0( mass ); entry_generic->setMWidth( width ); entry_generic->setTau0( lifetime ); @@ -456,7 +456,7 @@ // Check that the PDG code is not zero/null and exclude other // special cases, e.g. those reserved for internal generator use - if ( entry_alias != 0 && this->validPDGCode( PDGCode ) ) { + if ( entry_alias != nullptr && this->validPDGCode( PDGCode ) ) { entry_alias->setM0( mass ); entry_alias->setMWidth( width ); entry_alias->setTau0( lifetime ); @@ -557,7 +557,7 @@ EvtDecayBase* decayModel = EvtDecayTable::getInstance()->findDecayModel( aliasInt, iMode ); - if ( decayModel != 0 ) { + if ( decayModel != nullptr ) { int nDaug = decayModel->getNDaug(); // If the decay mode has no daughters, then that means that there will be @@ -645,7 +645,7 @@ { int tmpModeInt( 0 ), modeInt( 0 ); - if ( decayModel != 0 ) { + if ( decayModel != nullptr ) { int nVars = decayModel->getNArg(); // Just read the first integer, which specifies the Pythia decay model. // Ignore any other values. diff --git a/src/EvtGenModels/EvtBBScalar.cpp b/src/EvtGenModels/EvtBBScalar.cpp --- a/src/EvtGenModels/EvtBBScalar.cpp +++ b/src/EvtGenModels/EvtBBScalar.cpp @@ -42,9 +42,9 @@ -0.000813 * cos( 60 / 180 * pi ) ); const EvtComplex EvtBBScalar::a4 = EvtComplex( -387.3e-4, -121e-4 ); const EvtComplex EvtBBScalar::a6 = EvtComplex( -555.3e-4, -121e-4 ); -const double EvtBBScalar::x[] = {420.96, -10485.50, 100639.97, -433916.61, - 613780.15}; -const double EvtBBScalar::y[] = {292.62, -735.73}; +const double EvtBBScalar::x[] = { 420.96, -10485.50, 100639.97, -433916.61, + 613780.15 }; +const double EvtBBScalar::y[] = { 292.62, -735.73 }; const double EvtBBScalar::m_s = 0.120; const double EvtBBScalar::m_u = 0.029 * 0.120; const double EvtBBScalar::m_b = 4.88; @@ -244,28 +244,28 @@ double EvtBBScalar::D_A( double t ) const { - const double d_tilde[] = {x[0] - 1.5 * y[0], -478}; + const double d_tilde[] = { x[0] - 1.5 * y[0], -478 }; const vector v_d_tilde( d_tilde, d_tilde + 2 ); return formFactorFit( t, v_d_tilde ); } double EvtBBScalar::F_A( double t ) const { - const double f_tilde[] = {2. / 3 * x[0] + 0.5 * y[0], -478}; + const double f_tilde[] = { 2. / 3 * x[0] + 0.5 * y[0], -478 }; const vector v_f_tilde( f_tilde, f_tilde + 2 ); return formFactorFit( t, v_f_tilde ); } double EvtBBScalar::D_P( double t ) const { - const double d_bar[] = {1.5 * y[0] * _massRatio, /*-952*/ 0}; + const double d_bar[] = { 1.5 * y[0] * _massRatio, /*-952*/ 0 }; const vector v_d_bar( d_bar, d_bar + 2 ); return formFactorFit( t, v_d_bar ); } double EvtBBScalar::F_P( double t ) const { - const double f_bar[] = {( x[0] - 0.5 * y[0] ) * _massRatio, /*-952*/ 0}; + const double f_bar[] = { ( x[0] - 0.5 * y[0] ) * _massRatio, /*-952*/ 0 }; const vector v_f_bar( f_bar, f_bar + 2 ); return formFactorFit( t, v_f_bar ); } diff --git a/src/EvtGenModels/EvtBTo3hCP.cpp b/src/EvtGenModels/EvtBTo3hCP.cpp --- a/src/EvtGenModels/EvtBTo3hCP.cpp +++ b/src/EvtGenModels/EvtBTo3hCP.cpp @@ -127,7 +127,6 @@ NatKstar0 = EvtComplex( 0., 0. ); // B0bar -->-- K+ rho- Amplitudes (Trees + Penguins) NatKrho = EvtComplex( 0., 0. ); - } void EvtBTo3hCP::Evt3pi( double alpha, int iset, EvtVector4R& p_pi_plus, diff --git a/src/EvtGenModels/EvtBsMuMuKK.cpp b/src/EvtGenModels/EvtBsMuMuKK.cpp --- a/src/EvtGenModels/EvtBsMuMuKK.cpp +++ b/src/EvtGenModels/EvtBsMuMuKK.cpp @@ -326,9 +326,9 @@ // Generate 4-momenta double mKK = EvtRandom::Flat( kin_lower_limit, kin_upper_limit ); - double mass[10] = {MJpsi, mKK, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; - double Kmass[10] = {MKp, MKm, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; - double muMass[10] = {Mmu, Mmu, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; + double mass[10] = { MJpsi, mKK, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; + double Kmass[10] = { MKp, MKm, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; + double muMass[10] = { Mmu, Mmu, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; EvtVector4R mypV[2], mypK[2], mypmu[2]; EvtGenKine::PhaseSpace( 2, mass, mypV, MBs ); diff --git a/src/EvtGenModels/EvtBtoKD3P.cpp b/src/EvtGenModels/EvtBtoKD3P.cpp --- a/src/EvtGenModels/EvtBtoKD3P.cpp +++ b/src/EvtGenModels/EvtBtoKD3P.cpp @@ -87,7 +87,7 @@ const int D2IND = 2; // generate kinematics of daughters (K and D): - EvtId tempDaug[2] = {getDaug( KIND ), getDaug( D1IND )}; + EvtId tempDaug[2] = { getDaug( KIND ), getDaug( D1IND ) }; p->initializePhaseSpace( 2, tempDaug ); // Get the D daughter particle and the decay models of the allowed diff --git a/src/EvtGenModels/EvtBtoXsgamma.cpp b/src/EvtGenModels/EvtBtoXsgamma.cpp --- a/src/EvtGenModels/EvtBtoXsgamma.cpp +++ b/src/EvtGenModels/EvtBtoXsgamma.cpp @@ -75,7 +75,7 @@ { //initialize here. -- its too damn slow otherwise. - if ( _model == 0 ) { + if ( _model == nullptr ) { if ( getArg( 0 ) == 1 ) _model = std::make_unique(); else if ( getArg( 0 ) == 2 ) diff --git a/src/EvtGenModels/EvtBtoXsgammaFermiUtil.cpp b/src/EvtGenModels/EvtBtoXsgammaFermiUtil.cpp --- a/src/EvtGenModels/EvtBtoXsgammaFermiUtil.cpp +++ b/src/EvtGenModels/EvtBtoXsgammaFermiUtil.cpp @@ -54,13 +54,13 @@ double EvtBtoXsgammaFermiUtil::FermiGaussFuncRoot( double lambdabar, double lam1, double mb, std::vector& gammaCoeffs ) { - std::vector coeffs1 = {0.2, lambdabar, 0.0}; - std::vector coeffs2 = {0.2, lambdabar, -lam1 / 3.}; + std::vector coeffs1 = { 0.2, lambdabar, 0.0 }; + std::vector coeffs2 = { 0.2, lambdabar, -lam1 / 3. }; - auto lhFunc = EvtItgTwoCoeffFcn{&FermiGaussRootFcnA, -mb, lambdabar, - coeffs1, gammaCoeffs}; - auto rhFunc = EvtItgTwoCoeffFcn{&FermiGaussRootFcnB, -mb, lambdabar, - coeffs2, gammaCoeffs}; + auto lhFunc = EvtItgTwoCoeffFcn{ &FermiGaussRootFcnA, -mb, lambdabar, + coeffs1, gammaCoeffs }; + auto rhFunc = EvtItgTwoCoeffFcn{ &FermiGaussRootFcnB, -mb, lambdabar, + coeffs2, gammaCoeffs }; auto rootFinder = EvtBtoXsgammaRootFinder{}; return rootFinder.GetGaussIntegFcnRoot( &lhFunc, &rhFunc, 1.0e-4, 1.0e-4, @@ -180,7 +180,7 @@ double EvtBtoXsgammaFermiUtil::FermiRomanFuncRoot( double lambdabar, double lam1 ) { - auto lhFunc = EvtItgFunction{&FermiRomanRootFcnA, -1.e-6, 1.e6}; + auto lhFunc = EvtItgFunction{ &FermiRomanRootFcnA, -1.e-6, 1.e6 }; auto rootFinder = EvtBtoXsgammaRootFinder{}; double rhSide = 1.0 - ( lam1 / ( 3.0 * lambdabar * lambdabar ) ); diff --git a/src/EvtGenModels/EvtBtoXsgammaKagan.cpp b/src/EvtGenModels/EvtBtoXsgammaKagan.cpp --- a/src/EvtGenModels/EvtBtoXsgammaKagan.cpp +++ b/src/EvtGenModels/EvtBtoXsgammaKagan.cpp @@ -104,37 +104,37 @@ void EvtBtoXsgammaKagan::getDefaultHadronicMass() { - massHad = {0, 0.0625995, 0.125199, 0.187798, 0.250398, 0.312997, - 0.375597, 0.438196, 0.500796, 0.563395, 0.625995, 0.688594, - 0.751194, 0.813793, 0.876392, 0.938992, 1.00159, 1.06419, - 1.12679, 1.18939, 1.25199, 1.31459, 1.37719, 1.43979, - 1.50239, 1.56499, 1.62759, 1.69019, 1.75278, 1.81538, - 1.87798, 1.94058, 2.00318, 2.06578, 2.12838, 2.19098, - 2.25358, 2.31618, 2.37878, 2.44138, 2.50398, 2.56658, - 2.62918, 2.69178, 2.75438, 2.81698, 2.87958, 2.94217, - 3.00477, 3.06737, 3.12997, 3.19257, 3.25517, 3.31777, - 3.38037, 3.44297, 3.50557, 3.56817, 3.63077, 3.69337, - 3.75597, 3.81857, 3.88117, 3.94377, 4.00637, 4.06896, - 4.13156, 4.19416, 4.25676, 4.31936, 4.38196, 4.44456, - 4.50716, 4.56976, 4.63236, 4.69496, 4.75756, 4.82016, - 4.88276, 4.94536, 5.00796}; - brHad = {0, 1.03244e-09, 3.0239e-08, 1.99815e-07, 7.29392e-07, - 1.93129e-06, 4.17806e-06, 7.86021e-06, 1.33421e-05, 2.09196e-05, - 3.07815e-05, 4.29854e-05, 5.74406e-05, 7.3906e-05, 9.2003e-05, - 0.000111223, 0.000130977, 0.000150618, 0.000169483, 0.000186934, - 0.000202392, 0.000215366, 0.000225491, 0.000232496, 0.000236274, - 0.000236835, 0.000234313, 0.000228942, 0.000221042, 0.000210994, - 0.000199215, 0.000186137, 0.000172194, 0.000157775, 0.000143255, - 0.000128952, 0.000115133, 0.000102012, 8.97451e-05, 7.84384e-05, - 6.81519e-05, 5.89048e-05, 5.06851e-05, 4.34515e-05, 3.71506e-05, - 3.1702e-05, 2.70124e-05, 2.30588e-05, 1.96951e-05, 1.68596e-05, - 1.44909e-05, 1.25102e-05, 1.08596e-05, 9.48476e-06, 8.34013e-06, - 7.38477e-06, 6.58627e-06, 5.91541e-06, 5.35022e-06, 4.87047e-06, - 4.46249e-06, 4.11032e-06, 3.80543e-06, 3.54051e-06, 3.30967e-06, - 3.10848e-06, 2.93254e-06, 2.78369e-06, 2.65823e-06, 2.55747e-06, - 2.51068e-06, 2.57179e-06, 2.74684e-06, 3.02719e-06, 3.41182e-06, - 3.91387e-06, 4.56248e-06, 5.40862e-06, 6.53915e-06, 8.10867e-06, - 1.04167e-05}; + massHad = { 0, 0.0625995, 0.125199, 0.187798, 0.250398, 0.312997, + 0.375597, 0.438196, 0.500796, 0.563395, 0.625995, 0.688594, + 0.751194, 0.813793, 0.876392, 0.938992, 1.00159, 1.06419, + 1.12679, 1.18939, 1.25199, 1.31459, 1.37719, 1.43979, + 1.50239, 1.56499, 1.62759, 1.69019, 1.75278, 1.81538, + 1.87798, 1.94058, 2.00318, 2.06578, 2.12838, 2.19098, + 2.25358, 2.31618, 2.37878, 2.44138, 2.50398, 2.56658, + 2.62918, 2.69178, 2.75438, 2.81698, 2.87958, 2.94217, + 3.00477, 3.06737, 3.12997, 3.19257, 3.25517, 3.31777, + 3.38037, 3.44297, 3.50557, 3.56817, 3.63077, 3.69337, + 3.75597, 3.81857, 3.88117, 3.94377, 4.00637, 4.06896, + 4.13156, 4.19416, 4.25676, 4.31936, 4.38196, 4.44456, + 4.50716, 4.56976, 4.63236, 4.69496, 4.75756, 4.82016, + 4.88276, 4.94536, 5.00796 }; + brHad = { 0, 1.03244e-09, 3.0239e-08, 1.99815e-07, 7.29392e-07, + 1.93129e-06, 4.17806e-06, 7.86021e-06, 1.33421e-05, 2.09196e-05, + 3.07815e-05, 4.29854e-05, 5.74406e-05, 7.3906e-05, 9.2003e-05, + 0.000111223, 0.000130977, 0.000150618, 0.000169483, 0.000186934, + 0.000202392, 0.000215366, 0.000225491, 0.000232496, 0.000236274, + 0.000236835, 0.000234313, 0.000228942, 0.000221042, 0.000210994, + 0.000199215, 0.000186137, 0.000172194, 0.000157775, 0.000143255, + 0.000128952, 0.000115133, 0.000102012, 8.97451e-05, 7.84384e-05, + 6.81519e-05, 5.89048e-05, 5.06851e-05, 4.34515e-05, 3.71506e-05, + 3.1702e-05, 2.70124e-05, 2.30588e-05, 1.96951e-05, 1.68596e-05, + 1.44909e-05, 1.25102e-05, 1.08596e-05, 9.48476e-06, 8.34013e-06, + 7.38477e-06, 6.58627e-06, 5.91541e-06, 5.35022e-06, 4.87047e-06, + 4.46249e-06, 4.11032e-06, 3.80543e-06, 3.54051e-06, 3.30967e-06, + 3.10848e-06, 2.93254e-06, 2.78369e-06, 2.65823e-06, 2.55747e-06, + 2.51068e-06, 2.57179e-06, 2.74684e-06, 3.02719e-06, 3.41182e-06, + 3.91387e-06, 4.56248e-06, 5.40862e-06, 6.53915e-06, 8.10867e-06, + 1.04167e-05 }; massHad.resize( 81 ); brHad.resize( 81 ); @@ -221,12 +221,12 @@ sCoeffs[0] = _z; //Define s22 and s27 functions - auto mys22Func = EvtItgPtrFunction{&s22Func, 0., yMax + 0.1, sCoeffs}; - auto mys27Func = EvtItgPtrFunction{&s27Func, 0., yMax + 0.1, sCoeffs}; + auto mys22Func = EvtItgPtrFunction{ &s22Func, 0., yMax + 0.1, sCoeffs }; + auto mys27Func = EvtItgPtrFunction{ &s27Func, 0., yMax + 0.1, sCoeffs }; //Use a simpson integrator - auto mys22Simp = EvtItgSimpsonIntegrator{mys22Func, 1.0e-4, 20}; - auto mys27Simp = EvtItgSimpsonIntegrator{mys27Func, 1.0e-4, 50}; + auto mys22Simp = EvtItgSimpsonIntegrator{ mys22Func, 1.0e-4, 20 }; + auto mys27Simp = EvtItgSimpsonIntegrator{ mys27Func, 1.0e-4, 50 }; int i; @@ -323,37 +323,38 @@ } //Define functions - auto myDeltaFermiFunc = EvtItgThreeCoeffFcn{&DeltaFermiFunc, -_mb, - _mB - _mb, FermiCoeffs, - varCoeffs, DeltaCoeffs}; - auto mys88FermiFunc = EvtItgThreeCoeffFcn{&s88FermiFunc, -_mb, - _mB - _mb, FermiCoeffs, - varCoeffs, s88Coeffs}; - auto mys77FermiFunc = EvtItgTwoCoeffFcn{&s77FermiFunc, -_mb, _mB - _mb, - FermiCoeffs, varCoeffs}; - auto mys78FermiFunc = EvtItgTwoCoeffFcn{&s78FermiFunc, -_mb, _mB - _mb, - FermiCoeffs, varCoeffs}; - auto mys22FermiFunc = EvtItgFourCoeffFcn{&sFermiFunc, -_mb, - _mB - _mb, FermiCoeffs, - varCoeffs, sInitCoeffs, - s22Coeffs}; - auto mys27FermiFunc = EvtItgFourCoeffFcn{&sFermiFunc, -_mb, - _mB - _mb, FermiCoeffs, - varCoeffs, sInitCoeffs, - s27Coeffs}; - auto mys28FermiFunc = EvtItgFourCoeffFcn{&sFermiFunc, -_mb, - _mB - _mb, FermiCoeffs, - varCoeffs, sInitCoeffs, - s28Coeffs}; + auto myDeltaFermiFunc = EvtItgThreeCoeffFcn{ &DeltaFermiFunc, -_mb, + _mB - _mb, FermiCoeffs, + varCoeffs, DeltaCoeffs }; + auto mys88FermiFunc = EvtItgThreeCoeffFcn{ &s88FermiFunc, -_mb, + _mB - _mb, FermiCoeffs, + varCoeffs, s88Coeffs }; + auto mys77FermiFunc = EvtItgTwoCoeffFcn{ &s77FermiFunc, -_mb, _mB - _mb, + FermiCoeffs, varCoeffs }; + auto mys78FermiFunc = EvtItgTwoCoeffFcn{ &s78FermiFunc, -_mb, _mB - _mb, + FermiCoeffs, varCoeffs }; + auto mys22FermiFunc = EvtItgFourCoeffFcn{ &sFermiFunc, -_mb, + _mB - _mb, FermiCoeffs, + varCoeffs, sInitCoeffs, + s22Coeffs }; + auto mys27FermiFunc = EvtItgFourCoeffFcn{ &sFermiFunc, -_mb, + _mB - _mb, FermiCoeffs, + varCoeffs, sInitCoeffs, + s27Coeffs }; + auto mys28FermiFunc = EvtItgFourCoeffFcn{ &sFermiFunc, -_mb, + _mB - _mb, FermiCoeffs, + varCoeffs, sInitCoeffs, + s28Coeffs }; //Define integrators - auto myDeltaFermiSimp = EvtItgSimpsonIntegrator{myDeltaFermiFunc, 1.0e-4, 40}; - auto mys77FermiSimp = EvtItgSimpsonIntegrator{mys77FermiFunc, 1.0e-4, 40}; - auto mys88FermiSimp = EvtItgSimpsonIntegrator{mys88FermiFunc, 1.0e-4, 40}; - auto mys78FermiSimp = EvtItgSimpsonIntegrator{mys78FermiFunc, 1.0e-4, 40}; - auto mys22FermiSimp = EvtItgSimpsonIntegrator{mys22FermiFunc, 1.0e-4, 40}; - auto mys27FermiSimp = EvtItgSimpsonIntegrator{mys27FermiFunc, 1.0e-4, 40}; - auto mys28FermiSimp = EvtItgSimpsonIntegrator{mys28FermiFunc, 1.0e-4, 40}; + auto myDeltaFermiSimp = EvtItgSimpsonIntegrator{ myDeltaFermiFunc, 1.0e-4, + 40 }; + auto mys77FermiSimp = EvtItgSimpsonIntegrator{ mys77FermiFunc, 1.0e-4, 40 }; + auto mys88FermiSimp = EvtItgSimpsonIntegrator{ mys88FermiFunc, 1.0e-4, 40 }; + auto mys78FermiSimp = EvtItgSimpsonIntegrator{ mys78FermiFunc, 1.0e-4, 40 }; + auto mys22FermiSimp = EvtItgSimpsonIntegrator{ mys22FermiFunc, 1.0e-4, 40 }; + auto mys27FermiSimp = EvtItgSimpsonIntegrator{ mys27FermiFunc, 1.0e-4, 40 }; + auto mys28FermiSimp = EvtItgSimpsonIntegrator{ mys28FermiFunc, 1.0e-4, 40 }; //Finally calculate mHVect for the range of hadronic masses double mHmin = sqrt( _mB * _mB - 2. * _mB * eGammaMax ); diff --git a/src/EvtGenModels/EvtBtoXsgammaRootFinder.cpp b/src/EvtGenModels/EvtBtoXsgammaRootFinder.cpp --- a/src/EvtGenModels/EvtBtoXsgammaRootFinder.cpp +++ b/src/EvtGenModels/EvtBtoXsgammaRootFinder.cpp @@ -123,10 +123,10 @@ // Iterates until find root to the accuracy of precision //Need to work with integrators - auto func1Integ = EvtItgSimpsonIntegrator{*theFunc1, integ1Precision, - maxLoop1}; - auto func2Integ = EvtItgSimpsonIntegrator{*theFunc2, integ2Precision, - maxLoop2}; + auto func1Integ = EvtItgSimpsonIntegrator{ *theFunc1, integ1Precision, + maxLoop1 }; + auto func2Integ = EvtItgSimpsonIntegrator{ *theFunc2, integ2Precision, + maxLoop2 }; //coefficient 1 of the integrators is the root to be found //need to set this to lower value to start off with diff --git a/src/EvtGenModels/EvtD0gammaDalitz.cpp b/src/EvtGenModels/EvtD0gammaDalitz.cpp --- a/src/EvtGenModels/EvtD0gammaDalitz.cpp +++ b/src/EvtGenModels/EvtD0gammaDalitz.cpp @@ -118,7 +118,7 @@ // Check if the D is from a B+- -> D0 K+- decay with the appropriate model. EvtParticle* parent = part->getParent(); // If there are no mistakes, should be B+ or B-. - if ( parent != 0 && + if ( parent != nullptr && EvtDecayTable::getInstance()->getDecayFunc( parent )->getName() == "BTODDALITZCPK" ) { EvtId parId = parent->getId(); diff --git a/src/EvtGenModels/EvtDalitzTable.cpp b/src/EvtGenModels/EvtDalitzTable.cpp --- a/src/EvtGenModels/EvtDalitzTable.cpp +++ b/src/EvtGenModels/EvtDalitzTable.cpp @@ -49,9 +49,9 @@ EvtDalitzTable* EvtDalitzTable::getInstance( const std::string dec_name, bool verbose ) { - static EvtDalitzTable* theDalitzTable = 0; + static EvtDalitzTable* theDalitzTable = nullptr; - if ( theDalitzTable == 0 ) { + if ( theDalitzTable == nullptr ) { theDalitzTable = new EvtDalitzTable(); } @@ -83,7 +83,7 @@ _readFiles.push_back( dec_name ); - EvtDalitzDecayInfo* dalitzDecay = 0; + EvtDalitzDecayInfo* dalitzDecay = nullptr; double probMax = 0; EvtId ipar; std::string decayParent = ""; @@ -385,7 +385,7 @@ dalitzDecay->setProbMax( probMax ); addDecay( ipar, *dalitzDecay ); delete dalitzDecay; - dalitzDecay = 0; + dalitzDecay = nullptr; } else if ( verbose ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Unexpected tag " << parser.getTagTitle() diff --git a/src/EvtGenModels/EvtFourBodyPhsp.cpp b/src/EvtGenModels/EvtFourBodyPhsp.cpp --- a/src/EvtGenModels/EvtFourBodyPhsp.cpp +++ b/src/EvtGenModels/EvtFourBodyPhsp.cpp @@ -18,14 +18,15 @@ * along with EvtGen. If not, see . * ***********************************************************************/ -#include +#include "EvtGenModels/EvtFourBodyPhsp.hh" #include "EvtGenBase/EvtKine.hh" #include "EvtGenBase/EvtPDL.hh" #include "EvtGenBase/EvtParticle.hh" #include "EvtGenBase/EvtRandom.hh" #include "EvtGenBase/EvtReport.hh" -#include "EvtGenModels/EvtFourBodyPhsp.hh" + +#include std::string EvtFourBodyPhsp::getName() { @@ -163,7 +164,7 @@ double mMother = EvtPDL::getMaxMass( parent ); double funcValue = 0; - while (contCond){ + while ( contCond ) { ++iteration; double currentM12 = startM12; double currentM34 = startM34; @@ -225,14 +226,14 @@ } // Check termination condition - double m12Diff = currentM12 - startM12; - double m34Diff = currentM34 - startM34; - double distSq = m12Diff * m12Diff + m34Diff * m34Diff; - if (distSq < 1e-8 || iteration > 50){ - contCond = false; - } - startM12 = currentM12; - startM34 = currentM34; + double m12Diff = currentM12 - startM12; + double m34Diff = currentM34 - startM34; + double distSq = m12Diff * m12Diff + m34Diff * m34Diff; + if ( distSq < 1e-8 || iteration > 50 ) { + contCond = false; + } + startM12 = currentM12; + startM34 = currentM34; } setProbMax( funcValue * 1.05 ); @@ -240,7 +241,6 @@ void EvtFourBodyPhsp::decay( EvtParticle* parent ) { - parent->makeDaughters( getNDaug(), getDaugs() ); bool massTreeStatus = parent->generateMassTree(); if ( !massTreeStatus ) { @@ -299,9 +299,9 @@ setProb( probEval[0] ); // initialise kinematics - const double cosTheta1 = EvtRandom::Flat(-1.0, 1.0); + const double cosTheta1 = EvtRandom::Flat( -1.0, 1.0 ); const double sinTheta1 = std::sqrt( 1 - cosTheta1 * cosTheta1 ); - const double cosTheta3 = EvtRandom::Flat(-1.0, 1.0); + const double cosTheta3 = EvtRandom::Flat( -1.0, 1.0 ); const double sinTheta3 = std::sqrt( 1 - cosTheta3 * cosTheta3 ); const double phi = EvtRandom::Flat( 0., EvtConst::twoPi ); // m12 and m34 are put along z-axis, 1 and 2 go to x-z plane and 3-4 diff --git a/src/EvtGenModels/EvtLambdacPHH.cpp b/src/EvtGenModels/EvtLambdacPHH.cpp --- a/src/EvtGenModels/EvtLambdacPHH.cpp +++ b/src/EvtGenModels/EvtLambdacPHH.cpp @@ -168,11 +168,11 @@ int nDaug( 3 ); EvtVector4R p4Daug[3]; - double mDaug[3] = {EvtPDL::getMeanMass( EvtPDL::getId( "K-" ) ), - EvtPDL::getMeanMass( EvtPDL::getId( "pi+" ) ), - EvtPDL::getMeanMass( EvtPDL::getId( "p+" ) )}; + double mDaug[3] = { EvtPDL::getMeanMass( EvtPDL::getId( "K-" ) ), + EvtPDL::getMeanMass( EvtPDL::getId( "pi+" ) ), + EvtPDL::getMeanMass( EvtPDL::getId( "p+" ) ) }; - double norm[3] = {0.0, 0.0, 0.0}; + double norm[3] = { 0.0, 0.0, 0.0 }; // sample size int N( 100000 ); @@ -229,11 +229,11 @@ int nDaug( 3 ); EvtVector4R p4Daug[3]; - double mDaug[3] = {EvtPDL::getMeanMass( EvtPDL::getId( "K-" ) ), - EvtPDL::getMeanMass( EvtPDL::getId( "pi+" ) ), - EvtPDL::getMeanMass( EvtPDL::getId( "p+" ) )}; + double mDaug[3] = { EvtPDL::getMeanMass( EvtPDL::getId( "K-" ) ), + EvtPDL::getMeanMass( EvtPDL::getId( "pi+" ) ), + EvtPDL::getMeanMass( EvtPDL::getId( "p+" ) ) }; - double FitFracTop[4] = {0.0, 0.0, 0.0, 0.0}; + double FitFracTop[4] = { 0.0, 0.0, 0.0, 0.0 }; double FitFracDenom = 0.0; // sample size diff --git a/src/EvtGenModels/EvtLb2Baryonlnu.cpp b/src/EvtGenModels/EvtLb2Baryonlnu.cpp --- a/src/EvtGenModels/EvtLb2Baryonlnu.cpp +++ b/src/EvtGenModels/EvtLb2Baryonlnu.cpp @@ -37,16 +37,16 @@ #ifdef D0 #undef D0 #endif -EvtLb2Baryonlnu::EvtLb2Baryonlnu() : ffmodel( 0 ), calcamp( 0 ) +EvtLb2Baryonlnu::EvtLb2Baryonlnu() : ffmodel( nullptr ), calcamp( nullptr ) { } EvtLb2Baryonlnu::~EvtLb2Baryonlnu() { delete ffmodel; - ffmodel = 0; + ffmodel = nullptr; delete calcamp; - calcamp = 0; + calcamp = nullptr; } std::string EvtLb2Baryonlnu::getName() diff --git a/src/EvtGenModels/EvtLb2Lll.cpp b/src/EvtGenModels/EvtLb2Lll.cpp --- a/src/EvtGenModels/EvtLb2Lll.cpp +++ b/src/EvtGenModels/EvtLb2Lll.cpp @@ -292,7 +292,7 @@ parent->setDiagonalSpinDensity(); EvtAmp amp; - EvtId daughters[3] = {getDaug( 0 ), getDaug( 1 ), getDaug( 2 )}; + EvtId daughters[3] = { getDaug( 0 ), getDaug( 1 ), getDaug( 2 ) }; amp.init( getParentId(), 3, daughters ); parent->makeDaughters( 3, daughters ); EvtParticle* lambda = parent->getDaug( 0 ); @@ -368,10 +368,10 @@ delete parent; } - if (m_maxProbability < 1e-10) { - EvtGenReport( EVTGEN_INFO, "EvtLb2Lll") - << "EvtLb2Lll found zero max prob, setting to 1.5e6" << std::endl; - m_maxProbability = 1.5e6; + if ( m_maxProbability < 1e-10 ) { + EvtGenReport( EVTGEN_INFO, "EvtLb2Lll" ) + << "EvtLb2Lll found zero max prob, setting to 1.5e6" << std::endl; + m_maxProbability = 1.5e6; } setProbMax( m_maxProbability ); @@ -400,7 +400,7 @@ char ch; double r, M_L, M_Lb, M_s, M_c, M_b, q2, alpha, M_W, M_t; - double M_psi[2] = {0, 0}, Gamma_psi[2] = {0, 0}, k_psi[2] = {0, 0}; + double M_psi[2] = { 0, 0 }, Gamma_psi[2] = { 0, 0 }, k_psi[2] = { 0, 0 }; double F0_1, F0_2, a_F1, a_F2, b_F1, b_F2, F1, F2; double f_1, f_2, f_3, g_1, g_2, g_3, f_1T, f_2T, f_3T, g_1T, g_2T, g_3T, f_TV, f_TS, g_TV( 0.0 ), g_TS, f_T, g_T; diff --git a/src/EvtGenModels/EvtLb2plnuLCSR.cpp b/src/EvtGenModels/EvtLb2plnuLCSR.cpp --- a/src/EvtGenModels/EvtLb2plnuLCSR.cpp +++ b/src/EvtGenModels/EvtLb2plnuLCSR.cpp @@ -37,16 +37,16 @@ #ifdef D0 #undef D0 #endif -EvtLb2plnuLCSR::EvtLb2plnuLCSR() : ffmodel( 0 ), calcamp( 0 ) +EvtLb2plnuLCSR::EvtLb2plnuLCSR() : ffmodel( nullptr ), calcamp( nullptr ) { } EvtLb2plnuLCSR::~EvtLb2plnuLCSR() { delete ffmodel; - ffmodel = 0; + ffmodel = nullptr; delete calcamp; - calcamp = 0; + calcamp = nullptr; } std::string EvtLb2plnuLCSR::getName() diff --git a/src/EvtGenModels/EvtLb2plnuLQCD.cpp b/src/EvtGenModels/EvtLb2plnuLQCD.cpp --- a/src/EvtGenModels/EvtLb2plnuLQCD.cpp +++ b/src/EvtGenModels/EvtLb2plnuLQCD.cpp @@ -37,16 +37,16 @@ #ifdef D0 #undef D0 #endif -EvtLb2plnuLQCD::EvtLb2plnuLQCD() : ffmodel( 0 ), calcamp( 0 ) +EvtLb2plnuLQCD::EvtLb2plnuLQCD() : ffmodel( nullptr ), calcamp( nullptr ) { } EvtLb2plnuLQCD::~EvtLb2plnuLQCD() { delete ffmodel; - ffmodel = 0; + ffmodel = nullptr; delete calcamp; - calcamp = 0; + calcamp = nullptr; } std::string EvtLb2plnuLQCD::getName() diff --git a/src/EvtGenModels/EvtModelReg.cpp b/src/EvtGenModels/EvtModelReg.cpp --- a/src/EvtGenModels/EvtModelReg.cpp +++ b/src/EvtGenModels/EvtModelReg.cpp @@ -158,6 +158,8 @@ #include "EvtGenModels/EvtbTosllBall.hh" #include "EvtGenModels/EvtbTosllMS.hh" #include "EvtGenModels/EvtbTosllMSExt.hh" +#include "EvtGenModels/EvtbTosllNP.hh" +#include "EvtGenModels/EvtbTosllNPR.hh" #include "EvtGenModels/Evtbs2llGammaISRFSR.hh" #include "EvtGenModels/Evtbs2llGammaMNT.hh" #include "EvtGenModels/EvtbsToLLLL.hh" @@ -177,7 +179,6 @@ EvtModelReg::EvtModelReg( const std::list* extraModels ) { EvtModel& modelist = EvtModel::instance(); - if ( extraModels ) { for ( std::list::const_iterator it = extraModels->begin(); it != extraModels->end(); ++it ) { @@ -239,6 +240,8 @@ modelist.registerModel( new EvtTauScalarnu ); modelist.registerModel( new EvtKstarnunu ); modelist.registerModel( new EvtbTosllBall ); + modelist.registerModel( new EvtbTosllNP ); + modelist.registerModel( new EvtbTosllNPR ); modelist.registerModel( new EvtBto2piCPiso ); modelist.registerModel( new EvtBtoKpiCPiso ); modelist.registerModel( new EvtSVSCPiso ); diff --git a/src/EvtGenModels/EvtMultibody.cpp b/src/EvtGenModels/EvtMultibody.cpp --- a/src/EvtGenModels/EvtMultibody.cpp +++ b/src/EvtGenModels/EvtMultibody.cpp @@ -33,12 +33,12 @@ EvtMultibody::~EvtMultibody() { - if ( _decayTree != NULL ) + if ( _decayTree != nullptr ) delete _decayTree; - _decayTree = NULL; - if ( _ilist != NULL ) + _decayTree = nullptr; + if ( _ilist != nullptr ) delete[] _ilist; - _ilist = NULL; + _ilist = nullptr; } std::string EvtMultibody::getName() @@ -71,7 +71,7 @@ void EvtMultibody::initProbMax() { - setProbMax(1.0); + setProbMax( 1.0 ); } void EvtMultibody::decay( EvtParticle* p ) diff --git a/src/EvtGenModels/EvtPhspDecaytimeCut.cpp b/src/EvtGenModels/EvtPhspDecaytimeCut.cpp --- a/src/EvtGenModels/EvtPhspDecaytimeCut.cpp +++ b/src/EvtGenModels/EvtPhspDecaytimeCut.cpp @@ -26,9 +26,9 @@ #include "EvtGenBase/EvtPatches.hh" #include "EvtGenBase/EvtReport.hh" +#include #include #include -#include std::string EvtPhspDecaytimeCut::getName() { diff --git a/src/EvtGenModels/EvtPi0Dalitz.cpp b/src/EvtGenModels/EvtPi0Dalitz.cpp --- a/src/EvtGenModels/EvtPi0Dalitz.cpp +++ b/src/EvtGenModels/EvtPi0Dalitz.cpp @@ -52,31 +52,24 @@ // contractions, which is: // 1/((m_R^2-q^2)^2+m_R^2 Gamma_R^2) 1/(2q^2) (M^2-q^2)^2 beta_l // (1+cos(theta)^2) where we set cos(theta)=1 - auto daughter1 = getDaug( 0 ); - auto daughter2 = getDaug( 1 ); - double q2Min = EvtPDL::getMass( daughter1 ) + EvtPDL::getMass( daughter2 ); + double q2Min = EvtPDL::getMass( getDaug( 0 ) ) + + EvtPDL::getMass( getDaug( 1 ) ); q2Min *= q2Min; double q2Max = EvtPDL::getMass( getParentId() ); q2Max *= q2Max; - const int steps = 20000; - const double step = ( q2Max - q2Min ) / steps; - double maxProb = 0; - for ( int ii = 0; ii < steps; ++ii ) { - double q2 = q2Min + ii * step; - const double mSqDiff = m_m0Sq - q2; - const double q2Sq = q2 * q2; - double prob = ( q2Max - q2 ) * ( q2Max - q2 ) * ( q2 - q2Min ) / - ( q2Sq ); - prob *= ( 1.0 / ( mSqDiff * mSqDiff + m_m0SqG0Sq ) ); - // When generating events, we do not start from phase-space, but - // add some pole to it, weight of which is taken into account - // elsewhere - prob /= 1.0 + m_poleSize / ( q2Sq ); - if ( prob > maxProb ) { + const int steps = 100; + const double step = expm1( log( q2Max / q2Min ) / steps ); + double maxProb = 0, q2 = q2Min; + do { + double prob = ( q2Max - q2 ) * ( q2Max - q2 ) * ( q2 - q2Min ); + double m2d = m_m0Sq - q2; + prob /= q2 * ( m2d * m2d + m_m0SqG0Sq ) * ( q2 + m_poleSize ); + if ( prob > maxProb ) maxProb = prob; - } - } - setProbMax( maxProb * 1.05 ); + } while ( ( q2 += q2 * step ) < q2Max ); + setProbMax( maxProb * 1.01 ); + EvtGenReport( EVTGEN_INFO, "EvtGenProbMax" ) + << " " << sqrt( q2 ) << " " << maxProb << std::endl; } void EvtPi0Dalitz::init() @@ -100,41 +93,33 @@ void EvtPi0Dalitz::decay( EvtParticle* p ) { - EvtParticle *ep, *em, *gamma; - setWeight( p->initializePhaseSpace( getNDaug(), getDaugs(), false, - m_poleSize, 0, 1 ) ); - ep = p->getDaug( 0 ); - em = p->getDaug( 1 ); - gamma = p->getDaug( 2 ); - - // the next four lines generates events with a weight such that - // the efficiency for selecting them is good. The parameter below of - // 0.1 is the size of the peak at low q^2 (in arbitrary units). - // The value of 0.1 is appropriate for muons. - // when you use this remember to remove the cut on q^2! - - //ep em invariant mass^2 - double m2 = ( ep->getP4() + em->getP4() ).mass2(); - EvtVector4R q = ep->getP4() + em->getP4(); - //Just use the prob summed over spins... + using EvtGenFunctions::directProd; + double ew = p->initializePhaseSpace( getNDaug(), getDaugs(), false, + m_poleSize, 0, 1 ); + setWeight( ew ); - EvtTensor4C w, v; + const EvtVector4R& pp = p->getDaug( 0 )->getP4(); + const EvtVector4R& pm = p->getDaug( 1 )->getP4(); + const EvtVector4R& pg = p->getDaug( 2 )->getP4(); + EvtVector4R q = pp + pm; + double q2 = q.mass2(), t = pg * q; - v = 2.0 * ( gamma->getP4() * q ) * - EvtGenFunctions::directProd( q, gamma->getP4() ) - - ( gamma->getP4() * q ) * ( gamma->getP4() * q ) * EvtTensor4C::g() - - m2 * EvtGenFunctions::directProd( gamma->getP4(), gamma->getP4() ); + //Just use the prob summed over spins... + //EvtTensor4C v = (2.0 * t) * directProd( q, pg ) - t2 * EvtTensor4C::g() - q2 * directProd( pg, pg ); + //EvtTensor4C w = 4.0 * ( directProd( pp, pm ) + directProd( pm, pp ) - EvtTensor4C::g() * ( pp*pm - pp.mass2() ) ); + //double prob = real( cont( v, w ) ) / ( q2 * q2 ); + EvtTensor4C v = directProd( q, pg ) + .addScaled( -0.5 * t, EvtTensor4C::g() ) + .addScaled( -0.5 * q2 / t, directProd( pg, pg ) ); + EvtTensor4C w = directProd( pp, pm ).addDirProd( pm, pp ).addScaled( + pp.mass2() - pp * pm, EvtTensor4C::g() ); - w = 4.0 * ( EvtGenFunctions::directProd( ep->getP4(), em->getP4() ) + - EvtGenFunctions::directProd( em->getP4(), ep->getP4() ) - - EvtTensor4C::g() * - ( ep->getP4() * em->getP4() - ep->getP4().mass2() ) ); + double prob = 8 * t * real( cont( v, w ) ) / ( q2 * q2 ); + double m2d = m_m0Sq - q2; + prob /= m2d * m2d + m_m0SqG0Sq; - double prob = ( real( cont( v, w ) ) ) / ( m2 * m2 ); - const double m2Diff = m_m0Sq - m2; - prob *= ( 1.0 / ( m2Diff * m2Diff + m_m0SqG0Sq ) ); + // EvtGenReport(EVTGEN_INFO,"EvtGenDDD") <<" "<getParent(); double maxMass = -1.; - if ( par != 0 ) { + if ( par != nullptr ) { if ( par->hasValidP4() ) maxMass = par->mass(); for ( size_t i = 0; i < par->getNDaug(); i++ ) { @@ -210,8 +210,8 @@ } } - EvtId* dauId = 0; - double* dauMasses = 0; + EvtId* dauId = nullptr; + double* dauMasses = nullptr; size_t nDaug = pmeson->getNDaug(); if ( nDaug > 0 ) { dauId = new EvtId[nDaug]; @@ -221,8 +221,8 @@ dauMasses[j] = pmeson->getDaug( j )->mass(); } } - EvtId* parId = 0; - EvtId* othDaugId = 0; + EvtId* parId = nullptr; + EvtId* othDaugId = nullptr; EvtParticle* tempPar = pmeson->getParent(); if ( tempPar ) { parId = new EvtId( tempPar->getId() ); diff --git a/src/EvtGenModels/EvtRareLbToLll.cpp b/src/EvtGenModels/EvtRareLbToLll.cpp --- a/src/EvtGenModels/EvtRareLbToLll.cpp +++ b/src/EvtGenModels/EvtRareLbToLll.cpp @@ -72,14 +72,14 @@ // Work out whether we have electron mode const EvtIdSet leptons{ "e-", "e+" }; if ( leptons.contains( getDaug( 1 ) ) ) { - m_electronMode = true; - EvtGenReport( EVTGEN_ERROR, "EvtGen" ) - << " EvtRareLbToLll has dielectron final state" << std::endl; + m_electronMode = true; + EvtGenReport( EVTGEN_ERROR, "EvtGen" ) + << " EvtRareLbToLll has dielectron final state" << std::endl; } std::string model{ "LQCD" }; - if ( getNArg() == 1) { - model = getArgStr( 0 ); + if ( getNArg() == 1 ) { + model = getArgStr( 0 ); } if ( model == "Gutsche" ) { ffmodel_ = std::make_unique(); @@ -115,7 +115,7 @@ parent.setDiagonalSpinDensity(); EvtAmp amp; - EvtId daughters[3] = {getDaug( 0 ), getDaug( 1 ), getDaug( 2 )}; + EvtId daughters[3] = { getDaug( 0 ), getDaug( 1 ), getDaug( 2 ) }; amp.init( getParentId(), 3, daughters ); parent.makeDaughters( 3, daughters ); EvtParticle* lambda = parent.getDaug( 0 ); @@ -146,7 +146,7 @@ for ( int i = 0; i <= nsteps; i++ ) { const double q2 = q2min + i * ( q2max - q2min ) / nsteps; const double elambda = ( M0 * M0 + mL * mL - q2 ) / 2 / M0; - double pstar{0}; + double pstar{ 0 }; if ( i != 0 ) { pstar = sqrt( q2 - ( m1 + m2 ) * ( m1 + m2 ) ) * sqrt( q2 - ( m1 - m2 ) * ( m1 - m2 ) ) / 2 / sqrt( q2 ); @@ -165,7 +165,7 @@ p4lep2.set( sqrt( pstar * pstar + m2 * m2 ), 0, -pstar * sin( theta ), -pstar * cos( theta ) ); - if ( i != nsteps) // At maximal q2 we are already in correct frame as Lambda and W/Zvirtual are at rest + if ( i != nsteps ) // At maximal q2 we are already in correct frame as Lambda and W/Zvirtual are at rest { p4lep1 = boostTo( p4lep1, boost ); p4lep2 = boostTo( p4lep2, boost ); @@ -177,9 +177,9 @@ prob = rho.normalizedProb( amp.getSpinDensity() ); // In case of electron mode add pole if ( m_electronMode ) { - prob /= 1.0 + m_poleSize / ( q2*q2 ); + prob /= 1.0 + m_poleSize / ( q2 * q2 ); } - + if ( prob > m_maxProbability ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << " - probability " << prob << " found at q2 = " << q2 @@ -229,8 +229,8 @@ const bool isparticle = isParticle( parent ); - const EvtParticle* lp = 0; - const EvtParticle* lm = 0; + const EvtParticle* lp = nullptr; + const EvtParticle* lm = nullptr; if ( leptons.contains( parent.getDaug( 1 )->getId() ) ) { lp = parent.getDaug( 1 ); diff --git a/src/EvtGenModels/EvtRareLbToLllFF.cpp b/src/EvtGenModels/EvtRareLbToLllFF.cpp --- a/src/EvtGenModels/EvtRareLbToLllFF.cpp +++ b/src/EvtGenModels/EvtRareLbToLllFF.cpp @@ -154,7 +154,7 @@ FFMap_[EvtPDL::getId( "Lambda(1520)0" ).getId()] = L1520.get(); FFMap_[EvtPDL::getId( "anti-Lambda(1520)0" ).getId()] = L1520.get(); - FF_ = {std::move( L1115 ), std::move( L1520 )}; + FF_ = { std::move( L1115 ), std::move( L1520 ) }; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << " EvtRareLbToLll is using form factors from arXiv:1108.6129 " @@ -278,7 +278,8 @@ } } -void EvtRareLbToLllFF::getFF( const EvtParticle& parent, const EvtParticle& lambda, +void EvtRareLbToLllFF::getFF( const EvtParticle& parent, + const EvtParticle& lambda, EvtRareLbToLllFF::FormFactors& FF ) const { // Find the FF information for this particle, start by setting all to zero diff --git a/src/EvtGenModels/EvtSLBaryonAmp.cpp b/src/EvtGenModels/EvtSLBaryonAmp.cpp --- a/src/EvtGenModels/EvtSLBaryonAmp.cpp +++ b/src/EvtGenModels/EvtSLBaryonAmp.cpp @@ -461,7 +461,7 @@ FormFactors->getdiracff( par_num, bar_num, q2, baryonmass, &f1, &f2, &f3, &g1, &g2, &g3 ); - const double form_fact[6] = {f1, f2, f3, g1, g2, g3}; + const double form_fact[6] = { f1, f2, f3, g1, g2, g3 }; EvtVector4C b11, b12, b21, b22, l1, l2; @@ -584,7 +584,7 @@ FormFactors->getraritaff( par_num, bar_num, q2, baryonmass, &f1, &f2, &f3, &f4, &g1, &g2, &g3, &g4 ); - const double form_fact[8] = {f1, f2, f3, f4, g1, g2, g3, g4}; + const double form_fact[8] = { f1, f2, f3, f4, g1, g2, g3, g4 }; EvtId l_num = parent->getDaug( 1 )->getId(); diff --git a/src/EvtGenModels/EvtTVP.cpp b/src/EvtGenModels/EvtTVP.cpp --- a/src/EvtGenModels/EvtTVP.cpp +++ b/src/EvtGenModels/EvtTVP.cpp @@ -178,7 +178,7 @@ } // Calculate the amplitude terms, looping over the psi and lepton states - int iPols[4] = {0, 0, 0, 0}; + int iPols[4] = { 0, 0, 0, 0 }; for ( int iChi = 0; iChi < 5; iChi++ ) { iPols[0] = iChi; diff --git a/src/EvtGenModels/EvtVSS.cpp b/src/EvtGenModels/EvtVSS.cpp --- a/src/EvtGenModels/EvtVSS.cpp +++ b/src/EvtGenModels/EvtVSS.cpp @@ -67,9 +67,10 @@ EvtVector4R pDaug = p->getDaug( 0 )->getP4(); double norm = 1.0 / pDaug.d3mag(); - + pDaug *= norm; + // std::cout<<"VSS "<eps( i ) ) ); + vertex( i, pDaug * ( p->eps( i ) ) ); return; } diff --git a/src/EvtGenModels/EvtVVP.cpp b/src/EvtGenModels/EvtVVP.cpp --- a/src/EvtGenModels/EvtVVP.cpp +++ b/src/EvtGenModels/EvtVVP.cpp @@ -156,7 +156,7 @@ factor = dSq / ( dSqDenom * kSq ); } - int iPols[4] = {0, 0, 0, 0}; + int iPols[4] = { 0, 0, 0, 0 }; // Calculate the amplitude terms, looping over the chi, psi and lepton states for ( int iChi = 0; iChi < 3; iChi++ ) { diff --git a/src/EvtGenModels/EvtVtoSll.cpp b/src/EvtGenModels/EvtVtoSll.cpp --- a/src/EvtGenModels/EvtVtoSll.cpp +++ b/src/EvtGenModels/EvtVtoSll.cpp @@ -58,7 +58,7 @@ void EvtVtoSll::initProbMax() { - setProbMax(10.0); + setProbMax( 10.0 ); } void EvtVtoSll::decay( EvtParticle* p ) diff --git a/src/EvtGenModels/EvtVub.cpp b/src/EvtGenModels/EvtVub.cpp --- a/src/EvtGenModels/EvtVub.cpp +++ b/src/EvtGenModels/EvtVub.cpp @@ -166,7 +166,7 @@ int j; // B+ -> u-bar specflav l+ nu - EvtParticle *xuhad( 0 ), *lepton( 0 ), *neutrino( 0 ); + EvtParticle *xuhad( nullptr ), *lepton( nullptr ), *neutrino( nullptr ); EvtVector4R p4; // R. Faccini 21/02/03 // move the reweighting up , before also shooting the fermi distribution @@ -274,8 +274,8 @@ sttmp = sqrt( 1 - ctH * ctH ); ptmp = sqrt( Eh * Eh - sh ); - double pHB[4] = {Eh, ptmp * sttmp * cos( phH ), ptmp * sttmp * sin( phH ), - ptmp * ctH}; + double pHB[4] = { Eh, ptmp * sttmp * cos( phH ), ptmp * sttmp * sin( phH ), + ptmp * ctH }; p4.set( pHB[0], pHB[1], pHB[2], pHB[3] ); xuhad->init( getDaug( 0 ), p4 ); @@ -299,7 +299,7 @@ // calculate the W 4 vector in the B Meson restrframe double apWB = ptmp; - double pWB[4] = {mB - Eh, -pHB[1], -pHB[2], -pHB[3]}; + double pWB[4] = { mB - Eh, -pHB[1], -pHB[2], -pHB[3] }; // first go in the W restframe and calculate the lepton and // the neutrino in the W frame @@ -321,17 +321,17 @@ sttmp = sqrt( 1 - ctL * ctL ); // eX' = eZ x eW - double xW[3] = {-pWB[2], pWB[1], 0}; + double xW[3] = { -pWB[2], pWB[1], 0 }; // eZ' = eW - double zW[3] = {pWB[1] / apWB, pWB[2] / apWB, pWB[3] / apWB}; + double zW[3] = { pWB[1] / apWB, pWB[2] / apWB, pWB[3] / apWB }; double lx = sqrt( xW[0] * xW[0] + xW[1] * xW[1] ); for ( j = 0; j < 2; j++ ) xW[j] /= lx; // eY' = eZ' x eX' - double yW[3] = {-pWB[1] * pWB[3], -pWB[2] * pWB[3], - pWB[1] * pWB[1] + pWB[2] * pWB[2]}; + double yW[3] = { -pWB[1] * pWB[3], -pWB[2] * pWB[3], + pWB[1] * pWB[1] + pWB[2] * pWB[2] }; double ly = sqrt( yW[0] * yW[0] + yW[1] * yW[1] + yW[2] * yW[2] ); for ( j = 0; j < 3; j++ ) yW[j] /= ly; @@ -356,8 +356,8 @@ if ( ctLL < -1 ) ctLL = -1; - double pLB[4] = {El, 0, 0, 0}; - double pNB[4] = {pWB[0] - El, 0, 0, 0}; + double pLB[4] = { El, 0, 0, 0 }; + double pNB[4] = { pWB[0] - El, 0, 0, 0 }; for ( j = 1; j < 4; j++ ) { pLB[j] = pLW[j] + ( ctLL * ptmp - ctL * apLW ) / apWB * pWB[j]; diff --git a/src/EvtGenModels/EvtVubBLNP.cpp b/src/EvtGenModels/EvtVubBLNP.cpp --- a/src/EvtGenModels/EvtVubBLNP.cpp +++ b/src/EvtGenModels/EvtVubBLNP.cpp @@ -190,7 +190,7 @@ { int j; - EvtParticle *xuhad( 0 ), *lepton( 0 ), *neutrino( 0 ); + EvtParticle *xuhad( nullptr ), *lepton( nullptr ), *neutrino( nullptr ); EvtVector4R p4; double Pp, Pm, Pl, pdf, EX, sh, ml, mpi, ratemax; double El( 0. ); @@ -264,8 +264,8 @@ sttmp = sqrt( 1 - ctH * ctH ); ptmp = sqrt( EX * EX - sh ); - double pHB[4] = {EX, ptmp * sttmp * cos( phH ), ptmp * sttmp * sin( phH ), - ptmp * ctH}; + double pHB[4] = { EX, ptmp * sttmp * cos( phH ), ptmp * sttmp * sin( phH ), + ptmp * ctH }; p4.set( pHB[0], pHB[1], pHB[2], pHB[3] ); xuhad->init( getDaug( 0 ), p4 ); @@ -287,7 +287,7 @@ // calculate the W 4 vector in the B Meson restrframe double apWB = ptmp; - double pWB[4] = {mBB - EX, -pHB[1], -pHB[2], -pHB[3]}; + double pWB[4] = { mBB - EX, -pHB[1], -pHB[2], -pHB[3] }; // first go in the W restframe and calculate the lepton and // the neutrino in the W frame @@ -309,17 +309,17 @@ sttmp = sqrt( 1 - ctL * ctL ); // eX' = eZ x eW - double xW[3] = {-pWB[2], pWB[1], 0}; + double xW[3] = { -pWB[2], pWB[1], 0 }; // eZ' = eW - double zW[3] = {pWB[1] / apWB, pWB[2] / apWB, pWB[3] / apWB}; + double zW[3] = { pWB[1] / apWB, pWB[2] / apWB, pWB[3] / apWB }; double lx = sqrt( xW[0] * xW[0] + xW[1] * xW[1] ); for ( j = 0; j < 2; j++ ) xW[j] /= lx; // eY' = eZ' x eX' - double yW[3] = {-pWB[1] * pWB[3], -pWB[2] * pWB[3], - pWB[1] * pWB[1] + pWB[2] * pWB[2]}; + double yW[3] = { -pWB[1] * pWB[3], -pWB[2] * pWB[3], + pWB[1] * pWB[1] + pWB[2] * pWB[2] }; double ly = sqrt( yW[0] * yW[0] + yW[1] * yW[1] + yW[2] * yW[2] ); for ( j = 0; j < 3; j++ ) yW[j] /= ly; @@ -345,8 +345,8 @@ if ( ctLL < -1 ) ctLL = -1; - double pLB[4] = {El, 0, 0, 0}; - double pNB[4] = {pWB[0] - El, 0, 0, 0}; + double pLB[4] = { El, 0, 0, 0 }; + double pNB[4] = { pWB[0] - El, 0, 0, 0 }; for ( j = 1; j < 4; j++ ) { pLB[j] = pLW[j] + ( ctLL * ptmp - ctL * apLW ) / apWB * pWB[j]; @@ -498,8 +498,8 @@ double lowerlim = 0.001 * Pp; double upperlim = ( 1.0 - 0.001 ) * Pp; - auto func = EvtItgPtrFunction{&IntJS, lowerlim, upperlim, vars}; - auto integ = EvtItgSimpsonIntegrator{func, precision, maxLoop}; + auto func = EvtItgPtrFunction{ &IntJS, lowerlim, upperlim, vars }; + auto integ = EvtItgSimpsonIntegrator{ func, precision, maxLoop }; return integ.evaluate( lowerlim, upperlim ); } @@ -515,8 +515,8 @@ double lowerlim = 0.001 * Pp; double upperlim = ( 1.0 - 0.001 ) * Pp; - auto func = EvtItgPtrFunction{&Int1, lowerlim, upperlim, vars}; - auto integ = EvtItgSimpsonIntegrator{func, precision, maxLoop}; + auto func = EvtItgPtrFunction{ &Int1, lowerlim, upperlim, vars }; + auto integ = EvtItgSimpsonIntegrator{ func, precision, maxLoop }; return integ.evaluate( lowerlim, upperlim ); } @@ -532,8 +532,8 @@ double lowerlim = 0.001 * Pp; double upperlim = ( 1.0 - 0.001 ) * Pp; - auto func = EvtItgPtrFunction{&Int2, lowerlim, upperlim, vars}; - auto integ = EvtItgSimpsonIntegrator{func, precision, maxLoop}; + auto func = EvtItgPtrFunction{ &Int2, lowerlim, upperlim, vars }; + auto integ = EvtItgSimpsonIntegrator{ func, precision, maxLoop }; return integ.evaluate( lowerlim, upperlim ); } @@ -549,8 +549,8 @@ double lowerlim = 0.001 * Pp; double upperlim = ( 1.0 - 0.001 ) * Pp; - auto func = EvtItgPtrFunction{&Int3, lowerlim, upperlim, vars}; - auto integ = EvtItgSimpsonIntegrator{func, precision, maxLoop}; + auto func = EvtItgPtrFunction{ &Int3, lowerlim, upperlim, vars }; + auto integ = EvtItgSimpsonIntegrator{ func, precision, maxLoop }; return integ.evaluate( lowerlim, upperlim ); } diff --git a/src/EvtGenModels/EvtVubBLNPHybrid.cpp b/src/EvtGenModels/EvtVubBLNPHybrid.cpp --- a/src/EvtGenModels/EvtVubBLNPHybrid.cpp +++ b/src/EvtGenModels/EvtVubBLNPHybrid.cpp @@ -342,8 +342,8 @@ sttmp = sqrt( 1 - ctH * ctH ); ptmp = sqrt( EX * EX - sh ); - double pHB[4] = {EX, ptmp * sttmp * cos( phH ), ptmp * sttmp * sin( phH ), - ptmp * ctH}; + double pHB[4] = { EX, ptmp * sttmp * cos( phH ), ptmp * sttmp * sin( phH ), + ptmp * ctH }; p4.set( pHB[0], pHB[1], pHB[2], pHB[3] ); xuhad->init( getDaug( 0 ), p4 ); @@ -363,7 +363,7 @@ // calculate the W 4 vector in the B Meson restrframe double apWB = ptmp; - double pWB[4] = {mBB - EX, -pHB[1], -pHB[2], -pHB[3]}; + double pWB[4] = { mBB - EX, -pHB[1], -pHB[2], -pHB[3] }; // first go in the W restframe and calculate the lepton and // the neutrino in the W frame @@ -385,17 +385,17 @@ sttmp = sqrt( 1 - ctL * ctL ); // eX' = eZ x eW - double xW[3] = {-pWB[2], pWB[1], 0}; + double xW[3] = { -pWB[2], pWB[1], 0 }; // eZ' = eW - double zW[3] = {pWB[1] / apWB, pWB[2] / apWB, pWB[3] / apWB}; + double zW[3] = { pWB[1] / apWB, pWB[2] / apWB, pWB[3] / apWB }; double lx = sqrt( xW[0] * xW[0] + xW[1] * xW[1] ); for ( j = 0; j < 2; j++ ) xW[j] /= lx; // eY' = eZ' x eX' - double yW[3] = {-pWB[1] * pWB[3], -pWB[2] * pWB[3], - pWB[1] * pWB[1] + pWB[2] * pWB[2]}; + double yW[3] = { -pWB[1] * pWB[3], -pWB[2] * pWB[3], + pWB[1] * pWB[1] + pWB[2] * pWB[2] }; double ly = sqrt( yW[0] * yW[0] + yW[1] * yW[1] + yW[2] * yW[2] ); for ( j = 0; j < 3; j++ ) yW[j] /= ly; @@ -421,8 +421,8 @@ if ( ctLL < -1 ) ctLL = -1; - double pLB[4] = {El, 0, 0, 0}; - double pNB[4] = {pWB[0] - El, 0, 0, 0}; + double pLB[4] = { El, 0, 0, 0 }; + double pNB[4] = { pWB[0] - El, 0, 0, 0 }; for ( j = 1; j < 4; j++ ) { pLB[j] = pLW[j] + ( ctLL * ptmp - ctL * apLW ) / apWB * pWB[j]; @@ -572,8 +572,8 @@ double lowerlim = 0.001 * Pp; double upperlim = ( 1.0 - 0.001 ) * Pp; - auto func = EvtItgPtrFunction{&IntJS, lowerlim, upperlim, vars}; - auto integ = EvtItgSimpsonIntegrator{func, precision, maxLoop}; + auto func = EvtItgPtrFunction{ &IntJS, lowerlim, upperlim, vars }; + auto integ = EvtItgSimpsonIntegrator{ func, precision, maxLoop }; return integ.evaluate( lowerlim, upperlim ); } @@ -589,8 +589,8 @@ double lowerlim = 0.001 * Pp; double upperlim = ( 1.0 - 0.001 ) * Pp; - auto func = EvtItgPtrFunction{&Int1, lowerlim, upperlim, vars}; - auto integ = EvtItgSimpsonIntegrator{func, precision, maxLoop}; + auto func = EvtItgPtrFunction{ &Int1, lowerlim, upperlim, vars }; + auto integ = EvtItgSimpsonIntegrator{ func, precision, maxLoop }; return integ.evaluate( lowerlim, upperlim ); } @@ -606,8 +606,8 @@ double lowerlim = 0.001 * Pp; double upperlim = ( 1.0 - 0.001 ) * Pp; - auto func = EvtItgPtrFunction{&Int2, lowerlim, upperlim, vars}; - auto integ = EvtItgSimpsonIntegrator{func, precision, maxLoop}; + auto func = EvtItgPtrFunction{ &Int2, lowerlim, upperlim, vars }; + auto integ = EvtItgSimpsonIntegrator{ func, precision, maxLoop }; return integ.evaluate( lowerlim, upperlim ); } @@ -623,8 +623,8 @@ double lowerlim = 0.001 * Pp; double upperlim = ( 1.0 - 0.001 ) * Pp; - auto func = EvtItgPtrFunction{&Int3, lowerlim, upperlim, vars}; - auto integ = EvtItgSimpsonIntegrator{func, precision, maxLoop}; + auto func = EvtItgPtrFunction{ &Int3, lowerlim, upperlim, vars }; + auto integ = EvtItgSimpsonIntegrator{ func, precision, maxLoop }; return integ.evaluate( lowerlim, upperlim ); } diff --git a/src/EvtGenModels/EvtVubHybrid.cpp b/src/EvtGenModels/EvtVubHybrid.cpp --- a/src/EvtGenModels/EvtVubHybrid.cpp +++ b/src/EvtGenModels/EvtVubHybrid.cpp @@ -162,7 +162,7 @@ int j; // B+ -> u-bar specflav l+ nu - EvtParticle *xuhad( 0 ), *lepton( 0 ), *neutrino( 0 ); + EvtParticle *xuhad( nullptr ), *lepton( nullptr ), *neutrino( nullptr ); EvtVector4R p4; // R. Faccini 21/02/03 // move the reweighting up , before also shooting the fermi distribution @@ -275,8 +275,8 @@ sttmp = sqrt( 1 - ctH * ctH ); ptmp = sqrt( Eh * Eh - sh ); - double pHB[4] = {Eh, ptmp * sttmp * cos( phH ), ptmp * sttmp * sin( phH ), - ptmp * ctH}; + double pHB[4] = { Eh, ptmp * sttmp * cos( phH ), ptmp * sttmp * sin( phH ), + ptmp * ctH }; p4.set( pHB[0], pHB[1], pHB[2], pHB[3] ); xuhad->init( getDaug( 0 ), p4 ); @@ -300,7 +300,7 @@ // calculate the W 4 vector in the B Meson restrframe double apWB = ptmp; - double pWB[4] = {mB - Eh, -pHB[1], -pHB[2], -pHB[3]}; + double pWB[4] = { mB - Eh, -pHB[1], -pHB[2], -pHB[3] }; // first go in the W restframe and calculate the lepton and // the neutrino in the W frame @@ -322,17 +322,17 @@ sttmp = sqrt( 1 - ctL * ctL ); // eX' = eZ x eW - double xW[3] = {-pWB[2], pWB[1], 0}; + double xW[3] = { -pWB[2], pWB[1], 0 }; // eZ' = eW - double zW[3] = {pWB[1] / apWB, pWB[2] / apWB, pWB[3] / apWB}; + double zW[3] = { pWB[1] / apWB, pWB[2] / apWB, pWB[3] / apWB }; double lx = sqrt( xW[0] * xW[0] + xW[1] * xW[1] ); for ( j = 0; j < 2; j++ ) xW[j] /= lx; // eY' = eZ' x eX' - double yW[3] = {-pWB[1] * pWB[3], -pWB[2] * pWB[3], - pWB[1] * pWB[1] + pWB[2] * pWB[2]}; + double yW[3] = { -pWB[1] * pWB[3], -pWB[2] * pWB[3], + pWB[1] * pWB[1] + pWB[2] * pWB[2] }; double ly = sqrt( yW[0] * yW[0] + yW[1] * yW[1] + yW[2] * yW[2] ); for ( j = 0; j < 3; j++ ) yW[j] /= ly; @@ -360,8 +360,8 @@ if ( ctLL < -1 ) ctLL = -1; - double pLB[4] = {El, 0, 0, 0}; - double pNB[4] = {pWB[0] - El, 0, 0, 0}; + double pLB[4] = { El, 0, 0, 0 }; + double pNB[4] = { pWB[0] - El, 0, 0, 0 }; for ( j = 1; j < 4; j++ ) { pLB[j] = pLW[j] + ( ctLL * ptmp - ctL * apLW ) / apWB * pWB[j]; diff --git a/src/EvtGenModels/EvtVubNLO.cpp b/src/EvtGenModels/EvtVubNLO.cpp --- a/src/EvtGenModels/EvtVubNLO.cpp +++ b/src/EvtGenModels/EvtVubNLO.cpp @@ -261,15 +261,15 @@ sttmp = sqrt( 1 - ctH * ctH ); ptmp = sqrt( Eh * Eh - sh ); - double pHB[4] = {Eh, ptmp * sttmp * cos( phH ), ptmp * sttmp * sin( phH ), - ptmp * ctH}; + double pHB[4] = { Eh, ptmp * sttmp * cos( phH ), ptmp * sttmp * sin( phH ), + ptmp * ctH }; p4.set( pHB[0], pHB[1], pHB[2], pHB[3] ); xuhad->init( getDaug( 0 ), p4 ); // calculate the W 4 vector in the B Meson restrframe double apWB = ptmp; - double pWB[4] = {_mB - Eh, -pHB[1], -pHB[2], -pHB[3]}; + double pWB[4] = { _mB - Eh, -pHB[1], -pHB[2], -pHB[3] }; // first go in the W restframe and calculate the lepton and // the neutrino in the W frame @@ -294,17 +294,17 @@ sttmp = sqrt( 1 - ctL * ctL ); // eX' = eZ x eW - double xW[3] = {-pWB[2], pWB[1], 0}; + double xW[3] = { -pWB[2], pWB[1], 0 }; // eZ' = eW - double zW[3] = {pWB[1] / apWB, pWB[2] / apWB, pWB[3] / apWB}; + double zW[3] = { pWB[1] / apWB, pWB[2] / apWB, pWB[3] / apWB }; double lx = sqrt( xW[0] * xW[0] + xW[1] * xW[1] ); for ( int j = 0; j < 2; j++ ) xW[j] /= lx; // eY' = eZ' x eX' - double yW[3] = {-pWB[1] * pWB[3], -pWB[2] * pWB[3], - pWB[1] * pWB[1] + pWB[2] * pWB[2]}; + double yW[3] = { -pWB[1] * pWB[3], -pWB[2] * pWB[3], + pWB[1] * pWB[1] + pWB[2] * pWB[2] }; double ly = sqrt( yW[0] * yW[0] + yW[1] * yW[1] + yW[2] * yW[2] ); for ( int j = 0; j < 3; j++ ) yW[j] /= ly; @@ -330,8 +330,8 @@ if ( ctLL < -1 ) ctLL = -1; - double pLB[4] = {El, 0, 0, 0}; - double pNB[8] = {pWB[0] - El, 0, 0, 0}; + double pLB[4] = { El, 0, 0, 0 }; + double pNB[8] = { pWB[0] - El, 0, 0, 0 }; for ( int j = 1; j < 4; j++ ) { pLB[j] = pLW[j] + ( ctLL * ptmp - ctL * apLW ) / apWB * pWB[j]; @@ -370,8 +370,8 @@ double aF3 = F30( sCoeffs ); double td0 = c1 * aF1 + c2 * aF2 + c3 * aF3; - auto func = EvtItgPtrFunction{&integrand, 0., _mB, sCoeffs}; - auto jetSF = EvtItgSimpsonIntegrator{func, 0.01, 25}; + auto func = EvtItgPtrFunction{ &integrand, 0., _mB, sCoeffs }; + auto jetSF = EvtItgSimpsonIntegrator{ func, 0.01, 25 }; double smallfrac = 0.000001; // stop a bit before the end to avoid problems with numerical integration double tdInt = jetSF.evaluate( 0, pp * ( 1 - smallfrac ) ); @@ -704,7 +704,7 @@ { std::array gammaCoeffs{ 76.18009172947146, -86.50532032941677, 24.01409824083091, - -1.231739572450155, 0.1208650973866179e-2, -0.5395239384953e-5}; + -1.231739572450155, 0.1208650973866179e-2, -0.5395239384953e-5 }; //Lifted from Numerical Recipies in C double y = z; @@ -726,7 +726,7 @@ { std::vector c( 1 ); c[0] = z; - auto func = EvtItgPtrFunction{&dgamma, tmin, 100., c}; - auto jetSF = EvtItgSimpsonIntegrator{func, 0.001}; + auto func = EvtItgPtrFunction{ &dgamma, tmin, 100., c }; + auto jetSF = EvtItgSimpsonIntegrator{ func, 0.001 }; return jetSF.evaluate( tmin, 100. ); } diff --git a/src/EvtGenModels/EvtWilsonCoefficients.cpp b/src/EvtGenModels/EvtWilsonCoefficients.cpp --- a/src/EvtGenModels/EvtWilsonCoefficients.cpp +++ b/src/EvtGenModels/EvtWilsonCoefficients.cpp @@ -31,26 +31,27 @@ EvtWilsonCoefficients::EvtWilsonCoefficients() { int i, j; - double tmpa[8] = {14. / 23., 16. / 23., 6. / 23., -12. / 23., - 0.4086, -0.4230, -0.8994, 0.1456}; - double tmph[8] = {2.2996, -1.0880, -3. / 7., -1. / 14., - -0.6494, -0.0380, -0.0186, -0.0057}; - double tmpp[8] = {0, 0, -80. / 203., 8. / 33., - 0.0433, 0.1384, 0.1648, -0.0073}; - double tmps[8] = {0, 0, -0.2009, -0.3579, 0.0490, -0.3616, -0.3554, 0.0072}; - double tmpq[8] = {0, 0, 0, 0, 0.0318, 0.0918, -0.2700, 0.0059}; - double tmpg[8] = {313063. / 363036., 0, 0, 0, - -0.9135, 0.0873, -0.0571, -0.0209}; + double tmpa[8] = { 14. / 23., 16. / 23., 6. / 23., -12. / 23., + 0.4086, -0.4230, -0.8994, 0.1456 }; + double tmph[8] = { 2.2996, -1.0880, -3. / 7., -1. / 14., + -0.6494, -0.0380, -0.0186, -0.0057 }; + double tmpp[8] = { 0, 0, -80. / 203., 8. / 33., + 0.0433, 0.1384, 0.1648, -0.0073 }; + double tmps[8] = { 0, 0, -0.2009, -0.3579, + 0.0490, -0.3616, -0.3554, 0.0072 }; + double tmpq[8] = { 0, 0, 0, 0, 0.0318, 0.0918, -0.2700, 0.0059 }; + double tmpg[8] = { 313063. / 363036., 0, 0, 0, + -0.9135, 0.0873, -0.0571, -0.0209 }; double tmpk[6][8] = { - {0, 0, 1. / 2., -1. / 2., 0, 0, 0, 0}, - {0, 0, 1. / 2., +1. / 2., 0, 0, 0, 0}, - {0, 0, -1. / 14., +1. / 6., 0.0510, -0.1403, -0.0113, 0.0054}, - {0, 0, -1. / 14., -1. / 6., 0.0984, +0.1214, +0.0156, 0.0026}, - {0, 0, 0, 0, -0.0397, 0.0117, -0.0025, +0.0304}, - {0, 0, 0, 0, +0.0335, 0.0239, -0.0462, -0.0112}}; + { 0, 0, 1. / 2., -1. / 2., 0, 0, 0, 0 }, + { 0, 0, 1. / 2., +1. / 2., 0, 0, 0, 0 }, + { 0, 0, -1. / 14., +1. / 6., 0.0510, -0.1403, -0.0113, 0.0054 }, + { 0, 0, -1. / 14., -1. / 6., 0.0984, +0.1214, +0.0156, 0.0026 }, + { 0, 0, 0, 0, -0.0397, 0.0117, -0.0025, +0.0304 }, + { 0, 0, 0, 0, +0.0335, 0.0239, -0.0462, -0.0112 } }; double tmpr[2][8] = { - {0, 0, +0.8966, -0.1960, -0.2011, 0.1328, -0.0292, -0.1858}, - {0, 0, -0.1193, +0.1003, -0.0473, 0.2323, -0.0133, -0.1799}}; + { 0, 0, +0.8966, -0.1960, -0.2011, 0.1328, -0.0292, -0.1858 }, + { 0, 0, -0.1193, +0.1003, -0.0473, 0.2323, -0.0133, -0.1799 } }; for ( i = 0; i < 8; i++ ) { a[i] = tmpa[i]; h[i] = tmph[i]; diff --git a/src/EvtGenModels/EvtbTosllAli.cpp b/src/EvtGenModels/EvtbTosllAli.cpp --- a/src/EvtGenModels/EvtbTosllAli.cpp +++ b/src/EvtGenModels/EvtbTosllAli.cpp @@ -65,7 +65,7 @@ //This routine sets the _poleSize. double mymaxprob = _calcamp->CalcMaxProb( parnum, mesnum, l1num, l2num, _aliffmodel.get(), _poleSize ); - mymaxprob *= 1.25; // Increase to avoid maxprob errors + mymaxprob *= 1.25; // Increase to avoid maxprob errors setProbMax( mymaxprob ); } diff --git a/src/EvtGenModels/EvtbTosllAmp.cpp b/src/EvtGenModels/EvtbTosllAmp.cpp --- a/src/EvtGenModels/EvtbTosllAmp.cpp +++ b/src/EvtGenModels/EvtbTosllAmp.cpp @@ -34,6 +34,45 @@ #include "EvtGenBase/EvtVector4C.hh" #include "EvtGenBase/EvtVectorParticle.hh" +#include + +double getKineWeight( EvtParticle* p ) +{ + int nd = p->getNDaug(); + double prod = 1; + for ( int i = 0; i < nd - 1; i++ ) { + EvtVector4R M0; + for ( int j = i + 1; j < nd; j++ ) + M0 += p->getDaug( j )->getP4(); + EvtVector4R M1 = M0 + p->getDaug( i )->getP4(); + double Mi12 = M1.mass2(), Mi = M0.mass(), + mi = p->getDaug( i )->getP4().mass(), Mipm = Mi + mi, + Mimm = Mi - mi; + std::cout << Mi12 << std::endl; + prod *= 0.5 * + sqrt( ( Mi12 - Mipm * Mipm ) * ( Mi12 - Mimm * Mimm ) / Mi12 ); + } + return prod; +} + +double getKineWeight2( EvtParticle* p ) +{ + int nd = p->getNDaug(); + double prod = 1; + for ( int i = nd - 1; i > 0; i-- ) { + EvtVector4R M0; + for ( int j = i - 1; j >= 0; j-- ) + M0 += p->getDaug( j )->getP4(); + EvtVector4R M1 = M0 + p->getDaug( i )->getP4(); + double Mi12 = M1.mass2(), Mi = M0.mass(), + mi = p->getDaug( i )->getP4().mass(), Mipm = Mi + mi, + Mimm = Mi - mi; + prod *= 0.5 * + sqrt( ( Mi12 - Mipm * Mipm ) * ( Mi12 - Mimm * Mimm ) / Mi12 ); + } + return prod; +} + double EvtbTosllAmp::CalcMaxProb( EvtId parent, EvtId meson, EvtId lepton1, EvtId lepton2, EvtbTosllFF* FormFactors, double& poleSize ) @@ -85,8 +124,7 @@ lep1->noLifeTime(); lep2->noLifeTime(); - //Initial particle is unpolarized, well it is a scalar so it is - //trivial + //Initial particle is unpolarized, well it is a scalar so it is trivial EvtSpinDensity rho; rho.setDiag( root_part->getSpinStates() ); @@ -95,120 +133,87 @@ double m = root_part->mass(); EvtVector4R p4meson, p4lepton1, p4lepton2, p4w; - double q2max; - - double q2, elepton, plepton; - int i, j; - double erho, prho, costl; double maxfoundprob = 0.0; double prob = -10.0; - int massiter; - double maxpole = 0; - for ( massiter = 0; massiter < 3; massiter++ ) { - mass[0] = EvtPDL::getMeanMass( meson ); - mass[1] = EvtPDL::getMeanMass( lepton1 ); - mass[2] = EvtPDL::getMeanMass( lepton2 ); - if ( massiter == 1 ) { - mass[0] = EvtPDL::getMinMass( meson ); - } - if ( massiter == 2 ) { - mass[0] = EvtPDL::getMaxMass( meson ); - if ( ( mass[0] + mass[1] + mass[2] ) > m ) - mass[0] = m - mass[1] - mass[2] - 0.00001; - } - - q2max = ( m - mass[0] ) * ( m - mass[0] ); + mass[1] = EvtPDL::getMeanMass( lepton1 ); + mass[2] = EvtPDL::getMeanMass( lepton2 ); + std::vector mH; + mH.push_back( EvtPDL::getMeanMass( meson ) ); + //if the particle is narrow dont bother with changing the mass. + double g = EvtPDL::getWidth( meson ); + if ( g > 0 ) { + mH.push_back( EvtPDL::getMinMass( meson ) ); + mH.push_back( + std::min( EvtPDL::getMaxMass( meson ), m - mass[1] - mass[2] ) ); + mH.push_back( mH.front() - g ); + mH.push_back( mH.front() + g ); + } + double q2min = ( mass[1] + mass[2] ) * ( mass[1] + mass[2] ); + for ( double m0 : mH ) { + double q2max = ( m - m0 ) * ( m - m0 ); //loop over q2 - //cout << "m " << m << "mass[0] " << mass[0] << " q2max "<< q2max << endl; - for ( i = 0; i < 25; i++ ) { - //want to avoid picking up the tail of the photon propagator - q2 = ( ( i + 1.5 ) * q2max ) / 26.0; - + for ( int i = 0, n = 25; i < n; i++ ) { + // want to avoid picking up the tail of the photon propagator + double q2 = q2min + ( i + 0.5 ) / n * ( q2max - q2min ); + // std::cout<init( meson, p4meson ); lep1->init( lepton1, p4lepton1 ); lep2->init( lepton2, p4lepton2 ); - + // std::cout<<"kw "< prob ) - prob = probctl[1]; - if ( probctl[2] > prob ) - prob = probctl[2]; - - if ( fabs( c ) > 1e-20 ) { - double ctlx = -0.5 * b / c; - if ( fabs( ctlx ) < 1.0 ) { - double probtmp = a + b * ctlx + c * ctlx * ctlx; - if ( probtmp > prob ) - prob = probtmp; + for ( int j = 0; j < nj - 2; j++ ) { + // pm,p0,pp contain probabilities at x=-1,0,1. + // prob = a + b*x + c*x^2 + double pm = p[j + 0], p0 = p[j + 1], pp = p[j + 2]; + double a = p0, b = 0.5 * ( pp - pm ), c = 0.5 * ( pp + pm ) - p0; + prob = std::max( p0, std::max( pp, pm ) ); + if ( fabs( c ) > 1e-20 ) { + double x = -0.5 * b / c; + if ( fabs( x ) < 1.0 ) + prob = std::max( prob, a + b * x + c * x * x ); } } - //EvtGenReport(EVTGEN_DEBUG,"EvtGen") << "prob,probctl:"< maxfoundprob ) { maxfoundprob = prob; } - - //cout << "q2,maxfoundprob:"<deleteTree(); + if ( 0 ) { + std::vector v; + float x, y; + std::ifstream INR( "eRe_wide.dat" ); + while ( INR >> x >> y ) + v.push_back( x ); + std::cout << "q2 points read -- " << v.size() << std::endl; + + std::ofstream OUT( "b2sllprob_amp.dat" ); + double m0 = mH[0]; + m0 = EvtPDL::getMinMass( meson ); + double q2max = ( m - m0 ) * ( m - m0 ); + //loop over q2 + for ( double q2 : v ) { + // want to avoid picking up the tail of the photon propagator + if ( !( q2min <= q2 && q2 < q2max ) ) + continue; + double Erho = ( m * m + m0 * m0 - q2 ) / ( 2.0 * m ), + Prho = sqrt( ( Erho - m0 ) * ( Erho + m0 ) ); + + p4meson.set( Erho, 0.0, 0.0, -Prho ); + p4w.set( m - Erho, 0.0, 0.0, Prho ); + + //This is in the W rest frame + double Elep = sqrt( q2 ) * 0.5, + Plep = sqrt( Elep * Elep - mass[1] * mass[1] ); + + const int nj = 3 + 2 + 4 + 8 + 32; + double cmin = -1, cmax = 1, dc = ( cmax - cmin ) / ( nj - 1 ); + double maxprob = 0; + for ( int j = 0; j < nj; j++ ) { + double c = cmin + dc * j; - poleSize = 0.04 * ( maxpole / maxfoundprob ) * 4 * ( mass[1] * mass[1] ); + //These are in the W rest frame. Need to boost out into the B frame. + double Py = Plep * sqrt( 1.0 - c * c ), Pz = Plep * c; + p4lepton1.set( Elep, 0.0, Py, Pz ); + p4lepton2.set( Elep, 0.0, -Py, -Pz ); - //poleSize=0.002; + p4lepton1 = boostTo( p4lepton1, p4w ); + p4lepton2 = boostTo( p4lepton2, p4w ); - //cout <<"maxfoundprob,maxpole,poleSize:"<init( meson, p4meson ); + lep1->init( lepton1, p4lepton1 ); + lep2->init( lepton2, p4lepton2 ); + CalcAmp( root_part, amp, FormFactors ); + double prob = rho.normalizedProb( amp.getSpinDensity() ); + maxprob = std::max( maxprob, prob ); + } + OUT << q2 << " " << maxprob << "\n"; + } + } + + root_part->deleteTree(); - maxfoundprob *= 1.15; + // poleSize = 0.04 * ( maxpole / maxfoundprob ) * q2min; + poleSize = ( maxpole / maxfoundprob ) * q2min; + std::cout << "max " << maxfoundprob << " " << maxpole << " " << poleSize + << std::endl; + // maxfoundprob *= 1.5e-3; return maxfoundprob; // with resonances + // maxfoundprob *= 4e-7; return maxfoundprob; + // maxfoundprob *= 3.7e-4; return maxfoundprob; // with resonances - return maxfoundprob; + return maxfoundprob * 3; // without resonances + return maxfoundprob / 1000 * 3.5; } EvtComplex EvtbTosllAmp::GetC7Eff( double q2, bool nnlo ) diff --git a/src/EvtGenModels/EvtbTosllBSZFF.cpp b/src/EvtGenModels/EvtbTosllBSZFF.cpp new file mode 100644 --- /dev/null +++ b/src/EvtGenModels/EvtbTosllBSZFF.cpp @@ -0,0 +1,112 @@ +#include "EvtGenModels/EvtbTosllBSZFF.hh" + +#include "EvtGenBase/EvtPDL.hh" + +#include + +inline double poly( double x, int n, const double* c ) +{ + double t = c[--n]; + while ( n-- ) + t = c[n] + x * t; + return t; +} + +void EvtbTosllBSZFF::getVectorFF( EvtId pId, EvtId, double q2, double mV, + double& a1, double& a2, double& a0, double& v, + double& t1, double& t2, double& t3 ) +{ + const static double alfa[7][4] = { + // coefficients are from https://arxiv.org/src/1503.05534v3/anc/BKstar_LCSR-Lattice.json + // m_res, c0, c1, c2 + { 5.415000, 0.376313, -1.165970, 2.424430 }, // V + { 5.366000, 0.369196, -1.365840, 0.128191 }, // A0 + { 5.829000, 0.297250, 0.392378, 1.189160 }, // A1 + { 5.829000, 0.265375, 0.533638, 0.483166 }, // A12 + { 5.415000, 0.312055, -1.008930, 1.527200 }, // T1 + { 5.829000, 0.312055, 0.496846, 1.614310 }, // T2 + { 5.829000, 0.667412, 1.318120, 3.823340 } // T12 + // ffv1 + // {5.415000, 0.376313+0.033259, -1.165970+0.123496, 2.424430-0.038413}, + // {5.366000, 0.369196-0.000870, -1.365840+0.158886, 0.128191+0.705349}, + // {5.829000, 0.297250-0.023744, 0.392378-0.128900, 1.189160-0.207408}, + // {5.829000, 0.265375-0.008545, 0.533638+0.108205, 0.483166+0.435457}, + // {5.415000, 0.312055-0.001346, -1.008930-0.198232, 1.527200-2.387283}, + // {5.829000, 0.312055-0.038173, 0.496846-0.067891, 1.614310+0.349193}, + // {5.829000, 0.667412+0.036716, 1.318120-0.038069, 3.823340+0.606166}, + + // ffv2 + // {5.415000, 0.376313-0.041113, -1.165970-0.045535, 2.424430+1.137686}, + // {5.366000, 0.369196-0.003901, -1.365840-0.121212, 0.128191-0.729504}, + // {5.829000, 0.297250+0.048609, 0.392378+0.210965, 1.189160+0.906521}, + // {5.829000, 0.265375+0.000100, 0.533638-0.042370, 0.483166+0.284835}, + // {5.415000, 0.312055+0.002605, -1.008930+0.215231, 1.527200+2.604514}, + // {5.829000, 0.312055-0.003748, 0.496846-0.039576, 1.614310-0.241782}, + // {5.829000, 0.667412-0.007496, 1.318120-0.252147, 3.823340-1.210450}, + + // ffv3 + // {5.415000, 0.376313+0.000735, -1.165970-0.007790, 2.424430-1.608712}, + // {5.366000, 0.369196+0.050484, -1.365840+0.217869, 0.128191-0.479841}, + // {5.829000, 0.297250-0.031106, 0.392378-0.314969, 1.189160-2.128420}, + // {5.829000, 0.265375+0.027843, 0.533638+0.155898, 0.483166+0.413373}, + // {5.415000, 0.312055+0.006707, -1.008930-0.112003, 1.527200-1.779484}, + // {5.829000, 0.312055-0.021665, 0.496846-0.400001, 1.614310-2.018040}, + // {5.829000, 0.667412-0.078741, 1.318120-0.140305, 3.823340+3.390407}, + + // ffv4 + // {5.415000, 0.376313-0.015611, -1.165970-0.474344, 2.424430-1.821098}, + // {5.366000, 0.369196+0.051546, -1.365840+0.113835, 0.128191-0.334548}, + // {5.829000, 0.297250-0.009712, 0.392378-0.144326, 1.189160-0.880261}, + // {5.829000, 0.265375-0.006262, 0.533638-0.036838, 0.483166+0.208676}, + // {5.415000, 0.312055+0.012515, -1.008930+0.057467, 1.527200+1.067426}, + // {5.829000, 0.312055+0.009879, 0.496846-0.025578, 1.614310+0.063207}, + // {5.829000, 0.667412+0.088066, 1.318120+0.306504, 3.823340-1.852577}, + + // ffv5 + // {5.415000, 0.376313+0.009252, -1.165970-0.073415, 2.424430-1.479015}, + // {5.366000, 0.369196-0.037582, -1.365840-0.015347, 0.128191+1.217427}, + // {5.829000, 0.297250-0.039144, 0.392378-0.016291, 1.189160+1.097737}, + // {5.829000, 0.265375-0.003710, 0.533638-0.047800, 0.483166-0.066831}, + // {5.415000, 0.312055-0.012360, -1.008930+0.139269, 1.527200+1.496325}, + // {5.829000, 0.312055+0.002256, 0.496846+0.142894, 1.614310+1.115639}, + // {5.829000, 0.667412-0.089004, 1.318120-0.037696, 3.823340+2.278156}, + }; + + double mB = EvtPDL::getMeanMass( pId ); + double mBaV = mB + mV, mBsV = mB - mV; + double tp = mBaV * mBaV; // t_{+} = (m_B + m_V)^2 + double s0 = sqrt( + 2 * mBaV * + sqrt( mB * mV ) ); // sqrt(t_{+} - t_{+}*(1 - sqrt(1 - t_{-}/t_{+}))) + double z0 = ( mBaV - s0 ) / + ( mBaV + s0 ); // (sqrt(t_{+}) - s0)/(sqrt(t_{+}) + s0) + + double s = sqrt( tp - q2 ), z = ( s - s0 ) / ( s + s0 ), dz = z - z0, ff[7]; + for ( int j = 0; j < 7; j++ ) { + double mR = alfa[j][0], mR2 = mR * mR; + ff[j] = ( mR2 / ( mR2 - q2 ) ) * poly( dz, 3, alfa[j] + 1 ); + } + + // Källén-function + // arXiv:1503.05534 Eq. D.3 + double lambda = ( mBaV * mBaV - q2 ) * ( mBsV * mBsV - q2 ); + + v = ff[0]; + a0 = ff[1]; + a1 = ff[2]; + // Eq. D.5 arXiv:1503.05534 + // A12 = (mBaV*mBaV*(mBaV*mBsV - q2)*A1 - lambda(q2)*A2)/(16*mB*mV*mV*mBaV); + double a12 = ff[3]; + a2 = mBaV * + ( ( mBaV * ( mBaV * mBsV - q2 ) ) * a1 - ( 16 * mB * mV * mV ) * a12 ) / + lambda; + t1 = ff[4]; + t2 = ff[5]; + // Eq. D.5 arXiv:1503.05534 + // T23 = mBaV*mBsV*(mB*mB + 3*mV*mV - q2)*T2 - lambda(q2)*T3)/(8*mB*mV*mV*mBsV); + double t23 = ff[6]; + t3 = mBsV * + ( mBaV * ( mB * mB + 3 * mV * mV - q2 ) * t2 - + ( 8 * mB * mV * mV ) * t23 ) / + lambda; +} diff --git a/src/EvtGenModels/EvtbTosllBallFF.cpp b/src/EvtGenModels/EvtbTosllBallFF.cpp --- a/src/EvtGenModels/EvtbTosllBallFF.cpp +++ b/src/EvtGenModels/EvtbTosllBallFF.cpp @@ -30,10 +30,27 @@ _theFFModel = ffmodel; } +static EvtId IdKp, IdKm, IdKS, IdK0, IdaK0, IdKL, IdPip, IdPim, IdPi0, IdEta, + IdEtap; +static bool sfirst = true; void EvtbTosllBallFF::getScalarFF( EvtId parent, EvtId daught, double t, double /*mass*/, double& fp, double& f0, double& ft ) { + if ( sfirst ) { + sfirst = false; + IdKp = EvtPDL::getId( "K+" ); + IdKm = EvtPDL::getId( "K-" ); + IdKS = EvtPDL::getId( "K_S0" ); + IdK0 = EvtPDL::getId( "K0" ); + IdaK0 = EvtPDL::getId( "anti-K0" ); + IdKL = EvtPDL::getId( "K_L0" ); + IdPip = EvtPDL::getId( "pi+" ); + IdPim = EvtPDL::getId( "pi-" ); + IdPi0 = EvtPDL::getId( "pi0" ); + IdEta = EvtPDL::getId( "eta" ); + IdEtap = EvtPDL::getId( "eta'" ); + } int model = _theFFModel; double m = EvtPDL::getMeanMass( parent ); @@ -43,12 +60,8 @@ double shat2 = shat * shat; double shat3 = shat2 * shat; - if ( daught == EvtPDL::getId( std::string( "K+" ) ) || - daught == EvtPDL::getId( std::string( "K-" ) ) || - daught == EvtPDL::getId( std::string( "K_S0" ) ) || - daught == EvtPDL::getId( std::string( "K0" ) ) || - daught == EvtPDL::getId( std::string( "anti-K0" ) ) || - daught == EvtPDL::getId( std::string( "K_L0" ) ) ) { + if ( daught == IdKp || daught == IdKm || daught == IdKS || daught == IdK0 || + daught == IdaK0 || daught == IdKL ) { // B --> K form factors if ( model == 1 ) { //this is Ali-Ball '01 (or really Ali-Ball'99 minimum allowed) @@ -97,9 +110,7 @@ ft = ( 0.1851 / ( 1. - ( t / 29.30 ) ) ) + ( 0.1905 / ( 1. - ( t / 29.30 ) ) / ( 1. - ( t / 29.30 ) ) ); } - } else if ( daught == EvtPDL::getId( std::string( "pi+" ) ) || - daught == EvtPDL::getId( std::string( "pi-" ) ) || - daught == EvtPDL::getId( std::string( "pi0" ) ) ) { + } else if ( daught == IdPip || daught == IdPim || daught == IdPi0 ) { if ( model == 1 ) { // B --> pi form factors from Ball-Zwicky'01 (tabulated in hep-ph/0306251) fp = 0.261 / ( 1. - 2.03 * shat + 1.293 * shat * shat ); @@ -155,8 +166,7 @@ ft = ( 0.152 / ( 1. - ( t / ( 5.32 * 5.32 ) ) ) ) + ( 0.122 / ( 1. - ( t / 28.40 ) ) / ( 1. - ( t / 28.40 ) ) ); } - } else if ( daught == EvtPDL::getId( std::string( "eta" ) ) || - daught == EvtPDL::getId( std::string( "eta'" ) ) ) { + } else if ( daught == IdEta || daught == IdEtap ) { if ( model == 1 ) { // B --> eta form factors fp = 0.261 / ( 1. - 2.03 * shat + 1.293 * shat * shat ); @@ -185,11 +195,30 @@ // <<"ft "< K* form factors - daught == EvtPDL::getId( std::string( "K*0" ) ) || - daught == EvtPDL::getId( std::string( "anti-K*0" ) ) ) { + if ( parent == IdBs || parent == IdaBs ) { // B_s decay form factors + if ( daught == IdKst0 || daught == IdaKst0 ) { // B_s --> K* form factors if ( model == 6 ) { // Ball-Zwicky LCSR '05 (mb = 4.8) a1 = 0.231 / ( 1. - ( t / 32.94 ) ); @@ -228,9 +251,7 @@ } } - else if ( - // B_s --> phi form factors - daught == EvtPDL::getId( std::string( "phi" ) ) ) { + else if ( daught == IdPhi ) { // B_s --> phi form factors if ( model == 6 ) { // Ball-Zwicky LCSR '05 (mb = 4.8) a1 = 0.308 / ( 1. - ( t / 36.54 ) ); @@ -253,14 +274,8 @@ } } } - } else if ( daught == EvtPDL::getId( std::string( "K*+" ) ) || - daught == EvtPDL::getId( std::string( "K*-" ) ) || - daught == EvtPDL::getId( std::string( "K*0" ) ) || - daught == EvtPDL::getId( std::string( "anti-K*0" ) ) || - daught == EvtPDL::getId( std::string( "K_1+" ) ) || - daught == EvtPDL::getId( std::string( "K_1-" ) ) - - ) { + } else if ( daught == IdKstp || daught == IdKstm || daught == IdKst0 || + daught == IdaKst0 || daught == IdK1p || daught == IdK1m ) { if ( model == 1 ) { //this is Ali-Ball '01 a1 = 0.294 * exp( 0.656 * shat + 0.456 * shat2 ); @@ -372,9 +387,7 @@ ( 1 + ( -10.3 ) * ( z - z0 + 0.5 * ( ( z * z ) - ( z0 * z0 ) ) ) ); } - } else if ( daught == EvtPDL::getId( std::string( "rho+" ) ) || - daught == EvtPDL::getId( std::string( "rho-" ) ) || - daught == EvtPDL::getId( std::string( "rho0" ) ) ) { + } else if ( daught == IdRhop || daught == IdRhom || daught == IdRho0 ) { if ( model == 1 ) { // B --> rho form factors a1 = 0.261 / ( 1. - 0.29 * shat - 0.415 * shat * shat ); @@ -406,7 +419,7 @@ t3 = ( m * m - md * md ) * ( t3tilde - t2 ) / t; } } - } else if ( daught == EvtPDL::getId( std::string( "omega" ) ) ) { + } else if ( daught == IdOmega ) { if ( model == 1 ) { // B --> rho form factors a1 = 0.261 / ( 1. - 0.29 * shat - 0.415 * shat * shat ); diff --git a/src/EvtGenModels/EvtbTosllMSFF.cpp b/src/EvtGenModels/EvtbTosllMSFF.cpp --- a/src/EvtGenModels/EvtbTosllMSFF.cpp +++ b/src/EvtGenModels/EvtbTosllMSFF.cpp @@ -78,10 +78,10 @@ daught == EvtPDL::getId( std::string( "K_L0" ) ) ) || ( parent == EvtPDL::getId( std::string( "anti-B0" ) ) && daught == EvtPDL::getId( std::string( "K_L0" ) ) ) ) { - double ff0[] = {0.36, 0.36, 0.35}; - double sigma1[] = {0.43, 0.70, 0.43}; - double sigma2[] = {0.00, 0.27, 0.00}; - int eq_num[] = {9, 10, 9}; + double ff0[] = { 0.36, 0.36, 0.35 }; + double sigma1[] = { 0.43, 0.70, 0.43 }; + double sigma2[] = { 0.00, 0.27, 0.00 }; + int eq_num[] = { 9, 10, 9 }; double M_P2 = 5.37 * 5.37; // GeV^2 for B^0_s - meson double M_V2 = 5.42 * 5.42; // GeV^2 for B^*_s - meson @@ -105,10 +105,10 @@ daught == EvtPDL::getId( std::string( "pi0" ) ) ) || ( parent == EvtPDL::getId( std::string( "anti-B0" ) ) && daught == EvtPDL::getId( std::string( "pi0" ) ) ) ) { - double ff0[] = {0.29, 0.29, 0.28}; - double sigma1[] = {0.48, 0.76, 0.48}; - double sigma2[] = {0.00, 0.28, 0.00}; - int eq_num[] = {9, 10, 9}; + double ff0[] = { 0.29, 0.29, 0.28 }; + double sigma1[] = { 0.48, 0.76, 0.48 }; + double sigma2[] = { 0.00, 0.28, 0.00 }; + int eq_num[] = { 9, 10, 9 }; double M_P2 = 5.27 * 5.27; // GeV^2 for B^0 - meson double M_V2 = 5.32 * 5.32; // GeV^2 for B^* - meson @@ -128,10 +128,10 @@ daught == EvtPDL::getId( std::string( "eta" ) ) ) || ( parent == EvtPDL::getId( std::string( "anti-B0" ) ) && daught == EvtPDL::getId( std::string( "eta" ) ) ) ) { - double ff0[] = {0.36, 0.36, 0.36}; - double sigma1[] = {0.60, 0.80, 0.58}; - double sigma2[] = {0.20, 0.40, 0.18}; - int eq_num[] = {9, 10, 9}; + double ff0[] = { 0.36, 0.36, 0.36 }; + double sigma1[] = { 0.60, 0.80, 0.58 }; + double sigma2[] = { 0.20, 0.40, 0.18 }; + int eq_num[] = { 9, 10, 9 }; double M_P2 = 5.27 * 5.27; // GeV^2 for B_d^0 - meson double M_V2 = 5.32 * 5.32; // GeV^2 for B_d^* - meson @@ -154,10 +154,10 @@ daught == EvtPDL::getId( std::string( "eta'" ) ) ) || ( parent == EvtPDL::getId( std::string( "anti-B0" ) ) && daught == EvtPDL::getId( std::string( "eta'" ) ) ) ) { - double ff0[] = {0.36, 0.36, 0.39}; - double sigma1[] = {0.60, 0.80, 0.58}; - double sigma2[] = {0.20, 0.45, 0.18}; - int eq_num[] = {9, 10, 9}; + double ff0[] = { 0.36, 0.36, 0.39 }; + double sigma1[] = { 0.60, 0.80, 0.58 }; + double sigma2[] = { 0.20, 0.45, 0.18 }; + int eq_num[] = { 9, 10, 9 }; double M_P2 = 5.27 * 5.27; // GeV^2 for B_d^0 - meson double M_V2 = 5.32 * 5.32; // GeV^2 for B_d^* - meson @@ -177,10 +177,10 @@ daught == EvtPDL::getId( std::string( "eta" ) ) ) || ( parent == EvtPDL::getId( std::string( "anti-B_s0" ) ) && daught == EvtPDL::getId( std::string( "eta" ) ) ) ) { - double ff0[] = {0.36, 0.36, 0.36}; - double sigma1[] = {0.60, 0.80, 0.58}; - double sigma2[] = {0.20, 0.40, 0.18}; - int eq_num[] = {9, 10, 9}; + double ff0[] = { 0.36, 0.36, 0.36 }; + double sigma1[] = { 0.60, 0.80, 0.58 }; + double sigma2[] = { 0.20, 0.40, 0.18 }; + int eq_num[] = { 9, 10, 9 }; double M_P2 = 5.37 * 5.37; // GeV^2 for B_s^0 - meson double M_V2 = 5.42 * 5.42; // GeV^2 for B_s^* - meson @@ -200,10 +200,10 @@ daught == EvtPDL::getId( std::string( "eta'" ) ) ) || ( parent == EvtPDL::getId( std::string( "anti-B_s0" ) ) && daught == EvtPDL::getId( std::string( "eta'" ) ) ) ) { - double ff0[] = {0.36, 0.36, 0.39}; - double sigma1[] = {0.60, 0.80, 0.58}; - double sigma2[] = {0.20, 0.45, 0.18}; - int eq_num[] = {9, 10, 9}; + double ff0[] = { 0.36, 0.36, 0.39 }; + double sigma1[] = { 0.60, 0.80, 0.58 }; + double sigma2[] = { 0.20, 0.45, 0.18 }; + int eq_num[] = { 9, 10, 9 }; double M_P2 = 5.37 * 5.37; // GeV^2 for B_s^0 - meson double M_V2 = 5.42 * 5.42; // GeV^2 for B_s^* - meson @@ -223,10 +223,10 @@ daught == EvtPDL::getId( std::string( "f_0" ) ) ) || ( parent == EvtPDL::getId( std::string( "anti-B_s0" ) ) && daught == EvtPDL::getId( std::string( "f_0" ) ) ) ) { - double ff0[] = {0.238, 0.238, 0.308}; - double sigma1[] = {1.50, 0.53, 1.46}; - double sigma2[] = {0.58, -0.36, 0.58}; - int eq_num[] = {10, 10, 10}; + double ff0[] = { 0.238, 0.238, 0.308 }; + double sigma1[] = { 1.50, 0.53, 1.46 }; + double sigma2[] = { 0.58, -0.36, 0.58 }; + int eq_num[] = { 10, 10, 10 }; double M_P2 = 5.366 * 5.366; // GeV^2 for B_s^0 - meson fp = 0.0 - @@ -274,10 +274,10 @@ daught == EvtPDL::getId( std::string( "K*0" ) ) ) || ( parent == EvtPDL::getId( std::string( "anti-B0" ) ) && daught == EvtPDL::getId( std::string( "anti-K*0" ) ) ) ) { - double ff0[] = {0.44, 0.45, 0.36, 0.32, 0.39, 0.39, 0.27}; - double sigma1[] = {0.45, 0.46, 0.64, 1.23, 0.45, 0.72, 1.31}; - double sigma2[] = {0.00, 0.00, 0.36, 0.38, 0.00, 0.62, 0.41}; - int eq_num[] = {9, 9, 10, 10, 9, 10, 10}; + double ff0[] = { 0.44, 0.45, 0.36, 0.32, 0.39, 0.39, 0.27 }; + double sigma1[] = { 0.45, 0.46, 0.64, 1.23, 0.45, 0.72, 1.31 }; + double sigma2[] = { 0.00, 0.00, 0.36, 0.38, 0.00, 0.62, 0.41 }; + int eq_num[] = { 9, 9, 10, 10, 9, 10, 10 }; double M_P2 = 5.37 * 5.37; // GeV^2 for B^0_s - meson double M_V2 = 5.42 * 5.42; // GeV^2 for B^*_s - meson @@ -306,10 +306,10 @@ daught == EvtPDL::getId( std::string( "rho0" ) ) ) || ( parent == EvtPDL::getId( std::string( "anti-B0" ) ) && daught == EvtPDL::getId( std::string( "rho0" ) ) ) ) { - double ff0[] = {0.31, 0.30, 0.26, 0.24, 0.27, 0.27, 0.19}; - double sigma1[] = {0.59, 0.54, 0.73, 1.40, 0.60, 0.74, 1.42}; - double sigma2[] = {0.00, 0.00, 0.10, 0.50, 0.00, 0.19, 0.51}; - int eq_num[] = {9, 9, 10, 10, 9, 10, 10}; + double ff0[] = { 0.31, 0.30, 0.26, 0.24, 0.27, 0.27, 0.19 }; + double sigma1[] = { 0.59, 0.54, 0.73, 1.40, 0.60, 0.74, 1.42 }; + double sigma2[] = { 0.00, 0.00, 0.10, 0.50, 0.00, 0.19, 0.51 }; + int eq_num[] = { 9, 9, 10, 10, 9, 10, 10 }; double M_P2 = 5.27 * 5.27; // GeV^2 for B - meson double M_V2 = 5.32 * 5.32; // GeV^2 for B^* - meson @@ -334,10 +334,10 @@ daught == EvtPDL::getId( std::string( "omega" ) ) ) || ( parent == EvtPDL::getId( std::string( "anti-B0" ) ) && daught == EvtPDL::getId( std::string( "omega" ) ) ) ) { - double ff0[] = {0.31, 0.30, 0.26, 0.24, 0.27, 0.27, 0.19}; - double sigma1[] = {0.59, 0.54, 0.73, 1.40, 0.60, 0.74, 1.42}; - double sigma2[] = {0.00, 0.00, 0.10, 0.50, 0.00, 0.19, 0.51}; - int eq_num[] = {9, 9, 10, 10, 9, 10, 10}; + double ff0[] = { 0.31, 0.30, 0.26, 0.24, 0.27, 0.27, 0.19 }; + double sigma1[] = { 0.59, 0.54, 0.73, 1.40, 0.60, 0.74, 1.42 }; + double sigma2[] = { 0.00, 0.00, 0.10, 0.50, 0.00, 0.19, 0.51 }; + int eq_num[] = { 9, 9, 10, 10, 9, 10, 10 }; double M_P2 = 5.27 * 5.27; // GeV^2 for B - meson double M_V2 = 5.32 * 5.32; // GeV^2 for B^* - meson @@ -362,10 +362,10 @@ daught == EvtPDL::getId( std::string( "phi" ) ) ) || ( parent == EvtPDL::getId( std::string( "anti-B_s0" ) ) && daught == EvtPDL::getId( std::string( "phi" ) ) ) ) { - double ff0[] = {0.44, 0.42, 0.34, 0.31, 0.38, 0.38, 0.26}; - double sigma1[] = {0.62, 0.55, 0.73, 1.30, 0.62, 0.83, 1.41}; - double sigma2[] = {0.20, 0.12, 0.42, 0.52, 0.20, 0.71, 0.57}; - int eq_num[] = {9, 9, 10, 10, 9, 10, 10}; + double ff0[] = { 0.44, 0.42, 0.34, 0.31, 0.38, 0.38, 0.26 }; + double sigma1[] = { 0.62, 0.55, 0.73, 1.30, 0.62, 0.83, 1.41 }; + double sigma2[] = { 0.20, 0.12, 0.42, 0.52, 0.20, 0.71, 0.57 }; + int eq_num[] = { 9, 9, 10, 10, 9, 10, 10 }; double M_P2 = 5.37 * 5.37; // GeV^2 for B^0_s - meson double M_V2 = 5.42 * 5.42; // GeV^2 for B^*_s - meson @@ -390,10 +390,10 @@ daught == EvtPDL::getId( std::string( "anti-K*0" ) ) ) || ( parent == EvtPDL::getId( std::string( "anti-B_s0" ) ) && daught == EvtPDL::getId( std::string( "K*0" ) ) ) ) { - double ff0[] = {0.38, 0.37, 0.29, 0.26, 0.32, 0.32, 0.23}; - double sigma1[] = {0.66, 0.60, 0.86, 1.32, 0.66, 0.98, 1.42}; - double sigma2[] = {0.30, 0.16, 0.60, 0.54, 0.31, 0.90, 0.62}; - int eq_num[] = {9, 9, 10, 10, 9, 10, 10}; + double ff0[] = { 0.38, 0.37, 0.29, 0.26, 0.32, 0.32, 0.23 }; + double sigma1[] = { 0.66, 0.60, 0.86, 1.32, 0.66, 0.98, 1.42 }; + double sigma2[] = { 0.30, 0.16, 0.60, 0.54, 0.31, 0.90, 0.62 }; + int eq_num[] = { 9, 9, 10, 10, 9, 10, 10 }; double M_P2 = 5.27 * 5.27; // GeV^2 for B - meson double M_V2 = 5.32 * 5.32; // GeV^2 for B^* - meson @@ -423,13 +423,13 @@ daught == EvtPDL::getId( std::string( "K_10" ) ) ) || ( parent == EvtPDL::getId( std::string( "anti-B0" ) ) && daught == EvtPDL::getId( std::string( "anti-K_10" ) ) ) ) { - double ff0A[] = {0.450, 0.340, 0.41, 0.22, 0.31, 0.310, 0.28}; - double sigma1A[] = {1.600, 0.635, 1.51, 2.40, 2.01, 0.629, 1.36}; - double sigma2A[] = {0.974, 0.211, 1.18, 1.78, 1.50, 0.387, 0.72}; - double ff0B[] = {-0.37, -0.29, -0.17, -0.45, -0.25, -0.250, -0.11}; - double sigma1B[] = {1.72, 0.729, 0.919, 1.34, 1.59, 0.378, -1.61}; - double sigma2B[] = {0.912, 0.074, 0.855, 0.69, 0.79, -0.755, 10.2}; - int eq_num[] = {10, 10, 10, 10, 10, 10, 10}; + double ff0A[] = { 0.450, 0.340, 0.41, 0.22, 0.31, 0.310, 0.28 }; + double sigma1A[] = { 1.600, 0.635, 1.51, 2.40, 2.01, 0.629, 1.36 }; + double sigma2A[] = { 0.974, 0.211, 1.18, 1.78, 1.50, 0.387, 0.72 }; + double ff0B[] = { -0.37, -0.29, -0.17, -0.45, -0.25, -0.250, -0.11 }; + double sigma1B[] = { 1.72, 0.729, 0.919, 1.34, 1.59, 0.378, -1.61 }; + double sigma2B[] = { 0.912, 0.074, 0.855, 0.69, 0.79, -0.755, 10.2 }; + int eq_num[] = { 10, 10, 10, 10, 10, 10, 10 }; double MM2 = 5.279 * 5.279; // GeV^2 double MB = 5.279; // GeV @@ -514,13 +514,13 @@ daught == EvtPDL::getId( std::string( "K'_10" ) ) ) || ( parent == EvtPDL::getId( std::string( "anti-B0" ) ) && daught == EvtPDL::getId( std::string( "anti-K'_10" ) ) ) ) { - double ff0A[] = {0.450, 0.340, 0.41, 0.22, 0.31, 0.310, 0.28}; - double sigma1A[] = {1.600, 0.635, 1.51, 2.40, 2.01, 0.629, 1.36}; - double sigma2A[] = {0.974, 0.211, 1.18, 1.78, 1.50, 0.387, 0.72}; - double ff0B[] = {-0.37, -0.29, -0.17, -0.45, -0.25, -0.250, -0.11}; - double sigma1B[] = {1.72, 0.729, 0.919, 1.34, 1.59, 0.378, -1.61}; - double sigma2B[] = {0.912, 0.074, 0.855, 0.69, 0.79, -0.755, 10.2}; - int eq_num[] = {10, 10, 10, 10, 10, 10, 10}; + double ff0A[] = { 0.450, 0.340, 0.41, 0.22, 0.31, 0.310, 0.28 }; + double sigma1A[] = { 1.600, 0.635, 1.51, 2.40, 2.01, 0.629, 1.36 }; + double sigma2A[] = { 0.974, 0.211, 1.18, 1.78, 1.50, 0.387, 0.72 }; + double ff0B[] = { -0.37, -0.29, -0.17, -0.45, -0.25, -0.250, -0.11 }; + double sigma1B[] = { 1.72, 0.729, 0.919, 1.34, 1.59, 0.378, -1.61 }; + double sigma2B[] = { 0.912, 0.074, 0.855, 0.69, 0.79, -0.755, 10.2 }; + int eq_num[] = { 10, 10, 10, 10, 10, 10, 10 }; double MM2 = 5.279 * 5.279; // GeV^2 double MB = 5.279; // GeV diff --git a/src/EvtGenModels/EvtbTosllNP.cpp b/src/EvtGenModels/EvtbTosllNP.cpp new file mode 100644 --- /dev/null +++ b/src/EvtGenModels/EvtbTosllNP.cpp @@ -0,0 +1,138 @@ + +/*********************************************************************** +* Copyright 1998-2020 CERN for the benefit of the EvtGen authors * +* * +* This file is part of EvtGen. * +* * +* EvtGen is free software: you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation, either version 3 of the License, or * +* (at your option) any later version. * +* * +* EvtGen is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with EvtGen. If not, see . * +***********************************************************************/ + +#include "EvtGenModels/EvtbTosllNP.hh" + +#include "EvtGenBase/EvtGenKine.hh" +#include "EvtGenBase/EvtPDL.hh" +#include "EvtGenBase/EvtParticle.hh" + +#include "EvtGenModels/EvtbTosllAmp.hh" +#include "EvtGenModels/EvtbTosllBSZFF.hh" +#include "EvtGenModels/EvtbTosllVectorAmpNP.hh" + +using std::endl; + +std::string EvtbTosllNP::getName() +{ + return "BTOSLLNP"; +} + +EvtDecayBase* EvtbTosllNP::clone() +{ + return new EvtbTosllNP; +} + +void EvtbTosllNP::decay( EvtParticle* p ) +{ + setWeight( p->initializePhaseSpace( getNDaug(), getDaugs(), false, + _poleSize, 1, 2 ) ); + _calcamp->CalcAmp( p, _amp2, _ffmodel.get() ); +} + +void EvtbTosllNP::initProbMax() +{ + EvtId pId = getParentId(), mId = getDaug( 0 ), l1Id = getDaug( 1 ), + l2Id = getDaug( 2 ); + //This routine sets the _poleSize. + double mymaxprob = _calcamp->CalcMaxProb( pId, mId, l1Id, l2Id, + _ffmodel.get(), _poleSize ); + setProbMax( mymaxprob ); +} + +void EvtbTosllNP::init() +{ + // First choose format of NP coefficients from the .DEC file + // Cartesian(x,y)(0) or Polar(R,phase)(1) + int n = getNArg(); + if ( !( n == 0 || ( n - 1 ) % 3 == 0 ) ) { + EvtGenReport( EVTGEN_ERROR, "EvtGen" ) + << "Error in parameters in the BTOSLLNP decay model." << endl; + EvtGenReport( EVTGEN_ERROR, "EvtGen" ) + << "Will terminate execution!" << endl; + ::abort(); + } + + checkNDaug( 3 ); + + //We expect the parent to be a scalar + //and the daughters to be K* lepton+ lepton- + + checkSpinParent( EvtSpinType::SCALAR ); + checkSpinDaughter( 1, EvtSpinType::DIRAC ); + checkSpinDaughter( 2, EvtSpinType::DIRAC ); + + EvtId mId = getDaug( 0 ); + EvtId IdKst0 = EvtPDL::getId( "K*0" ), IdaKst0 = EvtPDL::getId( "anti-K*0" ), + IdKstp = EvtPDL::getId( "K*+" ), IdKstm = EvtPDL::getId( "K*-" ); + if ( mId != IdKst0 && mId != IdaKst0 && mId != IdKstp && mId != IdKstm ) { + EvtGenReport( EVTGEN_ERROR, "EvtGen" ) + << "EvtbTosllNP generator expected a K* 1st daughter, found: " + << EvtPDL::name( getDaug( 0 ) ) << endl; + EvtGenReport( EVTGEN_ERROR, "EvtGen" ) + << "Will terminate execution!" << endl; + ::abort(); + } + + _ffmodel = std::make_unique(); + _calcamp = std::make_unique(); + + auto getInteger = [this]( int i ) -> int { + double a = getArg( i ); + if ( a - static_cast( a ) != 0 ) { + EvtGenReport( EVTGEN_ERROR, "EvtGen" ) + << "Parameters is not integer in the BTOSLLNP decay model: " << i + << " " << a << endl; + EvtGenReport( EVTGEN_ERROR, "EvtGen" ) + << "Will terminate execution!" << endl; + ::abort(); + } + return static_cast( a ); + }; + EvtbTosllVectorAmpNP* amp = static_cast( + _calcamp.get() ); + if ( n > 0 ) { // parse arguments + int i = 0, coordsyst = getInteger( i++ ); + while ( i < n ) { + int id = getInteger( i++ ); // New Physics cooeficient Id + double a0 = getArg( i++ ); + double a1 = getArg( i++ ); + EvtComplex c = ( coordsyst ) + ? EvtComplex( a0 * cos( a1 ), a0 * sin( a1 ) ) + : EvtComplex( a0, a1 ); + if ( id == 0 ) + amp->m_dc7 = c; // delta C_7eff + if ( id == 1 ) + amp->m_dc9 = c; // delta C_9eff + if ( id == 2 ) + amp->m_dc10 = c; // delta C_10eff + if ( id == 3 ) + amp->m_c7p = c; // C'_7eff -- right hand polarizations + if ( id == 4 ) + amp->m_c9p = c; // C'_9eff -- right hand polarizations + if ( id == 5 ) + amp->m_c10p = c; // c'_10eff -- right hand polarizations + if ( id == 6 ) + amp->m_cS = c; // (C_S - C'_S) -- scalar right and left polarizations + if ( id == 7 ) + amp->m_cP = c; // (C_P - C'_P) -- pseudo-scalar right and left polarizations + } + } +} diff --git a/src/EvtGenModels/EvtbTosllNPR.cpp b/src/EvtGenModels/EvtbTosllNPR.cpp new file mode 100644 --- /dev/null +++ b/src/EvtGenModels/EvtbTosllNPR.cpp @@ -0,0 +1,402 @@ + +/*********************************************************************** +* Copyright 1998-2020 CERN for the benefit of the EvtGen authors * +* * +* This file is part of EvtGen. * +* * +* EvtGen is free software: you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation, either version 3 of the License, or * +* (at your option) any later version. * +* * +* EvtGen is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with EvtGen. If not, see . * +***********************************************************************/ + +#include "EvtGenModels/EvtbTosllNPR.hh" + +#include "EvtGenBase/EvtGenKine.hh" +#include "EvtGenBase/EvtPDL.hh" +#include "EvtGenBase/EvtParticle.hh" +#include "EvtGenBase/EvtScalarParticle.hh" + +#include "EvtGenModels/EvtbTosllAmp.hh" +#include "EvtGenModels/EvtbTosllBSZFF.hh" +#include "EvtGenModels/EvtbTosllVectorAmpNP.hh" + +#include +#include +using std::endl; + +std::string EvtbTosllNPR::getName() +{ + return "BTOSLLNPR"; +} + +EvtDecayBase* EvtbTosllNPR::clone() +{ + return new EvtbTosllNPR; +} + +void EvtbTosllNPR::decay( EvtParticle* p ) +{ + static EvtVector4R p4[3]; + static double mass[3]; + double m_b = p->mass(); + for ( int i = 0; i < 3; i++ ) + mass[i] = p->getDaug( i )->mass(); + EvtId* daughters = getDaugs(); + double weight = EvtGenKine::PhaseSpacePole2( m_b, mass[2], mass[1], mass[0], + p4, _ls ); + p->getDaug( 0 )->init( daughters[0], p4[2] ); + p->getDaug( 1 )->init( daughters[1], p4[1] ); + p->getDaug( 2 )->init( daughters[2], p4[0] ); + setWeight( weight ); + _calcamp->CalcAmp( p, _amp2, _ffmodel.get() ); +} + +struct ABW_t { + double Mv2, MGv, A; + + ABW_t( double m, double gtot, double, double bll ) + { + const double alpha = 1 / 137.035999084; // (+-21) PDG 2021 + Mv2 = m * m; + MGv = m * gtot; + A = 3 * M_PI / ( alpha * alpha ) * bll * gtot; + } + + std::complex R( double s ) const + { + return A / std::complex( s - Mv2, MGv ); + } + + void addknots( std::vector& en ) const + { + double Mv = sqrt( Mv2 ), Gv = MGv / Mv; + double w = 0.6; + double smin = ( Mv - w * Gv ) * ( Mv - w * Gv ); + double smax = ( Mv + w * Gv ) * ( Mv + w * Gv ); + en.push_back( Mv * Mv ); + for ( int i = 0, n = 30; i < n; i++ ) { + double s = smin + ( smax - smin ) * ( i + 0.5 ) / n; + en.push_back( s ); + } + w = 2; + double smin1 = ( Mv - w * Gv ) * ( Mv - w * Gv ); + double smax1 = ( Mv + w * Gv ) * ( Mv + w * Gv ); + for ( int i = 0, n = 30; i < n; i++ ) { + double s = smin1 + ( smax1 - smin1 ) * ( i + 0.5 ) / n; + if ( s >= smin && s <= smax ) + continue; + en.push_back( s ); + } + w = 8; + double smin2 = ( Mv - w * Gv ) * ( Mv - w * Gv ); + double smax2 = ( Mv + w * Gv ) * ( Mv + w * Gv ); + for ( int i = 0, n = 30; i < n; i++ ) { + double s = smin2 + ( smax2 - smin2 ) * ( i + 0.5 ) / n; + if ( s >= smin1 && s <= smax1 ) + continue; + en.push_back( s ); + } + w = 30; + double smin3 = ( Mv - w * Gv ) * ( Mv - w * Gv ); + double smax3 = ( Mv + w * Gv ) * ( Mv + w * Gv ); + for ( int i = 0, n = 30; i < n; i++ ) { + double s = smin3 + ( smax3 - smin3 ) * ( i + 0.5 ) / n; + if ( s >= smin2 && s <= smax2 ) + continue; + en.push_back( s ); + } + w = 100; + double smin4 = ( Mv - w * Gv ) * ( Mv - w * Gv ); + double smax4 = ( Mv + w * Gv ) * ( Mv + w * Gv ); + for ( int i = 0, n = 20; i < n; i++ ) { + double s = smin4 + ( smax4 - smin4 ) * ( i + 0.5 ) / n; + if ( s >= smin3 && s <= smax3 ) + continue; + en.push_back( s ); + } + } +}; + +ABW_t ajpsi( 3.0969, 0.0926 / 1000, 0.0926 / 1000 * 0.877, 0.05971 ); +ABW_t apsi2s( 3.6861, 0.294 / 1000, 0.294 / 1000 * 0.9785, 0.00793 ); +ABW_t apsi3770( 3773.7 / 1000, 27.2 / 1000, 27.2 / 1000, 1e-5 ); +ABW_t apsi4040( 4039 / 1000., 80 / 1000., 80 / 1000., 1.07e-5 ); +ABW_t apsi4160( 4191 / 1000., 70 / 1000., 70 / 1000., 6.9e-6 ); +ABW_t apsi4230( 4220 / 1000., 60 / 1000., 60 / 1000., 1e-5 ); + +std::complex aR( double s ) +{ + return ajpsi.R( s ) + apsi2s.R( s ) + apsi3770.R( s ) + apsi4040.R( s ) + + apsi4160.R( s ) + apsi4230.R( s ); +} + +std::vector getgrid() +{ + const double m_c = 1.3, m_s = 0.2, m_e = 0.511e-3, MD0 = 1864.84 / 1000; + + std::vector v = { ajpsi, apsi2s, apsi3770, + apsi4040, apsi4160, apsi4230 }; + std::vector en; + for ( const auto& t : v ) + t.addknots( en ); + + double smax = 25; //4.37*4.37; + for ( unsigned i = 0, n = 200; i < n; i++ ) { + double s = smax / n * ( i + 0.5 ); + en.push_back( s ); + } + en.push_back( ajpsi.Mv2 + 0.1 ); + en.push_back( ajpsi.Mv2 - 0.1 ); + en.push_back( ajpsi.Mv2 + 0.08 ); + en.push_back( ajpsi.Mv2 - 0.08 ); + en.push_back( ajpsi.Mv2 + 0.065 ); + en.push_back( ajpsi.Mv2 - 0.065 ); + + double t0; + for ( t0 = 4 * m_e * m_e; t0 < 0.15; t0 *= 1.5 ) { + en.push_back( t0 ); + } + + for ( t0 = 4 * m_e * m_e; t0 < 0.5; t0 *= 1.5 ) { + en.push_back( 4 * MD0 * MD0 + t0 ); + en.push_back( 4 * MD0 * MD0 - t0 ); + } + + en.push_back( 4 * m_c * m_c ); + for ( t0 = 0.00125; t0 < 0.05; t0 *= 1.5 ) { + en.push_back( 4 * m_c * m_c + t0 ); + en.push_back( 4 * m_c * m_c - t0 ); + } + + en.push_back( 4 * m_s * m_s ); + for ( t0 = 0.00125; t0 < 0.1; t0 *= 1.5 ) { + en.push_back( 4 * m_s * m_s + t0 ); + en.push_back( 4 * m_s * m_s - t0 ); + } + + std::sort( en.begin(), en.end() ); + + for ( std::vector::iterator it = en.begin(); it != en.end(); it++ ) { + if ( *it > smax ) { + en.erase( it, en.end() ); + break; + } + } + return en; +} + +void EvtbTosllNPR::initProbMax() +{ + EvtId pId = getParentId(), mId = getDaug( 0 ), l1Id = getDaug( 1 ), + l2Id = getDaug( 2 ); + // //This routine sets the _poleSize. + // double mymaxprob = _calcamp->CalcMaxProb( pId, mId, l1Id, l2Id, _ffmodel.get(), _poleSize ); + // setProbMax( mymaxprob ); + + std::vector v = getgrid(); + std::vector pp; + EvtScalarParticle* scalar_part; + EvtParticle* root_part; + + scalar_part = new EvtScalarParticle; + + //cludge to avoid generating random numbers! + scalar_part->noLifeTime(); + + EvtVector4R p_init; + + p_init.set( EvtPDL::getMass( pId ), 0.0, 0.0, 0.0 ); + scalar_part->init( pId, p_init ); + root_part = (EvtParticle*)scalar_part; + root_part->setDiagonalSpinDensity(); + + EvtParticle *daughter, *lep1, *lep2; + + EvtAmp amp; + + EvtId listdaug[3]; + listdaug[0] = mId; + listdaug[1] = l1Id; + listdaug[2] = l2Id; + + amp.init( pId, 3, listdaug ); + + root_part->makeDaughters( 3, listdaug ); + daughter = root_part->getDaug( 0 ); + lep1 = root_part->getDaug( 1 ); + lep2 = root_part->getDaug( 2 ); + + //cludge to avoid generating random numbers! + daughter->noLifeTime(); + lep1->noLifeTime(); + lep2->noLifeTime(); + + //Initial particle is unpolarized, well it is a scalar so it is trivial + EvtSpinDensity rho; + rho.setDiag( root_part->getSpinStates() ); + + double mass[3]; + + double m = root_part->mass(); + + EvtVector4R p4meson, p4lepton1, p4lepton2, p4w; + + double maxprobfound = 0.0; + + mass[1] = EvtPDL::getMeanMass( l1Id ); + mass[2] = EvtPDL::getMeanMass( l2Id ); + std::vector mH; + mH.push_back( EvtPDL::getMeanMass( mId ) ); + //if the particle is narrow dont bother with changing the mass. + double g = EvtPDL::getWidth( mId ); + if ( g > 0 ) { + mH.push_back( EvtPDL::getMinMass( mId ) ); + mH.push_back( + std::min( EvtPDL::getMaxMass( mId ), m - mass[1] - mass[2] ) ); + mH.push_back( mH.front() - g ); + mH.push_back( mH.front() + g ); + } + + double q2min = ( mass[1] + mass[2] ) * ( mass[1] + mass[2] ); + + double m0 = EvtPDL::getMinMass( mId ); + double q2max = ( m - m0 ) * ( m - m0 ); + m0 = mH[0]; + //loop over q2 + for ( double q2 : v ) { + // want to avoid picking up the tail of the photon propagator + if ( !( q2min <= q2 && q2 < q2max ) ) + continue; + double Erho = ( m * m + m0 * m0 - q2 ) / ( 2.0 * m ), + Prho = sqrt( ( Erho - m0 ) * ( Erho + m0 ) ); + + p4meson.set( Erho, 0.0, 0.0, -Prho ); + p4w.set( m - Erho, 0.0, 0.0, Prho ); + + //This is in the W rest frame + double Elep = sqrt( q2 ) * 0.5, + Plep = sqrt( Elep * Elep - mass[1] * mass[1] ); + + const int nj = 3 + 2 + 4 + 8 + 32; + double cmin = -1, cmax = 1, dc = ( cmax - cmin ) / ( nj - 1 ); + double maxprob = 0; + for ( int j = 0; j < nj; j++ ) { + double c = cmin + dc * j; + + //These are in the W rest frame. Need to boost out into the B frame. + double Py = Plep * sqrt( 1.0 - c * c ), Pz = Plep * c; + p4lepton1.set( Elep, 0.0, Py, Pz ); + p4lepton2.set( Elep, 0.0, -Py, -Pz ); + + p4lepton1 = boostTo( p4lepton1, p4w ); + p4lepton2 = boostTo( p4lepton2, p4w ); + + //Now initialize the daughters... + daughter->init( mId, p4meson ); + lep1->init( l1Id, p4lepton1 ); + lep2->init( l2Id, p4lepton2 ); + _calcamp->CalcAmp( root_part, amp, _ffmodel.get() ); + double prob = rho.normalizedProb( amp.getSpinDensity() ); + maxprob = std::max( maxprob, prob ); + } + // printf("%f %f\n",q2,maxprob); + pp.push_back( { (float)q2, (float)maxprob } ); + maxprobfound = std::max( maxprobfound, maxprob ); + } + root_part->deleteTree(); + + _ls.init( pp ); + maxprobfound *= 8e-8; + setProbMax( maxprobfound ); +} + +void EvtbTosllNPR::init() +{ + // First choose format of NP coefficients from the .DEC file + // Cartesian(x,y)(0) or Polar(R,phase)(1) + int n = getNArg(); + checkNDaug( 3 ); + + //We expect the parent to be a scalar + //and the daughters to be K* lepton+ lepton- + + checkSpinParent( EvtSpinType::SCALAR ); + checkSpinDaughter( 1, EvtSpinType::DIRAC ); + checkSpinDaughter( 2, EvtSpinType::DIRAC ); + + EvtId mId = getDaug( 0 ); + EvtId IdKst0 = EvtPDL::getId( "K*0" ), IdaKst0 = EvtPDL::getId( "anti-K*0" ), + IdKstp = EvtPDL::getId( "K*+" ), IdKstm = EvtPDL::getId( "K*-" ); + if ( mId != IdKst0 && mId != IdaKst0 && mId != IdKstp && mId != IdKstm ) { + EvtGenReport( EVTGEN_ERROR, "EvtGen" ) + << "EvtbTosllNPR generator expected a K* 1st daughter, found: " + << EvtPDL::name( getDaug( 0 ) ) << endl; + EvtGenReport( EVTGEN_ERROR, "EvtGen" ) + << "Will terminate execution!" << endl; + ::abort(); + } + + _ffmodel = std::make_unique(); + _calcamp = std::make_unique(); + + auto getInteger = [this]( int i ) -> int { + double a = getArg( i ); + if ( a - static_cast( a ) != 0 ) { + EvtGenReport( EVTGEN_ERROR, "EvtGen" ) + << "Parameters is not integer in the BTOSLLNPR decay model: " << i + << " " << a << endl; + EvtGenReport( EVTGEN_ERROR, "EvtGen" ) + << "Will terminate execution!" << endl; + ::abort(); + } + return static_cast( a ); + }; + EvtbTosllVectorAmpNP* amp = static_cast( + _calcamp.get() ); + double phi = 0; + if ( n > 0 ) { // parse arguments + int i = 0, coordsyst = getInteger( i++ ); + auto getcomplex = [this, &i, coordsyst]() -> EvtComplex { + double a0 = getArg( i++ ); + double a1 = getArg( i++ ); + return ( coordsyst ) ? EvtComplex( a0 * cos( a1 ), a0 * sin( a1 ) ) + : EvtComplex( a0, a1 ); + }; + auto getreal = [this, &i]() -> double { return getArg( i++ ); }; + while ( i < n ) { + int id = getInteger( i++ ); // New Physics cooeficient Id + if ( id == 0 ) + amp->m_dc7 = getcomplex(); // delta C_7eff + if ( id == 1 ) + amp->m_dc9 = getcomplex(); // delta C_9eff + if ( id == 2 ) + amp->m_dc10 = getcomplex(); // delta C_10eff + if ( id == 3 ) + amp->m_c7p = getcomplex(); // C'_7eff -- right hand polarizations + if ( id == 4 ) + amp->m_c9p = getcomplex(); // C'_9eff -- right hand polarizations + if ( id == 5 ) + amp->m_c10p = getcomplex(); // c'_10eff -- right hand polarizations + if ( id == 6 ) + amp->m_cS = getcomplex(); // (C_S - C'_S) -- scalar right and left polarizations + if ( id == 7 ) + amp->m_cP = getcomplex(); // (C_P - C'_P) -- pseudo-scalar right and left polarizations + if ( id == 10 ) + phi = getreal(); + } + } + + std::vector v = getgrid(); + std::complex eiphi = std::complex( cos( phi ), sin( phi ) ); + for ( auto t : v ) + amp->m_reso.push_back( std::make_pair( t, -aR( t ) * eiphi ) ); +} diff --git a/src/EvtGenModels/EvtbTosllScalarAmpNew.cpp b/src/EvtGenModels/EvtbTosllScalarAmpNew.cpp --- a/src/EvtGenModels/EvtbTosllScalarAmpNew.cpp +++ b/src/EvtGenModels/EvtbTosllScalarAmpNew.cpp @@ -294,8 +294,8 @@ int charge1 = EvtPDL::chg3( parent->getDaug( 1 )->getId() ); int charge2 = EvtPDL::chg3( parent->getDaug( 2 )->getId() ); - EvtParticle* lepPlus = 0; - EvtParticle* lepMinus = 0; + EvtParticle* lepPlus = nullptr; + EvtParticle* lepMinus = nullptr; lepPlus = ( charge1 > charge2 ) ? parent->getDaug( 1 ) : parent->getDaug( 2 ); lepMinus = ( charge1 < charge2 ) ? parent->getDaug( 1 ) diff --git a/src/EvtGenModels/EvtbTosllScalarAmpNewExt.cpp b/src/EvtGenModels/EvtbTosllScalarAmpNewExt.cpp --- a/src/EvtGenModels/EvtbTosllScalarAmpNewExt.cpp +++ b/src/EvtGenModels/EvtbTosllScalarAmpNewExt.cpp @@ -291,8 +291,8 @@ int charge1 = EvtPDL::chg3( parent->getDaug( 1 )->getId() ); int charge2 = EvtPDL::chg3( parent->getDaug( 2 )->getId() ); - EvtParticle* lepPlus = 0; - EvtParticle* lepMinus = 0; + EvtParticle* lepPlus = nullptr; + EvtParticle* lepMinus = nullptr; lepPlus = ( charge1 > charge2 ) ? parent->getDaug( 1 ) : parent->getDaug( 2 ); lepMinus = ( charge1 < charge2 ) ? parent->getDaug( 1 ) diff --git a/src/EvtGenModels/EvtbTosllVectorAmp.cpp b/src/EvtGenModels/EvtbTosllVectorAmp.cpp --- a/src/EvtGenModels/EvtbTosllVectorAmp.cpp +++ b/src/EvtGenModels/EvtbTosllVectorAmp.cpp @@ -131,8 +131,8 @@ static EvtIdSet bmesons( "B-", "anti-B0", "anti-B_s0" ); static EvtIdSet bbarmesons( "B+", "B0", "B_s0" ); - EvtParticle* lepPlus = 0; - EvtParticle* lepMinus = 0; + EvtParticle* lepPlus = nullptr; + EvtParticle* lepMinus = nullptr; int charge1 = EvtPDL::chg3( parent->getDaug( 1 )->getId() ); int charge2 = EvtPDL::chg3( parent->getDaug( 2 )->getId() ); diff --git a/src/EvtGenModels/EvtbTosllVectorAmpNP.cpp b/src/EvtGenModels/EvtbTosllVectorAmpNP.cpp new file mode 100644 --- /dev/null +++ b/src/EvtGenModels/EvtbTosllVectorAmpNP.cpp @@ -0,0 +1,250 @@ + +/*********************************************************************** +* Copyright 1998-2020 CERN for the benefit of the EvtGen authors * +* * +* This file is part of EvtGen. * +* * +* EvtGen is free software: you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation, either version 3 of the License, or * +* (at your option) any later version. * +* * +* EvtGen is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with EvtGen. If not, see . * +***********************************************************************/ + +#include "EvtGenModels/EvtbTosllVectorAmpNP.hh" + +#include "EvtGenBase/EvtAmp.hh" +#include "EvtGenBase/EvtDiracSpinor.hh" +#include "EvtGenBase/EvtId.hh" +#include "EvtGenBase/EvtPDL.hh" +#include "EvtGenBase/EvtParticle.hh" +#include "EvtGenBase/EvtTensor4C.hh" +#include "EvtGenBase/EvtVector4C.hh" + +#include "EvtGenModels/EvtbTosllAmp.hh" +#include "EvtGenModels/EvtbTosllFF.hh" + +#include +#include + +static std::complex h( double q2, double mq ) +{ + const double mu = 4.8; // mu = m_b = 4.8 GeV + if ( mq == 0.0 ) + return std::complex( 8. / 27 + 4. / 9 * log( mu * mu / q2 ), + 4. / 9 * M_PI ); + double z = 4 * mq * mq / q2; + std::complex t; + if ( z > 1 ) { + t = atan( 1 / sqrt( z - 1 ) ); + } else { + t = std::complex( log( ( 1 + sqrt( 1 - z ) ) / sqrt( z ) ), + -M_PI / 2 ); + } + return -4 / 9. * ( 2 * log( mq / mu ) - 2 / 3. - z ) - + ( 4 / 9. * ( 2 + z ) * sqrt( fabs( z - 1 ) ) ) * t; +} + +static EvtComplex C9( double q2, + std::complex hReso = std::complex( 0, 0 ) ) +{ + double m_c = 1.3, m_b = 4.8; // quark masses + + double C1 = -0.257, C2 = 1.009, C3 = -0.005, C4 = -0.078, C5 = 0, C6 = 0.001; + + std::complex Y = ( h( q2, m_c ) + hReso ) * + ( 4 / 3. * C1 + C2 + 6 * C3 + 60 * C5 ); + Y -= 0.5 * h( q2, m_b ) * ( 7 * C3 + 4 / 3. * C4 + 76 * C5 + 64 / 3. * C6 ); + Y -= 0.5 * h( q2, 0.0 ) * ( C3 + 4 / 3. * C4 + 16 * C5 + 64 / 3. * C6 ); + Y += 4 / 3. * C3 + 64 / 9. * C5 + 64 / 27. * C6; + return EvtComplex( 4.211 + real( Y ), imag( Y ) ); +} + +static std::complex interpol( + const std::vector>>& v, double s ) +{ + if ( !v.size() ) + return 0; + int j = std::lower_bound( v.begin(), v.end(), s, + []( const std::pair>& a, + float b ) { return a.first < b; } ) - + v.begin(); + + double dx = v[j].first - v[j - 1].first; + auto dy = v[j].second - v[j - 1].second; + return v[j - 1].second + ( s - v[j - 1].first ) * ( dy / dx ); +} + +static EvtId IdB0, IdaB0, IdBp, IdBm, IdBs, IdaBs, IdRhop, IdRhom, IdRho0, + IdOmega, IdKst0, IdaKst0, IdKstp, IdKstm; +static bool cafirst = true; +void EvtbTosllVectorAmpNP::CalcAmp( EvtParticle* parent, EvtAmp& amp, + EvtbTosllFF* formFactors ) +{ + if ( cafirst ) { + cafirst = false; + IdB0 = EvtPDL::getId( "B0" ); + IdaB0 = EvtPDL::getId( "anti-B0" ); + IdBp = EvtPDL::getId( "B+" ); + IdBm = EvtPDL::getId( "B-" ); + IdBs = EvtPDL::getId( "B_s0" ); + IdaBs = EvtPDL::getId( "anti-B_s0" ); + IdRhop = EvtPDL::getId( "rho+" ); + IdRhom = EvtPDL::getId( "rho-" ); + IdRho0 = EvtPDL::getId( "rho0" ); + IdOmega = EvtPDL::getId( "omega" ); + IdKst0 = EvtPDL::getId( "K*0" ); + IdaKst0 = EvtPDL::getId( "anti-K*0" ); + IdKstp = EvtPDL::getId( "K*+" ); + IdKstm = EvtPDL::getId( "K*-" ); + } + + // Add the lepton and neutrino 4 momenta to find q2 + EvtId pId = parent->getId(); + EvtId dId = parent->getDaug( 0 )->getId(); + EvtVector4R q = parent->getDaug( 1 )->getP4() + parent->getDaug( 2 )->getP4(); + double q2 = q.mass2(); + double mesonmass = parent->getDaug( 0 )->mass(); + + double a1, a2, a0, v, t1, t2, t3; // form factors + formFactors->getVectorFF( pId, dId, q2, mesonmass, a1, a2, a0, v, t1, t2, t3 ); + + const EvtVector4R& p4meson = parent->getDaug( 0 )->getP4(); + double pmass = parent->mass(), ipmass = 1 / pmass; + const EvtVector4R p4b( pmass, 0.0, 0.0, 0.0 ); + EvtVector4R pbhat = p4b * ipmass; + EvtVector4R qhat = q * ipmass; + EvtVector4R pkstarhat = p4meson * ipmass; + EvtVector4R phat = pbhat + pkstarhat; + + EvtComplex c7 = -0.304; + EvtComplex c9 = C9( q2, interpol( m_reso, q2 ) ); + EvtComplex c10 = -4.103; + c7 += m_dc7; + c9 += m_dc9; + c10 += m_dc10; + + EvtComplex I( 0.0, 1.0 ); + + double mb = 4.8 /*GeV/c^2*/ * ipmass, ms = 0.093 /*GeV/c^2*/ * ipmass; + double mH = mesonmass * ipmass, oamH = 1 + mH, osmH = 1 - mH, + osmH2 = oamH * osmH, iosmH2 = 1 / osmH2; // mhatkstar + double is = pmass * pmass / q2; // 1/shat + a1 *= oamH; + a2 *= osmH; + a0 *= 2 * mH; + double cs0 = ( a1 - a2 - a0 ) * is; + a2 *= iosmH2; + v *= 2 / oamH; + + EvtComplex a = ( c9 + m_c9p ) * v + ( c7 + m_c7p ) * ( 4 * mb * is * t1 ); + EvtComplex b = ( c9 - m_c9p ) * a1 + + ( c7 - m_c7p ) * ( 2 * mb * is * osmH2 * t2 ); + EvtComplex c = ( c9 - m_c9p ) * a2 + + ( c7 - m_c7p ) * ( 2 * mb * ( t3 * iosmH2 + t2 * is ) ); + EvtComplex d = ( c9 - m_c9p ) * cs0 - ( c7 - m_c7p ) * ( 2 * mb * is * t3 ); + EvtComplex e = ( c10 + m_c10p ) * v; + EvtComplex f = ( c10 - m_c10p ) * a1; + EvtComplex g = ( c10 - m_c10p ) * a2; + EvtComplex h = ( c10 - m_c10p ) * cs0; + double sscale = a0 / ( mb + ms ); + EvtComplex hs = m_cS * sscale, hp = m_cP * sscale; + + int charge1 = EvtPDL::chg3( parent->getDaug( 1 )->getId() ); + + EvtParticle* lepPos = ( charge1 > 0 ) ? parent->getDaug( 1 ) + : parent->getDaug( 2 ); + EvtParticle* lepNeg = ( charge1 < 0 ) ? parent->getDaug( 1 ) + : parent->getDaug( 2 ); + + EvtDiracSpinor lp0( lepPos->spParent( 0 ) ), lp1( lepPos->spParent( 1 ) ); + EvtDiracSpinor lm0( lepNeg->spParent( 0 ) ), lm1( lepNeg->spParent( 1 ) ); + + EvtVector4C l11, l12, l21, l22, a11, a12, a21, a22; + EvtComplex s11, s12, s21, s22, p11, p12, p21, p22; + EvtTensor4C tt0( EvtGenFunctions::asymProd( pbhat, pkstarhat ) ); + + EvtTensor4C T1( tt0 ), T2( tt0 ); + const EvtTensor4C& gmn = EvtTensor4C::g(); + EvtTensor4C tt1( EvtGenFunctions::directProd( pbhat, phat ) ); + EvtTensor4C tt2( EvtGenFunctions::directProd( pbhat, qhat ) ); + + b *= I; + c *= I; + d *= I; + f *= I; + g *= I; + h *= I; + if ( pId == IdBm || pId == IdaB0 || pId == IdaBs ) { + T1 *= a; + T1.addScaled( -b, gmn ); + T1.addScaled( c, tt1 ); + T1.addScaled( d, tt2 ); + T2 *= e; + T2.addScaled( -f, gmn ); + T2.addScaled( g, tt1 ); + T2.addScaled( h, tt2 ); + + EvtLeptonVandACurrents( l11, a11, lp0, lm0 ); + EvtLeptonVandACurrents( l21, a21, lp1, lm0 ); + EvtLeptonVandACurrents( l12, a12, lp0, lm1 ); + EvtLeptonVandACurrents( l22, a22, lp1, lm1 ); + + s11 = EvtLeptonSCurrent( lp0, lm0 ); + p11 = EvtLeptonPCurrent( lp0, lm0 ); + s21 = EvtLeptonSCurrent( lp1, lm0 ); + p21 = EvtLeptonPCurrent( lp1, lm0 ); + s12 = EvtLeptonSCurrent( lp0, lm1 ); + p12 = EvtLeptonPCurrent( lp0, lm1 ); + s22 = EvtLeptonSCurrent( lp1, lm1 ); + p22 = EvtLeptonPCurrent( lp1, lm1 ); + } else if ( pId == IdBp || pId == IdB0 || pId == IdBs ) { + T1 *= -a; + T1.addScaled( -b, gmn ); + T1.addScaled( c, tt1 ); + T1.addScaled( d, tt2 ); + T2 *= -e; + T2.addScaled( -f, gmn ); + T2.addScaled( g, tt1 ); + T2.addScaled( h, tt2 ); + + EvtLeptonVandACurrents( l11, a11, lp1, lm1 ); + EvtLeptonVandACurrents( l21, a21, lp0, lm1 ); + EvtLeptonVandACurrents( l12, a12, lp1, lm0 ); + EvtLeptonVandACurrents( l22, a22, lp0, lm0 ); + + s11 = EvtLeptonSCurrent( lp1, lm1 ); + p11 = EvtLeptonPCurrent( lp1, lm1 ); + s21 = EvtLeptonSCurrent( lp0, lm1 ); + p21 = EvtLeptonPCurrent( lp0, lm1 ); + s12 = EvtLeptonSCurrent( lp1, lm0 ); + p12 = EvtLeptonPCurrent( lp1, lm0 ); + s22 = EvtLeptonSCurrent( lp0, lm0 ); + p22 = EvtLeptonPCurrent( lp0, lm0 ); + } else { + EvtGenReport( EVTGEN_ERROR, "EvtGen" ) << "Wrong lepton number\n"; + T1.zero(); + T2.zero(); // Set all tensor terms to zero. + } + + for ( int i = 0; i < 3; i++ ) { + EvtVector4C eps = parent->getDaug( 0 )->epsParent( i ).conj(); + + EvtVector4C E1 = T1.cont1( eps ); + EvtVector4C E2 = T2.cont1( eps ); + + EvtComplex epsq = I * ( eps * q ), epsqs = epsq * hs, epsqp = epsq * hp; + + amp.vertex( i, 0, 0, l11 * E1 + a11 * E2 - s11 * epsqs - p11 * epsqp ); + amp.vertex( i, 0, 1, l12 * E1 + a12 * E2 - s12 * epsqs - p12 * epsqp ); + amp.vertex( i, 1, 0, l21 * E1 + a21 * E2 - s21 * epsqs - p21 * epsqp ); + amp.vertex( i, 1, 1, l22 * E1 + a22 * E2 - s22 * epsqs - p22 * epsqp ); + } +} diff --git a/src/EvtGenModels/EvtbTosllVectorAmpNew.cpp b/src/EvtGenModels/EvtbTosllVectorAmpNew.cpp --- a/src/EvtGenModels/EvtbTosllVectorAmpNew.cpp +++ b/src/EvtGenModels/EvtbTosllVectorAmpNew.cpp @@ -329,8 +329,8 @@ int charge1 = EvtPDL::chg3( parent->getDaug( 1 )->getId() ); int charge2 = EvtPDL::chg3( parent->getDaug( 2 )->getId() ); - EvtParticle* lepPlus = 0; - EvtParticle* lepMinus = 0; + EvtParticle* lepPlus = nullptr; + EvtParticle* lepMinus = nullptr; lepPlus = ( charge1 > charge2 ) ? parent->getDaug( 1 ) : parent->getDaug( 2 ); lepMinus = ( charge1 < charge2 ) ? parent->getDaug( 1 ) diff --git a/src/EvtGenModels/EvtbTosllVectorAmpNewExt.cpp b/src/EvtGenModels/EvtbTosllVectorAmpNewExt.cpp --- a/src/EvtGenModels/EvtbTosllVectorAmpNewExt.cpp +++ b/src/EvtGenModels/EvtbTosllVectorAmpNewExt.cpp @@ -336,8 +336,8 @@ int charge1 = EvtPDL::chg3( parent->getDaug( 1 )->getId() ); int charge2 = EvtPDL::chg3( parent->getDaug( 2 )->getId() ); - EvtParticle* lepPlus = 0; - EvtParticle* lepMinus = 0; + EvtParticle* lepPlus = nullptr; + EvtParticle* lepMinus = nullptr; lepPlus = ( charge1 > charge2 ) ? parent->getDaug( 1 ) : parent->getDaug( 2 ); lepMinus = ( charge1 < charge2 ) ? parent->getDaug( 1 ) diff --git a/src/EvtGenModels/EvtbTosllWilsCoeffNLO.cpp b/src/EvtGenModels/EvtbTosllWilsCoeffNLO.cpp --- a/src/EvtGenModels/EvtbTosllWilsCoeffNLO.cpp +++ b/src/EvtGenModels/EvtbTosllWilsCoeffNLO.cpp @@ -45,8 +45,8 @@ { double as, ll; double b0, b1, b2; /* terms in the series of the beta-function */ - double alpha_strong[] = {0.1156, 0.1176, 0.1196}; /* at M_Z scale */ - double MZ = 91.19; /* in GeV */ + double alpha_strong[] = { 0.1156, 0.1176, 0.1196 }; /* at M_Z scale */ + double MZ = 91.19; /* in GeV */ b0 = 11. - 2. * ( (double)Nf ) / 3.; b1 = 51. - 19. * ( (double)Nf ) / 3.; @@ -113,9 +113,9 @@ double asmu; /* the strong coupling constant at the scale mu */ int i; - double a[] = {14.0 / 23.0, 16.0 / 23.0, 6.0 / 23.0, -12.0 / 23.0, - 0.4086, -0.4230, -0.8994, 0.1456}; - double k1[] = {0.0, 0.0, 0.5, -0.5, 0.0, 0.0, 0.0, 0.0}; + double a[] = { 14.0 / 23.0, 16.0 / 23.0, 6.0 / 23.0, -12.0 / 23.0, + 0.4086, -0.4230, -0.8994, 0.1456 }; + double k1[] = { 0.0, 0.0, 0.5, -0.5, 0.0, 0.0, 0.0, 0.0 }; asW = As( Mw, Nf, ias ); asmu = As( mu, Nf, ias ); @@ -141,9 +141,9 @@ double asmu; /* the strong coupling constant at the scale mu */ int i; - double a[] = {14.0 / 23.0, 16.0 / 23.0, 6.0 / 23.0, -12.0 / 23.0, - 0.4086, -0.4230, -0.8994, 0.1456}; - double k2[] = {0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 0.0}; + double a[] = { 14.0 / 23.0, 16.0 / 23.0, 6.0 / 23.0, -12.0 / 23.0, + 0.4086, -0.4230, -0.8994, 0.1456 }; + double k2[] = { 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 0.0 }; asW = As( Mw, Nf, ias ); asmu = As( mu, Nf, ias ); @@ -169,10 +169,10 @@ double asmu; /* the strong coupling constant at the scale mu */ int i; - double a[] = {14.0 / 23.0, 16.0 / 23.0, 6.0 / 23.0, -12.0 / 23.0, - 0.4086, -0.4230, -0.8994, 0.1456}; - double k3[] = {0.0, 0.0, -1.0 / 14.0, 1.0 / 6.0, - 0.0510, -0.1403, -0.0113, 0.0054}; + double a[] = { 14.0 / 23.0, 16.0 / 23.0, 6.0 / 23.0, -12.0 / 23.0, + 0.4086, -0.4230, -0.8994, 0.1456 }; + double k3[] = { 0.0, 0.0, -1.0 / 14.0, 1.0 / 6.0, + 0.0510, -0.1403, -0.0113, 0.0054 }; asW = As( Mw, Nf, ias ); asmu = As( mu, Nf, ias ); @@ -198,10 +198,10 @@ double asmu; /* the strong coupling constant at the scale mu */ int i; - double a[] = {14.0 / 23.0, 16.0 / 23.0, 6.0 / 23.0, -12.0 / 23.0, - 0.4086, -0.4230, -0.8994, 0.1456}; - double k4[] = {0.0, 0.0, -1.0 / 14.0, -1.0 / 6.0, - 0.0984, 0.1214, 0.0156, 0.0026}; + double a[] = { 14.0 / 23.0, 16.0 / 23.0, 6.0 / 23.0, -12.0 / 23.0, + 0.4086, -0.4230, -0.8994, 0.1456 }; + double k4[] = { 0.0, 0.0, -1.0 / 14.0, -1.0 / 6.0, + 0.0984, 0.1214, 0.0156, 0.0026 }; asW = As( Mw, Nf, ias ); asmu = As( mu, Nf, ias ); @@ -227,9 +227,9 @@ double asmu; /* the strong coupling constant at the scale mu */ int i; - double a[] = {14.0 / 23.0, 16.0 / 23.0, 6.0 / 23.0, -12.0 / 23.0, - 0.4086, -0.4230, -0.8994, 0.1456}; - double k5[] = {0.0, 0.0, 0.0, 0.0, -0.0397, 0.0117, -0.0025, 0.0304}; + double a[] = { 14.0 / 23.0, 16.0 / 23.0, 6.0 / 23.0, -12.0 / 23.0, + 0.4086, -0.4230, -0.8994, 0.1456 }; + double k5[] = { 0.0, 0.0, 0.0, 0.0, -0.0397, 0.0117, -0.0025, 0.0304 }; asW = As( Mw, Nf, ias ); asmu = As( mu, Nf, ias ); @@ -255,9 +255,9 @@ double asmu; /* the strong coupling constant at the scale mu */ int i; - double a[] = {14.0 / 23.0, 16.0 / 23.0, 6.0 / 23.0, -12.0 / 23.0, - 0.4086, -0.4230, -0.8994, 0.1456}; - double k6[] = {0.0, 0.0, 0.0, 0.0, 0.0335, 0.0239, -0.0462, -0.0112}; + double a[] = { 14.0 / 23.0, 16.0 / 23.0, 6.0 / 23.0, -12.0 / 23.0, + 0.4086, -0.4230, -0.8994, 0.1456 }; + double k6[] = { 0.0, 0.0, 0.0, 0.0, 0.0335, 0.0239, -0.0462, -0.0112 }; asW = As( Mw, Nf, ias ); asmu = As( mu, Nf, ias ); @@ -379,10 +379,10 @@ double asW, asmu; int i; - double a[] = {14.0 / 23.0, 16.0 / 23.0, 6.0 / 23.0, -12.0 / 23.0, - 0.4086, -0.4230, -0.8994, 0.1456}; - double h[] = {2.2996, -1.0880, -3.0 / 7.0, -1.0 / 14.0, - -0.6494, -0.0380, -0.0186, -0.0057}; + double a[] = { 14.0 / 23.0, 16.0 / 23.0, 6.0 / 23.0, -12.0 / 23.0, + 0.4086, -0.4230, -0.8994, 0.1456 }; + double h[] = { 2.2996, -1.0880, -3.0 / 7.0, -1.0 / 14.0, + -0.6494, -0.0380, -0.0186, -0.0057 }; x = pow( mt / Mw, 2.0 ); asW = As( Mw, Nf, ias ); @@ -420,9 +420,9 @@ double Pee; int i; - double a[] = {14.0 / 23.0, 16.0 / 23.0, 6.0 / 23.0, -12.0 / 23.0, - 0.4086, -0.4230, -0.8994, 0.1456}; - double q[] = {0.0, 0.0, 0.0, 0.0, 0.0318, 0.0918, -0.2700, 0.0059}; + double a[] = { 14.0 / 23.0, 16.0 / 23.0, 6.0 / 23.0, -12.0 / 23.0, + 0.4086, -0.4230, -0.8994, 0.1456 }; + double q[] = { 0.0, 0.0, 0.0, 0.0, 0.0318, 0.0918, -0.2700, 0.0059 }; sum = 0.0; i = 0; @@ -444,12 +444,14 @@ double sum; int i; - double a[] = {14.0 / 23.0, 16.0 / 23.0, 6.0 / 23.0, -12.0 / 23.0, - 0.4086, -0.4230, -0.8994, 0.1456}; - double p[] = {0.0, 0.0, -80.0 / 203.0, 8.0 / 33.0, - 0.0433, 0.1384, 0.1648, -0.0073}; - double r[] = {0.0, 0.0, 0.8966, -0.1960, -0.2011, 0.1328, -0.0292, -0.1858}; - double s[] = {0.0, 0.0, -0.2009, -0.3579, 0.0490, -0.3616, -0.3554, 0.0072}; + double a[] = { 14.0 / 23.0, 16.0 / 23.0, 6.0 / 23.0, -12.0 / 23.0, + 0.4086, -0.4230, -0.8994, 0.1456 }; + double p[] = { 0.0, 0.0, -80.0 / 203.0, 8.0 / 33.0, + 0.0433, 0.1384, 0.1648, -0.0073 }; + double r[] = { 0.0, 0.0, 0.8966, -0.1960, + -0.2011, 0.1328, -0.0292, -0.1858 }; + double s[] = { 0.0, 0.0, -0.2009, -0.3579, + 0.0490, -0.3616, -0.3554, 0.0072 }; sum = 0.0; i = 0; diff --git a/src/EvtGenModels/Evtbs2llGammaAmp.cpp b/src/EvtGenModels/Evtbs2llGammaAmp.cpp --- a/src/EvtGenModels/Evtbs2llGammaAmp.cpp +++ b/src/EvtGenModels/Evtbs2llGammaAmp.cpp @@ -105,8 +105,8 @@ ::abort(); } - EvtParticle* lepPlus = 0; - EvtParticle* lepMinus = 0; + EvtParticle* lepPlus = nullptr; + EvtParticle* lepMinus = nullptr; lepPlus = ( charge1 > charge2 ) ? parent->getDaug( il1 ) diff --git a/src/EvtGenModels/Evtbs2llGammaFFMNT.cpp b/src/EvtGenModels/Evtbs2llGammaFFMNT.cpp --- a/src/EvtGenModels/Evtbs2llGammaFFMNT.cpp +++ b/src/EvtGenModels/Evtbs2llGammaFFMNT.cpp @@ -58,11 +58,11 @@ EvtComplex unit0( 0.0, 0.0 ); // complex zero unit // characteristics of resonances rho, omega, phi - double M_res[] = {0.7758, 0.78259, 1.019456}; // particle masses, Gev - double Gamma[] = {0.1503, 0.00849, 0.00426}; // particle widthes, Gev + double M_res[] = { 0.7758, 0.78259, 1.019456 }; // particle masses, Gev + double Gamma[] = { 0.1503, 0.00849, 0.00426 }; // particle widthes, Gev - double f_lept[] = {5.04, 17.1, -13.2}; // decay constants f_i - double g_plus[] = {0.27, -0.27, -0.38}; // and form-factors g+(0) + double f_lept[] = { 5.04, 17.1, -13.2 }; // decay constants f_i + double g_plus[] = { 0.27, -0.27, -0.38 }; // and form-factors g+(0) g_plus[0] = g_plus[0] / sqrt( 2.0 ); // by D.Melikhov, N.Nikitin, K.Toms, g_plus[1] = g_plus[1] / sqrt( 2.0 ); // Phys.At.Nucl. 68, p.1842 (2005) @@ -72,8 +72,8 @@ // parametrs for form-factors Fv, Ftv, Fa, Fta //(by D.Melikhov, N.Nikitin, K.Toms, Yad. Fiz. 62, No 11) - double beta[] = {0.28, 0.30, 0.26, 0.33}; // beta, Gev^(-1) - double Delta[] = {0.04, 0.04, 0.30, 0.30}; // Delta, Gev + double beta[] = { 0.28, 0.30, 0.26, 0.33 }; // beta, Gev^(-1) + double Delta[] = { 0.04, 0.04, 0.30, 0.30 }; // Delta, Gev // form-factors EvtComplex Ftvq0, Ftaq0, Ftv00, Fta00; diff --git a/src/EvtGenModels/Evtbs2llGammaISRFSRAmp.cpp b/src/EvtGenModels/Evtbs2llGammaISRFSRAmp.cpp --- a/src/EvtGenModels/Evtbs2llGammaISRFSRAmp.cpp +++ b/src/EvtGenModels/Evtbs2llGammaISRFSRAmp.cpp @@ -110,8 +110,8 @@ ::abort(); } - EvtParticle* lepPlus = 0; - EvtParticle* lepMinus = 0; + EvtParticle* lepPlus = nullptr; + EvtParticle* lepMinus = nullptr; lepPlus = ( charge1 > charge2 ) ? parent->getDaug( il1 ) diff --git a/src/EvtGenModels/EvtbsToLLLLAmp.cpp b/src/EvtGenModels/EvtbsToLLLLAmp.cpp --- a/src/EvtGenModels/EvtbsToLLLLAmp.cpp +++ b/src/EvtGenModels/EvtbsToLLLLAmp.cpp @@ -181,10 +181,10 @@ ::abort(); } - EvtParticle* lep1Plus = 0; - EvtParticle* lep1Minus = 0; - EvtParticle* lep2Plus = 0; - EvtParticle* lep2Minus = 0; + EvtParticle* lep1Plus = nullptr; + EvtParticle* lep1Minus = nullptr; + EvtParticle* lep2Plus = nullptr; + EvtParticle* lep2Minus = nullptr; EvtVector4R p; // B-meson momentum in the B-rest frame EvtVector4R q; // first transition 4-momentum in the B-rest frame diff --git a/src/EvtGenModels/EvtbsToLLLLHyperCPAmp.cpp b/src/EvtGenModels/EvtbsToLLLLHyperCPAmp.cpp --- a/src/EvtGenModels/EvtbsToLLLLHyperCPAmp.cpp +++ b/src/EvtGenModels/EvtbsToLLLLHyperCPAmp.cpp @@ -151,10 +151,10 @@ ::abort(); } - EvtParticle* lep1Plus = 0; - EvtParticle* lep1Minus = 0; - EvtParticle* lep2Plus = 0; - EvtParticle* lep2Minus = 0; + EvtParticle* lep1Plus = nullptr; + EvtParticle* lep1Minus = nullptr; + EvtParticle* lep2Plus = nullptr; + EvtParticle* lep2Minus = nullptr; EvtVector4R p; // B-meson momentum in the B-rest frame diff --git a/test/evt_dalitz.cc b/test/evt_dalitz.cc --- a/test/evt_dalitz.cc +++ b/test/evt_dalitz.cc @@ -89,7 +89,7 @@ // Initialize EvtGen // Define the random number generator - EvtRandomEngine* eng = 0; + EvtRandomEngine* eng = nullptr; #ifdef EVTGEN_CPP11 // Use the Mersenne-Twister generator (C++11 only) @@ -100,7 +100,7 @@ EvtRandom::setRandomEngine( eng ); - EvtAbsRadCorr* radCorrEngine = 0; + EvtAbsRadCorr* radCorrEngine = nullptr; std::list extraModels; #ifdef EVTGEN_EXTERNAL diff --git a/test/evtgenlhc_test1.cc b/test/evtgenlhc_test1.cc --- a/test/evtgenlhc_test1.cc +++ b/test/evtgenlhc_test1.cc @@ -150,12 +150,12 @@ void runDDK( int nevent, EvtGen& myGenerator ); void runPhspDecaytimeCut( int nevent, EvtGen& myGenerator ); -int countInclusive( std::string name, EvtParticle* root, TH1F* mom = 0, - TH1F* mass = 0 ); +int countInclusive( std::string name, EvtParticle* root, TH1F* mom = nullptr, + TH1F* mass = nullptr ); int countInclusiveParent( std::string name, EvtParticle* root, EvtIdSet setIds, - TH1F* mom = 0 ); + TH1F* mom = nullptr ); int countInclusiveSubTree( std::string name, EvtParticle* root, EvtIdSet setIds, - TH1F* mom = 0 ); + TH1F* mom = nullptr ); void runBaryonic( int nEvent, EvtGen& myGenerator ); void run3BPhspRegion( int nEvent, EvtGen& myGenerator ); void runFourBody( int nevent, EvtGen& myGenerator ); @@ -163,7 +163,7 @@ int main( int argc, char* argv[] ) { // Define the random number generator - EvtRandomEngine* myRandomEngine = 0; + EvtRandomEngine* myRandomEngine = nullptr; #ifdef EVTGEN_CPP11 // Use the Mersenne-Twister generator (C++11 only) @@ -190,7 +190,7 @@ return 1; } - EvtAbsRadCorr* radCorrEngine = 0; + EvtAbsRadCorr* radCorrEngine = nullptr; std::list extraModels; #ifdef EVTGEN_EXTERNAL @@ -690,7 +690,7 @@ } } p = p->nextIter( root_part ); - } while ( p != 0 ); + } while ( p != nullptr ); root_part->deleteTree(); } while ( count++ < nevent ); @@ -904,7 +904,7 @@ if ( theKs.contains( type ) && theBs.contains( typePar ) ) nK++; p = p->nextIter( theB01 ); - } while ( p != 0 ); + } while ( p != nullptr ); if ( nD == 2 && nK == 1 ) nDDK++; @@ -920,7 +920,7 @@ if ( theKs.contains( type ) && theBs.contains( typePar ) ) nK++; p = p->nextIter( theB02 ); - } while ( p != 0 ); + } while ( p != nullptr ); if ( nD == 2 && nK == 1 ) nDDK++; @@ -1268,7 +1268,7 @@ std::vector dList[20]; int dListNum[20]; - std::vector* dListItem = 0; + std::vector* dListItem = nullptr; std::string dListName[20]; int ik, lk; std::string tk = ""; @@ -1422,7 +1422,7 @@ p = p->nextIter(); - } while ( p != 0 ); + } while ( p != nullptr ); return fs; } @@ -1504,7 +1504,7 @@ } p = p->nextIter( root_part ); - } while ( p != 0 ); + } while ( p != nullptr ); //Now need to figure out which histogram to book trackAll->Fill( evTracks ); @@ -1609,14 +1609,14 @@ directName = strcpy( directName, tkname.c_str() ); directName = strcat( directName, "Direct" ); histo2[ik] = new TH1F( directName, directName, 30, 0.0, 3.0 ); - delete directName; + delete[] directName; char* massName; massName = new char[( strlen( tkname.c_str() ) + 4 )]; massName = strcpy( massName, tkname.c_str() ); massName = strcat( massName, "Mass" ); massHisto[ik] = new TH1F( massName, massName, 3000, 0.0, 5.0 ); - delete massName; + delete[] massName; } count = 1; @@ -1643,7 +1643,7 @@ 5.9 * 5.9 ), 0.0, 0.0, 5.9 ); - EvtParticle* root_part = 0; + EvtParticle* root_part = nullptr; if ( neventOrig > 0 ) { root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); } else { @@ -1748,7 +1748,7 @@ } EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); - EvtParticle* root_part = 0; + EvtParticle* root_part = nullptr; if ( neventOrig > 0 ) { root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); } else { @@ -3837,7 +3837,7 @@ p_jpsi = root_part->getDaug( 0 ); - p_rho = 0; + p_rho = nullptr; if ( p_jpsi->getDaug( 0 )->getNDaug() == 2 ) { p_rho = p_jpsi->getDaug( 0 ); @@ -3929,7 +3929,7 @@ } if ( nDaug == 2 ) { - if ( p->getParent() == 0 ) { + if ( p->getParent() == nullptr ) { EvtVector4R p4 = p->getDaug( 0 )->getP4(); double ctheta = p4.get( 3 ) / p4.d3mag(); double phi = atan2( p4.get( 2 ), p4.get( 1 ) ); @@ -4001,7 +4001,7 @@ p = p->nextIter( root_part ); - } while ( p != 0 ); + } while ( p != nullptr ); root_part->deleteTree(); @@ -4300,7 +4300,7 @@ << "bId1a " << bId1a << " bId1b " << bId1b << " bId2a " << bId2a << " bId2b " << bId2b << " for event " << count << std::endl; - EvtParticle* Bpeng = 0; + EvtParticle* Bpeng = nullptr; //int bnum=0; int pengcount = 0; if ( ( ( bId1a == strangeid ) && ( bId1b == 22 ) ) || @@ -4515,7 +4515,7 @@ << "bId1a " << bId1a << " bId1b " << bId1b << " bId2a " << bId2a << " bId2b " << bId2b << " for event " << count << std::endl; - EvtParticle* Bpeng = 0; + EvtParticle* Bpeng = nullptr; //int bnum=0; int pengcount = 0; if ( ( ( bId1a == strangeid ) && ( bId1b == 22 ) ) || @@ -4727,7 +4727,7 @@ p = p->nextIter( root_part ); - } while ( p != 0 ); + } while ( p != nullptr ); return temp; } @@ -4745,7 +4745,7 @@ //p->printTree(); p = p->nextIter( root_part ); - } while ( p != 0 ); + } while ( p != nullptr ); //EvtGenReport(EVTGEN_INFO,"EvtGen") << "done"<nextIter( root_part ); - } while ( p != 0 ); + } while ( p != nullptr ); return temp; } @@ -4983,7 +4983,7 @@ << std::endl; p = p->nextIter(); - } while ( p != 0 ); + } while ( p != nullptr ); root_part->deleteTree(); @@ -5489,7 +5489,7 @@ p = p->nextIter(); - } while ( p != 0 ); + } while ( p != nullptr ); outmix << "event" << std::endl; @@ -5538,7 +5538,7 @@ p = p->nextIter(); - } while ( p != 0 ); + } while ( p != nullptr ); //root_part->printTree(); diff --git a/test/example1.cc b/test/example1.cc --- a/test/example1.cc +++ b/test/example1.cc @@ -46,10 +46,10 @@ int main( int /*argc*/, char** /*argv*/ ) { - EvtParticle* parent( 0 ); + EvtParticle* parent( nullptr ); // Define the random number generator - EvtRandomEngine* eng = 0; + EvtRandomEngine* eng = nullptr; #ifdef EVTGEN_CPP11 // Use the Mersenne-Twister generator (C++11 only) @@ -60,7 +60,7 @@ EvtRandom::setRandomEngine( eng ); - EvtAbsRadCorr* radCorrEngine = 0; + EvtAbsRadCorr* radCorrEngine = nullptr; std::list extraModels; #ifdef EVTGEN_EXTERNAL diff --git a/test/exampleFiles/PI0DALITZ.DEC b/test/exampleFiles/PI0DALITZ.DEC --- a/test/exampleFiles/PI0DALITZ.DEC +++ b/test/exampleFiles/PI0DALITZ.DEC @@ -3,5 +3,8 @@ Decay pi0 1.000 e+ e- gamma PI0_DALITZ; Enddecay +Decay eta +1.000 mu+ mu- gamma PI0_DALITZ; +Enddecay # End diff --git a/test/exampleWriteHepMC.cc b/test/exampleWriteHepMC.cc --- a/test/exampleWriteHepMC.cc +++ b/test/exampleWriteHepMC.cc @@ -85,10 +85,10 @@ int main( int /*argc*/, char** /*argv*/ ) { - EvtParticle* parent( 0 ); + EvtParticle* parent( nullptr ); // Define the random number generator - EvtRandomEngine* eng = 0; + EvtRandomEngine* eng = nullptr; #ifdef EVTGEN_CPP11 // Use the Mersenne-Twister generator (C++11 only) @@ -99,7 +99,7 @@ EvtRandom::setRandomEngine( eng ); - EvtAbsRadCorr* radCorrEngine = 0; + EvtAbsRadCorr* radCorrEngine = nullptr; std::list extraModels; #ifdef EVTGEN_EXTERNAL diff --git a/validation/compareRootFiles.cc b/validation/compareRootFiles.cc --- a/validation/compareRootFiles.cc +++ b/validation/compareRootFiles.cc @@ -435,13 +435,13 @@ TH1D* compareRootFiles::getMtmHist( TFile* theFile, string histName, vector groupInts ) { - if ( theFile == 0 ) { + if ( theFile == nullptr ) { // Return empty histogram return _emptyHist; } TTree* theTree = dynamic_cast( theFile->Get( "Data" ) ); - if ( theTree == 0 ) { + if ( theTree == nullptr ) { // Return empty histogram return _emptyHist; } @@ -481,13 +481,13 @@ // with bins along the x axis representing each group // leptons gamma pi+- pi0 K+- K0 D+- D0 light_baryons strange_baryons other - if ( theFile == 0 ) { + if ( theFile == nullptr ) { // Return empty histogram return _emptyHist; } TTree* theTree = dynamic_cast( theFile->Get( "Data" ) ); - if ( theTree == 0 ) { + if ( theTree == nullptr ) { // Return empty histogram return _emptyHist; } @@ -563,13 +563,13 @@ TH1D* compareRootFiles::getAllIdHist( TFile* theFile, string histName ) { - if ( theFile == 0 ) { + if ( theFile == nullptr ) { // Return empty histogram return _emptyHist; } TTree* theTree = dynamic_cast( theFile->Get( "Data" ) ); - if ( theTree == 0 ) { + if ( theTree == nullptr ) { // Return empty histogram return _emptyHist; } @@ -598,13 +598,13 @@ TH1D* compareRootFiles::getDaugHist( TFile* theFile, string histName ) { - if ( theFile == 0 ) { + if ( theFile == nullptr ) { // Return empty histogram return _emptyHist; } TTree* nDaugTree = dynamic_cast( theFile->Get( "nDaugTree" ) ); - if ( nDaugTree == 0 ) { + if ( nDaugTree == nullptr ) { // Return empty histogram return _emptyHist; } diff --git a/validation/genExampleRootFiles.cc b/validation/genExampleRootFiles.cc --- a/validation/genExampleRootFiles.cc +++ b/validation/genExampleRootFiles.cc @@ -128,11 +128,11 @@ dalitzTree->Branch( "invMass13Sq", &inv13Sq, "invMass13Sq/D" ); dalitzTree->Branch( "invMass23Sq", &inv23Sq, "invMass23Sq/D" ); - EvtParticle* baseParticle( 0 ); - EvtParticle* theParent( 0 ); + EvtParticle* baseParticle( nullptr ); + EvtParticle* theParent( nullptr ); // Define the random number generator - EvtRandomEngine* myRandomEngine = 0; + EvtRandomEngine* myRandomEngine = nullptr; #ifdef EVTGEN_CPP11 // Use the Mersenne-Twister generator (C++11 only) @@ -145,7 +145,7 @@ // For our validation purposes, we just want to read in one decay file and create // plots from that. - EvtAbsRadCorr* radCorrEngine = 0; + EvtAbsRadCorr* radCorrEngine = nullptr; std::list extraModels; #ifdef EVTGEN_EXTERNAL @@ -206,7 +206,7 @@ EvtId daugEvtId( -1, -1 ); EvtParticle* baseDaughter = baseParticle->getDaug( 0 ); - if ( baseDaughter != 0 ) { + if ( baseDaughter != nullptr ) { daugEvtId = baseDaughter->getId(); } @@ -227,7 +227,7 @@ for ( iDaug = 0; iDaug < nDaug; iDaug++ ) { EvtParticle* daug = theParent->getDaug( iDaug ); - if ( daug != 0 ) { + if ( daug != nullptr ) { EvtVector4R p4Lab = daug->getP4Lab(); EvtVector4R pos4 = daug->get4Pos(); diff --git a/validation/genRootDecayChain.cc b/validation/genRootDecayChain.cc --- a/validation/genRootDecayChain.cc +++ b/validation/genRootDecayChain.cc @@ -101,10 +101,10 @@ _parentName( parentName ), _nEvents( nEvents ), _storeMtmXYZ( storeMtmXYZ ), - _theFile( 0 ), - _theTree( 0 ), - _probHist( 0 ), - _theCanvas( 0 ) + _theFile( nullptr ), + _theTree( nullptr ), + _probHist( nullptr ), + _theCanvas( nullptr ) { _theFile = new TFile( rootFileName.c_str(), "recreate" ); _theTree = new TTree( "Data", "Data" ); @@ -178,8 +178,8 @@ void genRootDecayChain::generateEvents() { - EvtRandomEngine* randomEngine = 0; - EvtAbsRadCorr* radCorrEngine = 0; + EvtRandomEngine* randomEngine = nullptr; + EvtAbsRadCorr* radCorrEngine = nullptr; std::list extraModels; // Define the random number generator @@ -207,7 +207,7 @@ EvtGen evtGen( _decayFileName.c_str(), "../evt.pdl", randomEngine, radCorrEngine, &extraModels, mixingType, useXml ); - EvtParticle* theParent( 0 ); + EvtParticle* theParent( nullptr ); EvtId theId = EvtPDL::getId( _parentName ); if ( theId.getId() == -1 && theId.getAlias() == -1 ) { diff --git a/validation/testCPVDecays.cc b/validation/testCPVDecays.cc --- a/validation/testCPVDecays.cc +++ b/validation/testCPVDecays.cc @@ -111,7 +111,7 @@ // Define the random number generator - EvtRandomEngine* myRandomEngine = 0; + EvtRandomEngine* myRandomEngine = nullptr; #ifdef EVTGEN_CPP11 // Use the Mersenne-Twister generator (C++11 only) @@ -120,7 +120,7 @@ myRandomEngine = new EvtSimpleRandomEngine(); #endif - EvtAbsRadCorr* radCorrEngine = 0; + EvtAbsRadCorr* radCorrEngine = nullptr; std::list extraModels; #ifdef EVTGEN_EXTERNAL @@ -147,7 +147,7 @@ // Start all initial (parent) decays at the origin EvtVector4R origin( 0.0, 0.0, 0.0, 0.0 ); - EvtSpinDensity* spinDensity = 0; + EvtSpinDensity* spinDensity = nullptr; EvtSpinType::spintype baseSpin = EvtPDL::getSpinType( theId ); @@ -337,7 +337,7 @@ // Get the vertex HepMC::GenVertex* theVertex = *vertexIter; - if ( theVertex == 0 ) { + if ( theVertex == nullptr ) { continue; } @@ -354,7 +354,7 @@ inIter != theVertex->particles_in_const_end(); ++inIter ) { HepMC::GenParticle* inParticle = *inIter; - if ( inParticle == 0 ) { + if ( inParticle == nullptr ) { continue; } @@ -379,7 +379,7 @@ outIter != theVertex->particles_out_const_end(); ++outIter ) { HepMC::GenParticle* outParticle = *outIter; - if ( outParticle != 0 ) { + if ( outParticle != nullptr ) { int outPDGId = outParticle->pdg_id(); daugIdVect.push_back( outPDGId ); }