| Message: Re: simultaneous B and E fields | Not Logged In (login) |
|
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: | Outline Depth: | Add message: |
|
to: |