| Summary: | G4VTouchable object in G4VNestedParameterisation is NULL most of the time | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | jonathan.a.rogers |
| Component: | geometry/management | Assignee: | asai |
| Status: | RESOLVED INVALID | ||
| Severity: | minor | ||
| Priority: | P2 | ||
| Version: | 8.0 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
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. |
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