Message: segmentation fault converting from one physical volume to nested parameterisation Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question segmentation fault converting from one physical volume to nested parameterisation 

Forum: Geometry
Date: 31 Mar, 2011
From: David Oxley <David Oxley>

Dear all,

I am pretty sure this is just a mistake I am making, but I am having difficulty converting from one large physical volume into many small voxels in a nested parameterisation. Any help with this problem would be much appreciated.

I am basing my code on the example examples/extended/runAndEvent/RE02 but the example is using scorers and, if possible, I would like to continue using a sensitive detector.

I slowly incorporated the different replica levels and was always assigning the lowest one in the hierarchy to the sensitive detector, but when I introduce the NestedParameterisation I get a segmentation fault after the beginning of the first event. So BeginOfEventAction gets called, but EndOfEventAction does not, but I can't track down the problem. I have put print statements into my at various places and the same for SteppingActions and I see them all printed.

I am defining my NestedParameterisation like this (as I say, I am trying to debug and am keeping it as close to the example as possible)

  // Use parameterisation for the Z axis -------
  // Z Slice
  G4String zVoxName("phantomSens");
  G4VSolid* solVoxel = new G4Box(zVoxName,sensSize.x()/2.,sensSize.y()/2.,sensSize.z()/2.);
  G4LogicalVolume* logicPhantomSens = new G4LogicalVolume(solVoxel,realBrain,zVoxName);

  std::vector<G4Material*> realBrainVec(1,realBrain);
  NestedPhantomParameterisation *nestedParam = new NestedPhantomParameterisation(sensSize/2.,nzCells,realBrainVec);  
   // (1) vector size 
   // (2) number of cells along axis 
   // (3) material .... material must be given as vector 

    G4VPhysicalVolume * physiPhantomSens =
    new G4PVParameterised("PhantomSens",     // their name
                          logicPhantomSens,  // their logical volume
                          logXRep,           // Mother logical volume
                          kUndefined,        // Are placed along this axis 
                          nzCells,            // Number of cells
                          nestedParam);     // Parameterisation.

Then I understood that lowest hierarchial volume...which is now logicPhantomSens, needs to be made sensitive. So like this..

// Make sensitive -------
  G4SDManager* SDman  = G4SDManager::GetSDMpointer();
  G4Region* aRegion = new G4Region("testlog");
  logicPhantomSens -> SetRegion(aRegion);
  aRegion -> AddRootLogicalVolume(logicPhantomSens);

	  G4String SmartPET1 = "ExN01/SmartPET1";
	  aSenDet1 = new ExN01TrackerSD(SmartPET1,"SmartPET1");

I have actually commented everything out in my EndOfEventAction function to just try and get it to run (unsuccessfully) so there seems little point in posting that.

In the physicsList I refer back to the region as follows...

  G4String regionName = "testlog";
  G4Region* region = G4RegionStore::GetInstance()->GetRegion(regionName);
  G4ProductionCuts* cuts = new G4ProductionCuts ;
  G4double regionCut = 10*um;

I think there must be something I am not seeing, unless the NestedParameterisation has to be used with a scorer. Could somebody confirm that it can be used with a sensitive detector ?

Thanks in advance for any advice as I seem to be a bit stuck here.

(I am guessing I will need to share more code. I am happy to do so, but I thought it may be easier to do that directly, rather than posting an entire tar file to the forum).

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

1 Ok: Re: segmentation fault converting from one physical volume to nested parameterisation   (David Oxley - 01 Apr, 2011)
 Add Message Add Message
to: "segmentation fault converting from one physical volume to nested parameterisation"

 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 ]