| Message: Re: multiple field maps | Not Logged In (login) |
|
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: | Outline Depth: | Add message: |
|
to: |