| Message: Re: Help setting up an Electric Field | Not Logged In (login) |
|
> 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: | Outline Depth: | Add message: |
|
to: |