Message: Re: multiple field maps Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Warning Re: multiple field maps 

Keywords: multiple field maps magnetic field
Forum: Fields: Magnetic and Otherwise
Re: Question multiple field maps (Kazutaka Nakahara)
Date: 30 Apr, 2007
From: Gumplinger Peter <Gumplinger Peter>

Hi Kaz,

I am sorry that nobody replied to your posting until now. I am not the most expert on this subject, but I do know that:

G4TransportationManager::GetTransportationManager()->GetFieldManager();

returns a pointer to a G4FieldManager:

G4TransportationManager::G4TransportationManager(){ . . fFieldManager = new G4FieldManager(); . .}

G4FieldManager* G4TransportationManager::GetFieldManager() const
{
   return fFieldManager;
}

So, the G4 kernel only ever has one such G4FieldManager. If you request
it:
      pFieldMgr=G4TransportationManager::GetTransportationManager()->GetFieldManager();
      pFieldMgr1=G4TransportationManager::GetTransportationManager()->GetFieldManager();
      pFieldMgr2=G4TransportationManager::GetTransportationManager()->GetFieldManager();

you get the same pointer every time. And yes, subsequent calls to:

      pFieldMgr->SetDetectorField(MuonMagField);
      pFieldMgr->SetDetectorField(MuonMagField1);
      pFieldMgr->SetDetectorField(MuonMagField2);

simply replace the previous; i.e. the G4FieldManager doesn't keep a list of G4Fields. It only has one pointer:

G4Field* fDetectorField;

Maybe, if there is need we should extend this to allow the G4FieldManager to keep a list of fields and each subsequent call to SetDetectorField will add automatically to the list.

For now, as I said and unless I am completely wrong with my C++, user code should never have multiple lines:

G4TransportationManager::GetTransportationManager()->GetFieldManager();

in the same method.

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

1 None: Re: multiple field maps   (Tom Roberts - 01 May, 2007)
(_ None: Re: multiple field maps   (maurizio - 01 Aug, 2007)
 Add Message Add Message
to: "Re: multiple field maps"

 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 ]