Commit 3134c5cf authored by Ross John Hunter's avatar Ross John Hunter 🌴 Committed by Christoph Hasse
Browse files

TOS efficiencies in HLT2 for HltEfficiencyChecker

parent dfe25537
###############################################################################
# (c) Copyright 2019-2020 CERN for the benefit of the LHCb Collaboration #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
from Moore import options
from HltEfficiencyChecker.config import run_moore_with_tuples
from RecoConf.reconstruction_objects import reconstruction
from RecoConf.protoparticles import make_charged_protoparticles
from Hlt2Conf.lines.Bs2JpsiPhi import all_lines
decay = ("[${B_s0}B_s0 => "
"${Jpsi}( J/psi(1S) => ${muplus}mu+ ${muminus}mu- ) "
"${phi}( phi(1020) => ${Kplus}K+ ${Kminus}K- )]CC")
options.input_files = [
# HLT1-filtered
# Bs2JpsiPhi, 13144011
# sim+std://MC/Upgrade/Beam7000GeV-Upgrade-MagDown-Nu7.6-25ns-Pythia8/Sim09c-Up02/Reco-Up01/Trig0x52000000/13144011/LDST
"root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/LDST/00076706/0000/00076706_00000001_1.ldst",
"root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/LDST/00076706/0000/00076706_00000002_1.ldst",
"root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/LDST/00076706/0000/00076706_00000003_1.ldst",
"root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/LDST/00076706/0000/00076706_00000004_1.ldst",
"root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/LDST/00076706/0000/00076706_00000005_1.ldst",
"root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/LDST/00076706/0000/00076706_00000006_1.ldst",
"root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/LDST/00076706/0000/00076706_00000007_1.ldst",
"root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/LDST/00076706/0000/00076706_00000064_1.ldst",
"root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/MC/Upgrade/LDST/00076706/0000/00076706_00000068_1.ldst",
]
def make_lines():
return [builder() for builder in all_lines.values()]
options.lines_maker = make_lines
options.input_type = 'ROOT'
options.input_raw_format = 4.3
options.evt_max = 20
options.simulation = True
options.data_type = 'Upgrade'
options.dddb_tag = 'dddb-20171126'
options.conddb_tag = 'sim-20171127-vc-md100'
options.ntuple_file = "eff_ntuple.root"
# needed to run over FTv2 data
from RecoConf.hlt1_tracking import default_ft_decoding_version
default_ft_decoding_version.global_bind(value=2)
from RecoConf.global_tools import stateProvider_with_simplified_geom
with reconstruction.bind(from_file=False), make_charged_protoparticles.bind(
enable_muon_id=True):
run_moore_with_tuples(
options,
False,
decay,
public_tools=[stateProvider_with_simplified_geom()])
......@@ -18,7 +18,7 @@ from Moore.config import (moore_control_flow, setup_ann_service,
from PyConf.Algorithms import MCDecayTreeTuple, EventTuple
from Configurables import (TupleToolTrigger, TupleToolEventInfo,
MCTupleToolKinematic, MCTupleToolReconstructed,
MCTupleToolTOS)
MCTupleToolTOSHLT1, MCTupleToolTOSHLT2)
from RecoConf.mc_checking import make_links_lhcbids_mcparticles_tracking_system
from RecoConf.data_from_file import mc_unpackers, make_mc_track_info
from RecoConf.hlt1_allen import make_allen_dec_reports
......@@ -177,7 +177,9 @@ def run_moore_with_tuples(options,
moore_cf_node, barrier_algs = moore_control_flow(options, streams, process,
False)
top_cf_node = add_efficiency_tuples(
moore_cf_node, descriptor_template=descriptor_template)
moore_cf_node,
streams["default"],
descriptor_template=descriptor_template)
config.update(
configure(
options,
......@@ -187,7 +189,7 @@ def run_moore_with_tuples(options,
return config
def add_efficiency_tuples(moore_cf, descriptor_template=None):
def add_efficiency_tuples(moore_cf, lines, descriptor_template=None):
"""Extend the Moore control flow with efficiency/rate tuple makers.
Args:
......@@ -229,24 +231,29 @@ def add_efficiency_tuples(moore_cf, descriptor_template=None):
# Now set up the Tuple Tools to be added to the control flow to save trigger & kinematic info
if efficiency_mode:
# HACK dodge sel report making for Min Bias due to Moore#145
if stage == 1:
sel_reports_maker = moore_cf.children[1].children[2]
sel_reports = sel_reports_maker.SelReports
# You only want MCTupleTools for the line efficiencies
mcttkin = MCTupleToolKinematic(
'MCDecayTreeTuple.MCTupleToolKinematic', StoreEtaInfo=True)
mcttrec = MCTupleToolReconstructed(Associate=False, FillPID=False)
# FIXME the Reconstructed flag from MCTupleToolReconstructed doesn't work yet
if stage == 1:
# TODO update it to handle Hlt2
mctttos = MCTupleToolTOS(
'MCDecayTreeTuple.MCTupleToolTOS',
sel_reports_maker = moore_cf.children[1].children[2]
sel_reports = sel_reports_maker.SelReports
mctttos = MCTupleToolTOSHLT1(
'MCDecayTreeTuple.MCTupleToolTOSHLT1',
TriggerList=decision_names,
HltSelReports=sel_reports.location,
MC2IDLink=make_links_lhcbids_mcparticles_tracking_system().
location,
Level='Hlt1')
HltSelReports=sel_reports.location)
else:
mctttos = MCTupleToolTOSHLT2(
'MCDecayTreeTuple.MCTupleToolTOSHLT2',
TriggerList=decision_names,
MC2IDLink=make_links_lhcbids_mcparticles_tracking_system().
location,
CandidateLocations=[
line.objects_to_persist[0].location for line in lines
],
Hlt2DecReports=dec_reports.location)
# Want the following tools for both rates and line efficiencies
tuple_flag = 'MCDecayTreeTuple' if efficiency_mode else 'EventTuple'
......@@ -272,10 +279,9 @@ def add_efficiency_tuples(moore_cf, descriptor_template=None):
mcdtt = _mc_decay_tree_tuple(
Decay=decay,
Branches=branches,
ToolList=tool_list + [
mcttkin.getFullName(),
mcttrec.getFullName()
] + ([mctttos.getFullName()] if stage == 1 else []))
ToolList=tool_list +
[mcttkin.getFullName(),
mcttrec.getFullName()] + [mctttos.getFullName()])
nodes = [
make_links_lhcbids_mcparticles_tracking_system(),
make_mc_track_info(), mcdtt
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment