ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/Development/DistributedModelCalculations/ShapeLimits/Utilities/DoFullLimits.py
Revision: 1.2
Committed: Fri Apr 27 13:44:39 2012 UTC (13 years ago) by buchmann
Content type: text/x-python
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
State: FILE REMOVED
Log Message:
removed file we no longer need

File Contents

# User Rev Content
1 buchmann 1.1 #!/usr/bin/python
2    
3     # System libraries to interact with the shell
4     import sys
5     import os
6     from os import popen
7     import commands
8     import time
9     #from datetime import date
10    
11     crab_jobs=[]
12    
13     def produce_jobs(jobinfo):
14     print "Going to produce job based on "+str(jobinfo)
15     jobinformation=jobinfo.split(";")
16     PointName=jobinformation[0]
17     Minimum=jobinformation[1]
18     Maximum=jobinformation[2]
19    
20     superstring= "ShapePreparationDirectory__"+str(time.strftime('%Y_%M_%d__%H_%m_%S'))
21     print superstring
22     print "Next steps: Create a directory (random!) copy histos & datacard there, run makeGridUsingCrab, and delete the directory"
23    
24     print "Going to take action for "+str(PointName)
25    
26    
27     command=" dirname="+superstring+" && mkdir -p $dirname && cd $dirname && cp ../../models/model_"+PointName+"_histo.root limitfile.root && cp ../../models/model_"+PointName+".txt susydatacard.txt && python ../makeGridUsingCrab.py susydatacard.txt "+str(Minimum)+" "+str(Maximum)+" -n 100 -o "+str(PointName)+"FullComputation"
28    
29     commands.getoutput(command)
30     # print command
31     f = open(superstring+"/"+PointName+"FullComputation.cfg", 'a')
32     f.write("ui_working_dir=../CrabJobs/"+PointName+"FullComputation");
33     f.close()
34     commands.getoutput("rm -rf CrabJobs/"+PointName+"FullComputation")
35     pipe=popen("mkdir -p CrabJobs && cd "+superstring+" && crab -create -cfg "+PointName+"FullComputation.cfg")
36     for l in pipe.readlines():
37     if l == " ": continue
38     print " crab job creation: -->" +str(l)+"<--"
39     print "Done with CRAB"
40     crab_jobs.append("Crab_Jobs/"+PointName+"FullComputation")
41     commands.getoutput("rm "+superstring+"/combine && rm -rf "+superstring)
42    
43    
44     if len(sys.argv) < 2:
45     print "You need to provide the fused file ... otherwise I can't do much :-)"
46     sys.exit(-1)
47     print sys.argv[1]
48     print "Going to compute the points for which a second computation is necessary"
49     commands.getoutput("make && ./ReadLimitsAndPrepareJobs.exec "+str(sys.argv[1]))
50     print "Going to read them back"
51     f = open('JobStrings.txt')
52     lines = f.readlines()
53     f.close()
54    
55     counter=0
56     for line in lines:
57     print str(counter)+" "+line
58     produce_jobs(line)
59     counter = counter + 1
60    
61     for job in crab_jobs:
62     print "Crab Job: "+str(job)
63