![]() |
|
|||
File indexing completed on 2025-02-23 09:21:10
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // 0027 /// \file eventgenerator/pythia/pythia8decayer/src/Py8DecayerPhysics.cc 0028 /// \brief Implementation of the Py8DecayerPhysics class 0029 /// 0030 /// \author J. Yarba; FNAL 0031 0032 #include "Py8DecayerPhysics.hh" 0033 0034 #include "Py8Decayer.hh" 0035 0036 #include "G4Decay.hh" 0037 #include "G4DecayTable.hh" 0038 #include "G4ParticleDefinition.hh" 0039 #include "G4ProcessManager.hh" 0040 0041 // factory 0042 // 0043 #include "G4PhysicsConstructorFactory.hh" 0044 // 0045 // register it with contructor factory 0046 // 0047 G4_DECLARE_PHYSCONSTR_FACTORY(Py8DecayerPhysics); 0048 0049 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0050 0051 Py8DecayerPhysics::Py8DecayerPhysics(G4int) : G4VPhysicsConstructor("Py8DecayerPhysics") {} 0052 0053 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0054 0055 Py8DecayerPhysics::~Py8DecayerPhysics() {} 0056 0057 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0058 0059 void Py8DecayerPhysics::ConstructParticle() 0060 { 0061 // Nothing needs to be done here 0062 } 0063 0064 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0065 0066 void Py8DecayerPhysics::ConstructProcess() 0067 { 0068 // Adding external decayer to G4Decay process (per each thread). 0069 // G4Decay will use the external decayer if G4Decay process is 0070 // assigned to an unstable particle and that particle does not 0071 // have its decay table. 0072 0073 // Loop over all particles instantiated and remove already-assigned 0074 // decay table for tau's and B+/- so that they will decay through 0075 // the external decayer (Pythia8). 0076 0077 // NOTE: The extDecayer will be deleted in G4Decay destructor 0078 0079 Py8Decayer* extDecayer = new Py8Decayer(); 0080 G4bool setOnce = true; 0081 0082 auto particleIterator = GetParticleIterator(); 0083 particleIterator->reset(); 0084 while ((*particleIterator)()) { 0085 G4ParticleDefinition* particle = particleIterator->value(); 0086 0087 // remove native/existing decay table for 0088 // a)tau's 0089 // b) B+/- 0090 // so that G4Decay will use the external decayer 0091 if (std::abs(particle->GetPDGEncoding()) == 15 || std::abs(particle->GetPDGEncoding()) == 521) { 0092 if (particle->GetDecayTable()) { 0093 delete particle->GetDecayTable(); 0094 particle->SetDecayTable(nullptr); 0095 /* 0096 if ( verboseLevel > 1 ) { 0097 G4cout << "Use ext decayer for: " 0098 << particleIterator->value()->GetParticleName() 0099 << G4endl; 0100 } 0101 */ 0102 } 0103 } 0104 0105 if (setOnce) 0106 // One G4Decay object is shared by all unstable particles (per thread). 0107 // Thus, we set the external decayer only once. 0108 { 0109 G4ProcessManager* pmanager = particle->GetProcessManager(); 0110 G4ProcessVector* processVector = pmanager->GetProcessList(); 0111 for (size_t i = 0; i < processVector->length(); ++i) { 0112 G4Decay* decay = dynamic_cast<G4Decay*>((*processVector)[i]); 0113 if (decay) { 0114 decay->SetExtDecayer(extDecayer); 0115 setOnce = false; 0116 } 0117 } 0118 } 0119 } 0120 0121 return; 0122 } 0123 0124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |