Message: Field setup has changed - how to fix? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Field setup has changed - how to fix? 

Forum: Fields: Magnetic and Otherwise
Date: 07 Aug, 2018
From: Tom Roberts <Tom Roberts>

This is geant4.10.04.p02, and I am trying to build code that is at least a decade old, but which works in geant4.10.03. The error is in initializing tracking for combined E&B fields, including the accuracy parameters and optionally spin tracking. I pasted the code below. This was triggered by the class G4MagInt_Driver being undefined in geant4.10.04.p02.

How should code set the following tracking parameters: DeltaChord, DeltaOneStep, DeltaIntersection, MinimumEpslion, MaximumEpsilon? How should the code setup to include spin tracking (polarized muons and their decay)? Also: WHEN should it set them?

(This is Mac OS X El Capitan (10.11.6) using the default compilers. But I will need to build on Windows and Linux as well.)

-------- Old code that works in geant4.10.3. This is from the constructor of BLGlobalField, which inherits G4ElectroMagneticField and defines the E and B fields throughout space and time. Note: the global object Param returns values of parameters set by the user (which have appropriate default values).

        // Get transportation, field, and propagator  managers
        G4TransportationManager  *pTransportMgr=
               G4TransportationManager::GetTransportationManager();
        G4FieldManager* fieldMgr = pTransportMgr->GetFieldManager();
        G4PropagatorInField *pFieldPropagator =
                                        pTransportMgr->GetPropagatorInField();

        // Need to SetFieldChangesEnergy to account for electric fields
        fieldMgr->SetFieldChangesEnergy(true);

        fieldMgr->SetDetectorField(this);

        // Construct equation of motion of particles through e.m. fields
        G4MagIntegratorStepper *pStepper = 0;
        if(spinTracking) {
                spinEqRhs = new G4EqEMFieldWithSpin(this);
                G4EquationOfMotion *equation = spinEqRhs;
                pStepper = new G4ClassicalRK4(equation,12);
        } else {
                spinEqRhs = 0;
                G4EquationOfMotion *equation = new G4EqMagElectricField(this);
                pStepper = new G4ClassicalRK4(equation,8);
        }
        G4double min_step = Param.getDouble("minStep");
        G4MagInt_Driver *fIntgrDriver = new G4MagInt_Driver(min_step,
                                pStepper, pStepper->GetNumberOfVariables() );
        G4ChordFinder *pChordFinder = new G4ChordFinder(fIntgrDriver);
        fieldMgr->SetChordFinder(pChordFinder);

        // Set accuracy parameters
        G4double delta_chord = Param.getDouble("deltaChord");
        pChordFinder->SetDeltaChord(delta_chord);
        G4double delta_onestep = Param.getDouble("deltaOneStep");
        fieldMgr->SetAccuraciesWithDeltaOneStep(delta_onestep);
        G4double delta_intersection = Param.getDouble("deltaIntersection");
        fieldMgr->SetDeltaIntersection(delta_intersection);
        G4double eps_min = Param.getDouble("epsMin");
        G4double eps_max = Param.getDouble("epsMax");
        pFieldPropagator->SetMinimumEpsilonStep(eps_min);
        pFieldPropagator->SetMaximumEpsilonStep(eps_max);

Note that if I replace the entire block "// Construct eq..." with this:
        G4ChordFinder *pChordFinder = fieldMgr->GetChordFinder();
it crashes with pChordFinder=0.

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

1 None: Re: Field setup has changed - how to fix? - FIXED   (Tom Roberts - 08 Aug, 2018)
 Add Message Add Message
to: "Field setup has changed - how to fix?"

 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 ]