Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4MonopoleFieldSetup.cc
이 파일의 문서화 페이지로 가기
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 //
28 //
29 // $Id: G4MonopoleFieldSetup.cc 104872 2017-06-23 14:19:16Z gcosmo $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 //
34 //
35 // G4MonopoleFieldSetup is responsible for setting up a magnetic field
36 // and the ability to use it with two different equation of motions,
37 // one for monopoles and another for the rest of the particles.
38 //
39 //
40 
41 // =======================================================================
42 // Created: 13 May 2010, B. Bozsogi
43 // =======================================================================
44 
45 #include "G4MonopoleFieldSetup.hh"
47 
48 #include "G4MagneticField.hh"
49 #include "G4UniformMagField.hh"
50 #include "G4FieldManager.hh"
52 #include "G4Mag_UsualEqRhs.hh"
53 #include "G4MonopoleEquation.hh"
55 #include "G4ChordFinder.hh"
56 
57 // #include "G4ExplicitEuler.hh"
58 // #include "G4ImplicitEuler.hh"
59 // #include "G4SimpleRunge.hh"
60 // #include "G4SimpleHeum.hh"
61 #include "G4ClassicalRK4.hh"
62 // #include "G4HelixExplicitEuler.hh"
63 // #include "G4HelixImplicitEuler.hh"
64 // #include "G4HelixSimpleRunge.hh"
65 // #include "G4CashKarpRKF45.hh"
66 // #include "G4RKG3_Stepper.hh"
67 
68 #include "G4SystemOfUnits.hh"
69 
70 //G4MonopoleFieldSetup* G4MonopoleFieldSetup::fMonopoleFieldSetup=0;
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73 
75  : fFieldManager(0),
76  fChordFinder(0),
77  fUsualChordFinder(0),
78  fMonopoleChordFinder(0),
79  fEquation(0),
80  fMonopoleEquation(0),
81  fMagneticField(0),
82  fStepper(0),
83  fMonopoleStepper(0),
84  fMinStep(0.0),
85  fZmagFieldValue(0.),
86  fMonopoleFieldMessenger(0)
87 {
88 
91 }
92 
93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
94 
95 // G4MonopoleFieldSetup* G4MonopoleFieldSetup::GetMonopoleFieldSetup()
96 // {
97 // if (0 == fMonopoleFieldSetup)
98 // {
99 // static G4ThreadLocal G4MonopoleFieldSetup theInstance;
100 // fMonopoleFieldSetup = &theInstance;
101 // }
102 
103 // return fMonopoleFieldSetup;
104 // }
105 
106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
107 
109 {
111  if(fMagneticField) delete fMagneticField;
112  // if(fChordFinder) delete fChordFinder;
115  if(fStepper) delete fStepper;
117 }
118 
119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
120 
121 
123  bool checkIfAlreadyDefined)
124 {
125  if(checkIfAlreadyDefined&&fMagneticField){
126  // G4double fieldSet[4], fValue;
127  // fMagneticField->GetFieldValue(fieldSet, &fValue);
128  return;
129  }
130 
131 
132  fZmagFieldValue = fieldValue;
133 
134  //apply a global uniform magnetic field along Z axis
135  if (fMagneticField) { delete fMagneticField; } //delete the existing magn field
136 
137  if (fZmagFieldValue != 0.) // create a new one if non nul
138  {
140  fZmagFieldValue));
141  InitialiseAll();
142  }
143  else
144  {
145  fMagneticField = 0;
146  }
147 
149 
150 }
151 
152 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
153 
155 {
158 
159  fMinStep = 0.01*mm ; // minimal step of 1 mm is default
160 
163 
167 
169 }
170 
171 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
172 
174 {
175 
176  if (fMagneticField)
177  {
179  // if(fChordFinder) delete fChordFinder;
180 
181  switch (val)
182  {
183 // case 0:
184 // fChordFinder = new G4ChordFinder( fMagneticField, fMinStep, fStepper);
185 // break;
186 // case 1:
187 // fChordFinder = new G4ChordFinder( fMagneticField, fMinStep,
188 // fMonopoleStepper);
189 // break;
190  case 0:
192  break;
193  case 1:
195  break;
196  }
197 
199  }
200 
201 }
202 
203 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
204 
206 {
208  ->GetFieldManager();
209 }
210 
211 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ChordFinder * fMonopoleChordFinder
CLHEP::Hep3Vector G4ThreeVector
G4FieldManager * GetGlobalFieldManager()
Definition of the G4MonopoleEquation class.
static constexpr double mm
Definition: G4SIunits.hh:115
G4MonopoleEquation * fMonopoleEquation
G4MagIntegratorStepper * fMonopoleStepper
G4Mag_UsualEqRhs * fEquation
G4MagIntegratorStepper * fStepper
#define fMinStep
G4ChordFinder * fUsualChordFinder
void SetMagField(G4double v, bool checkIfAlreadyDefined=false)
G4MonopoleFieldMessenger * fMonopoleFieldMessenger
void SetStepperAndChordFinder(G4int val)
G4bool SetDetectorField(G4Field *detectorField, int failMode=0)
double G4double
Definition: G4Types.hh:76
Definition of the G4MonopoleFieldMessenger class.
G4FieldManager * GetFieldManager() const
static G4TransportationManager * GetTransportationManager()
void SetChordFinder(G4ChordFinder *aChordFinder)
int G4int
Definition: G4Types.hh:78
G4MagneticField * fMagneticField
G4ChordFinder * fChordFinder
G4FieldManager * fFieldManager
Definition of the G4MonopoleFieldSetup class.