Message: Re: Parametrisation: Transformation and Dimension ok, Material does not get computes Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

More Re: Parametrisation: Transformation and Dimension ok, Material does not get computes 

Forum: Geometry
Re: Question Parametrisation: Transformation and Dimension ok, Material does not get computes (Andreas Best)
Date: 09 Feb, 2012
From: Gabriele Cosmo <Gabriele Cosmo>

The correct signature of the method you need to implement is:

    G4Material* ComputeMaterial (const G4int copyNo, G4VPhysicalVolume* physVol,
                                 const G4VTouchable *parentTouch=0);

Cheers, Gabriele
 
-----------------
On Thu, 09 Feb 2012 01:04:40 GMT, Andreas Best wrote:
> Hi,
> 
> I am trying to create a cone containing slices of different materials.
> The positioning inside the mother volume and the variation of the outer
> radii of the cone slices works fine but the material it contains never
> gets changed. From what I've read so far I understand that the
> parameterised geometry gets computed only when a track enters it, so I
> made sure that I shoot something through the center of my cone. But
> ComputeMaterial() never gets called.
> 
> Nonetheless, the only material that exists inside is always the material
> I assigned to the logical volume that gets passed to the
> G4PVParameterised constructor.
> 
> Do I need to implement additional methods or explicitly call something
> somewhere else?
> 
> Following is an excerpt of the parametrisation.
> 
> Thanks, Andreas
> 
> void Cons_Parametrisation::ComputeTransformation(const G4int copyNo, G4VPhysicalVolume* physVol) const
> {
>         G4double z = -total_length + (2*copyNo + 1) * total_length/float(n_divisions);
> 
>         physVol->SetTranslation(G4ThreeVector(0, 0, z));
> }
> 
> void Cons_Parametrisation::ComputeDimensions(G4Cons& Cons_Parametrisation, const G4int copyNo, 
>                 const G4VPhysicalVolume* physVol) const
> {
>         G4double Rmax1 = outer_radius_minus;
>         Rmax1 += copyNo * (outer_radius_plus - outer_radius_minus)/float(n_divisions);
> 
>         G4double Rmax2 = outer_radius_minus;
>         Rmax2 += (copyNo +1) * (outer_radius_plus - outer_radius_minus)/float(n_divisions);
> 
>         Cons_Parametrisation.SetInnerRadiusMinusZ(0);
>         Cons_Parametrisation.SetOuterRadiusMinusZ(Rmax1);
>         Cons_Parametrisation.SetInnerRadiusPlusZ(0);
>         Cons_Parametrisation.SetOuterRadiusPlusZ(Rmax2);
>         Cons_Parametrisation.SetZHalfLength(total_length/float(n_divisions));
>         Cons_Parametrisation.SetStartPhiAngle(0);
>         Cons_Parametrisation.SetDeltaPhiAngle(2*pi);
> }
> 
> G4Material* Cons_Parametrisation::ComputeMaterial(G4VPhysicalVolume* physVol, const G4int copyNo,
>                 const G4VTouchable *parentTouch=0)
> {
>         physVol->GetLogicalVolume()->SetSensitiveDetector(sdet);
>         return matvec.at(copyNo);
> }

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

1 None: Re: Parametrisation: Transformation and Dimension ok, Material does not get computes   (Andreas Best - 09 Feb, 2012)
 Add Message Add Message
to: "Re: Parametrisation: Transformation and Dimension ok, Material does not get computes"

 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 ]