1 from pathlib
import Path
4 from optparse
import OptionParser
11 parser.add_option(
"-q",
"--flavour",dest=
"jobFlavour",type=
"str",default=
"workday",help=
"job FLAVOUR",metavar=
"FLAVOUR")
13 parser.add_option(
"--filePU",dest=
"PU_file",type=str, default=
None,help=
"input PU file")
15 parser.add_option(
"--isotrackNtupler", dest=
"IsotrackNtupler", type=str, default=
None, help=
"location of isotrackNtupler")
20 parser.add_option(
"--fileNPU", dest=
"NoPU_file", type=str, default=
None,
21 help=
"input NoPU file")
23 parser.add_option(
"--output",
"-o", dest=
"output_dir", type=str,
24 help=
"location of output file directory without '/' ", )
26 opts, args = parser.parse_args()
28 jobDir = MYDIR +
'/condor_jobs_vF4' 29 Path(jobDir).
mkdir(parents=
True, exist_ok=
False)
32 PU_tree = uproot3.open(opts.PU_file)[
'hcalIsoTrkAnalyzer/CalibTree']
33 pu_entries = PU_tree.numentries
34 print(
"No of elements in pileup samples",pu_entries)
40 print(
"Creating jobs ------->")
41 for index
in range(0,pu_entries, scale):
44 if (pu_stop > pu_entries):
46 output_file = opts.output_dir +
"/IsoTrkNtupler" 47 arguments =
"%s -NPU %s -PU %s --start %i --end %i -O %s"%(opts.IsotrackNtupler, opts.NoPU_file, opts.PU_file, pu_start, pu_stop, output_file)
49 file_name =
"IsoTrkNtupler_" +
str(i)
50 job_file_name = os.path.join(jobDir, f
"{file_name}.sub")
51 job_file_out = os.path.join(jobDir, f
"{file_name}.out")
52 job_file_err = os.path.join(jobDir, f
"{file_name}.err")
54 with open(job_file_name,
"w")
as submit_file:
55 submit_file.write(f
"executable = /eos/user/d/dasgupsu/anaconda3/envs/dna/bin/python3.8\n")
56 submit_file.write(f
"arguments = {arguments}\n")
57 submit_file.write(f
"output = {job_file_out}\n")
58 submit_file.write(f
"error = {job_file_err}\n")
59 submit_file.write(
"getenv = True\n")
60 submit_file.write(f
'+JobFlavour = "{opts.jobFlavour}"\n')
61 submit_file.write(
"queue 1\n")
62 job_files.append(job_file_name)
66 if jobDir.startswith(
"/eos"):
67 subprocess.run([
"condor_submit",
"-spool", jf])
69 subprocess.run([
"condor_submit", jf])
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)