G4FieldManager.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id: G4FieldManager.cc 69786 2013-05-15 09:38:51Z gcosmo $
00028 //
00029 // -------------------------------------------------------------------
00030 
00031 #include "G4FieldManager.hh"
00032 #include "G4Field.hh"
00033 #include "G4MagneticField.hh"
00034 #include "G4ChordFinder.hh"
00035 #include "G4FieldManagerStore.hh"
00036 
00037 G4FieldManager::G4FieldManager(G4Field       *detectorField, 
00038                                G4ChordFinder *pChordFinder, 
00039                                G4bool        fieldChangesEnergy
00040                               )
00041    : fDetectorField(detectorField), 
00042      fChordFinder(pChordFinder), 
00043      fAllocatedChordFinder(false),
00044      fEpsilonMinDefault(5.0e-5), 
00045      fEpsilonMaxDefault(0.001),
00046      fDefault_Delta_One_Step_Value(0.01),    // mm
00047      fDefault_Delta_Intersection_Val(0.001), // mm
00048      fEpsilonMin( fEpsilonMinDefault ),
00049      fEpsilonMax( fEpsilonMaxDefault)
00050 { 
00051    fDelta_One_Step_Value= fDefault_Delta_One_Step_Value;
00052    fDelta_Intersection_Val= fDefault_Delta_Intersection_Val;
00053    if ( detectorField )
00054      fFieldChangesEnergy= detectorField->DoesFieldChangeEnergy();
00055    else
00056      fFieldChangesEnergy= fieldChangesEnergy;
00057 
00058    // Add to store
00059    G4FieldManagerStore::Register(this);
00060 }
00061 
00062 G4FieldManager::G4FieldManager(G4MagneticField *detectorField)
00063    : fDetectorField(detectorField), fAllocatedChordFinder(true),
00064      fEpsilonMinDefault(5.0e-5), 
00065      fEpsilonMaxDefault(0.001),
00066      fFieldChangesEnergy(false), 
00067      fDefault_Delta_One_Step_Value(0.01),    // mm
00068      fDefault_Delta_Intersection_Val(0.001), // mm
00069      fEpsilonMin( fEpsilonMinDefault ),
00070      fEpsilonMax( fEpsilonMaxDefault)
00071 {
00072    fChordFinder= new G4ChordFinder( detectorField );
00073    fDelta_One_Step_Value= fDefault_Delta_One_Step_Value;
00074    fDelta_Intersection_Val= fDefault_Delta_Intersection_Val;
00075    // Add to store
00076    G4FieldManagerStore::Register(this);
00077 }
00078 
00079 void G4FieldManager::ConfigureForTrack( const G4Track * ) 
00080 {
00081    // Default is to do nothing!
00082    ;
00083 }
00084 
00085 G4FieldManager::~G4FieldManager()
00086 {
00087    if( fAllocatedChordFinder ){
00088       delete fChordFinder;
00089    }
00090    G4FieldManagerStore::DeRegister(this);
00091 }
00092 
00093 void
00094 G4FieldManager::CreateChordFinder(G4MagneticField *detectorMagField)
00095 {
00096    if ( fAllocatedChordFinder )
00097       delete fChordFinder;
00098    fChordFinder= new G4ChordFinder( detectorMagField );
00099    fAllocatedChordFinder= true;
00100 }
00101 
00102 G4bool G4FieldManager::SetDetectorField(G4Field *pDetectorField)
00103 {
00104    fDetectorField= pDetectorField;
00105 
00106    if ( pDetectorField )
00107      fFieldChangesEnergy= pDetectorField->DoesFieldChangeEnergy();
00108    else
00109      fFieldChangesEnergy= false;   //  No field 
00110 
00111    return false;
00112 }
00113 

Generated on Mon May 27 17:48:16 2013 for Geant4 by  doxygen 1.4.7