targetinfo.py
Go to the documentation of this file.
1 #Helper script to get the target info locations from the output of
2 #DUNECDR_TestTargetPos.mac...needs modification for different opt beam.
3 
4 geomlist=[]
5 with open('/Users/bashyala/Documents/targetlocation.txt') as f:
6  for line in f:
7  geomlist.append(line)
8 myitem = " Placing target segments... At Z"
9 notmyitem = "*Face"
10 volumes=[]
11 
12 #this is for materials
13 
14 
15 for i in range(0,len(geomlist)):
16  if myitem in geomlist[i]:
17  volinterest = geomlist[i]
18 
19  #print '{} in line {}'.format(volinterest,i)
20  pstart = volinterest.index('=')#This for volume
21  #pend = volinterest.index('>')
22  #print '{} and {} are the start and endpoints'.format(pstart,pend)
23  myvol = volinterest[pstart+2:len(volinterest)-1]# This for volume
24  volumes.append(myvol)
25 
26 print volumes, len(volumes)
int open(const char *, int)
Opens a file descriptor.