source: trunk/source/physics_lists/builders/src/G4DecayPhysics.cc @ 1228

Last change on this file since 1228 was 1228, checked in by garnier, 14 years ago

update geant4.9.3 tag

File size: 4.0 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26// $Id: G4DecayPhysics.cc,v 1.1 2006/10/31 11:35:02 gunter Exp $
27// GEANT4 tag $Name: geant4-09-03 $
28//
29//---------------------------------------------------------------------------
30//
31// ClassName:   G4DecayPhysics
32//
33// Author: 2002 J.P. Wellisch
34//
35// Modified:
36// 10.11.2005 V.Ivanchenko edit to provide a standard
37// 05.12.2005 V.Ivanchenko add controlled verbosity
38// 25.04.2006 V.Ivanchenko fix problem of destructor
39//
40//----------------------------------------------------------------------------
41//
42
43#include "G4DecayPhysics.hh"
44
45#include "G4ParticleDefinition.hh"
46#include "G4ProcessManager.hh"
47
48#include "G4BosonConstructor.hh"
49#include "G4LeptonConstructor.hh"
50#include "G4MesonConstructor.hh"
51#include "G4BosonConstructor.hh"
52#include "G4BaryonConstructor.hh"
53#include "G4IonConstructor.hh"
54#include "G4ShortLivedConstructor.hh"
55
56
57G4DecayPhysics::G4DecayPhysics(const G4String& name, G4int ver)
58  :  G4VPhysicsConstructor(name), verbose(ver), wasActivated(false)
59{}
60
61G4DecayPhysics::~G4DecayPhysics()
62{
63  if(wasActivated) delete fDecayProcess;
64}
65
66void G4DecayPhysics::ConstructParticle()
67{
68
69// G4cout << "G4DecayPhysics::ConstructParticle" << G4endl;
70  G4BosonConstructor  pBosonConstructor;
71  pBosonConstructor.ConstructParticle();
72
73  G4LeptonConstructor pLeptonConstructor;
74  pLeptonConstructor.ConstructParticle();
75
76  G4MesonConstructor pMesonConstructor;
77  pMesonConstructor.ConstructParticle();
78
79  G4BaryonConstructor pBaryonConstructor;
80  pBaryonConstructor.ConstructParticle();
81
82  G4IonConstructor pIonConstructor;
83  pIonConstructor.ConstructParticle();
84
85  G4ShortLivedConstructor pShortLivedConstructor;
86  pShortLivedConstructor.ConstructParticle(); 
87}
88
89void G4DecayPhysics::ConstructProcess()
90{
91  if(wasActivated) return;
92  wasActivated = true;
93
94  // Add Decay Process
95  fDecayProcess = new G4Decay();
96  theParticleIterator->reset();
97  G4ParticleDefinition* particle=0;
98  G4ProcessManager* pmanager=0;
99
100  while( (*theParticleIterator)() )
101  {
102    particle = theParticleIterator->value();
103    pmanager = particle->GetProcessManager();
104    if( fDecayProcess->IsApplicable(*particle) ) 
105    { 
106      if(verbose > 1)
107        G4cout << "### Decays for " << particle->GetParticleName() << G4endl;
108      pmanager -> AddProcess(fDecayProcess);
109      pmanager -> SetProcessOrdering(fDecayProcess, idxPostStep);
110      pmanager -> SetProcessOrdering(fDecayProcess, idxAtRest);
111    }
112  }
113}
114
115
Note: See TracBrowser for help on using the repository browser.