Skip to content
Snippets Groups Projects

Draft: [QEE] ew_projects_Run3 : Centrally processed W31.34 MC (again)

Open Luke Grazette requested to merge lugrazet-ew-24MC into master
1 unresolved thread
3 files
+ 623
0
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 128
0
from PyConf.reading import (get_particles, get_pvs, get_rec_summary,
get_mc_particles)
from RecoConf.event_filters import require_pvs
from DaVinci import make_config, Options
from DaVinci.algorithms import create_lines_filter
from FunTuple import FunTuple_Particles as Funtuple
from FunTuple import FunTuple_MCParticles as MCFuntuple
from FunTuple import FunTuple_Event as EventFuntuple
from FunTuple import FunctorCollection
import FunTuple.functorcollections as FC
import Functors as F
from .ftuple_helpers import (
decaytree_variables, mcdecaytree_selection_to_variables, extra_event_info,
selection_to_decay_descriptor, mcdtt_selections_to_decay_descriptor, Spec,
rec_summary_variables, selection_dependent_filtering, trkeff_probes,
decaytreefitter_variables)
hlt1_tistos_lines = ["Hlt1SingleHighPtMuon", "Hlt1SingleHighPtMuonNoMuID"]
hlt2_tistos_lines = [
"Hlt2QEE_SingleHighPtMuonFull", "Hlt2QEE_SingleHighPtMuonNoMuIDFull",
"Hlt2QEE_ZToMuMuFull", "Hlt2QEE_ZToMuMu_SingleNoMuIDFull"
]
def hlt2_decision_lines(trkeff_methods):
return hlt2_tistos_lines + [
f"Hlt2TrackEff_ZToMuMu_{trkeff_method}_{probe}_{decision_type}"
for trkeff_method in trkeff_methods for probe in trkeff_probes
for decision_type in ["Tag", "Match"]
]
def make_DTT(selection, line, pvs, spec):
dec_desc = selection_to_decay_descriptor(
trkeff_methods=spec.trkeff_methods)[selection]
data = selection_dependent_filtering(
data=get_particles(f"/Event/{spec.dataLocProcess}/{line}/Particles"),
selection=selection)
variables = decaytree_variables(
selection=selection, pvs=pvs, data=data, spec=spec)
evtinfo = FC.EventInfo()
evtinfo += extra_event_info(spec=spec)
evtinfo += FC.SelectionInfo(
selection_type="Hlt1", trigger_lines=hlt1_tistos_lines)
evtinfo += rec_summary_variables(rec_summary=get_rec_summary())
evtinfo += FC.SelectionInfo(
selection_type="Hlt2",
trigger_lines=hlt2_decision_lines(spec.trkeff_methods))
variables["ALL"] += FC.HltTisTos(
selection_type="Hlt1",
trigger_lines=[f"{line}Decision" for line in hlt1_tistos_lines],
data=data)
if spec.isFull:
variables["ALL"] += FC.HltTisTos(
selection_type="Hlt2",
trigger_lines=[f"{line}Decision" for line in hlt2_tistos_lines],
data=data)
if spec.isTurCal:
dtf_variables = decaytreefitter_variables(
selection=selection, pvs=pvs, data=data)
for k in dtf_variables.keys():
variables[k] = variables.get(k, FunctorCollection(
{})) + dtf_variables[k]
funtuple = Funtuple(
name=selection,
tuple_name="DecayTree",
fields=dec_desc,
variables=variables,
inputs=data,
store_multiple_cand_info=True,
event_variables=evtinfo)
return funtuple
def make_MCDTT(selection, spec):
dec_desc = mcdtt_selections_to_decay_descriptor[selection]
mc_particles = get_mc_particles("/Event/MC/Particles")
variables = mcdecaytree_selection_to_variables[selection]
variables["ALL"] = FunctorCollection({"ID": F.PARTICLE_ID})
evtinfo = extra_event_info(spec=spec)
return MCFuntuple(
name=f"{selection}_mcdtt",
tuple_name="DecayTree",
fields=dec_desc,
variables=variables,
event_variables=evtinfo,
inputs=mc_particles,
)
def make_ET(spec):
return EventFuntuple(
name="EventTuple",
tuple_name="EventTuple",
variables=extra_event_info(spec=spec))
def main(options: Options, stream: str, campaign: str, polarity: str,
sample: str):
spec = Spec(stream, campaign, polarity, sample)
algs = {}
for selection, line in spec.selection_line_map.items():
line_prefilter = create_lines_filter(
name=f"PreFilter_{line}", lines=[line])
pvs = get_pvs()
algs[selection] = [
line_prefilter,
require_pvs(pvs),
make_DTT(selection=selection, line=line, pvs=pvs, spec=spec)
]
if spec.isMC: algs["EventTuple"] = [make_ET(spec=spec)]
if spec.isMC and spec.isFull:
for mcdtt_selection in mcdtt_selections_to_decay_descriptor.keys():
algs[f"{mcdtt_selection}_MCDecayTree"] = [
make_MCDTT(selection=mcdtt_selection, spec=spec)
]
return make_config(options, algs)
Loading