4 DIR =
"/nova/app/users/essmith/devsrepo/essmith/miniprod5_validation/events/lists/lists" 5 OUTFILE =
"Miniprod5ValidationCuts.cxx" 8 const Cut kIs_Prod4%(prod4_sel)s_Prod5%(prod5_sel)s_%(horn)s([](const caf::SRProxy * sr) 10 const std::unordered_set<std::size_t> hashes 15 return hashes.find(Hash(&sr->spill)) != hashes.end(); 22 for horn_current
in (
"fhc",
"rhc"):
23 sels = (
"unselected",
"presel",
"CVNeLow",
"CVNeHigh")
24 for prod4_sel
in sels:
25 for prod5_sel
in sels:
26 f = os.path.join(DIR,
"ND_%(horn)s_p4%(prod4_sel)s_p5%(prod5_sel)s.txt" % {
"horn": horn_current,
"prod4_sel": prod4_sel,
"prod5_sel" : prod5_sel})
27 if not os.path.isfile(f):
32 with
open(f)
as infile:
34 numbers = (l.lstrip(
"0")
if l != len(l) *
"0" else "0" for l
in line.split())
35 hash_text +=
" Hash(std::vector<std::size_t>{%s}),\n" % (
", ".join(numbers))
37 subst = {
"prod4_sel": prod4_sel,
"prod5_sel": prod5_sel,
"horn": horn_current.upper(),
"hash_list": hash_text}
38 for sel
in (
"prod4_sel",
"prod5_sel"):
39 subst[sel] = subst[sel].replace(
"elected",
"el")
40 subst[sel] = subst[sel][:1].upper() + subst[sel][1:]
41 cut_text += CUT_TEMPLATE % subst
44 with
open(OUTFILE,
'r') as infile: 45 text = [line for line
in infile]
46 with
open(OUTFILE,
'w')
as outfile:
49 if not replacing
and "AUTOFILL BELOW" in line:
51 elif replacing
and "END AUTOFILL" in line:
53 outfile.write(cut_text)
procfile open("FD_BRL_v0.txt")