Problem 878 - G4VTouchable object in G4VNestedParameterisation is NULL most of the time
Summary: G4VTouchable object in G4VNestedParameterisation is NULL most of the time
Status: RESOLVED INVALID
Alias: None
Product: Geant4
Classification: Unclassified
Component: geometry/management (show other problems)
Version: 8.0
Hardware: PC Linux
: P2 minor
Assignee: asai
URL:
Depends on:
Blocks:
 
Reported: 2006-07-11 10:23 CEST by jonathan.a.rogers
Modified: 2006-07-18 07:14 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description jonathan.a.rogers 2006-07-11 10:23:11 CEST
Hello. I am not sure if this is a bug or not, but I am going to post my code here
because I cannot figure out what I am doing wrong. I am trying to build a voxel
human based on the new nested parameterisation feature. When I try access the
touchable object passed, it is 0 most of the time, which means I cannot access any
information about the ancestor's copy number to map the materials. Here is my code.

DetectorConstruction:

G4Box* parameterisationMother = new G4Box( "Parameterisation_Mother",
                                                ((cols*xDim)/2)*mm,
                                                ((rows*yDim)/2)*mm,
                                                ((slices*zDim)/2)*mm);

    G4LogicalVolume* parameterisationMotherLogicalvolume = new G4LogicalVolume(
parameterisationMother,      					      					air,
"Parameterisation_Mother (logical)",          							0, 0, 0);


    G4ThreeVector origin(0,0,0);
    parameterisationMotherPhysVolume =  new G4PVPlacement( 0,
                                                           origin,
                                          parameterisationMotherLogicalvolume,
                                          "Parameterisation_Mother_placement",
                                                           logicWorld,
                                                           false,
                                                           0 );

    G4Box* zVoxels = new G4Box( "zAxis",
                                        ((cols*xDim)/2)*mm,
                                        ((rows*yDim)/2)*mm,
                                        ((zDim)/2)*mm);

    G4LogicalVolume* zVoxelsLogical = new G4LogicalVolume( zVoxels,
     					      		   air,
                              				   "zAxis logical",
                              			           0,0,0);

    G4PVReplica* zAxisPlacement = new G4PVReplica("zAxis",
						  zVoxelsLogical,
				              parameterisationMotherPhysVolume,
						  kZAxis,
						  slices,
						  zDim,
						  0);

    G4Box* yVoxels = new G4Box( "yAxis",
                                        ((cols*xDim)/2)*mm,
                                        ((yDim)/2)*mm,
                                        ((zDim)/2)*mm);

    G4LogicalVolume* yVoxelsLogical = new G4LogicalVolume( yVoxels,
     					      		   air,
                              				   "yAxis logical",
                              			           0,0,0);

    G4PVReplica* yAxisPlacement = new G4PVReplica("yAxis",
						  yVoxelsLogical,
						  zAxisPlacement,
						  kYAxis,
						  rows,
						  yDim,
						  0);

    G4Box* voxelParameterisation = new G4Box( "Voxels", (xDim/2)*mm,
    							(yDim/2)*mm,
    							(zDim/2)*mm);



    voxelParameterisationLogicalvolume = new
G4LogicalVolume(voxelParameterisation,    							     phantom,
             "VoxelParameterisation_logical");

    G4int numberOfVoxels = voxels.getTotalNumberOfVoxels();

    G4VNestedParameterisation* paramVoxel = new
VoxelPhantomParameterisation(lunginhale, lungexhale,

adiposeTissue,breast,phantom,muscle,liver,denseBone,trabecularBone );

    voxelParameterisationPhysical = new G4PVParameterised( "Voxels (physical)",

voxelParameterisationLogicalvolume,
                            					yAxisPlacement,
                            					kXAxis,
                            					cols,
                            					paramVoxel );


Parameterisation:

G4Material* VoxelPhantomParameterisation::ComputeMaterial(G4VPhysicalVolume
*physVol,
					const G4int repNo,
                                        const G4VTouchable *parentTouch
                                        )
{

	  G4int x = 0;
	  G4int y = 0;
	  G4int z = 0;

	  if (parentTouch==0)
	  {
                return phantomTissue;
	  }
          else
          {
          z = parentTouch->GetCopyNumber(1);
          y = parentTouch->GetCopyNumber(0);
          x = repNo;

          // check the copyNumbers before mapping... (doesn't get here often
          // enough to make sense. G4VTouchable object null most of the time

          G4cout << x << y << z << G4endl;
          return phantomTissue;
}

Thanks for any help. And again, sorry if this is not a bug!

Jonathan
Comment 1 asai 2006-07-18 07:14:59 CEST
The user was contacted for additional bit of his code.
There was a prblem in his geometrical definition, i.e.
in his implementation of ComputeTransformation() method,
which caused volume overlapping.