Message: Re: Help setting up an Electric Field Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: Help setting up an Electric Field 

Forum: Fields: Magnetic and Otherwise
Re: None Help setting up an Electric Field (Adam)
Date: 10 Jul, 2007
From: Gumplinger Peter <Gumplinger Peter>

> When the simulation starts, it seems as though particles are leaving

> the xenon and keep going on forever until they exit the world volume,

> which gives me a segmentation fault.

My guess is the segmentation fault has nothing to do with your field setup. You probably have code like this somewhere:

  G4StepPoint* thePostPoint = theStep->GetPostStepPoint();
  G4VPhysicalVolume* thePostPV = thePostPoint->GetPhysicalVolume();
  ...... thePostPV->GetName();

You must check that the pointer thePostPV is not NULL:

  if(thePostPV)thePostPV->GetName();

It is NULL for the last step when the particle leaves the world volume.

> I know that to isolate the field to only the xenon cylinder, I need to

> use the line:

> xenon_log->SetFieldManager(field->GetGlobalFieldManager(), false);

No, that's not correct! While yes, you have to set a field manager to the logical volume, if you set the 'global field manager' to it, you achieved nothing. Moreover, you assigned your field to the global field manager, thus your field is everywhere. The 'false/true' means:

       // Sets FieldManager and propagates it:

       //  i) only to daughters with G4FieldManager = 0

       //     if forceToAllDaughters=false

       // ii) to all daughters

       //     if forceToAllDaughters=true

I know there was an error in example:

examples/extended/field/field03/src/F03DetectorConstruction.cc

until G4.9. It was supposed to have exhibited tracking in a magnetic field associated to selected logical volumes (besides a global field). Now corrected, you want to follow this example, except you don't want to set any field to the global field manager. The code:

  fLocalFieldManager = new G4FieldManager();
  fLocalFieldManager->SetDetectorField(....
  fLocalFieldManager->SetChordFinder(

  // Set local field manager and local field

  xenon_log->SetFieldManager(fLocalFieldManager,true);

> in what class do I put this line? The documentation isn't very

> specific about this.

In DetectorConstruction.cc where you have the pointer xenon_log.

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

1 None: Re: Help setting up an Electric Field   (Adam - 10 Jul, 2007)
(_ None: Re: Help setting up an Electric Field   (John Apostolakis - 10 Jul, 2007)
(_ None: Re: Help setting up an Electric Field   (Adam - 11 Jul, 2007)
1 Warning: Re: Help setting up an Electric Field   (Peter Gumplinger - 11 Jul, 2007)
3 None: Re: Help setting up an Electric Field   (John Apostolakis - 13 Jul, 2007)
1 None: Re: Help setting up an Electric Field   (Adam - 13 Jul, 2007)
...
 Add Message Add Message
to: "Re: Help setting up an 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 ]