Question about G4GenericMessenger in B5

Hello,in B5,MagneticField.hh,there is

public:
    MagneticField();
    ~MagneticField() override;

    void GetFieldValue(const G4double point[4],double* bField ) const override;

    void SetField(G4double val) { fBy = val; }
    G4double GetField() const { return fBy; }

  private:
    void DefineCommands();

    G4GenericMessenger* fMessenger = nullptr;
    G4double fBy = 1.0*CLHEP::tesla;

So if I print fBy use

G4cout<<"MagneticFieldValue"<<MagneticField::GetField()<<G4endl;

after set the filed value ,it should be,like,20Tesla .
But in fact ,it only showed the default value,i.e. 1Tesla .
Please help me the question!!

1 Like