Skip to content
Snippets Groups Projects

Prep for sprucing productions

Merged Nicole Skidmore requested to merge preforSprucingprod into master
1 unresolved thread
Files
8
@@ -10,7 +10,7 @@
###############################################################################
from Moore import Options, run_moore
from RecoConf.global_tools import stateProvider_with_simplified_geom
from Hlt2Conf.lines import sprucing_lines, all_lines
from Hlt2Conf.lines import sprucing_lines
from Moore.lines import PassLine
from Hlt2Conf.lines.b_to_charmonia import sprucing_lines as spruce_b2cc_lines
@@ -21,27 +21,54 @@ from Hlt2Conf.lines.bnoc import sprucing_lines as spruce_bnoc_lines
from Hlt2Conf.lines.rd import sprucing_lines as spruce_rd_lines
from Hlt2Conf.lines.qee import sprucing_lines as spruce_qee_lines
from Hlt2Conf.lines.b_to_charmonia import all_lines as hlt2_b2cc_lines
from Hlt2Conf.lines.b_to_open_charm import all_lines as hlt2_b2oc_lines
from Hlt2Conf.lines.bandq import all_lines as hlt2_bandq_lines
from Hlt2Conf.lines.charm import all_lines as hlt2_charm_lines
from Hlt2Conf.lines.qee import all_lines as hlt2_qee_lines
from Hlt2Conf.lines.rd import all_lines as hlt2_rd_lines
from Hlt2Conf.lines.semileptonic import all_lines as hlt2_sl_lines
from Hlt2Conf.lines.bnoc import all_lines as hlt2_bnoc_lines
from Hlt2Conf.lines.charmonium_to_dimuon import all_lines as hlt2_charmonium_to_dimuon_lines
from Hlt2Conf.lines.DiMuonNoIP import all_lines as hlt2_DiMuonNoIP_lines
from Hlt2Conf.lines.pid import all_lines as turcal_pid_lines
from Hlt2Conf.lines.trackeff import all_lines as turcal_trackeff_lines
from Hlt2Conf.lines.monitoring import all_lines as turcal_monitoring_lines
from Moore.streams_hlt2 import DETECTOR_RAW_BANK_TYPES
#from Hlt2Conf.lines.pid import all_lines as hlt2_pid_lines
from Moore import streams_spruce
public_tools = [stateProvider_with_simplified_geom()]
#######################################################
##Should only need to change the following dictionaries.
# Note that wg_lines are themselves dict types here
fulllinedict = {
"b2oc": spruce_b2oc_lines,
"bandq": spruce_bandq_lines,
"b2cc": spruce_b2cc_lines,
"rd": spruce_rd_lines,
"sl": spruce_sl_lines,
"qee": spruce_qee_lines,
"bnoc": spruce_bnoc_lines,
}
turbolinedict = {
"b2oc": ["Hlt2B2OC.*Decision"],
"bandq": [
"Hlt2BandQ.*Decision", 'Hlt2_JpsiToMuMuDecision',
'Hlt2_Psi2SToMuMuDecision', 'Hlt2_DiMuonPsi2STightDecision',
'Hlt2_DiMuonJPsiTightDecision'
],
"b2cc": ["Hlt2B2CC.*Decision"],
"sl": ["Hlt2SLB.*Decision"],
"charm": ["Hlt2Charm.*Decision"],
"qee": ["Hlt2QEE.*Decision", "Hlt2.*DiMuonNoIP.*Decision"],
"rd": ["Hlt2RD.*Decision"],
"bnoc": ["Hlt2BnoC.*Decision"],
}
# For Turcal make 2 sets of line dict which will create 6 streams
# The first 3 streams will contain all events but no det rawbanks
# The second 3 streams will have a 10% prescale but have all det rawbanks
turcallinedict = {
"pid": ["Hlt2PID.*Decision"],
"trackeff": ["Hlt2TrackEff.*Decision", "Hlt2HadInt.*Decision"],
"monitoring": ["Hlt2Monitoring.*Decision"],
"pid_raw": ["Hlt2PID.*Decision"],
"trackeff_raw": ["Hlt2TrackEff.*Decision", "Hlt2HadInt.*Decision"],
"monitoring_raw": ["Hlt2Monitoring.*Decision"],
}
#######################################################
def lines_running(linedict):
""" Return the full list of lines to be run"""
@@ -59,36 +86,24 @@ def lines_not_running(all_lines, lines_to_run):
def excl_spruce_production(options: Options):
##Should only need to change the following dictionary.
# Note that wg_lines are themselves dict types
linedict = {
"b2oc": spruce_b2oc_lines,
"bandq": spruce_bandq_lines,
"b2cc": spruce_b2cc_lines,
"rd": spruce_rd_lines,
"sl": spruce_sl_lines,
"qee": spruce_qee_lines,
"bnoc": spruce_bnoc_lines,
}
streams_spruce.streams = list(linedict.keys())
streams_spruce.streams = list(fulllinedict.keys())
streams_spruce.stream_banks = {key: [] for key in streams_spruce.streams}
spruce_b2oc_lines.pop('SpruceB2OC_BdToDsmK_DsmToHHH_FEST')
lines_to_run = lines_running(linedict)
lines_to_run = lines_running(fulllinedict)
missing_lines = lines_not_running(sprucing_lines, lines_to_run)
def make_streams():
streamdict = {
wg: [builder() for builder in linedict[wg].values()]
for wg in linedict
wg: [builder() for builder in fulllinedict[wg].values()]
for wg in fulllinedict
}
return streamdict
print(f"Running {len(lines_to_run)} lines")
for wg in linedict.keys():
lines = list(linedict[wg].keys())
for wg in fulllinedict.keys():
lines = list(fulllinedict[wg].keys())
print(f"Stream {wg} will contain the lines: {lines} \n")
print(
@@ -101,51 +116,25 @@ def excl_spruce_production(options: Options):
def pass_spruce_production(options: Options):
##Should only need to change the following dictionary.
# Note that wg_lines are themselves dict types
linedict = {
"b2oc": hlt2_b2oc_lines,
"bandq": hlt2_bandq_lines,
"b2cc": hlt2_b2cc_lines,
"sl": hlt2_sl_lines,
"charm": hlt2_charm_lines,
"qee": hlt2_qee_lines,
"rd": hlt2_rd_lines,
"bnoc": hlt2_bnoc_lines,
"charmtodimuon": hlt2_charmonium_to_dimuon_lines,
"dimuonnoip": hlt2_DiMuonNoIP_lines
}
streams_spruce.streams = list(linedict.keys())
streams_spruce.streams = list(turbolinedict.keys())
streams_spruce.stream_banks = {key: [] for key in streams_spruce.streams}
lineregex = {
wg: [line + "Decision" for line in list(linedict[wg].keys())]
for wg in linedict
}
lines_to_run = lines_running(linedict)
missing_lines = lines_not_running(all_lines, lines_to_run)
def make_streams():
streamdict = {
wg: [PassLine(
wg:
[PassLine(
name="Pass" + wg,
hlt2_filter_code=lineregex[wg],
hlt2_filter_code=turbolinedict[wg],
)]
for wg in linedict
for wg in turbolinedict
}
return streamdict
for wg in linedict.keys():
lines = lineregex[wg]
print(f"Stream {wg} will contain the lines: {lines} \n")
print(
f"The following lines exist but are not appended to any stream : {missing_lines} \n end of missing lines."
)
for wg in turbolinedict.keys():
print(
f"Stream {wg} will contain the lines matching the regex : {turbolinedict[wg]} \n"
)
config = run_moore(options, make_streams, public_tools=[])
return config
@@ -153,71 +142,45 @@ def pass_spruce_production(options: Options):
def turcal_spruce_production(options: Options):
##Should only need to change the following dictionary.
# Note that wg_lines are themselves dict types
# Make 2 sets of line dict which will create 6 streams
# The first 3 streams will contain all events but no det rawbanks
# The second 3 streams will have a 10% prescale but have all det rawbanks
linedict = {
"pid": turcal_pid_lines,
"trackeff": turcal_trackeff_lines,
"monitoring": turcal_monitoring_lines,
"pid_rb": turcal_pid_lines,
"trackeff_rb": turcal_trackeff_lines,
"monitoring_rb": turcal_monitoring_lines,
}
streams_spruce.streams = list(linedict.keys())
streams_spruce.streams = list(turcallinedict.keys())
streams_spruce.stream_banks = {
key: []
for key in streams_spruce.streams if "rb" not in key
for key in streams_spruce.streams if "raw" not in key
}
# For 10% of events we want to keep detector rawbanks (see the prescale)
streams_spruce.stream_banks.update({
key: DETECTOR_RAW_BANK_TYPES
for key in streams_spruce.streams if "rb" in key
for key in streams_spruce.streams if "raw" in key
})
print("streams_spruce.stream_banks ", streams_spruce.stream_banks)
lineregex = {
wg: [line + "Decision" for line in list(linedict[wg].keys())]
for wg in linedict
}
##Find a way to implement
#lines_to_run = lines_running(linedict)
#missing_lines = lines_not_running(all_lines, lines_to_run)
print("Banks for each stream : ", streams_spruce.stream_banks)
def make_streams():
streamdict = {
wg: [PassLine(
name="Pass" + wg,
hlt2_filter_code=lineregex[wg],
)]
for wg in linedict if "rb" not in wg
wg: [
PassLine(
name="Pass" + wg,
hlt2_filter_code=turcallinedict[wg],
)
]
for wg in turcallinedict if "raw" not in wg
}
streamdict.update({
wg: [
PassLine(
name="Pass" + wg,
hlt2_filter_code=lineregex[wg],
hlt2_filter_code=turcallinedict[wg],
prescale=0.1)
]
for wg in linedict if "rb" in wg
for wg in turcallinedict if "raw" in wg
})
return streamdict
for wg in linedict.keys():
lines = lineregex[wg]
print(f"Stream {wg} will contain the lines: {lines} \n")
#print(
# f"The following lines exist but are not appended to any stream : {missing_lines} \n end of missing lines."
#)
for wg in turcallinedict.keys():
print(
f"Stream {wg} will contain the lines matching the regex : {turcallinedict[wg]} \n"
)
config = run_moore(options, make_streams, public_tools=[])
return config
Loading