Message: Problem with local magnetic field Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Problem with local magnetic field 

Forum: Fields: Magnetic and Otherwise
Date: 15 Dec, 2011
From: Lukasz Fulek <Lukasz Fulek>

Hi! I'm new to this forum and GEANT4. I have big problem with my magnetic field. I definded such torus part and I want to attach a local magnetic field to it but it doesn't work. The beam is not in the center of this torus at the end. Below is a part of the code. Any suggestions

G4double dxlength = 3.700219;//m
  G4double dxangle = 0.0188608;//rad0.0188608
  G4double tiradius = 13.0; //cm

  G4double tsweptradius =dxlength/(2*dxangle); //m
  G4cout << "swept"<<tsweptradius << G4endl;
  G4double dxangledx = dxlength/tsweptradius;//rad
  G4RotationMatrix *rotm  = new G4RotationMatrix;
  rotm->rotateY(180*deg);//180
  rotm->rotateX(90*deg);//90
  ////////////////////////////////////////////////////////////////////////
  //Magnetic field torus 1
  G4double q = 1.6021765314e-19;
  G4double mp = 1.6726217129e-27;
  G4double convertj = 1.60217656525e-19;
  G4double energystart =100.;

  G4double magtor1val = std::sqrt(2*energystart*convertj*mp)/(tsweptradius*q);//tesla 1st  torus
  G4cout << "field:" << magtor1val << G4endl;

  G4double fieldValue = magtor1val*tesla;
     G4UniformMagField* myField =new G4UniformMagField(G4ThreeVector(0.,-fieldValue,0.));
     G4Mag_UsualEqRhs* myEquation = new G4Mag_UsualEqRhs(myField);
     G4MagIntegratorStepper* myStepper = new G4ClassicalRK4(myEquation);
     G4ChordFinder* myChordFinder = new G4ChordFinder(myField,1.0e-5 * mm,myStepper);
     G4FieldManager* fieldMgr = new G4FieldManager(myField,myChordFinder);

  ////////////////////////////////////////////////////////////////////////

  G4VSolid* dipoleDXSolid = new G4Torus("dipoleDX_Solid", 0*cm, tiradius*cm, tsweptradius*m,
                                       0.*radian, dxangledx*radian);
  G4LogicalVolume* dipoleDXLogical =
    new G4LogicalVolume(dipoleDXSolid, vacuum, "dipoleDX_Logical",fieldMgr,0,0);
  new G4PVPlacement(rotm, G4ThreeVector(tsweptradius*m,0.,phlengthz*m),
                    dipoleDXLogical, "dipoleDX_Physical",
                    fpWorldLogical, false, 0);

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

1 Feedback: Re: Problem with local magnetic field   (Gumplinger Peter - 15 Dec, 2011)
(_ None: Re: Problem with local magnetic field   (Lukasz Fulek - 15 Dec, 2011)
(_ Feedback: Re: Problem with local magnetic field   (Gumplinger Peter - 15 Dec, 2011)
(_ None: Re: Problem with local magnetic field   (Lukasz Fulek - 15 Dec, 2011)
 Add Message Add Message
to: "Problem with local magnetic field"

 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 ]