Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 /// \file exoticphysics/monopole/src/G4Monopol 27 /// \brief Implementation of the G4MonopoleFie 28 // 29 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oo 32 // 33 // 34 // G4MonopoleFieldSetup is responsible for set 35 // and the ability to use it with two differen 36 // one for monopoles and another for the rest 37 // 38 // 39 40 // =========================================== 41 // Created: 13 May 2010, B. Bozsogi 42 // =========================================== 43 44 #include "G4MonopoleFieldSetup.hh" 45 46 #include "G4ChordFinder.hh" 47 #include "G4FieldManager.hh" 48 #include "G4MagIntegratorStepper.hh" 49 #include "G4Mag_UsualEqRhs.hh" 50 #include "G4MagneticField.hh" 51 #include "G4MonopoleEquation.hh" 52 #include "G4MonopoleFieldMessenger.hh" 53 #include "G4TransportationManager.hh" 54 #include "G4UniformMagField.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: 70 71 //....oooOO0OOooo........oooOO0OOooo........oo 72 73 G4MonopoleFieldSetup::G4MonopoleFieldSetup() 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 fMonopoleFieldMessenger = new G4MonopoleFiel 88 fFieldManager = GetGlobalFieldManager(); 89 } 90 91 //....oooOO0OOooo........oooOO0OOooo........oo 92 93 // G4MonopoleFieldSetup* G4MonopoleFieldSetup: 94 // { 95 // if (0 == fMonopoleFieldSetup) 96 // { 97 // static G4ThreadLocal G4MonopoleFieldSe 98 // fMonopoleFieldSetup = &theInstance; 99 // } 100 101 // return fMonopoleFieldSetup; 102 // } 103 104 //....oooOO0OOooo........oooOO0OOooo........oo 105 106 G4MonopoleFieldSetup::~G4MonopoleFieldSetup() 107 { 108 delete fMonopoleFieldMessenger; 109 if (fMagneticField) delete fMagneticField; 110 // if(fChordFinder) delete fChordFinder; 111 if (fUsualChordFinder) delete fUsualChordFin 112 if (fMonopoleChordFinder) delete fMonopoleCh 113 if (fStepper) delete fStepper; 114 if (fMonopoleStepper) delete fMonopoleSteppe 115 } 116 117 //....oooOO0OOooo........oooOO0OOooo........oo 118 119 void G4MonopoleFieldSetup::SetZMagFieldValue(G 120 { 121 // set new magnetic field value and rebuild 122 fZmagFieldValue = val; 123 124 ConstructMagField(); 125 } 126 127 //....oooOO0OOooo........oooOO0OOooo........oo 128 129 void G4MonopoleFieldSetup::ConstructMagField() 130 { 131 // apply a global uniform magnetic field alo 132 if (fMagneticField) { 133 delete fMagneticField; 134 } // delete the existing magn field 135 136 if (fZmagFieldValue != 0.) // create a new 137 { 138 // G4cout << "Go to create new field ..." 139 fMagneticField = new G4UniformMagField(G4T 140 InitialiseAll(); 141 } 142 else { 143 // G4cout << "Set field = 0 ..." << G4endl 144 fMagneticField = 0; 145 } 146 147 fFieldManager->SetDetectorField(fMagneticFie 148 } 149 150 //....oooOO0OOooo........oooOO0OOooo........oo 151 152 void G4MonopoleFieldSetup::InitialiseAll() 153 { 154 fEquation = new G4Mag_UsualEqRhs(fMagneticFi 155 fMonopoleEquation = new G4MonopoleEquation(f 156 157 fMinStep = 0.01 * mm; // minimal step of 1 158 159 fMonopoleStepper = new G4ClassicalRK4(fMonop 160 fStepper = new G4ClassicalRK4(fEquation); 161 162 fUsualChordFinder = new G4ChordFinder(fMagne 163 fMonopoleChordFinder = new G4ChordFinder(fMa 164 165 SetStepperAndChordFinder(0); 166 } 167 168 //....oooOO0OOooo........oooOO0OOooo........oo 169 170 void G4MonopoleFieldSetup::SetStepperAndChordF 171 { 172 if (fMagneticField) { 173 fFieldManager->SetDetectorField(fMagneticF 174 // if(fChordFinder) delete fChordFinder 175 176 switch (val) { 177 // case 0: 178 // fChordFinder = new G4ChordF 179 // break; 180 // case 1: 181 // fChordFinder = new G4ChordF 182 // 183 // break; 184 case 0: 185 fChordFinder = fUsualChordFinder; 186 break; 187 case 1: 188 fChordFinder = fMonopoleChordFinder; 189 break; 190 } 191 192 fFieldManager->SetChordFinder(fChordFinder 193 } 194 } 195 196 //....oooOO0OOooo........oooOO0OOooo........oo 197 198 G4FieldManager* G4MonopoleFieldSetup::GetGloba 199 { 200 return G4TransportationManager::GetTransport 201 } 202 203 //....oooOO0OOooo........oooOO0OOooo........oo 204