source: trunk/source/run/include/G4VModularPhysicsList.hh@ 1215

Last change on this file since 1215 was 1058, checked in by garnier, 17 years ago

file release beta

File size: 4.6 KB
RevLine 
[828]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//
27// $Id: G4VModularPhysicsList.hh,v 1.7 2006/06/29 21:13:28 gunter Exp $
[1058]28// GEANT4 tag $Name: geant4-09-02-ref-02 $
[828]29//
30//
31// ------------------------------------------------------------
32// GEANT 4 class header file
33//
34// Class Description:
35// This class is a subclass of G4VUserPhysicsList.
36// The user should register his/her physics constructors
37// by using
38// G4VModularPhysicsList::RegsiterPhysics()
39// to construt particles and processes.
40// In addition the user must implement the four virtual methods
41// in his own concrete class derived from this class.
42// G4VModularPhysicsList::SetCuts()
43// to set cut values in range to all particles
44// (rebuild of physics table will be invoked).
45
46// ------------------------------------------------------------
47// History
48// - first version 12 Nov 2000 by H.Kurashige
49// ------------------------------------------------------------
50#ifndef G4VModularPhysicsList_h
51#define G4VModularPhysicsList_h 1
52
53#include "globals.hh"
54#include "G4ios.hh"
55#include <vector>
56
57#include "G4VUserPhysicsList.hh"
58#include "G4VPhysicsConstructor.hh"
59
60class G4VModularPhysicsList: public virtual G4VUserPhysicsList
61{
62 public:
63 G4VModularPhysicsList();
64 virtual ~G4VModularPhysicsList();
65
66 public: // with description
67 // "SetCuts" method sets a cut value for all particle types
68 // in the particle table
69 virtual void SetCuts() = 0;
70
71 // This method will be invoked in the Construct() method.
72 // each particle type will be instantiated
73 virtual void ConstructParticle();
74
75 // This method will be invoked in the Construct() method.
76 // each physics process will be instantiated and
77 // registered to the process manager of each particle type
78 virtual void ConstructProcess();
79
80 public: // with description
81 void RegisterPhysics(G4VPhysicsConstructor* );
82
83 const G4VPhysicsConstructor* GetPhysics(G4int index) const;
84 const G4VPhysicsConstructor* GetPhysics(const G4String& name) const;
85
86 /////////////////////////////////////
87
88 protected: // with description
89 // vector of pointers to G4VPhysicsConstructor
90 typedef std::vector<G4VPhysicsConstructor*> G4PhysConstVector;
91 G4PhysConstVector* physicsVector;
92};
93
94
95inline
96 void G4VModularPhysicsList::RegisterPhysics(G4VPhysicsConstructor* fPhysics)
97{
98 physicsVector->push_back(fPhysics);
99}
100
101inline
102 const G4VPhysicsConstructor* G4VModularPhysicsList::GetPhysics(G4int idx) const
103{
104 G4int i;
105 G4PhysConstVector::iterator itr= physicsVector->begin();
106 for (i=0; i<idx && itr!= physicsVector->end() ; ++i) ++itr;
107 if (itr!= physicsVector->end()) return (*itr);
108 else return 0;
109}
110
111inline
112 const G4VPhysicsConstructor* G4VModularPhysicsList::GetPhysics(const G4String& name) const
113{
114 G4PhysConstVector::iterator itr;
115 for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
116 if ( name == (*itr)->GetPhysicsName()) break;
117 }
118 if (itr!= physicsVector->end()) return (*itr);
119 else return 0;
120}
121
122
123
124
125#endif
Note: See TracBrowser for help on using the repository browser.