Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4FieldManager.cc
Go to the documentation of this file.
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$
28//
29// -------------------------------------------------------------------
30
31#include "G4FieldManager.hh"
32#include "G4Field.hh"
33#include "G4MagneticField.hh"
34#include "G4ChordFinder.hh"
36
38 G4ChordFinder *pChordFinder,
39 G4bool fieldChangesEnergy
40 )
41 : fDetectorField(detectorField),
42 fChordFinder(pChordFinder),
43 fAllocatedChordFinder(false),
44 fEpsilonMinDefault(5.0e-5),
45 fEpsilonMaxDefault(0.001),
46 fDefault_Delta_One_Step_Value(0.01), // mm
47 fDefault_Delta_Intersection_Val(0.001), // mm
48 fEpsilonMin( fEpsilonMinDefault ),
49 fEpsilonMax( fEpsilonMaxDefault)
50{
51 fDelta_One_Step_Value= fDefault_Delta_One_Step_Value;
52 fDelta_Intersection_Val= fDefault_Delta_Intersection_Val;
53 if ( detectorField )
54 fFieldChangesEnergy= detectorField->DoesFieldChangeEnergy();
55 else
56 fFieldChangesEnergy= fieldChangesEnergy;
57
58 // Add to store
60}
61
63 : fDetectorField(detectorField), fAllocatedChordFinder(true),
64 fEpsilonMinDefault(5.0e-5),
65 fEpsilonMaxDefault(0.001),
66 fFieldChangesEnergy(false),
67 fDefault_Delta_One_Step_Value(0.01), // mm
68 fDefault_Delta_Intersection_Val(0.001), // mm
69 fEpsilonMin( fEpsilonMinDefault ),
70 fEpsilonMax( fEpsilonMaxDefault)
71{
72 fChordFinder= new G4ChordFinder( detectorField );
73 fDelta_One_Step_Value= fDefault_Delta_One_Step_Value;
74 fDelta_Intersection_Val= fDefault_Delta_Intersection_Val;
75 // Add to store
77}
78
80{
81 // Default is to do nothing!
82 ;
83}
84
86{
87 if( fAllocatedChordFinder ){
88 delete fChordFinder;
89 }
91}
92
93void
95{
96 if ( fAllocatedChordFinder )
97 delete fChordFinder;
98 fChordFinder= new G4ChordFinder( detectorMagField );
99 fAllocatedChordFinder= true;
100}
101
103{
104 fDetectorField= pDetectorField;
105
106 if ( pDetectorField )
107 fFieldChangesEnergy= pDetectorField->DoesFieldChangeEnergy();
108 else
109 fFieldChangesEnergy= false; // No field
110
111 return false;
112}
113
bool G4bool
Definition: G4Types.hh:67
static void DeRegister(G4FieldManager *pVolume)
static void Register(G4FieldManager *pVolume)
G4bool SetDetectorField(G4Field *detectorField)
virtual ~G4FieldManager()
void CreateChordFinder(G4MagneticField *detectorMagField)
virtual void ConfigureForTrack(const G4Track *)
G4FieldManager(G4Field *detectorField=0, G4ChordFinder *pChordFinder=0, G4bool b=true)
virtual G4bool DoesFieldChangeEnergy() const =0