Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F7877618
D108.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Subscribers
None
D108.diff
View Options
diff --git a/EvtGenBase/EvtTensorParticle.hh b/EvtGenBase/EvtTensorParticle.hh
--- a/EvtGenBase/EvtTensorParticle.hh
+++ b/EvtGenBase/EvtTensorParticle.hh
@@ -24,6 +24,8 @@
#include "EvtGenBase/EvtParticle.hh"
#include "EvtGenBase/EvtTensor4C.hh"
+#include <array>
+
class EvtTensorParticle : public EvtParticle {
public:
EvtTensorParticle() = default;
@@ -42,7 +44,7 @@
double gamma ) const override;
private:
- EvtTensor4C eps[5]; //eps1,eps2,eps3,eps4,eps5;
+ std::array<EvtTensor4C, 5> eps; //eps1,eps2,eps3,eps4,eps5;
EvtTensorParticle( const EvtTensorParticle& tensor );
EvtTensorParticle& operator=( const EvtTensorParticle& tensor );
diff --git a/EvtGenBase/EvtVectorParticle.hh b/EvtGenBase/EvtVectorParticle.hh
--- a/EvtGenBase/EvtVectorParticle.hh
+++ b/EvtGenBase/EvtVectorParticle.hh
@@ -25,6 +25,9 @@
#include "EvtGenBase/EvtVector4C.hh"
#include "EvtGenBase/EvtVector4R.hh"
+#include <array>
+#include <cassert>
+
class EvtId;
class EvtVectorParticle : public EvtParticle {
@@ -37,15 +40,22 @@
const EvtVector4C&, const EvtVector4C& );
EvtVector4C epsParent( int i ) const override
{
+ assert( i >= 0 && i < _eps.size() );
+
return boostTo( _eps[i], this->getP4() );
}
- EvtVector4C eps( int i ) const override { return _eps[i]; }
+ EvtVector4C eps( int i ) const override
+ {
+ assert( i >= 0 && i < _eps.size() );
+
+ return _eps[i];
+ }
EvtSpinDensity rotateToHelicityBasis() const override;
EvtSpinDensity rotateToHelicityBasis( double alpha, double beta,
double gamma ) const override;
private:
- EvtVector4C _eps[3];
+ std::array<EvtVector4C, 3> _eps;
EvtVectorParticle( const EvtVectorParticle& vector );
EvtVectorParticle& operator=( const EvtVectorParticle& vector );
diff --git a/History.md b/History.md
--- a/History.md
+++ b/History.md
@@ -12,6 +12,9 @@
## R02-0X-00
19 Feb 2024 Fernando Abudinen
+* D108: Bugfix protect polarisation vector for vector and tensor particles against wrong indices
+
+19 Feb 2024 Fernando Abudinen
* D107: Implement const correctness for epsPhoton and epsParentPhoton
3 Feb 2024 John Back
diff --git a/src/EvtGenBase/EvtTensorParticle.cpp b/src/EvtGenBase/EvtTensorParticle.cpp
--- a/src/EvtGenBase/EvtTensorParticle.cpp
+++ b/src/EvtGenBase/EvtTensorParticle.cpp
@@ -27,6 +27,7 @@
#include "EvtGenBase/EvtVector4C.hh"
#include "EvtGenBase/EvtVector4R.hh"
+#include <cassert>
#include <iostream>
#include <math.h>
#include <stdlib.h>
@@ -84,15 +85,15 @@
EvtTensor4C EvtTensorParticle::epsTensorParent( int i ) const
{
- EvtTensor4C temp = eps[i];
+ assert( i >= 0 && i < eps.size() );
- temp.applyBoostTo( this->getP4() );
- return temp;
+ return boostTo( eps[i], this->getP4() );
} //epsParent
EvtTensor4C EvtTensorParticle::epsTensor( int i ) const
{
+ assert( i >= 0 && i < eps.size() );
return eps[i];
} //eps
diff --git a/src/EvtGenModels/EvtBcToNPi.cpp b/src/EvtGenModels/EvtBcToNPi.cpp
--- a/src/EvtGenModels/EvtBcToNPi.cpp
+++ b/src/EvtGenModels/EvtBcToNPi.cpp
@@ -301,7 +301,7 @@
2 * I * FV * dual( EvtGenFunctions::directProd( p, k ) );
EvtVector4C Heps = H.cont2( hardCur );
- for ( int i = 0; i < 4; i++ ) {
+ for ( int i = 0; i < 3; i++ ) {
EvtVector4C eps = root_particle->getDaug( 0 )
->epsParent( i )
.conj(); // psi-meson polarization vector
diff --git a/src/EvtGenModels/EvtBcVNpi.cpp b/src/EvtGenModels/EvtBcVNpi.cpp
--- a/src/EvtGenModels/EvtBcVNpi.cpp
+++ b/src/EvtGenModels/EvtBcVNpi.cpp
@@ -183,7 +183,7 @@
H.addDirProd( ( a0f - a3f ) * 2.0 * ( m_meson / Q2 ) * p4b, p4b - p4meson );
EvtVector4C Heps = H.cont2( hardCur );
- for ( int i = 0; i < 4; i++ ) {
+ for ( int i = 0; i < 3; i++ ) {
EvtVector4C eps = root_particle->getDaug( 0 )
->epsParent( i )
.conj(); // psi-meson polarization vector
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 18, 3:55 PM (21 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3805050
Default Alt Text
D108.diff (4 KB)
Attached To
D108: Protect eps and epsParent against wrong indices
Event Timeline
Log In to Comment