Message: Re: Parameterised random size Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

More Re: Parameterised random size 

Forum: Geometry
Re: None Parameterised random size
Date: 02 Dec, 2016
From: Gabriele Cosmo <Gabriele Cosmo>

You cannot use parameterisations for random positioning/dimensioning of
the volumes, as the setup must be reproducible at any time during the event.
For your case, you can use placements instead, changing the geometry after
each event, eventually switching geometry optimisation off for that portion of
the geometry.

---------------------
On Thu, 24 Nov 2016 14:00:54 GMT, Synthex wrote:
> Hello;
> 
> I am designing a detector made of spheres of random radius, placed
> randomly (non overleaping). This looks like a glass filled with marbles
> of different sizes, or the bubbles in hair gel container. In order to
> save computation time, I switched from G4Placement to G4PVParamaterised,
> rewriting the B2b example (I need more than 50 spheres).
> 
> In the chamber parameterisation, I first tried to get a random placement
> by this way:
> 
> void B2bChamberParameterisation::ComputeTransformation
> (const G4int copyNo, G4VPhysicalVolume* physVol) const
> {
> for(d=0;d<copyNo;d++){
> CLHEP::HepRandom::setTheEngine(new CLHEP::DRand48Engine);
>      G4int Seed = time(NULL);
>         long seeds[2];
>         seeds[0]=(long) Seed; 
>         seeds[1]=(long) (Seed * G4UniformRand());
> CLHEP::HepRandom::getTheEngine()->setSeeds(seeds, -1);
>   // Note: copyNo will start with zero!
> G4double Zposition = G4UniformRand()*20*copyNo;
>   G4ThreeVector origin(0,0,Zposition);
>   physVol->SetTranslation(origin);
>   physVol->SetRotation(0);
> }}
> 
> A random number is generated at initialization, and is kept. I want this
> number to change at EACH volume placement.
> 
> Same applies to the Dimension Computation (setting the spheres radius)
> 
> void B2bChamberParameterisation::ComputeDimensions
> (G4Orb& trackerChamber, const G4int copyNo, const G4VPhysicalVolume*) const
> {
> CLHEP::HepRandom::setTheEngine(new CLHEP::DRand48Engine);
>      G4int Seed = time(NULL);
>         long seeds[2];
>         seeds[0]=(long) Seed; 
>         seeds[1]=(long) (Seed * G4UniformRand());
> CLHEP::HepRandom::getTheEngine()->setSeeds(seeds, -1);
> 
> G4double rmax = G4UniformRand()*1*cm;
>  trackerChamber.SetRadius(rmax);
> }
> 
> Thank you very much.
> 

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

1 None: Re: Parameterised random size   (Synthex - 02 Dec, 2016)
(_ More: Re: Parameterised random size   (Gabriele Cosmo - 02 Dec, 2016)
 Add Message Add Message
to: "Re: Parameterised random size"

 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 ]