ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4MonopoleFieldSetup.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file 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 //
30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //
33 //
34 // G4MonopoleFieldSetup is responsible for setting up a magnetic field
35 // and the ability to use it with two different equation of motions,
36 // one for monopoles and another for the rest of the particles.
37 //
38 //
39 
40 // =======================================================================
41 // Created: 13 May 2010, B. Bozsogi
42 // =======================================================================
43 
44 #include "G4MonopoleFieldSetup.hh"
46 
47 #include "G4MagneticField.hh"
48 #include "G4UniformMagField.hh"
49 #include "G4FieldManager.hh"
51 #include "G4Mag_UsualEqRhs.hh"
52 #include "G4MonopoleEquation.hh"
54 #include "G4ChordFinder.hh"
55 
56 // #include "G4ExplicitEuler.hh"
57 // #include "G4ImplicitEuler.hh"
58 // #include "G4SimpleRunge.hh"
59 // #include "G4SimpleHeum.hh"
60 #include "G4ClassicalRK4.hh"
61 // #include "G4HelixExplicitEuler.hh"
62 // #include "G4HelixImplicitEuler.hh"
63 // #include "G4HelixSimpleRunge.hh"
64 // #include "G4CashKarpRKF45.hh"
65 // #include "G4RKG3_Stepper.hh"
66 
67 #include "G4SystemOfUnits.hh"
68 
69 //G4MonopoleFieldSetup* G4MonopoleFieldSetup::fMonopoleFieldSetup=0;
70 
71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
72 
74  : fFieldManager(0),
75  fChordFinder(0),
76  fUsualChordFinder(0),
77  fMonopoleChordFinder(0),
78  fEquation(0),
79  fMonopoleEquation(0),
80  fMagneticField(0),
81  fStepper(0),
82  fMonopoleStepper(0),
83  fMinStep(0.0),
84  fZmagFieldValue(0.2*tesla),
85  fMonopoleFieldMessenger(0)
86 {
87 
90 }
91 
92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
93 
94 // G4MonopoleFieldSetup* G4MonopoleFieldSetup::GetMonopoleFieldSetup()
95 // {
96 // if (0 == fMonopoleFieldSetup)
97 // {
98 // static G4ThreadLocal G4MonopoleFieldSetup theInstance;
99 // fMonopoleFieldSetup = &theInstance;
100 // }
101 
102 // return fMonopoleFieldSetup;
103 // }
104 
105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
106 
108 {
110  if(fMagneticField) delete fMagneticField;
111  // if(fChordFinder) delete fChordFinder;
114  if(fStepper) delete fStepper;
116 }
117 
118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
119 
121 {
122  //set new magnetic field value and rebuild the field
123  fZmagFieldValue = val;
124 
126 }
127 
128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
129 
131 {
132  //apply a global uniform magnetic field along Z axis
133  if (fMagneticField) { delete fMagneticField; } //delete the existing magn field
134 
135  if (fZmagFieldValue != 0.) // create a new one if non nul
136  {
137  // G4cout << "Go to create new field ..." << G4endl;
139  fZmagFieldValue));
140  InitialiseAll();
141  }
142  else
143  {
144  // G4cout << "Set field = 0 ..." << G4endl;
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......