Message: Re: simultaneous B and E fields Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Re: simultaneous B and E fields 

Keywords: magnetic field, electric field
Forum: Fields: Magnetic and Otherwise
Re: Question simultaneous B and E fields (Abigail Bickley)
Re: Feedback Re: simultaneous B and E fields (Gumplinger Peter)
Date: 16 Jul, 2007
From: Abigail Bickley <bickley@nscl.msu.edu>

Thank you for your suggestion. If I understand correctly I still need to have a global field defined as a G4UniformMagField and then the local field is a superposition of the global B and local E fields.

Following your code I added the following lines to my DetectorConstruction.cc.

  // Global Magnetic Field
  G4double gbl_Bfield_x = 0.0*tesla;
  G4double gbl_Bfield_y = 2.0*tesla;
  G4double gbl_Bfield_z = 0.0*tesla;
  G4ThreeVector globalfieldVector = G4ThreeVector(gbl_Bfield_x,gbl_Bfield_y,gbl_Bfield_z);
  G4UniformMagField* fGlobalField = new G4UniformMagField(globalfieldVector);
  G4FieldManager* fGlobalFieldManager = G4TransportationManager::GetTransportationManager()->GetFieldManager();
  fGlobalFieldManager->SetDetectorField(fGlobalField);
  fGlobalFieldManager->CreateChordFinder(fGlobalField);
  fGlobalFieldManager->GetChordFinder()->SetDeltaChord(0.01*mm);

  // Local Electric Field
  G4double lcl_Efield_x = 0.0*volt/cm;
  G4double lcl_Efield_y = -5000.0*volt/cm;
  G4double lcl_Efield_z = 0.0*volt/cm;
  G4ElectroMagneticField* fLocalField = new G4ElectroMagneticField(gbl_Bfield_x,gbl_Bfield_y,gbl_Bfield_z,lcl_Efield_x,lcl_Efield_y,lcl_Efield_z);
  G4FieldManager* fLocalFieldManager = G4TransportationManager::GetTransportationManager()->GetFieldManager();
  fLocalFieldManager->SetDetectorField(fLocalField);

My observation is that the global magnetic field is applied properly, but the local electric field causes the code to fail to compile. The error messages I receive seem to indicate that G4ElectroMagneticField is expecting an initialization with two doubles (not 6)? Do you have any suggestions for a way around this problem?

Compiling TPCDetectorConstruction.cc ...
src/TPCDetectorConstruction.cc: In member function `G4VPhysicalVolume* 
   TPCDetectorConstruction::ConstructTPC()':
src/TPCDetectorConstruction.cc:385: error: cannot allocate an object of type `
   G4ElectroMagneticField'
src/TPCDetectorConstruction.cc:385: error:   because the following virtual 
   functions are abstract:
/opt/geant4.8.2/include/G4ElectroMagneticField.hh:75: error:    virtual void 
   G4ElectroMagneticField::GetFieldValue(const G4double*, G4double*) const
/opt/geant4.8.2/include/G4ElectroMagneticField.hh:79: error:    virtual G4bool 
   G4ElectroMagneticField::DoesFieldChangeEnergy() const
make: *** [/projects/proj2/EOS_sim/TPC/tmp/Linux-g++-3.3/tpc/TPCDetectorConstruction.o] Error 1

Thank you

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

1 Warning: Re: simultaneous B and E fields   (Peter Gumplinger - 17 Jul, 2007)
(_ Question: Re: simultaneous B and E fields   (Abigail Bickley - 19 Jul, 2007)
(_ Feedback: Re: simultaneous B and E fields   (Peter Gumplinger - 20 Jul, 2007)
(_ Warning: Re: simultaneous B and E fields   (Gumplinger Peter - 17 Sep, 2009)
 Add Message Add Message
to: "Re: simultaneous B and E fields"

 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 ]