yozhao
1
Dear experts,
Does anyone know how to construct a gaussian-like shaped detector geometry?
The length or thickness of the detector and the radius of the detector follow a gaussian function:
L = Gaus (R, mean = 0, sigma)
as shown in the figure:

Thanks very much in advance!
Best,
Yongke
loydms
2
You can probably approximate a gaussian using a connical geometery
https://geant4-userdoc.web.cern.ch/UsersGuides/ForApplicationDeveloper/html/Detector/Geometry/geomSolids.html
Otherwise, you can convert a CAD model into a tessellated surface and import into a G4TessellatedSolid
Hi,
An alternative to CAD or Tessellated solid is the Polycon
, ie
auto R0 = 1*cm;
auto zmax = 1*cm;
auto sigma=0.1*cm;
std::vector<G4double> zPlane = {0.05*zmax, 0.1*zmax, 0.2*zmax, 0.5*zmax, 0.9*zmax};
auto numZPlanes = zPlane.size();
std::vector<G4double> rInner( numZPlanes, 0.0 );
// function that calculates the outer radius as gausian.
// Takes by reference R0 and sigma
auto fgaus = [&](double x){return sigma*std::sqrt(-2*std::log(x/R0)); };
std::vector<G4double> rOuter = { fgaus(zPlane[0]), fgaus(zPlane[1]), fgaus(zPlane[2]), fgaus(zPlane[3]), fgaus(zPlane[4]) };
G4Polycone* targetSolid = new G4Polycone("solid-Target", // name
0.0, // G4double phiStart,
2*pi, // G4double phiTotal,
numZPlanes, // G4int numZPlanes,
zPlane.data(), // const G4double zPlane[],
rInner.data(), // const G4double rInner[],
rOuter.data() // const G4double rOuter[])
);
Which results in:

I hope it works 
Best,
Alvaro
yozhao
4
Dear Alvaro,
That sounds quite a good idea. Thanks very much!
Best,
Yongke
yozhao
5
Dear loydms,
Thanks very much for your advice!
Best,
Yongke
imelnyk
6
Hi @atolosad, would you be kind enough to hint me how to set such beautiful visual style? I mean those little white dots
I’m a newbie in Geant4
1 Like
allison
7
This is the “cloud” drawing style:
/vis/viewer/set/style cloud
You can set for individual volumes with vis attributes or with /vis/touchable
commands, or if you use the Qt GUI, by clicking on the scene tree.
Have a look at available commands with ls
or help
or look at Built-in Commands — Book For Application Developers 11.2 documentation. Most commands. have extensive guidance.
1 Like