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

Comparing UserCode/VHbb/python/submitThem.py (file contents):
Revision 1.34 by nmohr, Thu Feb 28 16:59:09 2013 UTC vs.
Revision 1.35 by bortigno, Thu Mar 21 14:18:17 2013 UTC

# Line 41 | Line 41 | en = opts.tag
41  
42   #create the list with the samples to run over
43   samplesList=opts.samples.split(",")
44
44   timestamp = time.asctime().replace(' ','_').replace(':','-')
45  
46 < configs = ['%sconfig/general'%(en),'%sconfig/paths'%(en),'%sconfig/plots'%(en),'%sconfig/training'%(en),'%sconfig/datacards'%(en),'%sconfig/cuts'%(en)]
48 <
46 > # the list of the config is taken from the path config
47   pathconfig = BetterConfigParser()
48   pathconfig.read('%sconfig/paths'%(en))
49 + _configs = pathconfig.get('Configuration','List').split(" ")
50 + configs = [ '%sconfig/'%(en) + c for c in _configs  ]
51  
52   if not opts.ftag == '':
53      tagDir = pathconfig.get('Directories','tagDir')
# Line 83 | Line 83 | print configs
83   config = BetterConfigParser()
84   config.read(configs)
85  
86 < btagLibrary = config.get('BTagReshaping','library')
87 < submitDir = os.getcwd()
88 < os.chdir(os.path.dirname(btagLibrary))
89 < if not os.path.exists(btagLibrary):
90 <    ROOT.gROOT.LoadMacro('%s+'%btagLibrary.replace('_h.so','.h'))
91 < shutil.copyfile(os.path.basename(btagLibrary),'/scratch/%s/%s'%(getpass.getuser(),os.path.basename(btagLibrary)))
92 < shutil.copyfile('/scratch/%s/%s'%(getpass.getuser(),os.path.basename(btagLibrary)),btagLibrary)
93 < os.chdir(submitDir)
86 >
87 > def compile_macro(config,macro):
88 >    """
89 >    Creates the library from a macro using CINT compiling it in scratch to avoid
90 >    problems with the linking in the working nodes.
91 >    Args:
92 >        config: configuration file where the macro path is specified
93 >        macro: macro name to be compiled
94 >    Returns:
95 >        nothing
96 >    """
97 >    submitDir = os.getcwd()
98 >    _macro=macro+'.h'
99 >    library = config.get(macro,'library')
100 >    libDir=os.path.dirname(library)
101 >    os.chdir(libDir)
102 >    if not os.path.exists(library):
103 >        print '@INFO: Compiling ' + _macro
104 >        scratchDir='/scratch/%s/'%(getpass.getuser())
105 >        shutil.copyfile(libDir+'/'+_macro,'/scratch/%s/%s'%(getpass.getuser(),_macro))
106 >        os.chdir(scratchDir)
107 >        ROOT.gROOT.ProcessLine('.L %s+'%(scratchDir+_macro))
108 >        shutil.copyfile('/scratch/%s/%s'%(getpass.getuser(),os.path.basename(library)),library)
109 >    os.chdir(submitDir)
110 >        
111 > compile_macro(config,'BTagReshaping')
112 > compile_macro(config,'VHbbNameSpace')
113 >
114   logPath = config.get("Directories","logpath")
115   logo = open('%s/data/submit.txt' %config.get('Directories','vhbbpath')).readlines()
116   counter = 0
117  
118   #check if the logPath exist. If not exit
119   if( not os.path.isdir(logPath) ):
120 <    print 'ERROR: ' + logPath + ': dir not found.'
121 <    print 'ERROR: Create it before submitting '
120 >    print '@ERROR : ' + logPath + ': dir not found.'
121 >    print '@ERROR : Create it before submitting '
122      print 'Exit'
123      sys.exit(-1)
124      

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines