2024-02-05 15:44:57 +01:00
|
|
|
# flake8: noqa
|
|
|
|
from Moore import options, run_reconstruction
|
|
|
|
from RecoConf.hlt2_tracking import (
|
|
|
|
make_hlt2_tracks,
|
|
|
|
get_default_out_track_types_for_light_reco,
|
|
|
|
convert_tracks_to_v3_from_v1,
|
|
|
|
get_global_ut_hits_tool,
|
|
|
|
)
|
|
|
|
from RecoConf.hlt1_tracking import make_all_pvs
|
|
|
|
from RecoConf.event_filters import require_gec
|
|
|
|
from RecoConf.mc_checking import get_track_checkers, get_fitted_tracks_checkers
|
|
|
|
from RecoConf.calorimeter_reconstruction import (
|
|
|
|
make_photons_and_electrons,
|
|
|
|
make_clusters,
|
|
|
|
make_acceptance,
|
|
|
|
make_track_cluster_matching,
|
|
|
|
make_digits,
|
|
|
|
make_track_electron_and_brem_matching,
|
|
|
|
make_trackbased_eshower,
|
|
|
|
)
|
|
|
|
from Moore.config import Reconstruction
|
|
|
|
from PyConf.Algorithms import (
|
|
|
|
PrFilterTracks2CaloClusters,
|
|
|
|
PrMatchNNv3,
|
|
|
|
PrFilterTracks2ElectronMatch,
|
|
|
|
PrFilterTracks2ElectronShower,
|
2024-02-12 15:57:23 +01:00
|
|
|
fromPrMatchTracksV1Tracks,
|
|
|
|
fromV3TrackV1Track,
|
2024-02-05 15:44:57 +01:00
|
|
|
)
|
|
|
|
import Functors as F
|
|
|
|
import glob
|
|
|
|
|
|
|
|
|
|
|
|
decay = "test"
|
|
|
|
|
|
|
|
options.evt_max = -1
|
|
|
|
|
2024-02-12 15:57:23 +01:00
|
|
|
options.ntuple_file = f"data/calo_data_{decay}_tinker.root"
|
2024-02-05 15:44:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
if decay == "B":
|
|
|
|
options.input_files = glob.glob("/auto/data/guenther/Bd_Kstee/*.xdigi")
|
|
|
|
elif decay == "BJpsi":
|
|
|
|
options.input_files = glob.glob("/auto/data/guenther/Bd_JpsiKst_ee/*.xdigi")
|
|
|
|
elif decay == "D":
|
|
|
|
options.input_files = glob.glob("/auto/data/guenther/Dst_D0ee/*.xdigi")
|
2024-02-08 17:42:15 +01:00
|
|
|
elif decay == "test2":
|
|
|
|
options.input_files = [
|
|
|
|
"/auto/data/guenther/Bd_JpsiKst_ee/00143565_00000009_1.xdigi"
|
|
|
|
]
|
2024-02-05 15:44:57 +01:00
|
|
|
elif decay == "test":
|
|
|
|
options.input_files = ["/auto/data/guenther/Bd_Kstee/00151673_00000002_1.xdigi"]
|
|
|
|
|
|
|
|
options.input_type = "ROOT"
|
|
|
|
|
|
|
|
options.dddb_tag = "dddb-20210617"
|
|
|
|
options.conddb_tag = "sim-20210617-vc-md100"
|
|
|
|
options.simulation = True
|
|
|
|
|
|
|
|
|
|
|
|
def standalone_hlt2_fastest_reco():
|
|
|
|
hlt2_tracks = make_hlt2_tracks(light_reco=True, fast_reco=False, use_pr_kf=True)
|
|
|
|
|
|
|
|
digisEcal = make_digits(calo_raw_bank=False)["digitsEcal"]
|
|
|
|
ecalClusters = make_clusters(digisEcal)
|
|
|
|
tracks_v3, trackrels = convert_tracks_to_v3_from_v1(
|
|
|
|
hlt2_tracks["Seed"]["v1"],
|
|
|
|
track_types=["Ttrack"],
|
|
|
|
)
|
|
|
|
# track acceptances
|
|
|
|
tracks_incalo = make_acceptance(tracks_v3)
|
|
|
|
tcmatches = make_track_cluster_matching(ecalClusters, tracks_incalo)
|
|
|
|
PhElOutput = make_photons_and_electrons(
|
|
|
|
ecalClusters, tcmatches["combined"], make_all_pvs()["v3"]
|
|
|
|
)
|
|
|
|
photons = PhElOutput["photons"]
|
|
|
|
electrons = PhElOutput["electrons"]
|
|
|
|
|
|
|
|
eshower = make_trackbased_eshower(tracks_incalo, digisEcal)
|
|
|
|
|
|
|
|
tcmatches_e = make_track_electron_and_brem_matching(
|
|
|
|
tracks_incalo, tcmatches, digisEcal, electrons, photons
|
|
|
|
)
|
|
|
|
|
|
|
|
# filter with calo clusters
|
|
|
|
calo_matched_seeds = PrFilterTracks2CaloClusters(
|
|
|
|
Relation=tcmatches["Ttrack"],
|
2024-02-09 11:46:58 +01:00
|
|
|
Cut=F.FILTER((F.MIN_ELEMENT_NOTZERO @ F.FORWARDARG0 @ F.WEIGHT) < 20),
|
2024-02-05 15:44:57 +01:00
|
|
|
).Output
|
2024-02-09 11:46:58 +01:00
|
|
|
|
2024-02-05 15:44:57 +01:00
|
|
|
# corrections on track (bit better for elec?)
|
|
|
|
# Cut=F.FILTER(F.ALL) ).Output
|
|
|
|
electron_matched_seeds = PrFilterTracks2ElectronMatch(
|
|
|
|
Relation=tcmatches_e["Ttrack"]["ElectronMatch"],
|
2024-02-09 11:46:58 +01:00
|
|
|
Cut=F.FILTER(F.MIN_ELEMENT_NOTZERO @ F.FORWARDARG0 @ F.WEIGHT < 20),
|
2024-02-05 15:44:57 +01:00
|
|
|
).Output
|
2024-02-09 11:46:58 +01:00
|
|
|
|
2024-02-05 15:44:57 +01:00
|
|
|
# should be best; shape of shower etc; E/p statt chi2; DLL even better? GET(1)
|
|
|
|
# Cut=F.FILTER(F.ALL)).Output
|
|
|
|
shower_matched_seeds = PrFilterTracks2ElectronShower(
|
|
|
|
Relation=eshower["Ttrack"], Cut=F.FILTER((F.GET(0) @ F.WEIGHT) > 0.7)
|
|
|
|
).Output
|
|
|
|
|
2024-02-12 15:57:23 +01:00
|
|
|
matched_seeds = {}
|
|
|
|
matched_seeds["v3"] = electron_matched_seeds
|
|
|
|
matched_seeds["v1"] = fromV3TrackV1Track(InputTracks=matched_seeds["v3"]).OutputTracks
|
|
|
|
|
2024-02-05 15:44:57 +01:00
|
|
|
calo_long = PrMatchNNv3(
|
|
|
|
VeloInput=hlt2_tracks["Velo"]["Pr"],
|
2024-02-12 15:57:23 +01:00
|
|
|
SeedInput=matched_seeds["v3"],
|
2024-02-05 15:44:57 +01:00
|
|
|
AddUTHitsToolName=get_global_ut_hits_tool(),
|
|
|
|
).MatchOutput
|
|
|
|
|
2024-02-12 15:57:23 +01:00
|
|
|
match_tracks = {}
|
|
|
|
match_tracks["Pr"] = calo_long
|
|
|
|
match_tracks["v1"] = fromPrMatchTracksV1Tracks(
|
|
|
|
InputTracksLocation=match_tracks["Pr"],
|
|
|
|
VeloTracksLocation=hlt2_tracks["Velo"]["v1"],
|
|
|
|
SeedTracksLocation=matched_seeds["v1"],
|
|
|
|
).OutputTracksLocation
|
|
|
|
|
2024-02-05 15:44:57 +01:00
|
|
|
out_track_types = get_default_out_track_types_for_light_reco()
|
|
|
|
best_tracks = {
|
|
|
|
track_type: hlt2_tracks[track_type] for track_type in out_track_types["Best"]
|
|
|
|
}
|
|
|
|
|
2024-02-12 15:57:23 +01:00
|
|
|
data = [calo_long, calo_matched_seeds, electron_matched_seeds, shower_matched_seeds]
|
2024-02-05 15:44:57 +01:00
|
|
|
types_and_locations_for_checkers = {
|
|
|
|
"Forward": hlt2_tracks["Forward"],
|
|
|
|
"Seed": hlt2_tracks["Seed"],
|
2024-02-12 15:57:23 +01:00
|
|
|
"Match": hlt2_tracks["Match"], #match_tracks,
|
2024-02-05 15:44:57 +01:00
|
|
|
}
|
|
|
|
data += get_track_checkers(types_and_locations_for_checkers)
|
2024-02-12 15:57:23 +01:00
|
|
|
# data += get_fitted_tracks_checkers(best_tracks)
|
2024-02-05 15:44:57 +01:00
|
|
|
|
|
|
|
return Reconstruction("hlt2_reco", data, [require_gec()])
|
|
|
|
|
|
|
|
|
|
|
|
run_reconstruction(options, standalone_hlt2_fastest_reco)
|