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.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/extended/exoticphysics/monopole/src/G4MonopoleFieldSetup.cc (Version 11.3.0) and /examples/extended/exoticphysics/monopole/src/G4MonopoleFieldSetup.cc (Version 3.0)


  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