Message: Re: Electrons not affected by electric field? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Electrons not affected by electric field? 

Forum: Fields: Magnetic and Otherwise
Re: None Electrons not affected by electric field? (Robert Schaefer)
Date: 19 Jan, 2015
From: John Apostolakis <John Apostolakis>

Dear Robert,

Your approach seems correct in creating your own class.

There is a small error in the code with which you create the Stepper which will stop you from being able to see the effects of the field.

As you can see from the Users Guide for Application Developers, section, for an electric field you need to use *8*variables in the integration. 

    G4int nvar = 8;
    fStepper = new G4ClassicalRK4( fEquation, nvar );       

Position, momentum, energy and time are individually integrated.

I hope that this help you move forward.

Best regards,
John Apostolakis,  PH Department, CERN

> On 19 Jan 2015, at 12:02, Robert Schaefer <> wrote:
> *** Discussion title: Fields: Magnetic and Otherwise
> Dear G4 community,
> I'm new to Geant4 and I'm using it for my PhD thesis. My work is about
> an EUV spectrometer employed on the ISS. We're also working with gas
> ionization chambers.
> The energy range of the photons are about 20eV < E_gamma < 70eV.
> The gas ionization chamber is a cylinder (potential of mantle is 0V )
> and a wire (not in the center of the cylinder, potential -23V). When
> radiation enters the chamber, it ionizes the gas inside (low pressure
> neon). The ions are sucked to the wire and the electrons are repelled to
> the chamber wall (see attached picture "ionChamb.png").
> The geometry is already set up and works, so no errors here. However the
> implementation of the (non uniform) electric field is quite a challenge
> and I need help here.
> My ElectricField class is quite simple. The script just consits of the
> constructor, destructor and the "GetFieldValue"-function. In this
> function, the electric field value (volt/meter) is calculated for each
> hit position (regarding the non central wire position, etc):
> //--------------------------------------------------------------------------------------------------
> void B7ElectricField::GetFieldValue(const G4double Point[3],G4double *Efield) const
> {
> /* some math here to calculate E */
>     Efield[0]=E*cos(phi_v);
>     Efield[1]=E*sin(phi_v);
>     Efield[2]=0;
> }
> //--------------------------------------------------------------------------------------------------
> With this function, I want to return the electric field strength in the
> x-y-plane. The value in the z plane (which is along the chamber) is
> always zero. The electric field is then called in my
> DetectorConstruction file, after building the geometry:
> //--------------------------------------------------------------------------------------------------
>     B7ElectricField* electricField=new B7ElectricField();
>     G4EqMagElectricField* fEquation = new G4EqMagElectricField(electricField);
>     G4int nvar = 4;
>     G4MagIntegratorStepper* fStepper = new G4ClassicalRK4( fEquation, nvar );       
>     G4FieldManager* fFieldMgr= G4TransportationManager::GetTransportationManager()->GetFieldManager();
>     fFieldMgr->SetDetectorField(electricField );
>     G4double fMinStep     = 1*mm ; // minimal step of 100 microns
>     G4MagInt_Driver* fIntgrDriver = new G4MagInt_Driver(fMinStep, fStepper, fStepper->GetNumberOfVariables() );
>     G4ChordFinder* fChordFinder = new G4ChordFinder(fIntgrDriver);
>     fFieldMgr->SetChordFinder( fChordFinder );
> //--------------------------------------------------------------------------------------------------
> (this piece of code is taken from "" and altered to my case)
> Now when I compile and run my code, the electrons are not affected by
> the electric field. What am I missing here? Is the implementation of the
> field wrong? How would you define an individual non uniform electric
> field and implement it here?
> The PhysicsList I'm using is the PAI model.
> Thanks & best regards, Robert
> PS: I've not been using C++ for very long, so my code and way of
> programming may not look very aesthetic :)
>   Attachment:
> -------------------------------------------------------------
> Visit this GEANT4 at message (to reply or unsubscribe) at: 

 Add Message Add Message
to: "Re: Electrons not affected by electric field?"

 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 ]