diff --git a/EvtGenExternal/EvtPHOTOS.hh b/EvtGenExternal/EvtPHOTOS.hh --- a/EvtGenExternal/EvtPHOTOS.hh +++ b/EvtGenExternal/EvtPHOTOS.hh @@ -18,6 +18,7 @@ * along with EvtGen. If not, see . * ***********************************************************************/ +#ifdef EVTGEN_PHOTOS #ifndef EVTPHOTOS_HH #define EVTPHOTOS_HH @@ -27,7 +28,6 @@ #include "EvtGenBase/EvtParticle.hh" #include "EvtGenBase/EvtVector4R.hh" -#ifdef EVTGEN_PHOTOS #ifdef EVTGEN_HEPMC3 #include "HepMC3/Units.h" @@ -38,7 +38,6 @@ #include "Photos/PhotosHepMCParticle.h" #include "Photos/PhotosParticle.h" #endif -#endif #include #include @@ -63,7 +62,6 @@ void doRadCorr( EvtParticle* theParticle ) override; private: -#ifdef EVTGEN_PHOTOS GenParticlePtr createGenParticle( const EvtParticle& theParticle, bool incoming ) const; @@ -78,8 +76,8 @@ bool m_initialised = false; static std::mutex photos_mutex; +}; #endif -}; #endif diff --git a/History.md b/History.md --- a/History.md +++ b/History.md @@ -11,6 +11,9 @@ === ## R02-0X-00 +17 Apr 2024 Fernando Abudinen +* D114: Simplified pre-processor behaviour for PHOTOS. + 12 Apr 2024 Fernando Abudinen * D113: Introduced new FSR flag and deprecated PHOTOS flag. Implemented proper use of neverRadCorr. diff --git a/src/EvtGenExternal/EvtExternalGenList.cpp b/src/EvtGenExternal/EvtExternalGenList.cpp --- a/src/EvtGenExternal/EvtExternalGenList.cpp +++ b/src/EvtGenExternal/EvtExternalGenList.cpp @@ -20,6 +20,8 @@ #include "EvtGenExternal/EvtExternalGenList.hh" +#include "EvtGenModels/EvtNoRadCorr.hh" + #include "EvtGenExternal/EvtExternalGenFactory.hh" #include "EvtGenExternal/EvtPHOTOS.hh" #include "EvtGenExternal/EvtPythia.hh" @@ -54,6 +56,7 @@ { } +#ifdef EVTGEN_PHOTOS EvtAbsRadCorr* EvtExternalGenList::getPhotosModel( const double infraredCutOff, const double maxWtInterference ) { @@ -62,6 +65,20 @@ infraredCutOff, maxWtInterference ); return photosModel; } +#else +EvtAbsRadCorr* EvtExternalGenList::getPhotosModel( + const double /*infraredCutOff*/, const double /*maxWtInterference*/ ) +{ + EvtGenReport( EVTGEN_ERROR, "EvtGen" ) + << " PHOTOS generator has been called for FSR simulation, but it was not switched on during compilation." + << std::endl; + + EvtGenReport( EVTGEN_ERROR, "EvtGen" ) + << " The simulation will be generated without FSR." << std::endl; + + return new EvtNoRadCorr{}; +} +#endif std::list EvtExternalGenList::getListOfModels() { diff --git a/src/EvtGenExternal/EvtPHOTOS.cpp b/src/EvtGenExternal/EvtPHOTOS.cpp --- a/src/EvtGenExternal/EvtPHOTOS.cpp +++ b/src/EvtGenExternal/EvtPHOTOS.cpp @@ -18,6 +18,8 @@ * along with EvtGen. If not, see . * ***********************************************************************/ +#ifdef EVTGEN_PHOTOS + #include "EvtGenExternal/EvtPHOTOS.hh" #include "EvtGenBase/EvtPDL.hh" @@ -32,8 +34,6 @@ using std::endl; -#ifdef EVTGEN_PHOTOS - // Mutex PHOTOS as it is not thread safe. std::mutex EvtPHOTOS::photos_mutex; @@ -79,22 +79,27 @@ photos_mutex.unlock(); } -#else -EvtPHOTOS::EvtPHOTOS( const std::string& /*photonType*/, - const bool /*useEvtGenRandom*/, - const double /*infraredCutOff*/, - const double /*maxWtInterference*/ ) + +void EvtPHOTOS::initialise() { - EvtGenReport( EVTGEN_WARNING, "EvtGen" ) - << " PHOTOS has been called for FSR simulation, but it was not switched on during compilation." - << endl; + if ( m_initialised ) { + return; + } + m_gammaId = EvtPDL::getId( m_photonType ); + + if ( m_gammaId == EvtId( -1, -1 ) ) { + EvtGenReport( EVTGEN_INFO, "EvtGen" ) + << "Error in EvtPHOTOS. Do not recognise the photon type " + << m_photonType << ". Setting this to \"gamma\". " << endl; + m_gammaId = EvtPDL::getId( "gamma" ); + } + + m_gammaPDG = EvtPDL::getStdHep( m_gammaId ); + m_mPhoton = EvtPDL::getMeanMass( m_gammaId ); - EvtGenReport( EVTGEN_WARNING, "EvtGen" ) - << " The simulation will be generated without FSR." << endl; + m_initialised = true; } -#endif -#ifdef EVTGEN_PHOTOS void EvtPHOTOS::doRadCorr( EvtParticle* theParticle ) { if ( !theParticle ) { @@ -224,39 +229,7 @@ return; } -#else -void EvtPHOTOS::doRadCorr( EvtParticle* /*theParticle*/ ) -{ -} -#endif -#ifdef EVTGEN_PHOTOS -void EvtPHOTOS::initialise() -{ - if ( m_initialised ) { - return; - } - m_gammaId = EvtPDL::getId( m_photonType ); - - if ( m_gammaId == EvtId( -1, -1 ) ) { - EvtGenReport( EVTGEN_INFO, "EvtGen" ) - << "Error in EvtPHOTOS. Do not recognise the photon type " - << m_photonType << ". Setting this to \"gamma\". " << endl; - m_gammaId = EvtPDL::getId( "gamma" ); - } - - m_gammaPDG = EvtPDL::getStdHep( m_gammaId ); - m_mPhoton = EvtPDL::getMeanMass( m_gammaId ); - - m_initialised = true; -} -#else -void EvtPHOTOS::initialise() -{ -} -#endif - -#ifdef EVTGEN_PHOTOS GenParticlePtr EvtPHOTOS::createGenParticle( const EvtParticle& theParticle, bool incoming ) const {