diff --git a/macros/macros_stats/LaunchTRExFitterOnBatch.py b/macros/macros_stats/LaunchTRExFitterOnBatch.py index dbf1cf51dbded43652fa76df0ecfa5ce38689833..4d77a8d02d8f5f60be6d2873fcc650e2dff148f5 100644 --- a/macros/macros_stats/LaunchTRExFitterOnBatch.py +++ b/macros/macros_stats/LaunchTRExFitterOnBatch.py @@ -2,6 +2,7 @@ import os import glob import sys +import socket sys.path.append( os.getenv("ROOTCOREBIN") + "/python/IFAETopFramework/" ) from BatchTools import * @@ -64,6 +65,7 @@ def writeScriptsAndLaunchJobs( scriptTempName, configFile, instructions, LaunchJ counter = 0 script.write("./myFit.exe h configFile.txt >& logFileRunning_h \n") for inst in instructions: + script.write("echo \"==> Now executing the instruction: " + inst + "\"\n") script.write("./myFit.exe " + inst.replace("_CONFIGFILE_","configFile.txt") + " >& logFileRunning_" + `counter` + " \n") counter += 1 @@ -101,8 +103,13 @@ def writeScriptsAndLaunchJobs( scriptTempName, configFile, instructions, LaunchJ script.close() if LaunchJobs: - print "You're lucky !!!" - os.system("qsub -q " + m_batch_queue + " " + scriptName + " -o " + m_outputDir + "/" + tRexFitterOutDirectory + "/ -e " + m_outputDir + "/" + tRexFitterOutDirectory + "/") + if socket.gethostname().find("cca")>-1: + #You are working at CCIN2P3 ... you must be Loic !! + os.system("mkdir -p " + m_outputDir + "/" + tRexFitterOutDirectory) + os.system("qsub -l sps=1 -P P_atlas -o " + m_outputDir + "/" + tRexFitterOutDirectory + "/ -e " + m_outputDir + "/" + tRexFitterOutDirectory + "/ " + scriptName) + else: + os.system("mkdir " + m_outputDir + "/" + tRexFitterOutDirectory) + os.system("qsub -q " + m_batch_queue + " " + scriptName + " -o " + m_outputDir + "/" + tRexFitterOutDirectory + "/ -e " + m_outputDir + "/" + tRexFitterOutDirectory + "/") ##------------------------------------------------------ ## Checking the arguments @@ -193,15 +200,17 @@ for config in configFileList: if len(commands)==m_rankingNPMerging: writeScriptsAndLaunchJobs( m_outputDir + "/scripts_RANKING"+`iJob`, config, commands ) commands = [] - writeScriptsAndLaunchJobs( m_outputDir + "/scripts_RANKING_ttbbNorm", config, ["wfr _CONFIGFILE_ 'Ranking=ttbbNorm'",] ) + writeScriptsAndLaunchJobs( m_outputDir + "/scripts_RANKING_ttbbNorm", config, ["wfr _CONFIGFILE_ 'Ranking=HTX_BKGNORM_TTBARBB'",] ) else: com = "w" if m_action.find("FIT")>-1: com += "f" if m_action.find("POSTPLOTS")>-1: com += "p" - if m_action.find("LIMIT")>-1: com += "ls" - if m_action.find("PREPLOTS")>-1: com += "d" + if m_action.find("LIMIT")>-1: + com += "ls" + if m_action.find("PREPLOTS")>-1: + com += "d" writeScriptsAndLaunchJobs( m_outputDir + "/scripts_", config, [com + " _CONFIGFILE_",], m_mergeJobs==False ) if m_mergeJobs: diff --git a/macros/macros_stats/launch_all_jobs.py b/macros/macros_stats/launch_all_jobs.py new file mode 100644 index 0000000000000000000000000000000000000000..412b956e91cf97b05198ae8d0452966ff17f2c07 --- /dev/null +++ b/macros/macros_stats/launch_all_jobs.py @@ -0,0 +1,115 @@ +#!/bin/python +import optparse +import os + +parser = optparse.OptionParser() +parser.add_option('-i', '--input_files_folder', default="") +parser.add_option('-I', '--input_config_file', default="/sps/atlas/l/lvalery/VLQ/AnalysisCode/VLQAnalysis/macros/macros_stats/templates/TEMPLATE_configFile__SIGNAL_.txt") +parser.add_option('-o', '--output_folder', default="") +parser.add_option('-f', '--fits', default="BONLY_Asimov1lep,BONLY_Asimov0lep,BONLY_Asimov0lep1lep,BONLY_BlindData1lep,BONLY_BlindData0lep,BONLY_BlindData0lep1lep") +parser.add_option('-l', '--limits', default="BONLY_Asimov1lep,BONLY_Asimov0lep,BONLY_Asimov0lep1lep") +parser.add_option('-t', '--tarball', default="/sps/atlas/l/lvalery/VLQ/TtHFitter.tgz") +(opts, args) = parser.parse_args() +input_files_folder = opts.input_files_folder +input_CF = opts.input_config_file +output_folder = opts.output_folder +fits = opts.fits.split(",") +limits = opts.limits.split(",") +tarball = opts.tarball + +for fit in fits: + print fit + com = "python PrepareConfigFilesFromTemplate.py inputTemplate=" + input_CF + com += " outputFolder=" + output_folder + "/ConfigFiles_" + fit + "/" + com += " inputDir=" + input_files_folder + com += " addition=\"" + fit + "\"" + + com += " FITBLIND=" + if(fit.upper().find("ASIMOV")>-1): + com += "TRUE" + else: + com += "FALSE" + + com += " LIMITBLIND=" + if(fit.upper().find("ASIMOV")>-1): + com += "TRUE" + else: + com += "FALSE" + + com += " signal=ONE" + + com += " FITTYPE=" + if(fit.upper().find("BONLY")>-1): + com += "BONLY" + else: + com += "SPLUSB" + + com += " NORMFACTOR=" + if(fit.upper().find("RANKING")>-1): + com += "1,-20,20" + else: + com += "1,0,100" + + com += " USEDATA=" + if(fit.upper().find("DATA")>-1): + com += "TRUE" + else: + com += "FALSE" + + com += " DOONELEP=" + if(fit.upper().find("1LEP")>-1): + com += "TRUE" + else: + com += "FALSE" + + com += " DOZEROLEP=" + if(fit.upper().find("0LEP")>-1): + com += "TRUE" + else: + com += "FALSE" + + com += " DOVR=" + if(fit.upper().find("DATA")>-1): + com += "TRUE" + else: + com += "FALSE" + + com += " useBlindingCuts=" + if(fit.upper().find("BLIND")>-1): + com += "TRUE" + else: + com += "FALSE" + com += " USE4TOPS=TRUE LUMIVALUE=36074.6" + os.system(com) + + com = "python LaunchTRExFitterOnBatch.py tarball=" + tarball + com += " outputDir=" + output_folder + "/Results_" + fit + "/" + if(fit.upper().find("RANKING")>-1): + com += " action=ranking" + else: + com += " action=fitpreplotspostplots" + if( fit in limits ): + com += "limits" + + if(fit.upper().find("BLIND")>-1 and fit.upper().find("DATA")>-1): + com += " queue=at3_xxl" + + com += " inputDir=" + output_folder + "/ConfigFiles_" + fit + "/configFile_" + ref_com = com + final_coms = [] + if(fit.upper().find("RANKING")==-1): + temp_com = ref_com + if(fit.upper().find("0LEP")>-1): + temp_com += "VLQ_TT" + if(fit.upper().find("BLIND")>-1 and fit.upper().find("DATA")>-1): + temp_com += "*1000_TDoublet*" + final_coms += [temp_com] + else: + for sig in ["VLQ_TT_1000_TDoublet*","UEDRPP_1400*"]: + temp_com = ref_com + temp_com += sig + final_coms += [temp_com] + + for command in final_coms: + os.system(com) + os.system("sleep 10")