Message: Mistake in DoseDeposit-scorer with G4PhantomParameterisation Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Mistake in DoseDeposit-scorer with G4PhantomParameterisation 

Keywords: G4PhantomParameterisation G4PSDoseDeposit
Forum: Hits, Digitization and Pileup
Date: 27 Feb, 2008
From: Sylvia Studeny <sylvia.studeny@helmholtz-muenchen.de>

Hello,
To test how the new G4PhantomParameterisation is working
I want to calculate a neutron depth dose in a waterphantom. 
I have done this in a waterbox and a "normaly" parametriesed
detector before and the depth dose curve from this seems
to be good.
I defined the G4PhantomParameterisation the way it is given in the manual:
 G4PhantomParameterisation* wpParam = new G4PhantomParameterisation();
  wpParam-> SetVoxelDimensions(voxelSize.x()/2.,voxelSize.y()/2.,voxelSize.z()/2.);
  wpParam-> SetNoVoxel(xNo,yNo,zNo);

  std::vector <G4Material*> theMaterials;
  for(G4int i=0;i<1;i++){theMaterials.push_back(H2O);};
  wpParam->SetMaterials( theMaterials );

  size_t* mateIDs = new size_t[xNo*yNo*zNo];
   G4int Zahler =0;
   for(G4int i=0;i<zNo;i++){
      for(G4int j=0;j<yNo;j++){
        for(G4int k=0;k<xNo;k++){
    	  mateIDs[Zahler] = 0;
    	  Zahler++;
    }}}
  wpParam->SetMaterialIndices( mateIDs );

  G4ThreeVector positionPhantom(0.,0.,0.); 
  solidPhantom = new G4Box("phantom",fphantomSize.x()/2.,fphantomSize.y()/2.,
  		 fphantomSize.z()/2.);
  logicPhantom = new G4LogicalVolume(solidPhantom, Air, "phantom", 0, 0, 0);  
  physiPhantom = new G4PVPlacement(0,positionPhantom,logicPhantom,
  		"phantom",logicWorld, false,0); 
//here also with copynumber=1

  wpParam->BuildContainerSolid(physiPhantom);
  wpParam->SetSkipEqualMaterials(1);

  solidVoxel = new G4Box("voxel",voxelSize.x()/2.,voxelSize.y()/2.,voxelSize.z()/2.);
  logicVoxel = new G4LogicalVolume(solidVoxel, H2O, "voxel", 0,0,0); 
  patient_phys = new G4PVParameterised("Voxel",logicVoxel,
 		 logicPhantom, kYAxis, xNo*yNo*zNo, wpParam);

  patient_phys->SetRegularStructureId(1);

I then set a DoseDeposit-scorer to the logicVoxel:

 G4MultiFunctionalDetector* MFDet = new G4MultiFunctionalDetector(phantomSDname);
  SDman->AddNewDetector( MFDet );                
  logicVoxel->SetSensitiveDetector(MFDet);  

G4PSDoseDeposit* scorer0 = new G4PSDoseDeposit(psName="totalDose"); MFDet->RegisterPrimitive(scorer0);

In RunAction I want to readout the dose and print it in an ascii-file:
void RE02RunAction::EndOfRunAction(const G4Run* aRun)
{
RE02Run* re02Run = (RE02Run*)aRun;
G4THitsMap<G4double>* totalDose;
totalDose = re02Run->GetHitsMap("PhantomSD/totalDose");
...
  xNo = detector->GetxNo(); //number of voxels in x-direction
  yNo = detector->GetyNo();
  zNo = detector->GetzNo();
  xyNo = xNo*yNo;
...
ofstream wpDose;
  wpDose.open("wpDoseMatrix.dat");
  ...
 for(G4int nz=0;nz<zNo;nz++){ 
  for(G4int nx=0;nx<xNo;nx++){
   for(G4int ny=0;ny<yNo;ny++){
    copyNo= nz*xyNo + ny*xNo + nx; 
//I copied this from the G4PhantomParameterisation-class!
 wpDose << copyNo << " "<< nx << " "<< ny << " "<< nz;
     Dose = (*totalDose)[copyNo];
if(Dose){
     dose = *Dose/NoOfEvents;
     wpDose << "   " << dose/gray << " " ;
}else{ 
	   wpDose <<"  " << 0.000 << "  " ;
	}
Dose=0;
...

But when I plot this with gnuplot:
reset
set title 'Dosis ueber xy'
set logscale z
set xlabel 'x'
set ylabel 'y'
splot 'wpDoseMatrix.dat' u 2:3:(($4) == 0 ? $5 : 1/0) pt 1 ti 'z = 0'\
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 1 ? $5 : 1/0) pt 2 ti 'z = 1' \
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 2 ? $5 : 1/0) pt 3 ti 'z = 2' \
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 3 ? $5 : 1/0) pt 4 ti 'z = 2' \
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 4 ? $5 : 1/0) pt 5 ti 'z = 4' \
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 5 ? $5 : 1/0) pt 6 ti 'z = 5' \
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 6 ? $5 : 1/0) pt 7 ti 'z = 6' \
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 7 ? $5 : 1/0) pt 8 ti 'z = 7' \
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 8 ? $5 : 1/0) pt 9 ti 'z = 8' \
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 9 ? $5 : 1/0) pt 10 ti 'z = 9' \
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 10 ? $5 : 1/0) pt 11 ti 'z = 10' \
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 11 ? $5 : 1/0) pt 12 ti 'z = 11' \

I see that there is only dose at the borders of the water qube, not in the middle. When I look at the visualisation, I do see tracks there and I tested the material definition (all voxels are set to water).

What did I do wrong? I have also tested	G4PSDoseDeposit3D (though
 I rather think this was desinged for Nestedparameterisation),
with no change.

How can I use a scorer with the G4PhantomParameterisation??? (maybe you can but this in the DICOM example, because many people will be interested in dose in this case)

Thanks a lot for your help Sylvia

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

1 None: RE: Mistake in DoseDeposit-scorer with G4PhantomParameterisation   (Makoto Asai - 27 Feb, 2008)
2 None: Re: Mistake in DoseDeposit-scorer with G4PhantomParameterisation   (Makoto Asai - 28 Feb, 2008)
1 None: Re: Mistake in DoseDeposit-scorer with G4PhantomParameterisation   (Sylvia Studeny - 28 Feb, 2008)
3 None: Re: Mistake in DoseDeposit-scorer with G4PhantomParameterisation   (Sylvia Studeny - 28 Feb, 2008)
 Add Message Add Message
to: "Mistake in DoseDeposit-scorer with G4PhantomParameterisation"

 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 ]