Storing Trigger Decisions
This example reads an HLT2 file and creates an ntuple, accessing HLT1 and HLT2 decisions.
from PyConf.reading import get_particles
import Functors as F
from FunTuple import FunctorCollection
from FunTuple import FunTuple_Particles as Funtuple
import FunTuple.functorcollections as FC
from DaVinci.algorithms import create_lines_filter
from DaVinci import Options, make_config
def main(options: Options):
fields = {"B0": "[[B0]CC -> (D- -> K+ pi- pi-) pi+]CC"}
B0_variables = FunctorCollection({"ID": F.PARTICLE_ID})
variables = {"B0": B0_variables}
my_filter = create_lines_filter(
name="HDRFilter", lines=["Hlt2B2OC_BdToDmPi_DmToPimPimKp_Line"]
)
b02dpi_data = get_particles(
"/Event/HLT2/Hlt2B2OC_BdToDmPi_DmToPimPimKp_Line/Particles"
)
Hlt1_decisions = [
"Hlt1TrackMVADecision",
"Hlt1TwoTrackMVADecision",
"Hlt1D2KKDecision",
"Hlt1D2KPiDecision",
"Hlt1D2PiPiDecision",
"Hlt1DiMuonHighMassDecision",
"Hlt1DiMuonLowMassDecision",
"Hlt1DiMuonSoftDecision",
"Hlt1GECPassthroughDecision",
"Hlt1KsToPiPiDecision",
"Hlt1LowPtMuonDecision",
"Hlt1LowPtDiMuonDecision",
"Hlt1SingleHighPtMuonDecision",
"Hlt1TrackMuonMVADecision",
]
# define event level variables
evt_variables = FC.SelectionInfo(
selection_type="Hlt1", trigger_lines=Hlt1_decisions
)
# define FunTuple instance
my_tuple = Funtuple(
name="Tuple",
tuple_name="DecayTree",
fields=fields,
variables=variables,
event_variables=evt_variables,
inputs=b02dpi_data,
)
return make_config(options, [my_filter, my_tuple])
To run the example:
lbexec DaVinciExamples.tupling.option_trigger_decision:main $DAVINCIEXAMPLESROOT/example_data/test_hlt1_trigger_decisions.yaml
For reference, these are the options of this example
input_files:
- root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp3/tests/hlt2_integration_B0_100.dst
input_type: ROOT
simulation: true
conddb_tag: sim-20201218-vc-md100
dddb_tag: dddb-20201211
conditions_version: master
geometry_version: run3/trunk
input_manifest_file: root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp3/tests/hlt2_integration_B0_100.tck.json
evt_max: 44
histo_file: hlt2_B0_test_histo.root
ntuple_file: hlt2_B0_test_ntuple.root
input_process: Hlt2
persistreco_version: 0.0
lumi: False
write_fsr: False