Message: ElectricField ? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question ElectricField ? 

Keywords: electric field chordfinder
Forum: Fields: Magnetic and Otherwise
Date: 28 Sep, 2004
From: Daniel Barna <Daniel Barna>

Hi

I want to use a pure electric field in my detector. This should be pretty straightforward, and in fact, there is also an example code in the tutorial. However, it does not compile. I quote this code below (http://geant4.web.cern.ch/geant4/G4UsersDocuments/UsersGuides/ForApplicationDeveloper/html/Detector/electroMagneticField.html) The problematic line is 'pChordFinder=new G4ChordFinder(&myElectricField,...)' because G4ChordFinder's constructor (to my greatest surprise) expects a G4MagneticField* as its first argument. That is, if my electric field is derived from G4ElectricField (as I assume it should be), then the code does not compile. So did I do something wrong (should I derive my electric field from G4MagneticField), or is the tutorial bad? Thanks Daniel

  #include "G4EqMagElectricField.hh"
  #include "G4UniformElectricField.hh"

  ...
  {
    // Part of detector description code

    G4FieldManager   *pFieldMgr;
    G4MagIntegratorStepper *pStepper;
    G4EqMagElectricField *fEquation = new
     G4EqMagElectricField(&myElectricField);

    pStepper = new G4ClassicalRK4( fEquation );
    // or    = new G4SimpleHeum(   fEquation );

    // Set this as a global field
    pFieldMgr= G4TransportationManager::GetTransportationManager()->
         GetFieldManager();

    pFieldMgr->SetDetectorField( &myElectricField );
    pChordFinder = new G4ChordFinder( &myElectricField,
                           1.0e-2 * mm,      // Minimum step size
                           pStepper);
    pFieldMgr->SetChordFinder( pChordFinder );
  }

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

 Add Message Add Message
to: "ElectricField ?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]