ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/RateMonShiftTool_dev/mkTMDfits.py
(Generate patch)

Comparing UserCode/RateMonShiftTool_dev/mkTMDfits.py (file contents):
Revision 1.1 by grchrist, Tue Apr 3 12:38:40 2012 UTC vs.
Revision 1.2 by grchrist, Tue Apr 10 10:02:32 2012 UTC

# Line 9 | Line 9 | def usage():
9      print sys.argv[0]+" [options]"
10      print "This script makes a pkl file from TMD rate predictions\nto be used in the RatePredictor script for new menu deployment"
11      print "--TriggerList=<path>"
12 +    print "--NColBunch=<# colliding bunches>"
13  
14   def main():
15      print "making TMD pkl fit files"
# Line 18 | Line 19 | def main():
19      fit_file="fits_TMD.pkl"
20  
21   #######################################
22 <    
22 >
23 >    ncolbunch=28
24 >    ntotbunch=1331
25 >    bunfrac=float(ncolbunch)/float(ntotbunch)
26 >
27 > #######################################
28      try:
29 <        opt, args = getopt.getopt(sys.argv[1:],"",["TriggerList="])
29 >        opt, args = getopt.getopt(sys.argv[1:],"",["NColBunch=","TriggerList="])
30              
31      except getopt.GetoptError, err:
32          print str(err)
# Line 30 | Line 36 | def main():
36      trig_list=[]
37      fit_list={}
38      for o,a in opt:
39 <        if o == "--TriggerList":
39 >        if o == "--NColBunch":
40 >            ncolbunch=int(a)
41 >            ntotbunch=1331
42 >            bunfrac=float(ncolbunch)/float(ntotbunch)
43 >        elif o == "--TriggerList":
44              try:
45                  f = open(a)
46                  for line in f:
# Line 40 | Line 50 | def main():
50                      if len(line)<3 or line=='\n':
51                          continue
52                      line = ((line.rstrip('\n')).rstrip(' '))
53 <                    if line.find(':')==-1: # exclude list, no rate estimates
53 >                    if line.find(':')==-1:
54                          list.append( line )
55 +                    
56                      else:
57                          split = line.split(':')
58                          ##trig_list.append([split[0],split[1],split[2],split[3]])
59                          trig_list.append(split[0])
60 <                        fit_list[split[0]]=[float(split[1]),float(split[2]),float(split[3])]
60 >                        fit_list[split[0]]=[float(split[1])*bunfrac,float(split[2])*bunfrac,float(split[3])*bunfrac]
61                          
62  
63                      

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines