Message: Parameterized volumes copy number? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Parameterized volumes copy number? 

Forum: Geometry
Date: 21 Jun, 2012
From: Justin Clinton <Justin Clinton>

I have a (possibly) simple question regarding parameterized volumes- does each corresponding physical volume of a single parameterization have a unique copy number?

An example: G4VPVParameterisation is used to modify and place several volumes, each with a different material, in a single mother.

During a simulation, I need to know which of these volumes a particular particle was created in. The code I use to do this is:

void TrackingAction::PostUserTrackingAction(const G4Track* aTrack)
{
  G4String tname = aTrack->GetDefinition()->GetParticleName();

	G4int pvcno =0;
	G4int stepno = 0;

    if (tname == "Au198[0.0]"){

		stepno = aTrack->GetCurrentStepNumber();

		if (stepno == 1){

			pvcno = aTrack->GetVolume()->GetCopyNo();
			KineticEnergy = aTrack->GetVertexKineticEnergy();
			G4ThreeVector vertexpos = aTrack->GetVertexPosition();

			G4double vx = vertexpos[0];
			G4double vy = vertexpos[1];
			G4double vz = vertexpos[2];

			Run->GetTuple("gold")->fill(0,pvcno);
			Run->GetTuple("gold")->fill(1,KineticEnergy/MeV);
			Run->GetTuple("gold")->fill(2,vx/cm);
			Run->GetTuple("gold")->fill(3,vy/cm);
			Run->GetTuple("gold")->fill(4,vz/cm);
			Run->GetTuple("gold")->addRow();   
		}
    }  ......   

When I run a simple test with three parameterized volume, only one of which is capable of producing the particle, the returned physical copy number varies from 0 - 2 instead of remaining constant. Here is a sample output:

        Gold Ion created in Foil with copy number 0
        Gold Ion created in Foil with copy number 0
        Gold Ion created in Foil with copy number 1
        Gold Ion created in Foil with copy number 2
        Gold Ion created in Foil with copy number 0
        Gold Ion created in Foil with copy number 0
        Gold Ion created in Foil with copy number 1
        Gold Ion created in Foil with copy number 2
        Gold Ion created in Foil with copy number 1
        Gold Ion created in Foil with copy number 0
        Gold Ion created in Foil with copy number 2
        Gold Ion created in Foil with copy number 2

The ASCIITree output clearly shows that there is only one volume "Foil"

#  Now printing with verbosity 12
#  Format is: PV:n / LV (SD,RO) / Solid(type)
#  Abbreviations: PV = Physical Volume,     LV = Logical Volume,
#                 SD = Sensitive Detector,  RO = Read Out Geometry.
  "World":0 / "World" / "world"(G4Box)
    "Spectrometer":0 / "Spectrometer" / "Spectrometer"(G4Tubs)
      "Moderator":0 / "ModFoil" / "ModFoil"(G4Tubs)
      "Foil":1 / "ModFoil" / "ModFoil"(G4Tubs)
      "Moderator":2 / "ModFoil" / "ModFoil"(G4Tubs)

Why does the physical volume copy number keep changing? Is the physical volume copy the same as the parameterized volume copy?

Thanks in advance,

Justin

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

1 Idea: Re: Parameterized volumes copy number?   (Justin Dingley - 23 Jun, 2012)
 Add Message Add Message
to: "Parameterized volumes copy number?"

 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 ]