zoglauer / megalib

MEGAlib - the Medium-Energy Gamma-ray Astronomy library
http://megalibtoolkit.com
Other
41 stars 32 forks source link

define a double in a geomega file #81

Open grferna opened 1 year ago

grferna commented 1 year ago

Dear Andreas,

Working with a geomega setup file I need to define a float variable that change his value inside a loop.

I don't know how to do it, and I cannot find information about this. Is it possible to define a float variable?

Gonzalo.

zoglauer commented 1 year ago

Hi Gonzalo,Can you write some pseudocode/example of what you want to do?Thanks,AndreasOn Jun 6, 2023, at 03:37, grferna @.***> wrote: Dear Andreas, Working with a geomega setup file I need to define a float variable that change his value inside a loop. I don't know how to do it, and I cannot find information about this. Is it possible to define a float variable? Gonzalo.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

grferna commented 1 year ago

Sure, for example.

for(int i=0;i<N;i++) { float a = i*4 + 10;

}

How can I defines "a" in the geomega setup file?

zoglauer commented 1 year ago

No you cannot do something like that. Simply because I haven't encountered a case where you would need that for building a geometry.

Here is an example to work around this:

Volume Pixel Pixel.Material CZT Pixel.Shape BOX 0.45 0.45 0.45 Pixel.Color 2

Constant N 10

For I N 0 1 Pixel.Copy Pixel%I Pixel%I.Position { $I*4 + 10 } 0.0 0.0 Pixel_%I.Mother WorldVolume Done

If you have an example, where you need to define a float, then please provide it.