diff --git a/EvtGenExternal/EvtExternalGenFactory.hh b/EvtGenExternal/EvtExternalGenFactory.hh index eb6ce21..74f3a5c 100644 --- a/EvtGenExternal/EvtExternalGenFactory.hh +++ b/EvtGenExternal/EvtExternalGenFactory.hh @@ -1,70 +1,72 @@ /*********************************************************************** * 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 <https://www.gnu.org/licenses/>. * ***********************************************************************/ #ifndef EVTEXTERNALGENFACTORY_HH #define EVTEXTERNALGENFACTORY_HH #include "EvtGenModels/EvtAbsExternalGen.hh" #include <map> #include <memory> // Description: A factory type method to create engines for external physics // generators like Pythia. class EvtExternalGenFactory final { public: enum class GenId { PythiaGenId = 0, TauolaGenId }; static EvtExternalGenFactory& getInstance(); EvtAbsExternalGen* getGenerator( const GenId genId ); void initialiseAllGenerators(); void definePythiaGenerator( std::string xmlDir, bool convertPhysCodes, bool useEvtGenRandom = true ); void defineTauolaGenerator( bool useEvtGenRandom = true, - bool seedTauolaFortran = true ); + bool seedTauolaFortran = true, + bool useTauolaRadiation = false, + double infraredCutOffTauola = 1.0e-7 ); //methods to add configuration commands to the pythia generators //void addPythiaCommand( std::string generator, std::string module, std::string param, std::string value); //void addPythia6Command(std::string generator, std::string module, std::string param, std::string value); private: EvtExternalGenFactory() = default; ~EvtExternalGenFactory() = default; EvtExternalGenFactory( const EvtExternalGenFactory& ) = delete; EvtExternalGenFactory( EvtExternalGenFactory&& ) = delete; EvtExternalGenFactory& operator=( const EvtExternalGenFactory& ) = delete; EvtExternalGenFactory& operator=( EvtExternalGenFactory&& ) = delete; typedef std::map<GenId, std::unique_ptr<EvtAbsExternalGen>> ExtGenMap; //typedef std::map<GenId, std::map<std::string, std::vector<std::string>>> ExtGenCommandMap; ExtGenMap m_extGenMap; //ExtGenCommandMap m_extGenCommandMap; }; #endif diff --git a/EvtGenExternal/EvtExternalGenList.hh b/EvtGenExternal/EvtExternalGenList.hh index 92466c7..1cd5176 100644 --- a/EvtGenExternal/EvtExternalGenList.hh +++ b/EvtGenExternal/EvtExternalGenList.hh @@ -1,57 +1,59 @@ /*********************************************************************** * 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 <https://www.gnu.org/licenses/>. * ***********************************************************************/ #ifndef EVTEXTERNALGENLIST_HH #define EVTEXTERNALGENLIST_HH #include "EvtGenBase/EvtAbsRadCorr.hh" #include "EvtGenBase/EvtDecayBase.hh" #include <list> // Description: A factory type method to create engines for external physics // generators like Pythia. class EvtExternalGenList { public: EvtExternalGenList( bool convertPythiaCodes = false, std::string pythiaXmlDir = "", std::string photonType = "gamma", bool useEvtGenRandom = true, - bool seedTauolaFortran = true ); + bool seedTauolaFortran = true, + bool useTauolaRadiation = false, + double infraredCutOffTauola = 1.0e-7 ); virtual ~EvtExternalGenList(); std::list<EvtDecayBase*> getListOfModels(); EvtAbsRadCorr* getPhotosModel( const double infraredCutOff = 1.0e-7, const double maxWtInterference = 64.0 ); EvtAbsRadCorr* getSherpaPhotonsModel( const double infraredCutOff = 1.0e-7, const int mode = 2, const int useME = 0 ); private: std::string m_photonType; bool m_useEvtGenRandom; }; #endif diff --git a/EvtGenExternal/EvtTauolaEngine.hh b/EvtGenExternal/EvtTauolaEngine.hh index 6fada5d..ee427cd 100644 --- a/EvtGenExternal/EvtTauolaEngine.hh +++ b/EvtGenExternal/EvtTauolaEngine.hh @@ -1,86 +1,92 @@ /*********************************************************************** * 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 <https://www.gnu.org/licenses/>. * ***********************************************************************/ #ifdef EVTGEN_TAUOLA #ifndef EVTTAUOLAENGINE_HH #define EVTTAUOLAENGINE_HH #include "EvtGenBase/EvtDecayBase.hh" #include "EvtGenBase/EvtId.hh" #include "EvtGenBase/EvtParticle.hh" #include "EvtGenBase/EvtVector4R.hh" #include "EvtGenModels/EvtAbsExternalGen.hh" #ifdef EVTGEN_HEPMC3 #include "HepMC3/Relatives.h" #include "HepMC3/Units.h" #include "Tauola/TauolaHepMC3Event.h" #include "Tauola/TauolaHepMC3Particle.h" #else #include "Tauola/TauolaHepMCEvent.h" #include "Tauola/TauolaHepMCParticle.h" #include "Tauola/TauolaParticle.h" #endif #include "EvtGenBase/EvtHepMCEvent.hh" #include <mutex> // Description: Interface to the TAUOLA external generator class EvtTauolaEngine : public EvtAbsExternalGen { public: - EvtTauolaEngine( bool useEvtGenRandom = true, bool seedTauolaFortran = true ); + EvtTauolaEngine( bool useEvtGenRandom = true, bool seedTauolaFortran = true, + bool useTauolaRadiation = false, + double infraredCutOffTauola = 1.0e-7 ); bool doDecay( EvtParticle* theMother ) override; void initialise() override; private: GenParticlePtr createGenParticle( const EvtParticle* theParticle ) const; void setUpPossibleTauModes(); void setOtherParameters(); int getModeInt( EvtDecayBase* decayModel ) const; void decayTauEvent( EvtParticle* tauParticle ); bool m_useEvtGenRandom{ true }; bool m_seedTauolaFortran{ true }; + // Arguments to steer radiation in leptonic tau decays + bool m_useTauolaRadiation{ false }; + double m_infraredCutOffTauola{ 1.0e-7 }; + // PDG standard code integer ID for tau particle static constexpr int m_tauPDG{ 15 }; // Number of possible decay modes in Tauola static constexpr int m_nTauolaModes{ 22 }; // Neutral and charged spin propagator choices static int m_neutPropType; static int m_posPropType; static int m_negPropType; static bool m_initialised; static std::mutex m_tauola_mutex; }; #endif #endif diff --git a/History.md b/History.md index 2ba7dce..a556224 100644 --- a/History.md +++ b/History.md @@ -1,1014 +1,1018 @@ # History file for EvtGen From version 2.0.0, Tabc labels refer to [Maniphest tasks](https://phab.hepforge.org/maniphest/query/nkBRd9OhPCBN/), while Dxyz labels refer to [Differential code reviews](https://phab.hepforge.org/differential/query/YDY8EgjNGd.e/) on HepForge: https://phab.hepforge.org/Tabc https://phab.hepforge.org/Dxyz === ## R03-00-00-betaX +7 Dec 2025 Fernando Abudinen +* D135: Control radiation corrections in TAUOLA + - Introduced arguments to switch on/off TAUOLA FSR for leptonic decays and control photon cut-off. + 3 Dec 2024 Fernando Abudinen * D134: Add support for Sherpa 3 - Modified EvtSherpaPhotons interface to support both Sherpa 2 and 3 releases - Introduced finalise function inside EvtSherpaPhotons class to control the order of static destruction - Updated CI to pick Sherpa 3, use Sherpa 2 for legacy builds - Updated setupEvtGen for Sherpa 3 2 Dec 2024 Thomas Latham * Remove or convert C headers to C++ equivalents 18 Nov 2024 Thomas Latham * Update CI to use LCG\_105 on el9 with gcc13/clang16 by default - Also update CI to avoid spurious failure of test stage - Update clang-format config to clang16 and apply resulting changes 25 Oct 2024 Thomas Latham * Fixes, updates and improvements to setupEvtGen script 7 Oct 2024 Thomas Latham * D133: Fix bug in rotation to helicity basis for tensor particles 4 Oct 2024 Heather Ratcliffe, Thomas Latham, Fernando Abudinen * D132: Introduce thread safety - Protect statics: make them const or thread\_local - Improve const-correctness of many functions - Make thread\_local the RNG, particle property table, external factory, decay tables, and sym tables - Add explicit mutexing to non-thread-safe externals (Sherpa, Tauola, Photos) - Propagate the EvtGen seed to the Fortran RNG in Tauola - Some fixes to EvtBtoXsEtap and EvtBtoXsgamma - Reorganise test code for multi-threading 1 Oct 2024 Fernando Abudinen * D131: Tauola tests - Translated TAUOLA tests in validation to new json format - Covered all 22 supported TAUOLA models 18 Sep 2024 Thomas Latham * D130: Fix recently introduced bug in EvtDalitzReso for parent with significant natural width - Add a test for eta\_c -> K+ K- pi0 under GENERIC\_DALITZ model - Modify code to restore correct behaviour - Make other general improvements to EvtDalitzReso class 14 Aug 2024 Fernando Abudinen * D128: Improvements in EvtId and EvtPDL. - Modernisation of EvtId class improving Boolean functions. - Conversion of EvtPDL into thread-local singleton. - Propagation of changes in EvtPDL to EvtGen initialisation. 9 Aug 2024 Fernando Abudinen * D129: Added tests for PYTHIA interface - Introduced new tests for decays with PYTHIA. - Converted preexisting tests to json format based on new testing framework. 1 Aug 2024 Fernando Abudinen * D127: Improve FSR mutexing by using `std::lock_guard`. 3 July 2024 Fernando Abudinen * D126: Fix FSR initialisation for thread safety. - Modified PHOTOS and Sherpa instances to become global static members and made sure that they are initialised only once. - Made sure that calls to these instances are mutexed. - Made sure that all interface class members are initialised for each thread. 1 July 2024 Fernando Abudinen * D125: Removed `EventHandler` in `EvtSherpaPhotons` interface to reduce initialisation overhead. 24 June 2024 John Back * D124: Add EvtD0ToKspipi DP model, courtesy of Camille Normand (LHCb). 21 June 2024 Thomas Latham * D123: Removed `EvtPatches.hh`. Removed unused `clock_t` typedef and redundant `UNUSED` macro. 20 June 2024 Thomas Latham * D122: Fix compilation warnings under gcc13 and clang16 20 June 2024 Fernando Abudinen * D121: Introduced function `setSeed` to set seed for random number engines. 19 June 2024 Thomas Latham * D120: Remove "reference" field from JSON test files. Instead simply prepend "Ref/" to output ROOT file name. 22 May 2024 Fernando Abudinen * D118: Removed obsolete `ISR` attribute for photons. It was redundant as it was supposed to be the contrary of the `FSR` attribute. It was never used and could lead to confusion. - The `FSR` attribute is now set to 0 by default at initialisation for `EvtPhotonParticle`. 21 May 2024 Fernando Abudinen * D115: Introduced Sherpa's PHOTONS++ generator as alternative for final-state radiation simulation. - Added Sherpa dependencies and linking in compilation files - Introduced new `EvtSherpaPhotons` interface - Introduced new `EvtSherpaRandom` interface to propagate EvtGen's random number into Sherpa - Implemented `fsrGenerator` as input argument in `testDecayModel` module 8 May 2024 Michal Kreps, Thomas Latham, Andrii Verbytskyi * D58: Rename member variables to follow convention of `m_` prefix - In addition: * Introduce pre-build check in the CI that convention is being followed in all classes * Fix shadowing of variables in some classes * Fixes to Doxygen configuration * Enable shadowing and overloaded-virtual compiler warnings 23 Apr 2024 Thomas Latham * D117: Drop redundant EVTGEN\_CPP11 preprocessor switch 22 Apr 2024 Fernando Abudinen * D116: Replaced PHOTOS with FSR flags in examples and tests. 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. 12 Apr 2024 Fernando Abudinen * D112: Removed EvtPhotosEngine and moved its functionality EvtPHOTOS class. Moved initialisation of fsrEngine to setRadCorrEngine. 11 Apr 2024 Thomas Latham * D109: Remove broken or obsolete models - Models removed: * BHADRONIC * BQTOLLLLHYPERCP * BQTOLLLL * D\_MULTIBODY * KSTARSTARGAMMA * LAMBDAB2LAMBDAV and subsidiary models LAMBDA2PPIFORLAMBDAB2LAMBDAV and V2VPVMFORLAMBDAB2LAMBDAV * Lb2Lhh * PROPSLPOLE * VPHOTOV * VPHOTOVISR * VUB\_AC - Classes in EvtGenBase already unused or used only by the above models also removed * Evt3Rank3C * EvtAbsBinning * EvtAmpAmpPdf * EvtAmpIndex * EvtAmpSubIndex * EvtBreitWignerPdf * EvtDecayParm * EvtIntegPdf1D * EvtMBreitWigner * EvtMHelAmp * EvtMNode * EvtMParticle * EvtMLineShape * EvtMRes * EvtMTree * EvtMTrivialLS * EvtPointPred * EvtPto3PAmpSmpResolution * EvtSpinAmp 9 Apr 2024 Fernando Abudinen * D111: Added tests for decays with FSR and implemented const correctness for getP4LabBeforeFSR() function. 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 * T230: Add EvtBcVPPHad model for Bc to Jpsi p pbar pi decays and generalised particle ordering for EvtBcVHad decay files, courtesy of Aleksei Luchinsky, Dmitrii Pereima & Vanya Belyaev (LHCb). Updated EvtPhiDalitz model to use helicity amplitudes and fixed the indices used in EvtVector3R::dot(), courtesy of Arnau Brossa Gonzalo & Antonio Romero Vidal (LHCb). 31 Oct 2023 Fernando Abudinen * D102: Bugfix probmax issue for X38722-+\_PSI\_GAMMA model - Calculation of amplitude moved to dedicated calcAmp function and fixed initialisation. - Introduced weighting to compensate for phase-space changes due to resonance width. - Fixed bugs in rho couplings and loops over photon and vector states. 16 Oct 2023 Fernando Abudinen * D99: Add tests for PHOTOS - EvtParticle::getAttribute function made const - Added variables for testing of FSR to testing framework - Added dedicated tests for FSR with Photos - Turned off Photos for all other tests 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. 22 Aug 2023 Tom Latham * CMake updates - Update default C++ standard to 17 - Suppress 'up-to-date' messages during install - Add 'EvtGen' prefix to file names of custom CMake modules - Remove unused CMake module * Update CI config - Update default LCG version to 103 - Add builds for el9 OS using LCG 104 - Allow switching on/off building against each external - Test stage: attempt to improve selection of commits to diff in different cases - Update CVMFS tags as per https://cern.service-now.com/service-portal?id=outage&n=OTG0079356 * Fix script for generating src dependencies - Adapted to behaviour of newer CMake version in LCG 103 * Apply clang-format - Few small changes after update of CI clang version to 12 - Document version of clang-format to be used * Updates to install script - Update to latest Pythia8 and HepMC3 versions - Fix to ensure dependencies are picked up from the local install 22 Aug 2023 Andrii Verbytskyi * Patch for finding Pythia8 xmldoc path 21 Aug 2023 Tom Latham * D96: Work around change of interface for setRndmEnginePtr in Pythia8 310 22 Jun 2023 Ludovico Massaccesi * T219: Fixed amplitudes for D_DALITZ model of D0 -> pi+ pi- pi0. 1 March 2023 Fernando Abudinen * D92: Bugfix probmax issue for TENSOR daughter in EvtSSD_DirectCP model. Calculation of amplitude in EvtSSD_DirectCP model moved to dedicated calcAmp function. Got rid of a few static variables along the way. 8 Feb 2023 Alexei Sibidanov and Tom Latham * D90: Apply clang format and enable checking of formatting in gitlab CI 3 Feb 2023 John Back * D91: Check for non-zero momentum for EvtSLBaryonAmp parent spin density matrix. Print out integrals of JSON test histograms. 16 Dec 2022 John Back * D89: Added probabilities for B_c -> V pi+ and V pi+ pi0 EvtBcVHad modes. 16 Dec 2022 Alexei Sibidanov * D88: Applied clang-tidy modernize-use-nullptr 13 Dec 2022 Fernando Abudinen and Tom Latham * Various improvements to testing framework 16 Nov 2022 Tom Latham * T123: Provide documention of how to contribute bug reports, feature requests, new/modified code 8 Sep 2022 Fernando Abudinen, John Back, Michal Kreps, Tom Latham, Alex Ward * T108: Implement JSON test framework for all decay models 9 June 2022 Michal Kreps * D84: Improve efficiency of RareLbToLll decay model for final states with e+e- pair. === ## R02-02-00 12 May 2022 Michal Kreps * D83: Fix double counting of charmonia with K0 decays for B0. 11 May 2022 Tom Latham * D80: Add CMake options for enabling clang-tidy static analysis checks during build 14 Apr 2022 John Back * D82: EvtDecayProb: initialise data members and remove empty destructor 14 Apr 2022 Michal Kreps * D81: Derive EvtFlatSqDalitz from EvtDecayIncoherent since we directly provide final kinematics 2nd Mar 2022 John Back * D78: Add Bc -> J/psi K+ pi- pi+ pi- pi+, Bc -> J/psi K+ K- pi+ pi- pi+ & Bc -> J/psi 4pi+ 3pi- decay modes to the BC_VHAD model, courtesy of Aleksei Luchinsky, Anna Danilina, Dmitrii Pereima & Vanya Belyaev (LHCb) === ## R02-01-01 8th Sep 2021 Michal Kreps * Update location of web page for Pythia8 download in setup script. 8th Sep 2021 Markus Prim, Lu Cao, Chaoyi Lyu and Michel De Cian (Michal Kreps) * D73: Add new model for semileptonic B decays with BCL and BGL form-factors 8th June 2021 Michal Kreps * T110, D71: Fix B+ --> eta' l nu BF which was order of magnitude too high. Balance the decrease by increasing B+ --> D0 l nu, which is after change still bit smaller than PDG 2021. 8th Jun 2021 Michal Kreps * D71: Fix B+ --> eta' l nu BF. 20th Apr 2021 Tom Lathem * D68: Fix compilation with Pythia 8.304 17th Mar 2021 Michal Kreps * D62: Improve PI0DALITZ model to dynamically work out maximum probability to make it usuable also for eta --> llgamma decays. Remove ETA2MUMUGAMMA since it is a pure one-to-one copy of PI0DALITZ. 15th Jan 2021 Michal Kreps * D47: Model to generate 4-body phase-space decays in restricted part of the m12-m34 space 12th Jan 2021 Michal Kreps * D48: Fix bug in calculation of the daughter momentum in decay model EvtBsMuMuKK 7th Jan 2021 Michal Kreps * D43: Allow to pass particle properties table in form of stringstream to constructor of EvtGen for use case where these are created on fly. 10th Dec 2020 Michal Kreps * D36: EvtFlatSqDalitz model to be more efficient and to avoid cut-off around the edges 21st Aug 2020 John Back * T109: Add EvtEtaLLPiPi model for eta' -> l l pi pi decays (l = e or mu), - courtesy of Aleksei Luchinsky (LHCb). 29th Jun 2020 Michal Kreps * T103: Add missing include in EvtGenBase/EvtMatrix.hh. 15th May 2020 Michal Kreps * D28: Add EvtThreeBodyPhsp (rectangular Dalitz plot selection) and EvtPhspDecaytimeCut (minimum decay time requirement) models. * D27: Fix initialisation of constants in EvtBTo3hCP model. === ## R02-00-00 24th Apr 2020 Michal Kreps * Update particle properties file evt.pdl to 2019 version of RPP by PDG. 23rd Apr 2020 Tom Latham * Apply copyright and licence notices to all relevant files. 17th Apr 2020 Tom Latham * Add text of GNU GPLv3 in COPYING, add (preliminary) list of authors in AUTHORS, and clean-up all source files, prior to applying copyright and licence notices. 9th Apr 2020 Tom Latham * Improve, and document use of, standalone installation script. * Apply clang-format formatting to all C++ source files. 8th Apr 2020 Tom Latham * One small modernisation change to EvtPhotosEngine to match that already applied in EvtTauolaEngine. 8th Apr 2020 John Back * Fixed NonReson amplitude and the 4-momentum boosts used for angles in EvtLambdacPHH, - courtesy of Elisabeth Niel (LHCb). 7th Apr 2020 Gerhard Raven, Tom Latham, Michal Kreps and John Back * Incorporate C++ modernization changes from Gerhard Raven (LHCb). - Merged modernize branch into master. 9th Mar 2020 John Back * Add EvtAbsExternalGen::getDecayProb() to allow external generators to return a probability that can be used in EvtDecayProb (default = 1). 6th Mar 2020 Andrii Verbytskyi and Tom Latham * Implement HepMC3 support: EvtHepMCEvent, external engines & cmake files. 15th Nov 2019 John Back * Added EvtPsi2JpsiPiPi model for psi2S -> J/psi pi+ pi- decays based on hep-ph/1507.07985, - courtesy of Aleksei Luchinsky (LHCb). 21st August 2019 Michal Kreps * Added the EvtDToKpienu decay model for D -> K pi e nu decays from BESIII, - courtesy of Liaoyuan Dong. 16th July 2019 John Back * Correct imaginary sign for EvtComplex /= (EvtComplex c) operator. 3rd July 2019 John Back * Added the EvtLambdacPHH decay model for Lc -> p K pi decays with K*(890), Delta++(1232) and Lambda(1520) resonances, based on the Fermilab E791 analysis hep-ex/9912003v1, - courtesy of Elisabeth Niel and Patrick Robbe (LHCb). * Modified EvtResonance2 to accept other barrier factor radii. 3rd July 2019 Michal Kreps * Make sure minimum mass for resonances with non-zero widths is larger than 1e-4 GeV in EvtRelBreitWignerBarrierFact. 3rd May 2019 John Back * Corrected EvtSLDiBaryonAmp bugs/issues in the BToDiBaryonlnupQCD model: - parity, amplitude terms and B momentum reference frame variables. * Corrected treament of spinor indices in EvtRareLb2Lll, - courtesy of Tom Blake and Michal Kreps (LHCb). * Updated the EvtBcVHad model to also handle Bc -> psi Ks K decays, - courtesy of Aleksei Luchinsky (LHCb). * Add new decay model EvtBsMuMuKK (BS_MUMUKK) for Bs to J/psi (mu+mu-) K+K-, - courtesy of Veronika Chobanova, Jeremy Dalseno, Diego Martinez Santos and Marcos Romero Lamas (LHCb). * Fix infinite loop during initialisation of the EvtBTo3hCP model via EvtCBTo3piP00 and EvtCBTo3piMPP, - courtesy of Peter Richardson (Durham). 15th March 2019 Tom Latham * Implement cmake build system, replacing the old config method. 30th Jan 2019 John Back * Fix modernization compiler errors and warnings. 29th Jan 2019 Michal Kreps * Allow reading decay files which are missing end-of-line before end-of-file. 21st December 2018 John Back * Imported C++ modernization changes from Gerhard Raven (LHCb). 7th December 2018 John Back * Added the EvtBLLNuL (BLLNUL) model that generates rare B -> ell ell nu ell decays, where ell = e or mu, - courtesy of Anna Danilina and Nikolai Nikitin (LHCb). * Removed the EvtB2MuMuMuNu (BUTOMMMN) model, since its now replaced by the more general BLLNuL one. 5th November 2018 John Back * Added the BToDiBaryonlnupQCD model for generating B to p N* l nu decays, where N can be any (exited) charged baryon (spin 1/2 or 3/2), - courtesy of Mark Smith and Ryan Newcombe (LHCb), with added code optimisations. 17th October 2018 John Back * Added various decay models from LHCb EvtGenExtras package: - EvtBcVHad ("BC_VHAD"), - Evtbs2llGammaMNT ("BSTOGLLMNT"), - Evtbs2llGammaISRFSR ("BSTOGLLISRFSR"), - EvtbTosllMS ("BTOSLLMS"), - EvtbTosllMSExt ("BTOSLLMSEXT"), - EvtLb2Baryonlnu ("Lb2Baryonlnu"), - EvtLb2plnuLCSR ("Lb2plnuLCSR"), - EvtLb2plnuLQCD ("Lb2plnuLQCD"), - EvtFlatSqDalitz ("FLATSQDALITZ"), - EvtPhspFlatLifetime ("PHSPFLATLIFETIME"). 5th October 2018 John Back * Updated setupEvtGen.sh to work with the new HepForge Phabricator site. 13th March 2018 John Back * Updated EvtPythiaEngine to correctly handle updates of various particle properties so that Pythia uses the same information as EvtGen (evt.pdl) for the generic and alias PYTHIA decay model. 12th March 2018 John Back * Updated EvtBcXMuNu models (X = Scalar, Vector, Tensor) to generate Bc to D0(star) mu nu decays, with associated form factors in EvtBCXFF, - courtesy of Aleksei Luchinsky (LHCb). * Also generalised the calculation of their maximum probabilities by reusing the CalcMaxProb method in EvtSemiLeptonicAmp, which now allows for different Q^2 binning (default remains at 25 bins). === ## R01-07-00 13th December 2017 John Back * New tag incorporating all changes below. * Recommended external packages are (as used in the setupEvtGen.sh script): - HepMC 2.06.09, - pythia 8.230, - Photos++ 3.61 - Tauola++ 1.1.6c. 12th December 2017 John Back * Changed Pythia validation example decay files to use Pythia8 codes. 6th December 2017 John Back * Modified the examples to use DECAY.DEC (see 25th April 2016) instead of DECAY_2010.DEC. Changed EvtExternalGenList to assume Pythia8 codes are used in decay files by default, which is the case for DECAY.DEC. Also updated the setupEvtGen.sh script to work with Pythia 8.2x versions. 29th November 2017 John Back * Modified EvtSVP, EvtVVP and EvtTVP models to handle both radiative and two-lepton decays, - courtesy of Aleksei Luchinsky (LHCb). 14th July 2017 John Back * Only create external generator objects if they don't already exist in EvtExternalGenFactory. * Modified configure script to work with Pythia 8.2x 5th July 2017 Michal Kreps * Register the VTOSLL model. 14th June 2017 John Back * Add isNeutralKaon() boolean function and corrected comments in EvtDDalitz. 8th May 2017 Michal Kreps * Fix bug in EvtbTosllVectorAmp to recognise Bs --> K*bar mu mu decay as b --> d ll transition. 8th May 2017 Michal Kreps * Significantly simplify way how we decide on decay mode and daughters ordering in DDalitz model. - With new code by definition all orderings of daughters in the decay file will yield same output. 4th May 2017 John Back * Further fixes to DDalitz particle ordering (including charge-conjugates): - Mode 5: D0 -> K- K0bar K+ and K+ K- K0bar - Mode 12: D0 -> pi0 pi- pi+ and pi+ pi0 pi- - Removed unneeded index ordering checks for mode 10 (D+ -> pi- pi+ pi+) and mode 11 (Ds+ -> pi- pi+ pi+) 27th April 2017 John Back * Fixed DDalitz particle ordering for mode 7: D+ -> pi+ K- K+ and K+ pi+ K- and their charge-conjugates 7th April 2017 John Back * Modified EvtGenExternal/EvtPythiaEngine to ensure that the EvtGen-based instances of Pythia8 (for generic and alias decays) use the same particle properties as defined by EvtGen, - courtesy Patrick Robbe (LHCb). 5th April 2017 Michal Kreps * Fixed indexing in copy constructor of Evt3Rank3C, which would otherwise produce an infinite loop; - bug report from David Grellscheid. 3rd November 2016 John Back * Modified EvtFlatQ2 model to work for all B -> X lepton lepton modes, as well as adding an extra phase space factor to correct for the dip at low q^2, which is enabled by using "FLATQ2 1" instead of just "FLATQ2" in the decay file, - courtesy of Marcin Chrzaszcz & Thomas Blake (LHCb). 13th October 2016 John Back * Added the TauolaCurrentOption decfile keyword to select the hadronic current in Tauola; default is the BaBar-tuned current option (int = 1). * EvtParticles can store double attributes using the functions setAttributeDouble(name, double) and getAttributeDouble(name), which can be useful for storing and retrieving amplitude weights, for example. - The analogous EvtParticle integer attribute interface remains unchanged: setAttribute(name, int) and getAttribute(name). 13th September 2016 John Back * Modified EvtTauolaEngine to use internal Tauola spin matrices for tau pair events by temporarily setting the PDG id of the mother as a boson, keeping the same 4-momentum. * The BaBar hadronic currents are now used by default. * Also added the ability to change some Tauola parameters using the "Define" keyword in decay files. * Added an example decay file illustrating the new features: validation/TauolaFiles/Btautau.dec 9th September 2016 Michal Kreps * Reimplement code in EvtBTo3pi.F, EvtBTo3piMPP.F, EvtBTo3piP00.F and EvtBToKpipi.F in C++ in order to remove dependence on Fortran compiler. - With this, there is no internal Fortran code in EvtGen. === ## R01-06-00 1st June 2016 John Back * New tag incorporating all changes below. * Recommended external packages are - HepMC 2.06.09 - pythia 8.186 - Photos++ 3.61 - Tauola++ 1.1.5 28th April 2016 Michal Kreps * For Ds+ --> 2pi+ pi- there was double counting of branching fraction resulting in total branching fraction being 1.5 times larger than measured one. - Fix by revisiting submodes, which now fill total Ds --> 3pi. 25th April 2016 Michal Kreps * Added DECAY.DEC/XML, which contain updated semileptonic charm and beauty branching fractions using the 2014 PDG, tuned to minimize disagreements between measurements and EvtGen for both inclusive and exclusive decays. * Updated the evt.pdl particle properties file to the PDG 2014 edition. * Implemented new LQCD form factors for Lb --> L mu mu from arXiv paper 1602.01399 (EvtRareLbToLllFFlQCD); old LQCD form factors are removed. 18th March 2016 John Back * Fixed incorrect spinor algebra used in S1 -> 1/2 S2, 1/2 -> S3 S4 decays in EvtDiracParticle::rotateToHelicityBasis() functions, - courtesy of Luis Miguel Garcia Martin and the IFIC Valencia LHCb group. 19th Feburary 2016 John Back * Fixed bug in the definition of the initial spinor term Sinit in EvtRareLbToLll::HadronicAmpRS(), - from Tom Blake (LHCb). 12th February 2016 John Back * From LHCb, added extensions to the EvtHQET2(FF) model for semitauonic decays from Brian Hamilton, which needs a patch to EvtSemiLeptonicAmp from Jack Wimberley to ensure that the q^2 range is physical when finding the maximum amplitude probability. 2nd December 2015 John Back * From LHCb, added EvtKStopizmumu model for KS -> pi0 mu mu decays based on JHEP08(1998)004, - courtesy of Veronika Chobanova, Diego Martinez Santos and Jeremy Dalseno. * Added EvtConst::Fermi for Fermi coupling constant. === ## R01-05-00 21st October 2015 John Back * New tag incorporating all changes below. * Recommended external packages are - HepMC 2.06.09 - pythia 8.186 - Photos++ 3.61 - Tauola++ 1.1.5 * Added the EvtB2MuMuMuNu model for simulating the very rare four-leptonic decays B- -> mu+ mu- anti-nu_mu mu-, - courtesy Nikolai Nikitin. 16th October 2015 John Back * Updated the configure script to automatically select the library names for PHOTOS++; version 3.56 and below uses Fortran, version 3.61 and above uses C++ only (default). Avoid using v3.60, since it does not work. This needs the PHOTOS libraries built before EvtGen is configured. Modified setupEvtGen.sh to use Photos++ v3.61. 7th October 2015 John Back * Updated EvtGenExternal/EvtPhotosEngine to check that additional particles from the outgoing vertex are indeed (FSR) photons, since later versions of PHOTOS introduce pair emission, where particles may not always be photons. * Added the genRootDecayChain.cc validation program to create ROOT files containing information about the complete decay tree. Two example test decay files BKstarGamma.dec and BuDst0rhop.dec can be used with this; the first tests PHOTOS, the second looks at sequential decay chain storage. The plotBKstarGamma.C ROOT macro can be used for B -> K* gamma plots. 2nd October 2015 John Back * Modified EvtSVPHelAmp and added a new EvtSVPHelCPMix model, implementing the complete mixing phenomenology of Bs to vector gamma decays, - courtesy of Clara Remon (LHCb). * EvtD0mixDalitz code: cleanup, inverted q/p for decays of D0bar (simplifies user decay files) and fixed y parameter bug, - courtesy of Jordi Tico (LHCb). * Changed the initialisation order of the infrared cut-off in EvtPhotosEngine. This actually has no effect, since the exponentiation function sets it to the same 1e-7 value, but it is now in the correct order if we need to update it. * Removed all remaining obsolete pragma (Win32) warnings from some classes. 23rd September 2015 Michal Kreps * Reimplement the real Spence function in C++ and removed its fortran implementation. 15th September 2015 Michal Kreps * Fixed accessed uninitialised memory in EvtPDL.cpp, line 213. * Modified the configure and setupEvtGen.sh scripts to work on Mac; needed Mac compilation patch files added to the new "platform" subdirectory. 10th September 2015 John Back * Updated setupEvtGen.sh to use the recommended external packages: - HepMC 2.06.09, pythia 8.186, Photos++ 3.56 and Tauola++ 1.1.5. * Fixed form-factor calculations for the BTOSLLBALL model 6 used to generate b -> sll decays, - courtesy of Christoph Langenbruch and David Loh (LHCb). - Affects B->K*ll, B->rholl and B->omegall, particularly the electron modes. * In the validation directory, added runPhotosTest.sh for testing FSR in Upsilon(4S) -> e+ e- decays, and changed the plot comparison scripts to use the 2nd directory "oldRootFiles" (which could be a soft-link) for including ROOT histograms made from a previous version of EvtGen. 27th August 2015 John Back * Added Mersenne-Twister random number generator (RNG) EvtMTRandomEngine. - It requires c++11 compiler features (>= gcc 4.7), which should automatically be enabled by the configure script. - Introduced the preprocessor environment variable EVTGEN_CPP11 for c++11 features. - EvtMTRandomEngine is the default RNG for the validation and test examples if c++11 features are enabled. * Added a phase-space test validation/genPHSP.sh and PhaseSpacePlots.C to visually check the flatness of Dalitz plots in order to ensure that the RNG is not producing biased results that depend on particle ordering. * Added the models EvtbsToLLLLAmp and EvtbsToLLLLHyperCP for B0_q -> l+ l- l+ l- decays (SM and one supersymmetric scenario), - courtesy of Nikolai Nikitin and Konstantin Toms. - Documentation provided in doc/evt_BQTOLLLL_model.pdf and doc/evt_BQTOLLLLHYPERCP_model.pdf. * Changed the installation and set-up script name to be just setupEvtGen.sh; it uses the VERSION variable to specify the required tag. List of tags are available using either "svn ls -v http://svn.cern.ch/guest/evtgen/tags" or by going to http://svn.cern.ch/guest/evtgen/tags in a web browser. 12th June 2015 John Back * Changed the width of chi_b1 in evt.pdl from 9.8928 GeV (!) to zero. 1st May 2015 John Back * Added Bc -> scalar ell nu (EvtBcSMuNu) and Bc -> tensor ell nu (EvtBcTMuNu) decays, - courtesy of Jack Wimberley, LHCb. - Also included the chi_c1 mode for EvtBcVMuNu. === ## R01-04-00 2nd April 2015 John Back * Removed the EvtStdlibRandomEngine class since this can produce biases to kinematic distributions when one or more of the daughters is a resonance, such as B0 -> K pi psi - (thanks to Antonio Augusto Alves Jr who discovered this issue). - EvtSimpleRandomEngine is now the default random number generator in the validation and test examples. * Incorporated several additions and modifications from LHCb: a) From Michal Kreps, Tom Blake & Christoph Langenbruch, added rare Lb --> Lambda^(*) ell ell models described in arXiv:1108.6129, with various form factors from Gutsche et al. (arXiv:1301.3737) and lattice QCD (arXiv:1212.4827) b) From Andrew Crocombe, implemented Bs --> K* form factors from Ball-Zwicky and z-parametrization form factors from arXiv:1006.4945 for EvtbTosllBallFF c) Christoph Langenbruch fixed the Bs -> phi ll form factors in EvtbTosllBallFF; T3 showed a non-physical pole at very low q2 which significantly affected the electron mode d) From Michal Kreps, removed semicolons from wrong places to clear warnings when compiled with the "-pedantic" option. 9th October 2014 John Back * Change svnweb.cern.ch to svn.cern.ch in the setup script. 1st April 2014 John Back * In EvtReport, modified the logging output severity status flags to have the "EVTGEN_" prefix, e.g. INFO becomes EVTGEN_INFO. * The global report() function has been renamed to EvtGenReport(). 31st March 2014 John Back * Added the ability to store named attributes for EvtParticles in the form of a map<string, int>. The setAttribute(name, value) stores the required value, while getAttribute(name) retrieves the integer value. This is used in EvtPhotosEngine to specify the final-state radiation "FSR" attribute to 1 for any additional photons (EvtPhotonParticles) created by Photos++. It also stores the "ISR" attribute, but this is always set to zero, since only FSR photons are created. If the named attribute does not exist, then getAttribute() returns zero. 29th January 2014 Daniel Craik * Removed mass assertion on GS shape in EvtDalitzReso to allow it to also be used for charged rho resonances. 27th January 2014 John Back * Minor corrections to Vub models to remove further gcc 4.8 warnings. * Updated configure script to work for MacOS clang (from Genser team). === ## R01-03-00 9th January 2014 John Back * New tag version "1.3.0", incorporating all changes below. * Replaced auto-install script to work with this version as well as the latest versions of all external generator packages. * Updated README to mention the new CERN-based web pages for Photos++ and Tauola++. 8th January 2014 John Back * Fix gcc 4.6 and 4.8 compilation warnings, - courtesy of Patrick Robbe (LHCb); - main changes are removal of unused variables. * Changed the EvtPythiaEngine class and configure script to use new Pythia 8 header locations; Pythia 8.180 or above is now required. 7th January 2014 John Back * Modified EvtBCVFF to correct the Kiselev form factors - from Jack Wimberley (LHCb). 9th October 2013 Daniel Craik * Added Gounaris-Sakurai and Gaussian shapes to EvtGenericDalitz and set sensible defaults for LASS parameters. 19th September 2013 John Back * Modified EvtGenExternal/EvtPythiaEngine to keep track of any new particles that are added to the default Pythia database to avoid duplicating particle/anti-particle entries that could override previously defined Pythia decay chains. 18th September 2013 John Back * Added Mac OS flags for the configure script and src/Makefile. 15th July 2013 Daniel Craik * Added flag to turn on scaling of LASS amplitude by M/q in EvtDalitzReso 15th July 2013 Daniel Craik * EvtParserXML now accepts file names containing environment variables, exponential non-resonant shape in EvtDalitzReso now defined as exp(-alpha*m^2), LASS shape in EvtDalitzReso now takes a cutoff parameter 4th July 2013 Daniel Craik * Added LASS, exponential non-resonant and linear non-resonant shapes to EvtGenericDalitz. 3rd July 2013 Daniel Craik * Fixed auto-install script for R01-02-00. 1st July 2013 Daniel Craik * Added auto-install script for R01-02-00. === ## R01-02-00 15th May 2013 John Back * New tag, version "1.2.0", incorporating all changes below. 14th May 2013 Michal Kreps * Added Blatt-Weisskopf barrier factors up to L=5 in EvtGenBase/EvtBlattWeisskopf::compute(). 14th May 2013 John Back * Added additional entries (appended at the end) to the evt.pdl particle data file - courtesy of Romulus Godang and Belle II colleagues. 14th March 2013 John Back * Added the method EvtParticle::getPDGId() to get the PDG integer for a particle directly (which just calls EvtPDL::getStdHep()). * Added a check in EvtPhotosEngine::doDecay to skip Photos if a given particle has too many daughters (>= 10) to avoid a problem with a hard coded upper limit in the Photos PHOENE subroutine. 2nd February 2013 Daniel Craik * Updated EvtDalitzTable to estimate probMax when it is missing from a Dalitz model. 1st February 2013 John Back * Added the ability to read in Pythia 6 commands in ascii decay files in EvtDecayTable::readDecayFile (this was already possible in xml files). * Modified the Photos++ engine default settings to be more suited to B decays (from LHCb defaults). 31st January 2013 John Back * Added the ability to read in Pythia 8 commands in ascii decay files in EvtDecayTable::readDecayFile. They can be set using the syntax: "PythiaTypeParam module:variable=value", where Type = Generic, Alias or Both for specifying whether the parameter is for the generic or alias Pythia decay engines (or both). The 2nd argument must not contain any spaces. Fixed the list of commands strings being used in the EvtPythiaEngine class (i.e. Pythia parameters that can be set via decay files). 31st January 2013 Daniel Craik * Added named parameters to various decay models. 30th January 2013 John Back * Fixed some of the parameter arguments used in the EvtSVSCPiso model. 24th January 2013 John Back * Set the Photos++ and Tauola++ models to use the EvtGen random number engine when useEvtGenRandom is set to true in the EvtExternalGenList constructor. 23rd January 2013 John Back * Added EvtGenExternal/EvtPythiaRandom to allow the use of the EvtGen random number engine to also be used for the random engine for Pythia 8. * Added a boolean (useEvtGenRandom, default = true) within the EvtExternalGenList constructor to use this feature. 18th December 2012 John Back * Corrected some wrong daughter ordering assignments for decay modes 5 and 12 in EvtDDalitz. Updated validation/DalitzDecays.xml to also contain D decay mode 12, as well as various modes that may use K_S0 and K_L0. * Added validation/genDDalitzModes.sh and updated validation/compareDalitz.C to do a complete comparison of the D Dalitz modes with the xml versions. 11th December 2012 Daniel Craik * Updated the Xml parser to support named model parameters. * Updated the generic Dalitz model to use named model parameters as an example. 15th October 2012 John Back * Make EvtSimpleRandomEngine inherit from EvtRandomEngine to avoid crash in EvtGen.cpp when no random engine is defined - (from Bjoern Spruck). === ## R01-01-00 4th October 2012 John Back * New tag, version "1.1.0", incorporating all changes below. * Provide proper default constructors for EvtVector4R and EvtPhotonParticle. Modified the validation and test code to also compile/link in the case of no external generators being included. 3rd October 2012 John Back * Corrected the t3 vector form factor values for the Ball-Zwicky 2005 model (modelId = 6) in EvtbTosllBallFF::getVectorFF(), which were set to t3tilde instead. 18th September 2012 John Back * Moved the external generator engines to a new sub-directory EvtGenExternal. Building the code now creates 2 libraries: libEvtGen.so (Base+Models) and libEvtGenExternal.so. - This allows anyone to ignore using the new external generators if required (by not creating/loading the 2nd library). * Added prefix option to the configure script/Makefile to allow the user to specify an installation directory for the include files, libraries, DECAY.DEC and evt.pdl files (for Genser). 14th September 2012 Michal Kreps * Fixed the calculation of the angle between decay planes in the function EvtKine::EvtDecayAngleChi. Fixed typo in EvtLb2Lll decay model. Only some NP scenarious could be affected, SM one is definitely unaffected. 13th September 2012 John Back * Added the use of the environment variables EVTGEN_PHOTOS, EVTGEN_PYTHIA and EVTGEN_TAUOLA to specify if the Photos, Pythia and/or Tauola engine classes are used or not. These variables are set by the configure script, depending if the library paths are specified for these generators. === ## R01-00-01 12th September 2012 John Back * New tag incorporating all changes below, since R01-00-00. 11th September 2012 John Back * Modified the Photos and Tauola engine classes to use the new Photospp and Tauolapp namespaces that are present in the latest versions of Photos++(3.5) and Tauola++(1.0.7). * Updated the configure file to get the correct location of the Tauola++ include files. * Added the D0->pi+pi-pi0 decay mode in EvtDDalitz - from Marco Gersabeck and Frederic Dreyer (LHCb). * Added new decay models/classes from Alexey Luchinsky (LHCb): EvtBcVMuNu, EvtTVP, EvtWnPi, EvtSVP, EvtXPsiGamma, EvtBcVNpi 29th June 2012 John Back * Corrected mass(squared) variables filled in the Dalitz TTree in validation/genExampleRootFiles. 15th May 2012 Daniel Craik * Updated EvtD0gammaDalitz to deal with D mesons from neutral B->DK * Added save function to validation/compareDalitz.C. 11th May 2012 Daniel Craik * Replaced BaBar specific configuration for BlattWeisskopf birth factors. * Updated XML conversion script to handle new configuration. * Fixed some bugs in the XML conversion script related to particle modifications. 9th May 2012 Daniel Craik * Added latex documentation for xml decay files. 2nd May 2012 Daniel Craik * Added resDaughters attribute to the Dalitz resonance xml tag to simplify defining symmetric resonances. Updated validation xml files to use the new functionality. 27th April 2012 Daniel Craik * Upgraded EvtGenericDalitz to use EvtDalitzReso for resonances. * Added validation to compare EvtGenericDalitz to all 11 EvtDDalitz modes. * Added a root macro to quickly compare two Dalitz decays for validation. 24th April 2012 John Back * Solved two bugs in the EvtD0gammaDalitz model (from Jordi Tico, LHCb): configuration of the conjugated model, and using only the B charge to determine the model used, not the D flavour. 17th April 2012 Daniel Craik * Updated the GenericDalitz validation code to use the same probMax values as DDalitz. * Added XML decay file parsing to EvtGen::readUDecay. - Dec files are still the default. 30th March 2012 John Back * Update maximum probability values in EvtDDalitz::initProbMax() for all DDalitz modes. 23rd March 2012 John Back * Added the EvtEta2MuMuGamma decay model from LHCb. 21st March 2012 John Back * Added EvtD0gammaDalitz decay model from LHCb. 20th March 2012 Daniel Craik * Added backwards compatibility for Pythia 6 commands in the XML configuration. * Updated decay file conversion tool to convert JetSetPar lines to pythia6Param tags. 19th March 2012 Daniel Craik * Added infrastructure to pass commands to external generators. * XML config now takes Pythia8 configuration commands. 16th March 2012 Daniel Craik * Added the ability to define particles from the PDL for Dalitz decay resonances instead of defining mass, width and spin seperately. * Renamed the lifetime attribute of Dalitz decay resonaces to width to avoid confusion. * Added further validation code for the generic Dalitz model. 15th March 2012 Daniel Craik * Added validation code for xml decay files and the generic Dalitz model. === ## R01-00-00 6th March 2012 John Back * First official version for Genser (evtgen 1.0.0) that includes support for external generators: Pythia8, Photos++ and Tauola++. * This also includes a preliminary version of creating Dalitz plot decay models using EvtGenericDalitz. diff --git a/src/EvtGenExternal/EvtExternalGenFactory.cpp b/src/EvtGenExternal/EvtExternalGenFactory.cpp index 6b94d76..f159ca9 100644 --- a/src/EvtGenExternal/EvtExternalGenFactory.cpp +++ b/src/EvtGenExternal/EvtExternalGenFactory.cpp @@ -1,113 +1,116 @@ /*********************************************************************** * 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 <https://www.gnu.org/licenses/>. * ***********************************************************************/ #include "EvtGenExternal/EvtExternalGenFactory.hh" #include "EvtGenBase/EvtReport.hh" #ifdef EVTGEN_PYTHIA #include "EvtGenExternal/EvtPythiaEngine.hh" #endif #ifdef EVTGEN_TAUOLA #include "EvtGenExternal/EvtTauolaEngine.hh" #endif #include <iostream> using std::endl; EvtExternalGenFactory& EvtExternalGenFactory::getInstance() { static thread_local EvtExternalGenFactory theFactory; return theFactory; } // Only define the generator if we have the external ifdef variable set #ifdef EVTGEN_PYTHIA void EvtExternalGenFactory::definePythiaGenerator( std::string xmlDir, bool convertPhysCodes, bool useEvtGenRandom ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Defining EvtPythiaEngine: data tables defined in " << xmlDir << endl; if ( convertPhysCodes == true ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Pythia 6 codes in decay files will be converted to Pythia 8 codes" << endl; } else { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Pythia 8 codes need to be used in decay files" << endl; } if ( useEvtGenRandom == true ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Using EvtGen random engine for Pythia 8 as well" << endl; } m_extGenMap[GenId::PythiaGenId] = std::make_unique<EvtPythiaEngine>( xmlDir, convertPhysCodes, useEvtGenRandom ); } #else void EvtExternalGenFactory::definePythiaGenerator( std::string, bool, bool ) { } #endif #ifdef EVTGEN_TAUOLA void EvtExternalGenFactory::defineTauolaGenerator( bool useEvtGenRandom, - bool seedTauolaFortran ) + bool seedTauolaFortran, + bool useTauolaRadiation, + double infraredCutOffTauola ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Defining EvtTauolaEngine." << endl; - m_extGenMap[GenId::TauolaGenId] = - std::make_unique<EvtTauolaEngine>( useEvtGenRandom, seedTauolaFortran ); + m_extGenMap[GenId::TauolaGenId] = std::make_unique<EvtTauolaEngine>( + useEvtGenRandom, seedTauolaFortran, useTauolaRadiation, + infraredCutOffTauola ); } #else void EvtExternalGenFactory::defineTauolaGenerator( bool, bool ) { } #endif EvtAbsExternalGen* EvtExternalGenFactory::getGenerator( const GenId genId ) { ExtGenMap::iterator iter = m_extGenMap.find( genId ); if ( iter == m_extGenMap.end() ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "EvtAbsExternalGen::getGenerator: could not find generator for genId = " //FIXME C++23 use std::to_underlying << static_cast<std::underlying_type_t<GenId>>( genId ) << endl; return nullptr; } // Retrieve the external generator engine auto& theGenerator = iter->second; return theGenerator.get(); } void EvtExternalGenFactory::initialiseAllGenerators() { for ( auto& [id, theGenerator] : m_extGenMap ) { if ( theGenerator ) { theGenerator->initialise(); } } } diff --git a/src/EvtGenExternal/EvtExternalGenList.cpp b/src/EvtGenExternal/EvtExternalGenList.cpp index 27c4e31..faaa5a8 100644 --- a/src/EvtGenExternal/EvtExternalGenList.cpp +++ b/src/EvtGenExternal/EvtExternalGenList.cpp @@ -1,121 +1,121 @@ /*********************************************************************** * 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 <https://www.gnu.org/licenses/>. * ***********************************************************************/ #include "EvtGenExternal/EvtExternalGenList.hh" #include "EvtGenModels/EvtNoRadCorr.hh" #include "EvtGenExternal/EvtExternalGenFactory.hh" #include "EvtGenExternal/EvtPHOTOS.hh" #include "EvtGenExternal/EvtPythia.hh" #include "EvtGenExternal/EvtSherpaPhotons.hh" #include "EvtGenExternal/EvtTauola.hh" -EvtExternalGenList::EvtExternalGenList( bool convertPythiaCodes, - std::string pythiaXmlDir, - std::string photonType, - bool useEvtGenRandom, - bool seedTauolaFortran ) : +EvtExternalGenList::EvtExternalGenList( + bool convertPythiaCodes, std::string pythiaXmlDir, std::string photonType, + bool useEvtGenRandom, bool seedTauolaFortran, bool useTauolaRadiation, + double infraredCutOffTauola ) : m_photonType{ photonType }, m_useEvtGenRandom{ useEvtGenRandom } { // Instantiate the external generator factory EvtExternalGenFactory& extFactory = EvtExternalGenFactory::getInstance(); if ( pythiaXmlDir.size() < 1 ) { // If we have no string defined, check the value of the // PYTHIA8DATA environment variable which should be set to the // xmldoc Pythia directory char* pythiaDataDir = getenv( "PYTHIA8DATA" ); if ( pythiaDataDir != nullptr ) { pythiaXmlDir = pythiaDataDir; } } extFactory.definePythiaGenerator( pythiaXmlDir, convertPythiaCodes, useEvtGenRandom ); - extFactory.defineTauolaGenerator( useEvtGenRandom, seedTauolaFortran ); + extFactory.defineTauolaGenerator( useEvtGenRandom, seedTauolaFortran, + useTauolaRadiation, infraredCutOffTauola ); } EvtExternalGenList::~EvtExternalGenList() { } #ifdef EVTGEN_PHOTOS EvtAbsRadCorr* EvtExternalGenList::getPhotosModel( const double infraredCutOff, const double maxWtInterference ) { // Define the Photos model, which uses the EvtPHOTOS class. EvtPHOTOS* photosModel = new EvtPHOTOS( m_photonType, m_useEvtGenRandom, 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 #ifdef EVTGEN_SHERPA EvtAbsRadCorr* EvtExternalGenList::getSherpaPhotonsModel( const double infraredCutOff, const int mode, const int useME ) { // Define the Photos model, which uses the EvtSherpaPhotonsEngine class. EvtSherpaPhotons* sherpaPhotonsModel = new EvtSherpaPhotons( m_useEvtGenRandom, infraredCutOff, mode, useME ); return sherpaPhotonsModel; } #else EvtAbsRadCorr* EvtExternalGenList::getSherpaPhotonsModel( const double /*infraredCutOff*/, const int /*mode*/, const int /*useME*/ ) { EvtGenReport( EVTGEN_ERROR, "EvtGen" ) << " Sherpa's PHOTONS++ generator has been called for FSR simulation, but Sherpa 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<EvtDecayBase*> EvtExternalGenList::getListOfModels() { // Create the Pythia and Tauola models, which use their own engine classes. EvtPythia* pythiaModel = new EvtPythia(); EvtTauola* tauolaModel = new EvtTauola(); std::list<EvtDecayBase*> extraModels; extraModels.push_back( pythiaModel ); extraModels.push_back( tauolaModel ); // Return the list of models return extraModels; } diff --git a/src/EvtGenExternal/EvtTauolaEngine.cpp b/src/EvtGenExternal/EvtTauolaEngine.cpp index ecc7e87..b9a25c4 100644 --- a/src/EvtGenExternal/EvtTauolaEngine.cpp +++ b/src/EvtGenExternal/EvtTauolaEngine.cpp @@ -1,601 +1,612 @@ /*********************************************************************** * 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 <https://www.gnu.org/licenses/>. * ***********************************************************************/ #ifdef EVTGEN_TAUOLA #include "EvtGenExternal/EvtTauolaEngine.hh" #include "EvtGenBase/EvtDecayTable.hh" #include "EvtGenBase/EvtPDL.hh" #include "EvtGenBase/EvtRandom.hh" #include "EvtGenBase/EvtReport.hh" #include "EvtGenBase/EvtSymTable.hh" #include "EvtGenBase/EvtVector4R.hh" #include "Tauola/Log.h" #include "Tauola/Tauola.h" #include <array> #include <cmath> #include <iostream> #include <limits> #include <memory> #include <sstream> #include <string> using std::endl; // Mutex Tauola as it is not thread safe. int EvtTauolaEngine::m_neutPropType = 0; int EvtTauolaEngine::m_posPropType = 0; int EvtTauolaEngine::m_negPropType = 0; bool EvtTauolaEngine::m_initialised = false; std::mutex EvtTauolaEngine::m_tauola_mutex; -EvtTauolaEngine::EvtTauolaEngine( bool useEvtGenRandom, bool seedTauolaFortran ) : - m_useEvtGenRandom{ useEvtGenRandom }, m_seedTauolaFortran{ seedTauolaFortran } +EvtTauolaEngine::EvtTauolaEngine( bool useEvtGenRandom, bool seedTauolaFortran, + bool useTauolaRadiation, + double infraredCutOffTauola ) : + m_useEvtGenRandom{ useEvtGenRandom }, + m_seedTauolaFortran{ seedTauolaFortran }, + m_useTauolaRadiation{ useTauolaRadiation }, + m_infraredCutOffTauola{ infraredCutOffTauola } { } void EvtTauolaEngine::initialise() { const std::lock_guard<std::mutex> lock( m_tauola_mutex ); // Set up all possible tau decay modes. // This should be done just before the first doDecay() call, // since we want to make sure that any decay.dec files are processed // first to get lists of particle modes and their alias definitions // (for creating EvtParticles with the right history information). if ( m_initialised ) { return; } EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Setting up TAUOLA." << endl; // These three lines are not really necessary since they are the default. // But they are here so that we know what the initial conditions are. // tau PDG code Tauolapp::Tauola::setDecayingParticle( m_tauPDG ); // all modes allowed Tauolapp::Tauola::setSameParticleDecayMode( Tauolapp::Tauola::All ); // all modes allowed Tauolapp::Tauola::setOppositeParticleDecayMode( Tauolapp::Tauola::All ); // Limit the number of warnings printed out. // Can't choose zero here, unfortunately. Tauolapp::Log::SetWarningLimit( 1 ); // Initial the Tauola external generator if ( m_useEvtGenRandom ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Using EvtGen random number engine also for Tauola++" << endl; Tauolapp::Tauola::setRandomGenerator( EvtRandom::Flat ); } + // Switch for radiation in leptonic tau decays + Tauolapp::Tauola::setRadiation( m_useTauolaRadiation ); + + // Cut-Off parameter of radiation. Above that value photon is explicitly generated. + Tauolapp::Tauola::setRadiationCutOff( m_infraredCutOffTauola ); + // Use the BaBar-tuned chiral current calculations by default. Can be changed using the // TauolaCurrentOption keyword in decay files Tauolapp::Tauola::setNewCurrents( 1 ); Tauolapp::Tauola::initialize(); // Set-up possible decay modes _after_ we have read the (user) decay file this->setUpPossibleTauModes(); this->setOtherParameters(); m_initialised = true; } void EvtTauolaEngine::setUpPossibleTauModes() { // Get the decay table list defined by the decay.dec files. // Only look for the first tau particle decay mode definitions with the Tauola name, // since that generator only allows the same BFs for both tau+ and tau- decays. // We can not choose a specific tau decay event-by-event, since this is // only possible before we call Tauola::initialize(). // Otherwise, we could have selected a random mode ourselves for tau- and tau+ // separately (via selecting a random number and comparing it to be less than // the cumulative BF) for each event. const int nPDL = EvtPDL::entries(); bool gotAnyTauolaModes( false ); for ( int iPDL = 0; iPDL < nPDL; iPDL++ ) { const EvtId particleId = EvtPDL::getEntry( iPDL ); const int PDGId = EvtPDL::getStdHep( particleId ); if ( abs( PDGId ) == m_tauPDG && gotAnyTauolaModes == false ) { const int aliasInt = particleId.getAlias(); // Get the list of decay modes for this tau particle (alias) const int nModes = EvtDecayTable::getInstance().getNModes( aliasInt ); // Vector to store tau mode branching fractions. // The size of this vector equals the total number of possible // Tauola decay modes. Initialise all BFs to zero. std::vector<double> tauolaModeBFs; tauolaModeBFs.assign( m_nTauolaModes, 0.0 ); double totalTauModeBF( 0.0 ); int nNonTauolaModes( 0 ); // Loop through each decay mode for ( int iMode = 0; iMode < nModes; iMode++ ) { EvtDecayBase* decayModel = EvtDecayTable::getInstance().findDecayModel( aliasInt, iMode ); if ( decayModel ) { // Check that the decay model name matches TAUOLA std::string modelName = decayModel->getName(); if ( modelName == "TAUOLA" ) { gotAnyTauolaModes = true; // Extract the decay mode integer type and branching fraction double BF = decayModel->getBranchingFraction(); int modeArrayInt = this->getModeInt( decayModel ) - 1; if ( modeArrayInt >= 0 && modeArrayInt < m_nTauolaModes ) { tauolaModeBFs[modeArrayInt] = BF; totalTauModeBF += BF; } } else { nNonTauolaModes++; } } // Decay mode exists } // Loop over decay models if ( gotAnyTauolaModes == true && nNonTauolaModes > 0 ) { EvtGenReport( EVTGEN_ERROR, "EvtGen" ) << "Please remove all non-TAUOLA decay modes for particle " << EvtPDL::name( particleId ) << endl; ::abort(); } // Normalise all (non-zero) tau mode BFs to sum up to 1.0, and // let Tauola know about these normalised branching fractions if ( totalTauModeBF > 0.0 ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Setting TAUOLA BF modes using the definitions for the particle " << EvtPDL::name( particleId ) << endl; for ( int iTauMode = 0; iTauMode < m_nTauolaModes; iTauMode++ ) { tauolaModeBFs[iTauMode] /= totalTauModeBF; double modeBF = tauolaModeBFs[iTauMode]; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Setting TAUOLA BF for mode " << iTauMode + 1 << " = " << modeBF << endl; Tauolapp::Tauola::setTauBr( iTauMode + 1, modeBF ); } EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Any other TAUOLA BF modes for other tau particle decay mode definitions will be ignored!" << endl; } } // Got tau particle and have yet to get a TAUOLA mode } // Loop through PDL entries } int EvtTauolaEngine::getModeInt( EvtDecayBase* decayModel ) const { int modeInt( 0 ); if ( decayModel ) { int nVars = decayModel->getNArg(); if ( nVars > 0 ) { modeInt = static_cast<int>( decayModel->getArg( 0 ) ); } } return modeInt; } void EvtTauolaEngine::setOtherParameters() { // Set other Tauola parameters using the "Defined" keyword in the decay file. If any of // these are not found in the decay file, then default values are assumed/kept // 1) TauolaNeutralProp: Specify the neutral propagator type used for spin matrix calculations // "Z" (default), "Gamma", "Higgs" (H0), "PseudoHiggs" (A0), "MixedHiggs" (A0/H0) int iErr( 0 ); std::string neutPropName = EvtSymTable::get( "TauolaNeutralProp", iErr ); if ( neutPropName == "Z0" || neutPropName == "Z" ) { m_neutPropType = Tauolapp::TauolaParticle::Z0; } else if ( neutPropName == "Gamma" ) { m_neutPropType = Tauolapp::TauolaParticle::GAMMA; } else if ( neutPropName == "Higgs" ) { m_neutPropType = Tauolapp::TauolaParticle::HIGGS; } else if ( neutPropName == "PseudoHiggs" ) { m_neutPropType = Tauolapp::TauolaParticle::HIGGS_A; } else if ( neutPropName == "MixedHiggs" ) { m_neutPropType = Tauolapp::Tauola::getHiggsScalarPseudoscalarPDG(); } if ( m_neutPropType != 0 ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "TAUOLA neutral spin propagator PDG id set to " << m_neutPropType << endl; } // 2) TauolaChargedProp: Specify the charged propagator type used for spin matrix calculations // "W" (default), "Higgs" (H+/H-) std::string chargedPropName = EvtSymTable::get( "TauolaChargedProp", iErr ); if ( chargedPropName == "W" ) { m_negPropType = Tauolapp::TauolaParticle::W_MINUS; m_posPropType = Tauolapp::TauolaParticle::W_PLUS; } else if ( chargedPropName == "Higgs" ) { m_negPropType = Tauolapp::TauolaParticle::HIGGS_MINUS; m_posPropType = Tauolapp::TauolaParticle::HIGGS_PLUS; } if ( m_negPropType != 0 ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "TAUOLA negative charge spin propagator PDG id set to " << m_negPropType << endl; } if ( m_posPropType != 0 ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "TAUOLA positive charge spin propagator PDG id set to " << m_posPropType << endl; } // 3) TauolaHiggsMixingAngle: Specify the mixing angle between the neutral scalar & pseudoscalar Higgs // A0/H0; the default mixing angle is pi/4 radians std::string mixString = EvtSymTable::get( "TauolaHiggsMixingAngle", iErr ); // If the definition name is not found, get() just returns the first argument string if ( mixString != "TauolaHiggsMixingAngle" ) { double mixAngle = std::atof( mixString.c_str() ); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "TAUOLA Higgs mixing angle set to " << mixAngle << " radians" << endl; Tauolapp::Tauola::setHiggsScalarPseudoscalarMixingAngle( mixAngle ); } // 4) TauolaBRi, where i = 1,2,3,4: Redefine sub-channel branching fractions using the setTaukle // function, after initialized() has been called. Default values = 0.5, 0.5, 0.5 and 0.6667 std::array<double, 4> BRVect{ 0.5, 0.5, 0.5, 0.6667 }; for ( int j = 0; j < 4; j++ ) { std::ostringstream o; o << j + 1; std::string BRName = "TauolaBR" + o.str(); std::string stringBR = EvtSymTable::get( BRName, iErr ); // If the definition name is not found, get() just returns the first argument string if ( stringBR != BRName ) { BRVect[j] = std::atof( stringBR.c_str() ); } } EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "TAUOLA::setTaukle values are " << BRVect[0] << ", " << BRVect[1] << ", " << BRVect[2] << ", " << BRVect[3] << endl; Tauolapp::Tauola::setTaukle( BRVect[0], BRVect[1], BRVect[2], BRVect[3] ); // 5) Specify the hadronic current option, e.g. orig CLEO = 0, BaBar-tuned = 1 (default), ... // No check is made by EvtGen on valid integer options - its just passed to Tauola std::string currentOption = EvtSymTable::get( "TauolaCurrentOption", iErr ); // If the definition name is not found, get() just returns the first argument string if ( currentOption != "TauolaCurrentOption" ) { int currentOpt = std::atoi( currentOption.c_str() ); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "TAUOLA current option = " << currentOpt << endl; Tauolapp::Tauola::setNewCurrents( currentOpt ); } } bool EvtTauolaEngine::doDecay( EvtParticle* tauParticle ) { if ( !m_initialised ) { this->initialise(); } if ( !tauParticle ) { return false; } // Check that we have a tau particle. EvtId partId = tauParticle->getId(); if ( abs( EvtPDL::getStdHep( partId ) ) != m_tauPDG ) { return false; } int nTauDaug = tauParticle->getNDaug(); // If the number of tau daughters is not zero, then we have already decayed // it using Tauola/another decay algorithm. if ( nTauDaug > 0 ) { return true; } this->decayTauEvent( tauParticle ); return true; } void EvtTauolaEngine::decayTauEvent( EvtParticle* tauParticle ) { // Either we have a tau particle within a decay chain, or a single particle. // Create a dummy HepMC event & vertex for the parent particle, containing the tau as // one of the outgoing particles. If we have a decay chain, the parent will be the // incoming particle, while the daughters, including the tau, are outgoing particles. // For the single particle case, the incoming particle is null, while the single tau // is the only outgoing particle. // We can then pass this event to Tauola which should then decay the tau particle. // We also consider all other tau particles from the parent decay in the logic below. // Create the dummy event. auto theEvent = std::make_unique<GenEvent>( Units::GEV, Units::MM ); // Create the decay "vertex". GenVertexPtr theVertex = newGenVertexPtr(); theEvent->add_vertex( theVertex ); // Get the parent of this tau particle EvtParticle* theParent = tauParticle->getParent(); GenParticlePtr hepMCParent( nullptr ); // Assign the parent particle as the incoming particle to the vertex. if ( theParent ) { hepMCParent = this->createGenParticle( theParent ); theVertex->add_particle_in( hepMCParent ); } else { // The tau particle has no parent. Set "itself" as the incoming particle for the first vertex. // This is needed, otherwise Tauola warns of momentum non-conservation for this (1st) vertex. GenParticlePtr tauGenInit = this->createGenParticle( tauParticle ); theVertex->add_particle_in( tauGenInit ); } // Find all daughter particles and assign them as outgoing particles to the vertex. // This will include the tau particle we are currently processing. // If the parent decay has more than one tau particle, we need to include them as well. // This is important since Tauola needs the correct physics correlations: we do not // want Tauola to decay each particle separately if they are from tau pair combinations. // Tauola will process the event, and we will create EvtParticles from all tau decay // products, i.e. the tau particle we currently have and any other tau particles. // EvtGen will try to decay the other tau particle(s) by calling EvtTauola and therefore // this function. However, we check to see if the tau candidate has any daughters already. // If it does, then we have already set the tau decay products from Tauola. // Map to store (HepMC,EvtParticle) pairs for each tau candidate from the parent // decay. This is needed to find out what EvtParticle corresponds to a given tau HepMC // candidate: we do not want to recreate existing EvtParticle pointers. std::map<GenParticlePtr, EvtParticle*> tauMap; // Keep track of the original EvtId of the parent particle, since we may need to set // the equivalent HepMCParticle has a gauge boson to let Tauola calculate spin effects EvtId origParentId( -1, -1 ); if ( theParent ) { // Original parent id origParentId = EvtPDL::getId( theParent->getName() ); // Find all tau particles in the decay tree and store them in the map. // Keep track of how many tau daughters this parent particle has int nTaus( 0 ); int nDaug( theParent->getNDaug() ); int iDaug( 0 ); for ( iDaug = 0; iDaug < nDaug; iDaug++ ) { EvtParticle* theDaughter = theParent->getDaug( iDaug ); if ( theDaughter ) { GenParticlePtr hepMCDaughter = this->createGenParticle( theDaughter ); theVertex->add_particle_out( hepMCDaughter ); EvtId theId = theDaughter->getId(); int PDGInt = EvtPDL::getStdHep( theId ); if ( abs( PDGInt ) == m_tauPDG ) { // Delete any siblings for the tau particle if ( theDaughter->getNDaug() > 0 ) { theDaughter->deleteDaughters( false ); } tauMap[hepMCDaughter] = theDaughter; nTaus++; } else { // Treat all other particles as "stable" hepMCDaughter->set_status( Tauolapp::TauolaParticle::STABLE ); } } // theDaughter != 0 } // Loop over daughters // For the parent particle, artifically set the PDG to a boson with the same 4-momentum // so that spin correlations are calculated inside Tauola. // This leaves the original parent m_EvtParticle_ unchanged if ( nTaus > 0 && hepMCParent ) { int parCharge = EvtPDL::chg3( origParentId ) / 3; // (3*particle charge)/3 = particle charge if ( parCharge == 0 && m_neutPropType != 0 ) { hepMCParent->set_pdg_id( m_neutPropType ); } else if ( parCharge == -1 && m_negPropType != 0 ) { hepMCParent->set_pdg_id( m_negPropType ); } else if ( parCharge == 1 && m_posPropType != 0 ) { hepMCParent->set_pdg_id( m_posPropType ); } } } else { // We only have the one tau particle. Store only this in the map. GenParticlePtr singleTau = this->createGenParticle( tauParticle ); theVertex->add_particle_out( singleTau ); tauMap[singleTau] = tauParticle; } { const std::lock_guard<std::mutex> lock( m_tauola_mutex ); if ( m_useEvtGenRandom && m_seedTauolaFortran ) { static thread_local auto lastSeed{ std::numeric_limits<unsigned long int>::max() }; if ( lastSeed != EvtRandom::lastSeed() ) { lastSeed = EvtRandom::lastSeed(); Tauolapp::Tauola::setSeed( lastSeed, 0, 0 ); } } // Now pass the event to Tauola for processing // Create a Tauola event object #ifdef EVTGEN_HEPMC3 Tauolapp::TauolaHepMC3Event tauolaEvent( theEvent.get() ); #else Tauolapp::TauolaHepMCEvent tauolaEvent( theEvent.get() ); #endif // Run the Tauola algorithm tauolaEvent.decayTaus(); } // Loop over all tau particles in the HepMC event and create their EvtParticle daughters. // Store all final "stable" descendent particles as the tau daughters, i.e. // let Tauola decay any resonances such as a_1 or rho. // If there is more than one tau particle in the event, then also create the // corresponding EvtParticles for their daughters as well. They will not be // re-decayed since we check at the start of this function if the tau particle has // any daughters before running Tauola decayTaus(). #ifdef EVTGEN_HEPMC3 for ( auto aParticle : theEvent->particles() ) { #else HepMC::GenEvent::particle_iterator eventIter; for ( eventIter = theEvent->particles_begin(); eventIter != theEvent->particles_end(); ++eventIter ) { // Check to see if we have a tau particle HepMC::GenParticle* aParticle = ( *eventIter ); #endif if ( aParticle && abs( aParticle->pdg_id() ) == m_tauPDG ) { // Find out what EvtParticle corresponds to the HepMC particle. // We need this to create and attach EvtParticle daughters. EvtParticle* tauEvtParticle = tauMap[aParticle]; if ( tauEvtParticle ) { // Get the tau 4-momentum in the lab (first mother) frame. We need to boost // all the tau daughters to this frame, such that daug.getP4() is in the tau restframe. EvtVector4R tauP4CM = tauEvtParticle->getP4Lab(); tauP4CM.set( tauP4CM.get( 0 ), -tauP4CM.get( 1 ), -tauP4CM.get( 2 ), -tauP4CM.get( 3 ) ); // Get the decay vertex for the tau particle GenVertexPtr endVertex = aParticle->end_vertex(); std::vector<EvtId> daugIdVect; std::vector<EvtVector4R> daugP4Vect; // Loop through all descendants #ifdef EVTGEN_HEPMC3 for ( auto tauDaug : HepMC3::Relatives::DESCENDANTS( endVertex ) ) { #else HepMC::GenVertex::particle_iterator tauIter; // Loop through all descendants for ( tauIter = endVertex->particles_begin( HepMC::descendants ); tauIter != endVertex->particles_end( HepMC::descendants ); ++tauIter ) { HepMC::GenParticle* tauDaug = ( *tauIter ); #endif // Check to see if this descendant has its own decay vertex, e.g. rho resonance. // If so, skip this daughter and continue looping through the descendant list // until we reach the final "stable" products (e.g. pi pi from rho -> pi pi). GenVertexPtr daugDecayVtx = tauDaug->end_vertex(); if ( daugDecayVtx ) { continue; } // Store the particle id and 4-momentum int tauDaugPDG = tauDaug->pdg_id(); EvtId daugId = EvtPDL::evtIdFromStdHep( tauDaugPDG ); daugIdVect.push_back( daugId ); FourVector tauDaugP4 = tauDaug->momentum(); double tauDaug_px = tauDaugP4.px(); double tauDaug_py = tauDaugP4.py(); double tauDaug_pz = tauDaugP4.pz(); double tauDaug_E = tauDaugP4.e(); EvtVector4R daugP4( tauDaug_E, tauDaug_px, tauDaug_py, tauDaug_pz ); daugP4Vect.push_back( daugP4 ); } // Loop over HepMC tau daughters // Create the tau EvtParticle daughters and assign their ids and 4-mtm int nDaug = daugIdVect.size(); tauEvtParticle->makeDaughters( nDaug, daugIdVect ); int iDaug( 0 ); for ( iDaug = 0; iDaug < nDaug; iDaug++ ) { EvtParticle* theDaugPart = tauEvtParticle->getDaug( iDaug ); if ( theDaugPart ) { EvtId theDaugId = daugIdVect[iDaug]; EvtVector4R theDaugP4 = daugP4Vect[iDaug]; theDaugP4.applyBoostTo( tauP4CM ); // Boost the 4-mtm to the tau rest frame theDaugPart->init( theDaugId, theDaugP4 ); } } // Loop over tau daughters } } // We have a tau HepMC particle in the event } theEvent->clear(); } GenParticlePtr EvtTauolaEngine::createGenParticle( const EvtParticle* theParticle ) const { // Method to create an HepMC::GenParticle version of the given EvtParticle. if ( theParticle == nullptr ) { return nullptr; } // Get the 4-momentum (E, px, py, pz) for the EvtParticle EvtVector4R p4 = theParticle->getP4Lab(); // Convert this to the HepMC 4-momentum double E = p4.get( 0 ); double px = p4.get( 1 ); double py = p4.get( 2 ); double pz = p4.get( 3 ); FourVector hepMC_p4( px, py, pz, E ); int PDGInt = EvtPDL::getStdHep( theParticle->getId() ); // Set the status flag for the particle. int status = Tauolapp::TauolaParticle::HISTORY; GenParticlePtr genParticle = newGenParticlePtr( hepMC_p4, PDGInt, status ); return genParticle; } #endif