Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:20:04

0001 
0002 /***********************************************************************
0003 * Copyright 1998-2020 CERN for the benefit of the EvtGen authors       *
0004 *                                                                      *
0005 * This file is part of EvtGen.                                         *
0006 *                                                                      *
0007 * EvtGen is free software: you can redistribute it and/or modify       *
0008 * it under the terms of the GNU General Public License as published by *
0009 * the Free Software Foundation, either version 3 of the License, or    *
0010 * (at your option) any later version.                                  *
0011 *                                                                      *
0012 * EvtGen is distributed in the hope that it will be useful,            *
0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
0015 * GNU General Public License for more details.                         *
0016 *                                                                      *
0017 * You should have received a copy of the GNU General Public License    *
0018 * along with EvtGen.  If not, see <https://www.gnu.org/licenses/>.     *
0019 ***********************************************************************/
0020 
0021 #ifdef EVTGEN_PYTHIA
0022 
0023 #ifndef EVTPYTHIAENGINE_HH
0024 #define EVTPYTHIAENGINE_HH
0025 
0026 #include "EvtGenBase/EvtDecayBase.hh"
0027 #include "EvtGenBase/EvtId.hh"
0028 #include "EvtGenBase/EvtParticle.hh"
0029 #include "EvtGenBase/EvtVector4R.hh"
0030 
0031 #include "EvtGenModels/EvtAbsExternalGen.hh"
0032 
0033 #include "EvtGenExternal/EvtPythiaRandom.hh"
0034 
0035 #include "Pythia8/ParticleData.h"
0036 #include "Pythia8/Pythia.h"
0037 
0038 #include <map>
0039 #include <memory>
0040 #include <string>
0041 #include <vector>
0042 
0043 // Description: Interface to the Pytha 8 external generator
0044 
0045 class EvtPythiaEngine : public EvtAbsExternalGen {
0046   public:
0047     EvtPythiaEngine( std::string xmlDir = "./xmldoc",
0048                      bool convertPhysCodes = false, bool useEvtGenRandom = true );
0049 
0050     virtual ~EvtPythiaEngine();
0051 
0052     bool doDecay( EvtParticle* theMother ) override;
0053 
0054     void initialise() override;
0055 
0056   protected:
0057   private:
0058     void updateParticleLists();
0059     void updatePhysicsParameters();
0060 
0061     void createPythiaParticle( EvtId& particleId, int PDGCode );
0062     bool validPDGCode( int PDGCode );
0063     void updatePythiaDecayTable( EvtId& particleId, int aliasInt, int PDGCode );
0064     void storeDaughterInfo( EvtParticle* theParticle, int startInt );
0065 
0066     void clearDaughterVectors();
0067     void clearPythiaModeMap();
0068 
0069     void createDaughterEvtParticles( EvtParticle* theParent );
0070 
0071     int getModeInt( EvtDecayBase* decayModel );
0072 
0073     std::unique_ptr<Pythia8::Pythia> _genericPythiaGen;
0074     std::unique_ptr<Pythia8::Pythia> _aliasPythiaGen;
0075     Pythia8::Pythia* _thePythiaGenerator;
0076 
0077     std::vector<int> _daugPDGVector;
0078     std::vector<EvtVector4R> _daugP4Vector;
0079 
0080     typedef std::map<int, std::vector<int>> PythiaModeMap;
0081     PythiaModeMap _pythiaModeMap;
0082 
0083     bool _convertPhysCodes, _initialised, _useEvtGenRandom;
0084 
0085     std::shared_ptr<EvtPythiaRandom> _evtgenRandom;
0086 
0087     std::map<int, int> _addedPDGCodes;
0088 };
0089 
0090 #endif
0091 
0092 #endif