Message: Re: Electric Field does not work... Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Electric Field does not work... 

Keywords: Electric Field
Forum: Fields: Magnetic and Otherwise
Re: Question Electric Field does not work... (Dai ho Ko)
Re: None Re: Electric Field does not work... (Dai ho Ko)
Date: 31 Aug, 2004
From: Dai ho Ko <kodainim@hotmail.com>

Although I corrected my source according to Tom's advice, this still does not work. Same as before. It stops when it deals with first particle. I cannot understand why this program works for uniform E-field, but does not work for non-uniform E-field. I must have made a big mistakes. But I cannot pick it out....:( So, here I post all of my sources about detector part.

************Detector source************************************

#include "ExN03DetectorConstruction.hh"

#include "G4Material.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "globals.hh"
#include "G4GeometryManager.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"

#include "G4EqMagElectricField.hh"
#include "G4FieldManager.hh"
#include "G4ClassicalRK4.hh"
#include "G4TransportationManager.hh"
#include "G4ChordFinder.hh"

#include "G4MagIntegratorStepper.hh"
#include "G4MagIntegratorDriver.hh"

#include "G4UniformElectricField.hh" //#include "G4UniformMagField.hh"

#include "ExN03Field.hh"
#include "G4PropagatorInField.hh"

ExN03DetectorConstruction::ExN03DetectorConstruction ():out_box_log (0),// package_lid_log (0), package_cavity_log (0), radfet_die_log (0), substrate_log (0), die_attach_adhesive_log (0), die_attach_pad_log (0), package_base_log (0), out_box_phys (0),// package_lid_phys (0), package_cavity_phys (0), radfet_die_phys (0), substrate_phys (0), die_attach_adhesive_phys (0), die_attach_pad_phys (0), package_base_phys (0) {; }

ExN03DetectorConstruction::~ExN03DetectorConstruction () { }

G4VPhysicalVolume * ExN03DetectorConstruction::Construct () {

//---------------------------------------------------------- field

ExN03Field* myField = new ExN03Field; //G4UniformElectricField* myField //= new G4UniformElectricField(G4ThreeVector(0,90000*kilovolt/cm,0)); G4FieldManager *pFieldMgr; G4MagIntegratorStepper *pStepper; G4ChordFinder* pChordFinder; G4EqMagElectricField *fEquation = new G4EqMagElectricField(myField); G4MagInt_Driver* pIntgrDriver; G4TransportationManager* pTransportMgr =G4TransportationManager::GetTransportationManager(); G4PropagatorInField* pFieldPropagator; pFieldPropagator=pTransportMgr->GetPropagatorInField();

pStepper = new G4ClassicalRK4(fEquation,8); pFieldMgr=pTransportMgr->GetFieldManager(); pFieldMgr->SetFieldChangesEnergy(true); pFieldMgr->SetDetectorField(myField);

pIntgrDriver = new G4MagInt_Driver(0.001*mm,pStepper,pStepper-> GetNumberOfVariables()); //if(pChordFinder) delete pChordFinder; pChordFinder = new G4ChordFinder(pIntgrDriver); pFieldMgr->SetChordFinder(pChordFinder);

  //------------------------------------------------------ materials

  G4double a;			// atomic mass
  G4double z;			// atomic number
  G4double density, fractionmass;
  G4String symbol;
  G4int ncomponents, natoms;

  G4Element *Al = new G4Element ("Aluminum", symbol = "Al", z = 13., a =
				 26.98 * g / mole);
  G4Element *Si = new G4Element ("Silicon", symbol = "Si", z = 14, a =
				 28.09 * g / mole);
  G4Element *O = new G4Element ("Oxygen", symbol = "O", z = 8., a =
				16.00 * g / mole);

  G4Material *Vacuum =
    new G4Material ("Galactic", z = 1., a = 1.01 * g / mole, density =
		    universe_mean_density,
		    kStateGas, 3.e-18 * pascal, 2.73 * kelvin);
  G4Material *Ni =
    new G4Material ("Nickel", z = 28., a = 58.71 * g / mole, density =
		    8.9 * mg / cm3);

  G4Material *Co =
    new G4Material ("Cabalt", z = 27., a = 58.93 * g / mole, density =
		    8.9 * g / cm3);

  G4Material *Fe =
    new G4Material ("Iron", z = 26., a = 55.85 * g / mole, density =
		    7.86 * g / cm3);

  G4Material *Ag =
    new G4Material ("Silver", z = 47., a = 107.87 * g / mole, density =
		    10.5 * g / cm3);

  G4Material *SiO2 =
    new G4Material ("Quartz", 2.200 * g / cm3, ncomponents = 2);
  SiO2->AddElement (Si, natoms = 1);
  SiO2->AddElement (O, natoms = 2);

  G4Material *Al2O3 =
    new G4Material ("Alumina", 3.90 * g / cm3, ncomponents = 2);
  Al2O3->AddElement (Al, natoms = 2);
  Al2O3->AddElement (O, natoms = 3);

  G4Material *NiCoFe =
    new G4Material ("Kovar", 8.8 * g / cm3, ncomponents = 3);
  NiCoFe->AddMaterial (Ni, fractionmass = 0.29);
  NiCoFe->AddMaterial (Co, fractionmass = 0.18);
  NiCoFe->AddMaterial (Fe, fractionmass = 0.53);

  G4Material *AgSiO2 =
    new G4Material ("Adhesive", 6.1 * g / cm3, ncomponents = 2);
  AgSiO2->AddMaterial (Ag, fractionmass = 0.5);
  AgSiO2->AddMaterial (SiO2, fractionmass = 0.5);

  G4Material *SiMate = new G4Material ("SiliconMate", z = 14, a =
				       28.09 * g / mole, density =
				       2.33 * g / cm3);

  //------------------------------------------------------ volumes

  //------------------------------ out box (world volume)
  //------------------------------ beam line along z axis

  G4double out_box_x = 1.0 * mm;
  G4double out_box_y = 1.0 * mm;
  G4double out_box_z = 2.0 * mm;
  G4Box *out_box = new G4Box ("out_box", out_box_x, out_box_y, out_box_z);
  out_box_log = new G4LogicalVolume (out_box, Vacuum, "out_box_log", 0, 0, 0);
  out_box_phys = new G4PVPlacement (0, G4ThreeVector (),
				    out_box_log, "Out_box", 0, false, 0);

  //------------------------------ a package lid block

//  G4Box *package_lid_box =
  //  new G4Box ("package_lid_box", 0.5 * mm, 0.5 * mm, 0.125 * mm);
//  package_lid_log =
//    new G4LogicalVolume (package_lid_box, NiCoFe, "package_lid_log", 0, 0, 0);
//  package_lid_phys =
//    new G4PVPlacement (0, G4ThreeVector (0, 0, -1.8 * mm), package_lid_log,
//		       "Package_lid", out_box_log, false, 0);

  //------------------------------ a package cavity block

  G4Box *package_cavity_box =
    new G4Box ("package_cavity_box", 0.5 * mm, 0.5 * mm, 0.125 * mm);
  package_cavity_log =
    new G4LogicalVolume (package_cavity_box, Vacuum, "package_cavity_log", 0,
			 0, 0);
  package_cavity_phys =
    new G4PVPlacement (0, G4ThreeVector (0, 0, -1.55 * mm),
		       package_cavity_log, "Package_cavity", out_box_log,
		       false, 0);

  //------------------------------ a radfet die bblock

  G4Box *radfet_die_box =
    new G4Box ("radfet_die_box", 0.5 * mm, 0.5 * mm, 0.00075 * mm);
  radfet_die_log =
    new G4LogicalVolume (radfet_die_box, SiMate, "radfet_die_log", 0, 0, 0);
  radfet_die_phys =
    new G4PVPlacement (0, G4ThreeVector (0, 0, -1.42425 * mm), radfet_die_log,
		       "Radfet_die", out_box_log, false, 0);

  //------------------------------ a substrate block

  G4Box *substrate_box =
    new G4Box ("substrate_box", 0.5 * mm, 0.5 * mm, 0.25 * mm);
  substrate_log =
    new G4LogicalVolume (substrate_box, SiO2, "substrate_log", 0, 0, 0);
  substrate_phys =
    new G4PVPlacement (0, G4ThreeVector (0, 0, -1.1735 * mm), substrate_log,
		       "Substrate", out_box_log, false, 0);

  //------------------------------ a die attach adhesive block

  G4Box *die_attach_adhesive_box =
    new G4Box ("die_attach_adhesive_box", 0.5 * mm, 0.5 * mm, 0.125 * mm);
  die_attach_adhesive_log =
    new G4LogicalVolume (die_attach_adhesive_box, AgSiO2,
			 "die_attach_adhesive_log", 0, 0, 0);
  die_attach_adhesive_phys =
    new G4PVPlacement (0, G4ThreeVector (0, 0, -0.7985 * mm),
		       die_attach_adhesive_log, "Die_attach_adhesive",
		       out_box_log, false, 0);

  //------------------------------ a die attach pad block

  G4Box *die_attach_pad_box =
    new G4Box ("die_attach_pad_box", 0.5 * mm, 0.5 * mm, 0.001875 * mm);
  die_attach_pad_log =
    new G4LogicalVolume (die_attach_pad_box, SiO2, "die_attach_pad_log", 0, 0,
			 0);
  die_attach_pad_phys =
    new G4PVPlacement (0, G4ThreeVector (0, 0, -0.671625 * mm),
		       die_attach_pad_log, "Die_attach_pad", out_box_log,
		       false, 0);

  //------------------------------ a package base block

  G4Box *package_base_box =
    new G4Box ("package_base_box", 0.5 * mm, 0.5 * mm, 0.5 * mm);
  package_base_log =
    new G4LogicalVolume (package_base_box, Al2O3, "package_base_log", 0, 0,
			 0);
  package_base_phys =
    new G4PVPlacement (0, G4ThreeVector (0, 0, -0.16975 * mm),
		       package_base_log, "Package_base", out_box_log, false,
		       0);
  //------------------------------------------------------------------
  return out_box_phys;

}

******************Field header file**********************************

#ifndef ExN03Field_H
#define ExN03Field_H 1

#include "globals.hh"
#include "G4ElectricField.hh"

class ExN03Field : public G4ElectricField
{
  public:
    ExN03Field();
    ~ExN03Field();

    void GetFieldValue( const  double Point[3],
                               double *Bfield ) const;

  private:
    G4double Bz;
};

#endif

**********************Field source file**********************************

#include "ExN03Field.hh"

ExN03Field::ExN03Field()
{
  Bz = 3000*kilovolt/cm;
}

ExN03Field::~ExN03Field() {;}

void ExN03Field::GetFieldValue(const double Point[3],double *Bfield) const
{
  Bfield[0] = 0.;
  Bfield[2] = 0.;
  if(Point[2]>0.0 )
  { Bfield[1] = Bz; }
  else
  { Bfield[1] = 0.; }
}

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

 Add Message Add Message
to: "Re: Electric Field does not work..."

 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 ]