diff --git a/.clang-format b/.clang-format --- a/.clang-format +++ b/.clang-format @@ -70,7 +70,7 @@ Priority: 6 - Regex: '^"T[[:alnum:]]+\.h"' Priority: 7 - - Regex: '^<[[:alnum:].]+>' + - Regex: '^<[[:alnum:]._]+>' Priority: 9 - Regex: '.*' Priority: 8 diff --git a/EvtGenBase/EvtAbsLineShape.hh b/EvtGenBase/EvtAbsLineShape.hh --- a/EvtGenBase/EvtAbsLineShape.hh +++ b/EvtGenBase/EvtAbsLineShape.hh @@ -26,8 +26,6 @@ #include -class EvtId; - class EvtAbsLineShape { public: EvtAbsLineShape() = default; diff --git a/EvtGenBase/EvtIdSet.hh b/EvtGenBase/EvtIdSet.hh --- a/EvtGenBase/EvtIdSet.hh +++ b/EvtGenBase/EvtIdSet.hh @@ -1,6 +1,6 @@ /*********************************************************************** -* Copyright 1998-2020 CERN for the benefit of the EvtGen authors * +* Copyright 1998-2021 CERN for the benefit of the EvtGen authors * * * * This file is part of EvtGen. * * * @@ -24,123 +24,24 @@ #include "EvtGenBase/EvtId.hh" #include "EvtGenBase/EvtPatches.hh" +#include +#include #include -class EvtId; class EvtIdSet { public: - //need a default constructor - - EvtIdSet( const EvtId name1 ); - EvtIdSet( const std::string name1 ); - - EvtIdSet( const EvtId name1, const EvtId name2 ); - - EvtIdSet( const std::string name1, const std::string name2 ); - - EvtIdSet( const EvtId name1, const EvtId name2, const EvtId name3 ); - - EvtIdSet( const std::string name1, const std::string name2, - const std::string name3 ); - - EvtIdSet( const EvtId name1, const EvtId name2, const EvtId name3, - const EvtId name4 ); - - EvtIdSet( const std::string name1, const std::string name2, - const std::string name3, const std::string name4 ); - - EvtIdSet( const EvtId name1, const EvtId name2, const EvtId name3, - const EvtId name4, const EvtId name5 ); - - EvtIdSet( const std::string name1, const std::string name2, - const std::string name3, const std::string name4, - const std::string name5 ); - - EvtIdSet( const EvtId name1, const EvtId name2, const EvtId name3, - const EvtId name4, const EvtId name5, const EvtId name6 ); - - EvtIdSet( const std::string name1, const std::string name2, - const std::string name3, const std::string name4, - const std::string name5, const std::string name6 ); - - EvtIdSet( const EvtId name1, const EvtId name2, const EvtId name3, - const EvtId name4, const EvtId name5, const EvtId name6, - const EvtId name7 ); - - EvtIdSet( const std::string name1, const std::string name2, - const std::string name3, const std::string name4, - const std::string name5, const std::string name6, - const std::string name7 ); - - EvtIdSet( const EvtId name1, const EvtId name2, const EvtId name3, - const EvtId name4, const EvtId name5, const EvtId name6, - const EvtId name7, const EvtId name8 ); - - EvtIdSet( const std::string name1, const std::string name2, - const std::string name3, const std::string name4, - const std::string name5, const std::string name6, - const std::string name7, const std::string name8 ); - - EvtIdSet( const EvtId name1, const EvtId name2, const EvtId name3, - const EvtId name4, const EvtId name5, const EvtId name6, - const EvtId name7, const EvtId name8, const EvtId name9 ); - - EvtIdSet( const std::string name1, const std::string name2, - const std::string name3, const std::string name4, - const std::string name5, const std::string name6, - const std::string name7, const std::string name8, - const std::string name9 ); - - EvtIdSet( const EvtId name1, const EvtId name2, const EvtId name3, - const EvtId name4, const EvtId name5, const EvtId name6, - const EvtId name7, const EvtId name8, const EvtId name9, - const EvtId name10 ); - - EvtIdSet( const std::string name1, const std::string name2, - const std::string name3, const std::string name4, - const std::string name5, const std::string name6, - const std::string name7, const std::string name8, - const std::string name9, const std::string name10 ); - - EvtIdSet( const EvtId name1, const EvtId name2, const EvtId name3, - const EvtId name4, const EvtId name5, const EvtId name6, - const EvtId name7, const EvtId name8, const EvtId name9, - const EvtId name10, const EvtId name11 ); - - EvtIdSet( const std::string name1, const std::string name2, - const std::string name3, const std::string name4, - const std::string name5, const std::string name6, - const std::string name7, const std::string name8, - const std::string name9, const std::string name10, - const std::string name11 ); - - EvtIdSet( const EvtId name1, const EvtId name2, const EvtId name3, - const EvtId name4, const EvtId name5, const EvtId name6, - const EvtId name7, const EvtId name8, const EvtId name9, - const EvtId name10, const EvtId name11, const EvtId name12 ); - - EvtIdSet( const std::string name1, const std::string name2, - const std::string name3, const std::string name4, - const std::string name5, const std::string name6, - const std::string name7, const std::string name8, - const std::string name9, const std::string name10, - const std::string name11, const std::string name12 ); - - ~EvtIdSet() { delete[] _list; } - - EvtIdSet( const EvtIdSet& set1 ); + explicit EvtIdSet( std::initializer_list idList ); + explicit EvtIdSet( std::initializer_list nameList ); EvtIdSet( const EvtIdSet& set1, const EvtIdSet& set2 ); - int contains( const EvtId id ) const; - int contains( const std::string id ) const; + std::size_t sizeOfSet() const { return m_list.size(); }; + bool contains( const EvtId& id ) const; + bool contains( const std::string& name ) const; - void append( const EvtIdSet set1 ); - int sizeOfSet() const; - EvtId getElem( const int i ) const; + void append( const EvtIdSet& set1 ); private: - int _numInList; - EvtId* _list; + std::set m_list; }; #endif diff --git a/EvtGenBase/EvtPto3PAmp.hh b/EvtGenBase/EvtPto3PAmp.hh --- a/EvtGenBase/EvtPto3PAmp.hh +++ b/EvtGenBase/EvtPto3PAmp.hh @@ -21,6 +21,7 @@ #ifndef EVT_PTO3P_AMP_HH #define EVT_PTO3P_AMP_HH +#include "EvtGenBase/EvtComplex.hh" #include "EvtGenBase/EvtCyclic3.hh" #include "EvtGenBase/EvtSpinType.hh" @@ -31,7 +32,6 @@ #include "EvtGenBase/EvtPropagator.hh" #include "EvtGenBase/EvtTwoBodyVertex.hh" -class EvtComplex; class EvtBlattWeisskopf; class EvtPto3PAmp : public EvtAmplitude { diff --git a/History.md b/History.md --- a/History.md +++ b/History.md @@ -11,6 +11,14 @@ === ## R02-0X-00 +16 Oct 2023 Thomas Latham +* D98: Modernise EvtIdSet and other improvements + - Modernise and greatly simplify EvtIdSet implementation + - Fixes in EvtPropSLPole to avoid unnecessary dynamic allocations + - Other minor fixes and tidy-ups +* Credit to Heather Ratcliffe and Chris Brady for providing + and/or inspiring several of these improvements + 22 Aug 2023 Fernando Abudinen * D97: Bugfix probmax issue and introduced pole compensation for VTOSLL model Calculation of amplitude moved to dedicated calcAmp function and fixed initialisation. diff --git a/src/EvtGenBase/EvtCPUtil.cpp b/src/EvtGenBase/EvtCPUtil.cpp --- a/src/EvtGenBase/EvtCPUtil.cpp +++ b/src/EvtGenBase/EvtCPUtil.cpp @@ -44,7 +44,7 @@ { static EvtCPUtil* theCPUtil = nullptr; - if ( theCPUtil == nullptr ) { + if ( !theCPUtil ) { theCPUtil = new EvtCPUtil( 1 ); } diff --git a/src/EvtGenBase/EvtDecayTable.cpp b/src/EvtGenBase/EvtDecayTable.cpp --- a/src/EvtGenBase/EvtDecayTable.cpp +++ b/src/EvtGenBase/EvtDecayTable.cpp @@ -60,7 +60,7 @@ { static EvtDecayTable* theDecayTable = nullptr; - if ( theDecayTable == nullptr ) { + if ( !theDecayTable ) { theDecayTable = new EvtDecayTable(); } diff --git a/src/EvtGenBase/EvtExtGeneratorCommandsTable.cpp b/src/EvtGenBase/EvtExtGeneratorCommandsTable.cpp --- a/src/EvtGenBase/EvtExtGeneratorCommandsTable.cpp +++ b/src/EvtGenBase/EvtExtGeneratorCommandsTable.cpp @@ -34,7 +34,7 @@ { static EvtExtGeneratorCommandsTable* theCommandMap = nullptr; - if ( theCommandMap == nullptr ) { + if ( !theCommandMap ) { theCommandMap = new EvtExtGeneratorCommandsTable(); } diff --git a/src/EvtGenBase/EvtIdSet.cpp b/src/EvtGenBase/EvtIdSet.cpp --- a/src/EvtGenBase/EvtIdSet.cpp +++ b/src/EvtGenBase/EvtIdSet.cpp @@ -23,470 +23,40 @@ #include "EvtGenBase/EvtPDL.hh" #include "EvtGenBase/EvtPatches.hh" -#include +#include +#include #include -EvtIdSet::EvtIdSet( const EvtId name1 ) +EvtIdSet::EvtIdSet( std::initializer_list idList ) : m_list{ idList } { - _numInList = 1; - _list = new EvtId[_numInList]; - - _list[0] = name1; -} - -EvtIdSet::EvtIdSet( const std::string name1 ) -{ - _numInList = 1; - _list = new EvtId[_numInList]; - - _list[0] = EvtPDL::getId( name1 ); -} - -EvtIdSet::EvtIdSet( const EvtId name1, const EvtId name2 ) -{ - _numInList = 2; - _list = new EvtId[_numInList]; - - _list[0] = name1; - _list[1] = name2; -} - -EvtIdSet::EvtIdSet( const std::string name1, const std::string name2 ) -{ - _numInList = 2; - _list = new EvtId[_numInList]; - - _list[0] = EvtPDL::getId( name1 ); - _list[1] = EvtPDL::getId( name2 ); -} - -EvtIdSet::EvtIdSet( const EvtId name1, const EvtId name2, const EvtId name3 ) -{ - _numInList = 3; - _list = new EvtId[_numInList]; - - _list[0] = name1; - _list[1] = name2; - _list[2] = name3; -} - -EvtIdSet::EvtIdSet( const std::string name1, const std::string name2, - const std::string name3 ) -{ - _numInList = 3; - _list = new EvtId[_numInList]; - - _list[0] = EvtPDL::getId( name1 ); - _list[1] = EvtPDL::getId( name2 ); - _list[2] = EvtPDL::getId( name3 ); -} - -EvtIdSet::EvtIdSet( const EvtId name1, const EvtId name2, const EvtId name3, - const EvtId name4 ) -{ - _numInList = 4; - _list = new EvtId[_numInList]; - - _list[0] = name1; - _list[1] = name2; - _list[2] = name3; - _list[3] = name4; -} - -EvtIdSet::EvtIdSet( const std::string name1, const std::string name2, - const std::string name3, const std::string name4 ) -{ - _numInList = 4; - _list = new EvtId[_numInList]; - - _list[0] = EvtPDL::getId( name1 ); - _list[1] = EvtPDL::getId( name2 ); - _list[2] = EvtPDL::getId( name3 ); - _list[3] = EvtPDL::getId( name4 ); -} - -EvtIdSet::EvtIdSet( const EvtId name1, const EvtId name2, const EvtId name3, - const EvtId name4, const EvtId name5 ) -{ - _numInList = 5; - _list = new EvtId[_numInList]; - - _list[0] = name1; - _list[1] = name2; - _list[2] = name3; - _list[3] = name4; - _list[4] = name5; -} - -EvtIdSet::EvtIdSet( const std::string name1, const std::string name2, - const std::string name3, const std::string name4, - const std::string name5 ) -{ - _numInList = 5; - _list = new EvtId[_numInList]; - - _list[0] = EvtPDL::getId( name1 ); - _list[1] = EvtPDL::getId( name2 ); - _list[2] = EvtPDL::getId( name3 ); - _list[3] = EvtPDL::getId( name4 ); - _list[4] = EvtPDL::getId( name5 ); -} - -EvtIdSet::EvtIdSet( const EvtId name1, const EvtId name2, const EvtId name3, - const EvtId name4, const EvtId name5, const EvtId name6 ) -{ - _numInList = 6; - _list = new EvtId[_numInList]; - - _list[0] = name1; - _list[1] = name2; - _list[2] = name3; - _list[3] = name4; - _list[4] = name5; - _list[5] = name6; -} - -EvtIdSet::EvtIdSet( const std::string name1, const std::string name2, - const std::string name3, const std::string name4, - const std::string name5, const std::string name6 ) -{ - _numInList = 6; - _list = new EvtId[_numInList]; - - _list[0] = EvtPDL::getId( name1 ); - _list[1] = EvtPDL::getId( name2 ); - _list[2] = EvtPDL::getId( name3 ); - _list[3] = EvtPDL::getId( name4 ); - _list[4] = EvtPDL::getId( name5 ); - _list[5] = EvtPDL::getId( name6 ); -} - -EvtIdSet::EvtIdSet( const EvtId name1, const EvtId name2, const EvtId name3, - const EvtId name4, const EvtId name5, const EvtId name6, - const EvtId name7 ) -{ - _numInList = 7; - _list = new EvtId[_numInList]; - - _list[0] = name1; - _list[1] = name2; - _list[2] = name3; - _list[3] = name4; - _list[4] = name5; - _list[5] = name6; - _list[6] = name7; } -EvtIdSet::EvtIdSet( const std::string name1, const std::string name2, - const std::string name3, const std::string name4, - const std::string name5, const std::string name6, - const std::string name7 ) +EvtIdSet::EvtIdSet( std::initializer_list nameList ) { - _numInList = 7; - _list = new EvtId[_numInList]; - - _list[0] = EvtPDL::getId( name1 ); - _list[1] = EvtPDL::getId( name2 ); - _list[2] = EvtPDL::getId( name3 ); - _list[3] = EvtPDL::getId( name4 ); - _list[4] = EvtPDL::getId( name5 ); - _list[5] = EvtPDL::getId( name6 ); - _list[6] = EvtPDL::getId( name7 ); -} - -EvtIdSet::EvtIdSet( const EvtId name1, const EvtId name2, const EvtId name3, - const EvtId name4, const EvtId name5, const EvtId name6, - const EvtId name7, const EvtId name8 ) -{ - _numInList = 8; - _list = new EvtId[_numInList]; - - _list[0] = name1; - _list[1] = name2; - _list[2] = name3; - _list[3] = name4; - _list[4] = name5; - _list[5] = name6; - _list[6] = name7; - _list[7] = name8; -} - -EvtIdSet::EvtIdSet( const std::string name1, const std::string name2, - const std::string name3, const std::string name4, - const std::string name5, const std::string name6, - const std::string name7, const std::string name8 ) -{ - _numInList = 8; - _list = new EvtId[_numInList]; - - _list[0] = EvtPDL::getId( name1 ); - _list[1] = EvtPDL::getId( name2 ); - _list[2] = EvtPDL::getId( name3 ); - _list[3] = EvtPDL::getId( name4 ); - _list[4] = EvtPDL::getId( name5 ); - _list[5] = EvtPDL::getId( name6 ); - _list[6] = EvtPDL::getId( name7 ); - _list[7] = EvtPDL::getId( name8 ); -} - -EvtIdSet::EvtIdSet( const EvtId name1, const EvtId name2, const EvtId name3, - const EvtId name4, const EvtId name5, const EvtId name6, - const EvtId name7, const EvtId name8, const EvtId name9 ) -{ - _numInList = 9; - _list = new EvtId[_numInList]; - - _list[0] = name1; - _list[1] = name2; - _list[2] = name3; - _list[3] = name4; - _list[4] = name5; - _list[5] = name6; - _list[6] = name7; - _list[7] = name8; - _list[8] = name9; -} - -EvtIdSet::EvtIdSet( const std::string name1, const std::string name2, - const std::string name3, const std::string name4, - const std::string name5, const std::string name6, - const std::string name7, const std::string name8, - const std::string name9 ) -{ - _numInList = 9; - _list = new EvtId[_numInList]; - - _list[0] = EvtPDL::getId( name1 ); - _list[1] = EvtPDL::getId( name2 ); - _list[2] = EvtPDL::getId( name3 ); - _list[3] = EvtPDL::getId( name4 ); - _list[4] = EvtPDL::getId( name5 ); - _list[5] = EvtPDL::getId( name6 ); - _list[6] = EvtPDL::getId( name7 ); - _list[7] = EvtPDL::getId( name8 ); - _list[8] = EvtPDL::getId( name9 ); -} - -EvtIdSet::EvtIdSet( const EvtId name1, const EvtId name2, const EvtId name3, - const EvtId name4, const EvtId name5, const EvtId name6, - const EvtId name7, const EvtId name8, const EvtId name9, - const EvtId name10 ) -{ - _numInList = 10; - _list = new EvtId[_numInList]; - - _list[0] = name1; - _list[1] = name2; - _list[2] = name3; - _list[3] = name4; - _list[4] = name5; - _list[5] = name6; - _list[6] = name7; - _list[7] = name8; - _list[8] = name9; - _list[9] = name10; -} - -EvtIdSet::EvtIdSet( const std::string name1, const std::string name2, - const std::string name3, const std::string name4, - const std::string name5, const std::string name6, - const std::string name7, const std::string name8, - const std::string name9, const std::string name10 ) -{ - _numInList = 10; - _list = new EvtId[_numInList]; - - _list[0] = EvtPDL::getId( name1 ); - _list[1] = EvtPDL::getId( name2 ); - _list[2] = EvtPDL::getId( name3 ); - _list[3] = EvtPDL::getId( name4 ); - _list[4] = EvtPDL::getId( name5 ); - _list[5] = EvtPDL::getId( name6 ); - _list[6] = EvtPDL::getId( name7 ); - _list[7] = EvtPDL::getId( name8 ); - _list[8] = EvtPDL::getId( name9 ); - _list[9] = EvtPDL::getId( name10 ); -} - -EvtIdSet::EvtIdSet( const EvtId name1, const EvtId name2, const EvtId name3, - const EvtId name4, const EvtId name5, const EvtId name6, - const EvtId name7, const EvtId name8, const EvtId name9, - const EvtId name10, const EvtId name11 ) -{ - _numInList = 11; - _list = new EvtId[_numInList]; - - _list[0] = name1; - _list[1] = name2; - _list[2] = name3; - _list[3] = name4; - _list[4] = name5; - _list[5] = name6; - _list[6] = name7; - _list[7] = name8; - _list[8] = name9; - _list[9] = name10; - _list[10] = name11; -} - -EvtIdSet::EvtIdSet( const std::string name1, const std::string name2, - const std::string name3, const std::string name4, - const std::string name5, const std::string name6, - const std::string name7, const std::string name8, - const std::string name9, const std::string name10, - const std::string name11 ) -{ - _numInList = 11; - _list = new EvtId[_numInList]; - - _list[0] = EvtPDL::getId( name1 ); - _list[1] = EvtPDL::getId( name2 ); - _list[2] = EvtPDL::getId( name3 ); - _list[3] = EvtPDL::getId( name4 ); - _list[4] = EvtPDL::getId( name5 ); - _list[5] = EvtPDL::getId( name6 ); - _list[6] = EvtPDL::getId( name7 ); - _list[7] = EvtPDL::getId( name8 ); - _list[8] = EvtPDL::getId( name9 ); - _list[9] = EvtPDL::getId( name10 ); - _list[10] = EvtPDL::getId( name11 ); -} - -EvtIdSet::EvtIdSet( const EvtId name1, const EvtId name2, const EvtId name3, - const EvtId name4, const EvtId name5, const EvtId name6, - const EvtId name7, const EvtId name8, const EvtId name9, - const EvtId name10, const EvtId name11, const EvtId name12 ) -{ - _numInList = 12; - _list = new EvtId[_numInList]; - - _list[0] = name1; - _list[1] = name2; - _list[2] = name3; - _list[3] = name4; - _list[4] = name5; - _list[5] = name6; - _list[6] = name7; - _list[7] = name8; - _list[8] = name9; - _list[9] = name10; - _list[10] = name11; - _list[11] = name12; -} - -EvtIdSet::EvtIdSet( const std::string name1, const std::string name2, - const std::string name3, const std::string name4, - const std::string name5, const std::string name6, - const std::string name7, const std::string name8, - const std::string name9, const std::string name10, - const std::string name11, const std::string name12 ) -{ - _numInList = 12; - _list = new EvtId[_numInList]; - - _list[0] = EvtPDL::getId( name1 ); - _list[1] = EvtPDL::getId( name2 ); - _list[2] = EvtPDL::getId( name3 ); - _list[3] = EvtPDL::getId( name4 ); - _list[4] = EvtPDL::getId( name5 ); - _list[5] = EvtPDL::getId( name6 ); - _list[6] = EvtPDL::getId( name7 ); - _list[7] = EvtPDL::getId( name8 ); - _list[8] = EvtPDL::getId( name9 ); - _list[9] = EvtPDL::getId( name10 ); - _list[10] = EvtPDL::getId( name11 ); - _list[11] = EvtPDL::getId( name12 ); -} - -EvtIdSet::EvtIdSet( const EvtIdSet& set1 ) -{ - _numInList = set1.sizeOfSet(); - _list = new EvtId[_numInList]; - int i; - for ( i = 0; i < _numInList; i++ ) { - _list[i] = set1.getElem( i ); + for ( const std::string& name : nameList ) { + m_list.insert( EvtPDL::getId( name ) ); } } -EvtIdSet::EvtIdSet( const EvtIdSet& set1, const EvtIdSet& set2 ) -{ - _numInList = set1.sizeOfSet(); - _list = new EvtId[_numInList]; - int i; - for ( i = 0; i < _numInList; i++ ) { - _list[i] = set1.getElem( i ); - } - //then just append the second list. - this->append( set2 ); -} -int EvtIdSet::contains( const EvtId id ) const +EvtIdSet::EvtIdSet( const EvtIdSet& set1, const EvtIdSet& set2 ) : + m_list{ set1.m_list } { - int i; - for ( i = 0; i < _numInList; i++ ) { - if ( _list[i] == id ) - return 1; - } - - return 0; -} - -int EvtIdSet::contains( const std::string nm ) const -{ - int i; - for ( i = 0; i < _numInList; i++ ) { - if ( _list[i] == EvtPDL::getId( nm ) ) - return 1; - } - - return 0; + this->append( set2 ); } -void EvtIdSet::append( const EvtIdSet set1 ) +bool EvtIdSet::contains( const EvtId& id ) const { - int combLen = _numInList + set1.sizeOfSet(); - int uniqueLen = 0; - EvtId* combSet; - - combSet = new EvtId[combLen]; - - int i; - for ( i = 0; i < combLen; i++ ) { - if ( i >= _numInList ) { - //check that there are no overlaps between lists - int j; - int isUnique = 1; - for ( j = 0; j < _numInList; j++ ) { - if ( _list[j] == set1.getElem( i - _numInList ) ) { - isUnique = 0; - } - } - if ( isUnique == 1 ) { - combSet[uniqueLen] = set1.getElem( i - _numInList ); - uniqueLen += 1; - } - } else { - 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 combSet; - } + const auto iter = m_list.find( id ); + return iter != m_list.end(); } -int EvtIdSet::sizeOfSet() const +bool EvtIdSet::contains( const std::string& name ) const { - return _numInList; + const EvtId id{ EvtPDL::getId( name ) }; + return this->contains( id ); } -EvtId EvtIdSet::getElem( const int i ) const +void EvtIdSet::append( const EvtIdSet& set1 ) { - return _list[i]; + m_list.insert( set1.m_list.begin(), set1.m_list.end() ); } diff --git a/src/EvtGenBase/EvtModel.cpp b/src/EvtGenBase/EvtModel.cpp --- a/src/EvtGenBase/EvtModel.cpp +++ b/src/EvtGenBase/EvtModel.cpp @@ -51,7 +51,7 @@ model = _modelNameHash[model_name]; } - if ( model == nullptr ) { + if ( !model ) { EvtGenReport( EVTGEN_ERROR, "EvtGen" ) << "Did not find the right model:" << model_name.c_str() << "\n"; return nullptr; @@ -96,7 +96,7 @@ model = _commandNameHash[cmd]; } - assert( model != 0 ); + assert( model ); model->command( cnfgstr ); } diff --git a/src/EvtGenBase/EvtParticle.cpp b/src/EvtGenBase/EvtParticle.cpp --- a/src/EvtGenBase/EvtParticle.cpp +++ b/src/EvtGenBase/EvtParticle.cpp @@ -248,7 +248,7 @@ // carefull - the parent mass might be fixed in stone.. EvtParticle* par = p->getParent(); double parMass = -1.; - if ( par != nullptr ) { + if ( par ) { if ( par->hasValidP4() ) parMass = par->mass(); for ( size_t i = 0; i < par->getNDaug(); i++ ) { @@ -320,7 +320,7 @@ static EvtId D0 = EvtPDL::getId( "D0" ); static EvtId D0B = EvtPDL::getId( "anti-D0" ); static EvtId U4S = EvtPDL::getId( "Upsilon(4S)" ); - static EvtIdSet borUps( BS0, BSB, BD0, BDB, U4S ); + static EvtIdSet borUps{ BS0, BSB, BD0, BDB, U4S }; //only makes sense if there is no parent particle which is a B or an Upsilon bool hasBorUps = false; @@ -761,7 +761,7 @@ temp = this->getP4(); ptemp = this; - while ( ptemp->getParent() != nullptr ) { + while ( ptemp->getParent() ) { ptemp = ptemp->getParent(); mom = ptemp->getP4(); temp = boostTo( temp, mom ); @@ -777,7 +777,7 @@ temp = this->_pBeforeFSR; ptemp = this; - while ( ptemp->getParent() != nullptr ) { + while ( ptemp->getParent() ) { ptemp = ptemp->getParent(); mom = ptemp->getP4(); temp = boostTo( temp, mom ); @@ -798,12 +798,13 @@ temp.set( 0.0, 0.0, 0.0, 0.0 ); ptemp = getParent(); - if ( ptemp == nullptr ) + if ( !ptemp ) { return temp; + } temp = ( ptemp->_t / ptemp->mass() ) * ( ptemp->getP4() ); - while ( ptemp->getParent() != nullptr ) { + while ( ptemp->getParent() ) { ptemp = ptemp->getParent(); mom = ptemp->getP4(); temp = boostTo( temp, mom ); @@ -826,16 +827,18 @@ do { bpart = current->_parent; - if ( bpart == nullptr ) + if ( !bpart ) { return nullptr; + } i = 0; while ( bpart->_daug[i] != current ) { i++; } if ( bpart == rootOfTree ) { - if ( i + 1 == bpart->_ndaug ) + if ( i + 1 == bpart->_ndaug ) { return nullptr; + } } i++; diff --git a/src/EvtGenModels/EvtBLLNuL.cpp b/src/EvtGenModels/EvtBLLNuL.cpp --- a/src/EvtGenModels/EvtBLLNuL.cpp +++ b/src/EvtGenModels/EvtBLLNuL.cpp @@ -59,7 +59,7 @@ checkSpinDaughter( 3, EvtSpinType::DIRAC ); // ell-(k_4) // Check that we have a charged B parent - static EvtIdSet BMesons( "B-", "B+" ); + static EvtIdSet BMesons{ "B-", "B+" }; if ( !BMesons.contains( getParentId() ) ) { EvtGenReport( EVTGEN_ERROR, "EvtBLLNuL" ) << "Expecting the parent to be a charged B. Found PDG = " diff --git a/src/EvtGenModels/EvtBToDiBaryonlnupQCD.cpp b/src/EvtGenModels/EvtBToDiBaryonlnupQCD.cpp --- a/src/EvtGenModels/EvtBToDiBaryonlnupQCD.cpp +++ b/src/EvtGenModels/EvtBToDiBaryonlnupQCD.cpp @@ -150,18 +150,18 @@ // baryon that can be any (excited) state. They all have lower // maximum probabilities compared to the default pp mode in order // to improve accept/reject generation efficiency - static EvtIdSet BMesons( "B-", "B+" ); - static EvtIdSet Delta( "Delta+", "anti-Delta-" ); - static EvtIdSet LambdaC( "Lambda_c+", "anti-Lambda_c-" ); - static EvtIdSet LambdaC1( "Lambda_c(2593)+", "anti-Lambda_c(2593)-" ); - static EvtIdSet LambdaC2( "Lambda_c(2625)+", "anti-Lambda_c(2625)-" ); - static EvtIdSet N1440( "N(1440)+", "anti-N(1440)-" ); - static EvtIdSet N1520( "N(1520)+", "anti-N(1520)-" ); - static EvtIdSet N1535( "N(1535)+", "anti-N(1535)-" ); - static EvtIdSet N1650( "N(1650)+", "anti-N(1650)-" ); - static EvtIdSet N1700( "N(1700)+", "anti-N(1700)-" ); - static EvtIdSet N1710( "N(1710)+", "anti-N(1710)-" ); - static EvtIdSet N1720( "N(1720)+", "anti-N(1720)-" ); + static EvtIdSet BMesons{ "B-", "B+" }; + static EvtIdSet Delta{ "Delta+", "anti-Delta-" }; + static EvtIdSet LambdaC{ "Lambda_c+", "anti-Lambda_c-" }; + static EvtIdSet LambdaC1{ "Lambda_c(2593)+", "anti-Lambda_c(2593)-" }; + static EvtIdSet LambdaC2{ "Lambda_c(2625)+", "anti-Lambda_c(2625)-" }; + static EvtIdSet N1440{ "N(1440)+", "anti-N(1440)-" }; + static EvtIdSet N1520{ "N(1520)+", "anti-N(1520)-" }; + static EvtIdSet N1535{ "N(1535)+", "anti-N(1535)-" }; + static EvtIdSet N1650{ "N(1650)+", "anti-N(1650)-" }; + static EvtIdSet N1700{ "N(1700)+", "anti-N(1700)-" }; + static EvtIdSet N1710{ "N(1710)+", "anti-N(1710)-" }; + static EvtIdSet N1720{ "N(1720)+", "anti-N(1720)-" }; EvtId parId = getParentId(); EvtId bar1Id = getDaug( 0 ); diff --git a/src/EvtGenModels/EvtBaryonPCR.cpp b/src/EvtGenModels/EvtBaryonPCR.cpp --- a/src/EvtGenModels/EvtBaryonPCR.cpp +++ b/src/EvtGenModels/EvtBaryonPCR.cpp @@ -51,9 +51,9 @@ void EvtBaryonPCR::decay( EvtParticle* p ) { //This is a kludge to avoid warnings because the K_2* mass becomes to large. - static EvtIdSet regenerateMasses( "K_2*+", "K_2*-", "K_2*0", "anti-K_2*0", - "K_1+", "K_1-", "K_10", "anti-K_10", - "D'_1+", "D'_1-", "D'_10", "anti-D'_10" ); + static EvtIdSet regenerateMasses{ "K_2*+", "K_2*-", "K_2*0", "anti-K_2*0", + "K_1+", "K_1-", "K_10", "anti-K_10", + "D'_1+", "D'_1-", "D'_10", "anti-D'_10" }; if ( regenerateMasses.contains( getDaug( 0 ) ) ) { p->resetFirstOrNot(); diff --git a/src/EvtGenModels/EvtBcToNPi.cpp b/src/EvtGenModels/EvtBcToNPi.cpp --- a/src/EvtGenModels/EvtBcToNPi.cpp +++ b/src/EvtGenModels/EvtBcToNPi.cpp @@ -213,7 +213,7 @@ { ++nCall; - EvtIdSet thePis( "pi+", "pi-", "pi0" ); + EvtIdSet thePis{ "pi+", "pi-", "pi0" }; EvtComplex I = EvtComplex( 0.0, 1.0 ); root_particle->initializePhaseSpace( getNDaug(), getDaugs() ); diff --git a/src/EvtGenModels/EvtBcVHad.cpp b/src/EvtGenModels/EvtBcVHad.cpp --- a/src/EvtGenModels/EvtBcVHad.cpp +++ b/src/EvtGenModels/EvtBcVHad.cpp @@ -61,8 +61,8 @@ wcurr = std::make_unique(); // determine the code of final hadronic state - EvtIdSet thePis( "pi+", "pi-", "pi0" ); - EvtIdSet theK( "K+", "K-", "K_S0" ); + EvtIdSet thePis{ "pi+", "pi-", "pi0" }; + EvtIdSet theK{ "K+", "K-", "K_S0" }; if ( getNDaug() == 2 && thePis.contains( getDaug( 1 ) ) ) { out_code = 1; // pi+ } else if ( getNDaug() == 3 && thePis.contains( getDaug( 1 ) ) && diff --git a/src/EvtGenModels/EvtBsquark.cpp b/src/EvtGenModels/EvtBsquark.cpp --- a/src/EvtGenModels/EvtBsquark.cpp +++ b/src/EvtGenModels/EvtBsquark.cpp @@ -59,7 +59,7 @@ static EvtId cquark = EvtPDL::getId( "c" ); static EvtId anticquark = EvtPDL::getId( "anti-c" ); - static EvtIdSet leptons( "e-", "mu-", "tau-" ); + static EvtIdSet leptons{ "e-", "mu-", "tau-" }; p->initializePhaseSpace( getNDaug(), getDaugs() ); diff --git a/src/EvtGenModels/EvtISGW2FF.cpp b/src/EvtGenModels/EvtISGW2FF.cpp --- a/src/EvtGenModels/EvtISGW2FF.cpp +++ b/src/EvtGenModels/EvtISGW2FF.cpp @@ -261,7 +261,7 @@ EvtId dgt = daugt; //added by Lange Jan4,2000 - static EvtIdSet theB( "B+", "B-", "B0", "anti-B0" ); + static EvtIdSet theB{ "B+", "B-", "B0", "anti-B0" }; static EvtId D0 = EvtPDL::getId( "D0" ); static EvtId D0B = EvtPDL::getId( "anti-D0" ); diff --git a/src/EvtGenModels/EvtLb2Baryonlnu.cpp b/src/EvtGenModels/EvtLb2Baryonlnu.cpp --- a/src/EvtGenModels/EvtLb2Baryonlnu.cpp +++ b/src/EvtGenModels/EvtLb2Baryonlnu.cpp @@ -62,9 +62,9 @@ void EvtLb2Baryonlnu::decay( EvtParticle* p ) { //This is a kludge to avoid warnings because the K_2* mass becomes to large. - static EvtIdSet regenerateMasses( "K_2*+", "K_2*-", "K_2*0", "anti-K_2*0", - "K_1+", "K_1-", "K_10", "anti-K_10", - "D'_1+", "D'_1-", "D'_10", "anti-D'_10" ); + static EvtIdSet regenerateMasses{ "K_2*+", "K_2*-", "K_2*0", "anti-K_2*0", + "K_1+", "K_1-", "K_10", "anti-K_10", + "D'_1+", "D'_1-", "D'_10", "anti-D'_10" }; if ( regenerateMasses.contains( getDaug( 0 ) ) ) { p->resetFirstOrNot(); diff --git a/src/EvtGenModels/EvtLb2plnuLCSR.cpp b/src/EvtGenModels/EvtLb2plnuLCSR.cpp --- a/src/EvtGenModels/EvtLb2plnuLCSR.cpp +++ b/src/EvtGenModels/EvtLb2plnuLCSR.cpp @@ -62,9 +62,9 @@ void EvtLb2plnuLCSR::decay( EvtParticle* p ) { //This is a kludge to avoid warnings because the K_2* mass becomes to large. - static EvtIdSet regenerateMasses( "K_2*+", "K_2*-", "K_2*0", "anti-K_2*0", - "K_1+", "K_1-", "K_10", "anti-K_10", - "D'_1+", "D'_1-", "D'_10", "anti-D'_10" ); + static EvtIdSet regenerateMasses{ "K_2*+", "K_2*-", "K_2*0", "anti-K_2*0", + "K_1+", "K_1-", "K_10", "anti-K_10", + "D'_1+", "D'_1-", "D'_10", "anti-D'_10" }; if ( regenerateMasses.contains( getDaug( 0 ) ) ) { p->resetFirstOrNot(); diff --git a/src/EvtGenModels/EvtLb2plnuLQCD.cpp b/src/EvtGenModels/EvtLb2plnuLQCD.cpp --- a/src/EvtGenModels/EvtLb2plnuLQCD.cpp +++ b/src/EvtGenModels/EvtLb2plnuLQCD.cpp @@ -62,9 +62,9 @@ void EvtLb2plnuLQCD::decay( EvtParticle* p ) { //This is a kludge to avoid warnings because the K_2* mass becomes to large. - static EvtIdSet regenerateMasses( "K_2*+", "K_2*-", "K_2*0", "anti-K_2*0", - "K_1+", "K_1-", "K_10", "anti-K_10", - "D'_1+", "D'_1-", "D'_10", "anti-D'_10" ); + static EvtIdSet regenerateMasses{ "K_2*+", "K_2*-", "K_2*0", "anti-K_2*0", + "K_1+", "K_1-", "K_10", "anti-K_10", + "D'_1+", "D'_1-", "D'_10", "anti-D'_10" }; if ( regenerateMasses.contains( getDaug( 0 ) ) ) { p->resetFirstOrNot(); diff --git a/src/EvtGenModels/EvtPropSLPole.cpp b/src/EvtGenModels/EvtPropSLPole.cpp --- a/src/EvtGenModels/EvtPropSLPole.cpp +++ b/src/EvtGenModels/EvtPropSLPole.cpp @@ -203,34 +203,35 @@ if ( par != nullptr ) { if ( par->hasValidP4() ) maxMass = par->mass(); - for ( size_t i = 0; i < par->getNDaug(); i++ ) { + for ( std::size_t i = 0; i < par->getNDaug(); i++ ) { EvtParticle* tDaug = par->getDaug( i ); if ( pmeson != tDaug ) maxMass -= EvtPDL::getMinMass( tDaug->getId() ); } } - EvtId* dauId = nullptr; - double* dauMasses = nullptr; - size_t nDaug = pmeson->getNDaug(); + std::vector dauId; + std::vector dauMasses; + const std::size_t nDaug{ pmeson->getNDaug() }; if ( nDaug > 0 ) { - dauId = new EvtId[nDaug]; - dauMasses = new double[nDaug]; - for ( size_t j = 0; j < nDaug; j++ ) { + dauId.resize( nDaug ); + dauMasses.resize( nDaug ); + for ( std::size_t j = 0; j < nDaug; j++ ) { dauId[j] = pmeson->getDaug( j )->getId(); dauMasses[j] = pmeson->getDaug( j )->mass(); } } - EvtId* parId = nullptr; - EvtId* othDaugId = nullptr; + EvtId parId; + EvtId othDaugId; EvtParticle* tempPar = pmeson->getParent(); if ( tempPar ) { - parId = new EvtId( tempPar->getId() ); + parId = tempPar->getId(); if ( tempPar->getNDaug() == 2 ) { - if ( tempPar->getDaug( 0 ) == pmeson ) - othDaugId = new EvtId( tempPar->getDaug( 1 )->getId() ); - else - othDaugId = new EvtId( tempPar->getDaug( 0 )->getId() ); + if ( tempPar->getDaug( 0 ) == pmeson ) { + othDaugId = tempPar->getDaug( 1 )->getId(); + } else { + othDaugId = tempPar->getDaug( 0 )->getId(); + } } } @@ -281,9 +282,9 @@ double massOthD = -10.; double massParent = -10.; int birthl = -10; - if ( othDaugId ) { - EvtSpinType::spintype spinOth = EvtPDL::getSpinType( *othDaugId ); - EvtSpinType::spintype spinPar = EvtPDL::getSpinType( *parId ); + if ( othDaugId != EvtId{} ) { + EvtSpinType::spintype spinOth = EvtPDL::getSpinType( othDaugId ); + EvtSpinType::spintype spinPar = EvtPDL::getSpinType( parId ); int tt1 = EvtSpinType::getSpin2( spinOth ); int tt2 = EvtSpinType::getSpin2( spinPar ); @@ -296,8 +297,8 @@ if ( birthl < 0 ) birthl = 0; - massOthD = EvtPDL::getMeanMass( *othDaugId ); - massParent = EvtPDL::getMeanMass( *parId ); + massOthD = EvtPDL::getMeanMass( othDaugId ); + massParent = EvtPDL::getMeanMass( parId ); } } double massM = _massMax; @@ -332,15 +333,6 @@ double ampVal = sqrt( pdf.evaluate( point ) ); - if ( parId ) - delete parId; - if ( othDaugId ) - delete othDaugId; - if ( dauId ) - delete[] dauId; - if ( dauMasses ) - delete[] dauMasses; - return ampVal; } @@ -370,7 +362,7 @@ p_init.set( EvtPDL::getMass( parent ), 0.0, 0.0, 0.0 ); scalar_part->init( parent, p_init ); - root_part = (EvtParticle*)scalar_part; + root_part = scalar_part; // root_part->set_type(EvtSpinType::SCALAR); root_part->setDiagonalSpinDensity(); @@ -481,9 +473,9 @@ calcamp->CalcAmp( root_part, amp, FormFactors ); - EvtPoint1D* point = new EvtPoint1D( mass[0] ); + EvtPoint1D point( mass[0] ); - double meson_BWAmp = calBreitWigner( daughter, *point ); + double meson_BWAmp = calBreitWigner( daughter, point ); int list[2]; list[0] = 0; diff --git a/src/EvtGenModels/EvtRareLbToLllFFBase.cpp b/src/EvtGenModels/EvtRareLbToLllFFBase.cpp --- a/src/EvtGenModels/EvtRareLbToLllFFBase.cpp +++ b/src/EvtGenModels/EvtRareLbToLllFFBase.cpp @@ -36,8 +36,9 @@ } EvtRareLbToLllFFBase::EvtRareLbToLllFFBase() : - natural_( "Lambda0", "anti-Lambda0", "Lambda(1520)0", "anti-Lambda(1520)0", - "Lambda(1600)0", "anti-Lambda(1600)0" ) + natural_{ "Lambda0", "anti-Lambda0", + "Lambda(1520)0", "anti-Lambda(1520)0", + "Lambda(1600)0", "anti-Lambda(1600)0" } { } diff --git a/src/EvtGenModels/EvtSLDiBaryonAmp.cpp b/src/EvtGenModels/EvtSLDiBaryonAmp.cpp --- a/src/EvtGenModels/EvtSLDiBaryonAmp.cpp +++ b/src/EvtGenModels/EvtSLDiBaryonAmp.cpp @@ -420,11 +420,18 @@ int parity( 1 ); // List of baryons with parity = +1 - static EvtIdSet posParity( "p+", "Delta+", "Lambda_c+", - "anti-Lambda_c(2593)-", "anti-Lambda_c(2625)-", - "N(1440)+", "anti-N(1520)-", "anti-N(1535)-", - "anti-N(1650)-", "anti-N(1700)-", "N(1710)+", - "N(1720)+" ); + static EvtIdSet posParity{ "p+", + "Delta+", + "Lambda_c+", + "anti-Lambda_c(2593)-", + "anti-Lambda_c(2625)-", + "N(1440)+", + "anti-N(1520)-", + "anti-N(1535)-", + "anti-N(1650)-", + "anti-N(1700)-", + "N(1710)+", + "N(1720)+" }; // If the baryon id is not in the list, set the parity to -1 if ( !posParity.contains( id ) ) { diff --git a/src/EvtGenModels/EvtTauHadnu.cpp b/src/EvtGenModels/EvtTauHadnu.cpp --- a/src/EvtGenModels/EvtTauHadnu.cpp +++ b/src/EvtGenModels/EvtTauHadnu.cpp @@ -115,8 +115,8 @@ { static EvtId TAUM = EvtPDL::getId( "tau-" ); - EvtIdSet thePis( "pi+", "pi-", "pi0" ); - EvtIdSet theKs( "K+", "K-" ); + EvtIdSet thePis{ "pi+", "pi-", "pi0" }; + EvtIdSet theKs{ "K+", "K-" }; p->initializePhaseSpace( getNDaug(), getDaugs() ); diff --git a/src/EvtGenModels/EvtbTosllScalarAmp.cpp b/src/EvtGenModels/EvtbTosllScalarAmp.cpp --- a/src/EvtGenModels/EvtbTosllScalarAmp.cpp +++ b/src/EvtGenModels/EvtbTosllScalarAmp.cpp @@ -99,8 +99,8 @@ EvtComplex dprime; dprime = c10eff * fm; - static EvtIdSet leptons( "e-", "mu-", "tau-" ); - static EvtIdSet antileptons( "e+", "mu+", "tau+" ); + static EvtIdSet leptons{ "e-", "mu-", "tau-" }; + static EvtIdSet antileptons{ "e+", "mu+", "tau+" }; if ( leptons.contains( l_num ) ) { T1 = aprime * phat + bprime * qhat; diff --git a/src/EvtGenModels/EvtbTosllScalarAmpNew.cpp b/src/EvtGenModels/EvtbTosllScalarAmpNew.cpp --- a/src/EvtGenModels/EvtbTosllScalarAmpNew.cpp +++ b/src/EvtGenModels/EvtbTosllScalarAmpNew.cpp @@ -310,8 +310,8 @@ EvtVector4C lac21, lac22; // the leptonic axial current // B - and barB - mesons descriptors - EvtIdSet bmesons( "B-", "anti-B0", "anti-B_s0", "B_c-" ); - EvtIdSet bbarmesons( "B+", "B0", "B_s0", "B_c+" ); + EvtIdSet bmesons{ "B-", "anti-B0", "anti-B_s0", "B_c-" }; + EvtIdSet bbarmesons{ "B+", "B0", "B_s0", "B_c+" }; EvtId parentID = parent->getId(); diff --git a/src/EvtGenModels/EvtbTosllScalarAmpNewExt.cpp b/src/EvtGenModels/EvtbTosllScalarAmpNewExt.cpp --- a/src/EvtGenModels/EvtbTosllScalarAmpNewExt.cpp +++ b/src/EvtGenModels/EvtbTosllScalarAmpNewExt.cpp @@ -307,8 +307,8 @@ EvtVector4C lac21, lac22; // the leptonic axial current // B - and barB - mesons descriptors - EvtIdSet bmesons( "B-", "anti-B0", "anti-B_s0", "B_c-" ); - EvtIdSet bbarmesons( "B+", "B0", "B_s0", "B_c+" ); + EvtIdSet bmesons{ "B-", "anti-B0", "anti-B_s0", "B_c-" }; + EvtIdSet bbarmesons{ "B+", "B0", "B_s0", "B_c+" }; EvtId parentID = parent->getId(); diff --git a/src/EvtGenModels/EvtbTosllVectorAmp.cpp b/src/EvtGenModels/EvtbTosllVectorAmp.cpp --- a/src/EvtGenModels/EvtbTosllVectorAmp.cpp +++ b/src/EvtGenModels/EvtbTosllVectorAmp.cpp @@ -128,8 +128,8 @@ EvtTensor4C T1, T2; - static EvtIdSet bmesons( "B-", "anti-B0", "anti-B_s0" ); - static EvtIdSet bbarmesons( "B+", "B0", "B_s0" ); + static EvtIdSet bmesons{ "B-", "anti-B0", "anti-B_s0" }; + static EvtIdSet bbarmesons{ "B+", "B0", "B_s0" }; EvtParticle* lepPlus = nullptr; EvtParticle* lepMinus = nullptr; diff --git a/src/EvtGenModels/EvtbTosllVectorAmpNew.cpp b/src/EvtGenModels/EvtbTosllVectorAmpNew.cpp --- a/src/EvtGenModels/EvtbTosllVectorAmpNew.cpp +++ b/src/EvtGenModels/EvtbTosllVectorAmpNew.cpp @@ -349,8 +349,8 @@ EvtVector4C lac21, lac22; // the leptonic axial current // B - and barB - mesons descriptors - EvtIdSet bmesons( "B-", "anti-B0", "anti-B_s0", "B_c-" ); - EvtIdSet bbarmesons( "B+", "B0", "B_s0", "B_c+" ); + EvtIdSet bmesons{ "B-", "anti-B0", "anti-B_s0", "B_c-" }; + EvtIdSet bbarmesons{ "B+", "B0", "B_s0", "B_c+" }; EvtId parentID = parent->getId(); diff --git a/src/EvtGenModels/EvtbTosllVectorAmpNewExt.cpp b/src/EvtGenModels/EvtbTosllVectorAmpNewExt.cpp --- a/src/EvtGenModels/EvtbTosllVectorAmpNewExt.cpp +++ b/src/EvtGenModels/EvtbTosllVectorAmpNewExt.cpp @@ -356,8 +356,8 @@ EvtVector4C lac21, lac22; // the leptonic axial current // B - and barB - mesons descriptors - EvtIdSet bmesons( "B-", "anti-B0", "anti-B_s0", "B_c-" ); - EvtIdSet bbarmesons( "B+", "B0", "B_s0", "B_c+" ); + EvtIdSet bmesons{ "B-", "anti-B0", "anti-B_s0", "B_c-" }; + EvtIdSet bbarmesons{ "B+", "B0", "B_s0", "B_c+" }; EvtId parentID = parent->getId(); diff --git a/src/EvtGenModels/Evtbs2llGammaAmp.cpp b/src/EvtGenModels/Evtbs2llGammaAmp.cpp --- a/src/EvtGenModels/Evtbs2llGammaAmp.cpp +++ b/src/EvtGenModels/Evtbs2llGammaAmp.cpp @@ -378,8 +378,8 @@ EvtTensor4C ltc21, ltc22; // the leptonic tensor current // B - and barB - mesons descriptors - static EvtIdSet bmesons( "anti-B0", "anti-B_s0" ); - static EvtIdSet bbarmesons( "B0", "B_s0" ); + static EvtIdSet bmesons{ "anti-B0", "anti-B_s0" }; + static EvtIdSet bbarmesons{ "B0", "B_s0" }; EvtId parentID = parent->getId(); diff --git a/src/EvtGenModels/Evtbs2llGammaISRFSRAmp.cpp b/src/EvtGenModels/Evtbs2llGammaISRFSRAmp.cpp --- a/src/EvtGenModels/Evtbs2llGammaISRFSRAmp.cpp +++ b/src/EvtGenModels/Evtbs2llGammaISRFSRAmp.cpp @@ -402,8 +402,8 @@ EvtTensor4C ltc21, ltc22; // the leptonic tensor current // B - and barB - mesons descriptors - static EvtIdSet bmesons( "anti-B0", "anti-B_s0" ); - static EvtIdSet bbarmesons( "B0", "B_s0" ); + static EvtIdSet bmesons{ "anti-B0", "anti-B_s0" }; + static EvtIdSet bbarmesons{ "B0", "B_s0" }; EvtId parentID = parent->getId(); diff --git a/src/EvtGenModels/EvtbsToLLLLAmp.cpp b/src/EvtGenModels/EvtbsToLLLLAmp.cpp --- a/src/EvtGenModels/EvtbsToLLLLAmp.cpp +++ b/src/EvtGenModels/EvtbsToLLLLAmp.cpp @@ -487,8 +487,8 @@ T2second; // the hadronic matrix element calculation // B - and barB - mesons descriptors - static EvtIdSet bmesons( "anti-B0", "anti-B_s0" ); - static EvtIdSet bbarmesons( "B0", "B_s0" ); + static EvtIdSet bmesons{ "anti-B0", "anti-B_s0" }; + static EvtIdSet bbarmesons{ "B0", "B_s0" }; EvtId parentID = parent->getId(); diff --git a/src/EvtGenModels/EvtbsToLLLLHyperCPAmp.cpp b/src/EvtGenModels/EvtbsToLLLLHyperCPAmp.cpp --- a/src/EvtGenModels/EvtbsToLLLLHyperCPAmp.cpp +++ b/src/EvtGenModels/EvtbsToLLLLHyperCPAmp.cpp @@ -272,8 +272,8 @@ k2second = ksecond.mass2(); // Mandelstam variable t=k^2 // B - and barB - mesons descriptors - static EvtIdSet bmesons( "anti-B0", "anti-B_s0" ); - static EvtIdSet bbarmesons( "B0", "B_s0" ); + static EvtIdSet bmesons{ "anti-B0", "anti-B_s0" }; + static EvtIdSet bbarmesons{ "B0", "B_s0" }; EvtId parentID = parent->getId(); diff --git a/test/evtgenlhc_test1.cc b/test/evtgenlhc_test1.cc --- a/test/evtgenlhc_test1.cc +++ b/test/evtgenlhc_test1.cc @@ -869,15 +869,15 @@ static EvtId dm = EvtPDL::getId( std::string( "D-" ) ); static EvtId db = EvtPDL::getId( std::string( "anti-D0" ) ); - static EvtIdSet theKs( kp, km, ks, kl, k0, kb ); - static EvtIdSet theDs( d0, dp, dm, db ); + static EvtIdSet theKs{ kp, km, ks, kl, k0, kb }; + static EvtIdSet theDs{ d0, dp, dm, db }; static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); static EvtId B0B = EvtPDL::getId( std::string( "anti-B0" ) ); static EvtId BP = EvtPDL::getId( std::string( "B+" ) ); static EvtId BM = EvtPDL::getId( std::string( "B-" ) ); - static EvtIdSet theBs( B0B, B0, BP, BM ); + static EvtIdSet theBs{ B0B, B0, BP, BM }; int nDDK = 0; do { @@ -1454,9 +1454,9 @@ static EvtId pp = EvtPDL::getId( std::string( "p+" ) ); static EvtId pm = EvtPDL::getId( std::string( "anti-p-" ) ); - static EvtIdSet theTracks( ep, em, mup, mum, pip, pim, kp, km, pp, pm ); - static EvtIdSet theLeptons( ep, em, mup, mum ); - static EvtIdSet theBs( B0, B0B, BP, BM ); + static EvtIdSet theTracks{ ep, em, mup, mum, pip, pim, kp, km, pp, pm }; + static EvtIdSet theLeptons{ ep, em, mup, mum }; + static EvtIdSet theBs{ B0, B0B, BP, BM }; int count = 1; @@ -1563,22 +1563,22 @@ static EvtId BP = EvtPDL::getId( std::string( "B+" ) ); static EvtId BM = EvtPDL::getId( std::string( "B-" ) ); - static EvtIdSet theBs( B0B, B0, BP, BM ); - static EvtIdSet theB0B( B0B ); - static EvtIdSet theB0( B0 ); - static EvtIdSet theBP( BP ); - static EvtIdSet theBM( BM ); + static EvtIdSet theBs{ B0B, B0, BP, BM }; + static EvtIdSet theB0B{ B0B }; + static EvtIdSet theB0{ B0 }; + static EvtIdSet theBP{ BP }; + static EvtIdSet theBM{ BM }; static EvtId D0 = EvtPDL::getId( std::string( "D0" ) ); static EvtId D0B = EvtPDL::getId( std::string( "anti-D0" ) ); static EvtId DP = EvtPDL::getId( std::string( "D+" ) ); static EvtId DM = EvtPDL::getId( std::string( "D-" ) ); - static EvtIdSet theDs( D0B, D0, DP, DM ); - static EvtIdSet theD0B( D0B ); - static EvtIdSet theD0( D0 ); - static EvtIdSet theDP( DP ); - static EvtIdSet theDM( DM ); + static EvtIdSet theDs{ D0B, D0, DP, DM }; + static EvtIdSet theD0B{ D0B }; + static EvtIdSet theD0{ D0 }; + static EvtIdSet theDP{ DP }; + static EvtIdSet theDM{ DM }; int count; char udecay_name[100]; @@ -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; @@ -1908,7 +1908,7 @@ static EvtId D23S10 = EvtPDL::getId( std::string( "D*(2S)0" ) ); static EvtId D23S1B = EvtPDL::getId( std::string( "anti-D*(2S)0" ) ); - static EvtIdSet radExitDstar( D23S1P, D23S1N, D23S10, D23S1B ); + static EvtIdSet radExitDstar{ D23S1P, D23S1N, D23S10, D23S1B }; TFile* file = new TFile( "semic.root", "RECREATE" );