Message: How turn on the magnetic field Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question How turn on the magnetic field 

Forum: Fields: Magnetic and Otherwise
Date: 20 Nov, 2009
From: Paul <Paul>

Hi Users,
Two weeks I try to add magnetic field to my simulation. I used to N03 and in this case it was verry simple. I wrote line /N03/det/setField 3 tesla in file.mac and gave control/execute file.mac in Idle> and it worked. Next I tried to do this same method in TestEm3. When I wrote /testem/det/setField 5 tesla in file.mac and started in Idle> I got the command: COMMAND NOT FOUND.
On the other hand iI tried to modify the codes in DetectorConstruction.cc file.
void DetectorConstruction::SetMagField(G4double fieldValue)
{
  //apply a global uniform magnetic field along Z axis
  //

fieldValue = 3. * tesla;
  G4FieldManager* fieldMgr
   = G4TransportationManager::GetTransportationManager()->GetFieldManager();

  if(magField) delete magField;		//delete the existing magn field

  if(fieldValue!=0.)			// create a new one if non nul
  { 
	  magField = new G4UniformMagField(G4ThreeVector(0.,fieldValue,0.));
    fieldMgr->SetDetectorField(magField);
    fieldMgr->CreateChordFinder(magField);
  } else {
    magField = 0;
    fieldMgr->SetDetectorField(magField);
  }
}

But the results from simulations without magnetic field are this same like 3 tesla and 20 tesla. Maybe I should to switch on magnetic filed but I don't know how. Why command from .mac file is don't working. Help me please Pawel

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

1 None: Re: How turn on the magnetic field   (michel maire - 20 Nov, 2009)
 Add Message Add Message
to: "How turn on the 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 ]