Back to home page

EIC code displayed by LXR

 
 

    


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/decayer6/src/P6DExtDecayerPhysics.cc
0028 /// \brief Implementation of the P6DExtDecayerPhysics class
0029 ///
0030 /// \author I. Hrivnacova; IPN, Orsay
0031 
0032 #include "P6DExtDecayerPhysics.hh"
0033 
0034 #include "G4Pythia6Decayer.hh"
0035 
0036 #include <G4Decay.hh>
0037 #include <G4ParticleDefinition.hh>
0038 #include <G4ProcessManager.hh>
0039 
0040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0041 
0042 P6DExtDecayerPhysics::P6DExtDecayerPhysics(const G4String& name) : G4VPhysicsConstructor(name)
0043 {
0044   /// Standard constructor
0045 }
0046 
0047 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0048 
0049 P6DExtDecayerPhysics::~P6DExtDecayerPhysics()
0050 {
0051   /// Destructor
0052 }
0053 
0054 //
0055 // protected methods
0056 //
0057 
0058 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0059 
0060 void P6DExtDecayerPhysics::ConstructParticle()
0061 {
0062   /// Nothing to be done here
0063 }
0064 
0065 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0066 
0067 void P6DExtDecayerPhysics::ConstructProcess()
0068 {
0069   /// Loop over all particles instantiated and add external decayer
0070   /// to all decay processes if External decayer is set
0071 
0072   // Create Geant4 external decayer
0073   G4Pythia6Decayer* extDecayer = new G4Pythia6Decayer();
0074   extDecayer->SetVerboseLevel(1);
0075   // The extDecayer will be deleted in G4Decay destructor
0076 
0077   G4bool isSet = false;
0078   // One G4Decay object is shared by all unstable particles (per thread).
0079   // Thus, we need to set the external decayer only once.
0080 
0081   auto particleIterator = GetParticleIterator();
0082   particleIterator->reset();
0083   while ((*particleIterator)()) {
0084     if (isSet) break;
0085 
0086     G4ParticleDefinition* particle = particleIterator->value();
0087     G4ProcessManager* pmanager = particle->GetProcessManager();
0088 
0089     if (verboseLevel > 1) {
0090       G4cout << "Setting ext decayer for: " << particleIterator->value()->GetParticleName()
0091              << G4endl;
0092     }
0093 
0094     G4ProcessVector* processVector = pmanager->GetProcessList();
0095     for (std::size_t i = 0; i < processVector->length(); i++) {
0096       G4Decay* decay = dynamic_cast<G4Decay*>((*processVector)[i]);
0097       if (decay) {
0098         decay->SetExtDecayer(extDecayer);
0099         isSet = true;
0100       }
0101     }
0102   }
0103 
0104   if (verboseLevel > 0) {
0105     G4cout << "External decayer physics constructed." << G4endl;
0106   }
0107 }
0108 
0109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......