Message: Step size in Magnetic Tracking Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Step size in Magnetic Tracking 

Forum: Fields: Magnetic and Otherwise
Date: 03 Aug, 2004
From: Dvorak <Dvorak>

Hello,
    I'm trying to track an electron in an magnetic field.
    I use the following code in the DetectorConstrction class to set the magnetic field:



  G4UniformMagField* magField =
    new G4UniformMagField(G4ThreeVector(0.,1.*gauss,0.));

  G4FieldManager *pFieldMgr;
  G4MagIntegratorStepper *pStepper;

  G4EqMagElectricField *fEquation = new G4EqMagElectricField(magField);
  pStepper=new G4ClassicalRK4(fEquation);

  pFieldMgr=G4TransportationManager::GetTransportationManager()->GetFieldManager();
  pFieldMgr->SetDetectorField(magField);
  //  pFieldMgr->CreateChordFinder(magField);                                            

  G4MagInt_Driver*        fIntgrDriver;
  G4double fMinStep     = 0.010*mm;
  fIntgrDriver = new G4MagInt_Driver(fMinStep,
                                     pStepper,
                                     pStepper->GetNumberOfVariables() );
  G4ChordFinder *pChordFinder = new G4ChordFinder(fIntgrDriver);

  pFieldMgr->SetChordFinder(pChordFinder);



    AND the following code for an incoming electron in PrimaryGeneratorAction:



  G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
  G4String particleName;
  G4ParticleDefinition* particle
                    = particleTable->FindParticle(particleName="e-");
  particleGun->SetParticleDefinition(particle);
  particleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.5,0.));
  particleGun->SetParticleEnergy(5.*MeV);
  G4double position = 0; //-0.5*(ExN03Detector->GetWorldSizeX());                        
  particleGun->SetParticlePosition(G4ThreeVector(position,0.*cm,0.*cm));
  particleGun->GeneratePrimaryVertex(anEvent);

    I'm expecting a spiral track but I always get errors.
    When the fMinStep is small, I get:



G4MagIntegratorDriver::OneGoodStep: Stepsize underflow in Stepper 
  Step's start x=0.22 and end x= 0.22 are equal !! 
  Due to step-size= 5e-18 . Note that input step was 0.05
G4MagIntegratorDriver::OneGoodStep: Stepsize underflow in Stepper 
  Step's start x=0.23 and end x= 0.23 are equal !! 
  Due to step-size= 5e-18 . Note that input step was 0.05
...
...


    When the fMinStep is big(>10cm), or I use the FieldManager->CreateChordFinder instead 
of the manual ChordFinder, it tells me that the Track Was killed becasue it is loop or stucked.

    What's wrong with my program?
    Thanks.
                                            -Dvorak

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

 Add Message Add Message
to: "Step size in Magnetic Tracking"

 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 ]