Message: Re: How to access to G4VSolid* in StackingAction()? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: How to access to G4VSolid* in StackingAction()? 

Forum: Event and Track Management
Re: None How to access to G4VSolid* in StackingAction()?
Re: None Re: How to access to G4VSolid* in StackingAction()?
Re: More Re: How to access to G4VSolid* in StackingAction()? (Gumplinger Peter)
Date: 23 Oct, 2007
From: <hyao@jlab.org>

Thank you for your response.

I tried your code but it always gave me segmentation fault. Maybe I didn't
make my question clear. The question is

I have already insert a Geo class into mirror vector before DetectorConstruction.
So (*MirrorObj)[0] has info 
example
mirror has name but no G4VSolid. 

Now I try to replace the null solid with the mirrorsolid created in DetectorConstruction. 
(*MirrorObj)[0]->SetGeoSolid() works in DetectorConstruction. 

But once I try to read it in StackingAction it gives me segmentation fault 
unless I reinitialize the (*mirror)[0] info in DetectorConstruction
example: 
In DetectorConstruction
Userman->Reinit( MirrorObj, mirrorsolid);

In UserManager.cc
Reinit(vector<Geo*>* oldMirror,G4VSolid* aSolid)
{
 (*fMirror)[0].SetGeoName((*oldMirror)[0]->GetGeoName());
 (*fMirror)[0].SetGeoSolid(aSolid);
}


Then everything is fine. 
I just learn C++ since I get in touch with Geant4. So in some case, I'm 
confused about the scope of variable. Could you explain more explicit?


Thank you very much.

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

 Add Message Add Message
to: "Re: How to access to G4VSolid* in StackingAction()?"

 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 ]