Message: How to do nested loops in .mac file Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question How to do nested loops in .mac file 

Keywords: nested loops .mac
Forum: Run Management
Date: 28 Nov, 2007
From: Ethan Brown <ecbrown@physics.ucla.edu>

Hi,

I want to do a nested loop in a .mac file.  I can do a single loop with:
/control/loop position.mac zPosition 10 90 10

and in position.mac:
/gun/position 10 10 {zPosition} cm
...

Is there a way to do this to vary x, y, and z values?  
For example, I want to do the equivalent of:

for(xPosition=10;xPosition<100;xPosition+=10){
  for(yPosition=10;yPosition<100;yPosition+=10){
    for(zPosition=10;zPosition<100;zPosition+=10){
      /gun/position xPosition yPosition zPosition cm
      ...
}}}

Thanks

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

1 None: RE: How to do nested loops in .mac file   (Makoto Asai - 28 Nov, 2007)
 Add Message Add Message
to: "How to do nested loops in .mac file"

 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 ]