Dear experts,
I am attempting to set up a local uniform electric field in my simulation. For that I used as a reference the examples /extended/field/field02 and /extended/field/field03.
This is how I set up the electric field in my Detector construction class:
FC_ElectricFieldSetup* fieldSetup = new FC_ElectricFieldSetup();
fEmFieldSetup.Put(fieldSetup);
G4AutoDelete::Register(fieldSetup);
CIL2_Logic->SetFieldManager(fieldSetup->GetLocalFieldManager(),true);
return worldPhysical;
Here, CIL2_Logic is the logical volume inside which I would like the electric field to be present.
------------------------------------ Electric field constructor ---------------------------------------------
FC_ElectricFieldSetup::FC_ElectricFieldSetup( G4ThreeVector fieldVector)
: fMinStep(0.010*CLHEP::mm), // minimal step of 10 microns
fFieldManager(0),
fLocalFieldManager(0),
fChordFinder(0),
fIntgrDriver(0),
fLocalChordFinder(0),
fEquation(0),
fLocalEquation(0),
fElectricField(0),
fLocalElectricField(0),
fStepper(0),
fLocalStepper(0),
fStepperType(4), // ClassicalRK4 -- the default stepper
fFieldMessenger(0) {
G4cout << " FC_ElectricFieldSetup - Constructor called. " << G4endl;
fElectricField = new G4UniformElectricField(G4ThreeVector(0.0,0.0,0.0));
fLocalElectricField = new G4UniformElectricField(G4ThreeVector(0.0,0.0,0.0));
fFieldMessenger = new FC_FieldMessenger(this);
fEquation = new G4EqMagElectricField(fElectricField);
fLocalEquation = new G4EqMagElectricField(fLocalElectricField);
fFieldManager = GetGlobalFieldManager();
fLocalFieldManager = new G4FieldManager();
UpdateField();
}
When I represent the geometry I see the electric field present in all the mother volume (see picture). Also, they are affected by the electric field as soon as they are created…
Any advice/suggestions would be welcome.
Thank you in advance!
Araceli