Skip to content
Snippets Groups Projects
Commit 9dba0d7c authored by Rosen Matev's avatar Rosen Matev :sunny:
Browse files

Merge branch 'sesen-master-patch-50891' into 'master'

Update hlt2_analysis.rst

See merge request !1513
parents bfe82059 ffa6ab19
No related branches found
No related tags found
1 merge request!1513Update hlt2_analysis.rst
Pipeline #3888704 passed
......@@ -104,7 +104,6 @@ familiar to you::
DecayTreeTuple,
LHCbApp,
createODIN,
HltANNSvc,
)
from DecayTreeTuple import Configuration, DecayTreeTupleTruthUtils
from PhysSelPython.Selections import (
......@@ -112,79 +111,7 @@ familiar to you::
CombineSelection,
SelectionSequence,
)
from GaudiConf.reading import (
decoder,
unpackers,
mc_unpackers,
unpack_rawevent,
hlt2_decisions,
)
import json
# Helper functions to be able to read the Hlt2 data
def get_hlt2_unpackers(ann=HltANNSvc(), is_simulation=False):
"""Configures algorithms for reading HLT2 output.
This is a temporary measure until support for Run 3 HLT2 output is added to
an LHCb application.
"""
unpack_raw_event = reading.unpack_rawevent(
bank_types=['ODIN', 'DstData', 'HltDecReports'])
reading_algs = [unpack_raw_event]
mc_unpackers = []
if is_simulation:
mc_unpackers = reading.mc_unpackers()
locations = reading.make_locations(ann.PackedObjectLocations,
"/Event/HLT2")
decoder = reading.decoder(locations=locations, ann=ann)
unpackers = reading.unpackers(
locations=locations, ann=ann, mc=mc_unpackers)
reading_algs += [decoder]
reading_algs += mc_unpackers
reading_algs += unpackers
reading_algs += [createODIN()]
return reading_algs
def configure_packed_locations(tck_location):
"""Configures HltANNSvc to know about packed locations and hlt2 decision names used in Moore.
tck_location (string): Location of json file containing trigger configuration.
"""
with open(tck_location) as f:
tck = json.load(f)
ann_config = tck["HltANNSvc/HltANNSvc"]
HltANNSvc(PackedObjectLocations={
str(k): v
for k, v in ann_config["PackedObjectLocations"].items()
})
HltANNSvc(Hlt2SelectionID={
str(k): v
for k, v in ann_config["Hlt2SelectionID"].items()
})
packed_object_types = {}
if "PackedObjectTypes" in ann_config.keys():
packed_object_types = {
str(k): v
for k, v in ann_config["PackedObjectTypes"].items()
}
return HltANNSvc(
"HltANNSvc",
PackedObjectLocations=packed_object_locs,
PackedObjectTypes=packed_object_types,
)
# The output of the HLT2 line
kpi_line = AutomaticData("/Event/HLT2/Hlt2CharmD0ToKmPipLine/Particles")
# Extra pions
......@@ -246,14 +173,20 @@ familiar to you::
user_algs = [selseq.sequence(), dtt_kpi, dtt_kpi_dst]
LHCbApp().TupleFile = "hlt2_example.root"
from GaudiConf.reading import do_unpacking
from Moore.tcks import load_hlt2_configuration
# Load the 'TCK' dumped from the Moore job, assuming the TCK file was named
# like the Moore output file
ann= configure_packed_locations(LHCbApp().TupleFile.replace(".root", "") +
".tck.json")
json= LHCbApp().TupleFile.replace(".root", "") + ".tck.json"
ann = load_hlt2_configuration(json, annsvc_name="HltANNSvc")
# decoding and unpacking
unpacking = do_unpacking(annsvc=ann, process='Hlt2', simulation=True)
# Configure the unpacking of data (we assume we want MC information)
# and the running of the user algorithms. The order is important.
ApplicationMgr().TopAlg = get_hlt2_unpackers(ann=ann, is_simulation=True) + user_algs
ApplicationMgr().TopAlg = [createODIN()] + unpacking + user_algs
These options demonstrate using the output of extra selections. If your line
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment