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

None RE: How to do nested loops in .mac file 

Forum: Run Management
Re: Question How to do nested loops in .mac file (Ethan Brown)
Date: 28 Nov, 2007
From: Makoto Asai <Makoto Asai>

Sorry for your inconvenience but the following is the only 
way available.

Idle> /control/loop p1.mac xPosition 10 90 10

in p1.mac

/control/loop p2.mac yPosition 10 90 10

in p2.mac

/control/loop p3.mac zPosiiotn 10 90 10

and finally in p3.mac

/gun/position {xPosition} {yPosition} {zPosition} cm
...


 

> -----Original Message-----
> From: Ethan Brown [mailto:ecbrown@physics.ucla.edu] 
> Sent: Wednesday, November 28, 2007 2:34 PM
> To: publichypernews
> Subject: How to do nested loops in .mac file
> 
> *** Discussion title: Run Management
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/runmanage/215"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> 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)

 Add Message Add Message
to: "RE: 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 ]