From 69b568beb4effe7fa9bc6377dc8d64dc71f0dfd6 Mon Sep 17 00:00:00 2001 From: Alex Pearce <alex@alexpearce.me> Date: Fri, 9 Mar 2018 14:49:35 +0100 Subject: [PATCH] Add tests for Turbo MC processing. --- DaVinciTests/tests/options/TurboMC_2015.py | 41 ++++++++ DaVinciTests/tests/options/TurboMC_2016.py | 40 ++++++++ .../tests/options/TurboMC_2016_uDST.py | 95 +++++++++++++++++++ 3 files changed, 176 insertions(+) create mode 100644 DaVinciTests/tests/options/TurboMC_2015.py create mode 100644 DaVinciTests/tests/options/TurboMC_2016.py create mode 100644 DaVinciTests/tests/options/TurboMC_2016_uDST.py diff --git a/DaVinciTests/tests/options/TurboMC_2015.py b/DaVinciTests/tests/options/TurboMC_2015.py new file mode 100644 index 000000000..4595df200 --- /dev/null +++ b/DaVinciTests/tests/options/TurboMC_2015.py @@ -0,0 +1,41 @@ +from Configurables import DaVinci, DecayTreeTuple +from DecayTreeTuple import Configuration +from GaudiConf import IOHelper +from PhysConf.Filters import LoKi_Filters +from TeslaTools import TeslaTruthUtils + +hlt2_line = 'Hlt2CharmHadDstp2D0Pip_D02KmPipTurbo' + +dtt = DecayTreeTuple('TupleDstToD0pi_D0ToKpi') +dtt.Inputs = ['{0}/Particles'.format(hlt2_line)] +dtt.Decay = '[D*(2010)+ -> ^(D0 -> ^K- ^pi+) ^pi+]CC' +dtt.addBranches({ + 'Dst': '[D*(2010)+ -> (D0 -> K- pi+) pi+]CC', + 'D0': '[D*(2010)+ -> ^(D0 -> K- pi+) pi+]CC', + 'D0_K': '[D*(2010)+ -> (D0 -> ^K- pi+) pi+]CC', + 'D0_pi': '[D*(2010)+ -> (D0 -> K- ^pi+) pi+]CC', + 'Dst_pi': '[D*(2010)+ -> (D0 -> K- pi+) ^pi+]CC' +}) +dtt.ToolList += [ + 'TupleToolMCBackgroundInfo', + 'TupleToolMCTruth' +] +relations = [TeslaTruthUtils.getRelLoc('')] +mc_tools = [ + 'MCTupleToolKinematic' +] +TeslaTruthUtils.makeTruth(dtt, relations, mc_tools) + +trigger_filter = LoKi_Filters( + HLT2_Code="HLT_PASS_RE('^{0}Decision$')".format(hlt2_line) +) + +DaVinci().EventPreFilters = trigger_filter.filters('TriggerFilters') +DaVinci().UserAlgorithms = [dtt] +DaVinci().TupleFile = 'TurboMC_2015.root' +DaVinci().EvtMax = 1000 + +# Found with `lb-run LHCbDirac dirac-dms-lfn-accessURL --Protocol=xroot /lhcb/MC/2015/DST/00064085/0000/00064085_00000001_1.dst` +IOHelper().inputFiles([ + 'root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/swtest/lhcb/MC/2015/DST/00064085/0000/00064085_00000001_1.dst' +]) diff --git a/DaVinciTests/tests/options/TurboMC_2016.py b/DaVinciTests/tests/options/TurboMC_2016.py new file mode 100644 index 000000000..f89eea004 --- /dev/null +++ b/DaVinciTests/tests/options/TurboMC_2016.py @@ -0,0 +1,40 @@ +from Configurables import DaVinci, DecayTreeTuple +from DecayTreeTuple import Configuration +from GaudiConf import IOHelper +from PhysConf.Filters import LoKi_Filters +from TeslaTools import TeslaTruthUtils + +hlt2_line = 'Hlt2CharmHadDstp2D0Pip_D02KmPipTurbo' + +dtt = DecayTreeTuple('TupleDstToD0pi_D0ToKpi') +dtt.Inputs = ['{0}/Particles'.format(hlt2_line)] +dtt.Decay = '[D*(2010)+ -> ^(D0 -> ^K- ^pi+) ^pi+]CC' +dtt.addBranches({ + 'Dst': '[D*(2010)+ -> (D0 -> K- pi+) pi+]CC', + 'D0': '[D*(2010)+ -> ^(D0 -> K- pi+) pi+]CC', + 'D0_K': '[D*(2010)+ -> (D0 -> ^K- pi+) pi+]CC', + 'D0_pi': '[D*(2010)+ -> (D0 -> K- ^pi+) pi+]CC', + 'Dst_pi': '[D*(2010)+ -> (D0 -> K- pi+) ^pi+]CC' +}) +dtt.ToolList += [ + 'TupleToolMCBackgroundInfo', + 'TupleToolMCTruth' +] +relations = [TeslaTruthUtils.getRelLoc('')] +mc_tools = [ + 'MCTupleToolKinematic' +] +TeslaTruthUtils.makeTruth(dtt, relations, mc_tools) + +trigger_filter = LoKi_Filters( + HLT2_Code="HLT_PASS_RE('^{0}Decision$')".format(hlt2_line) +) + +DaVinci().EventPreFilters = trigger_filter.filters('TriggerFilters') +DaVinci().UserAlgorithms = [dtt] +DaVinci().TupleFile = 'TurboMC_2016.root' + +# Found with `lb-run LHCbDirac dirac-dms-lfn-accessURL --Protocol=xroot /lhcb/MC/2016/DST/00066623/0000/00066623_00000001_1.dst` +IOHelper().inputFiles([ + 'root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/swtest/lhcb/MC/2016/DST/00066623/0000/00066623_00000001_1.dst' +]) diff --git a/DaVinciTests/tests/options/TurboMC_2016_uDST.py b/DaVinciTests/tests/options/TurboMC_2016_uDST.py new file mode 100644 index 000000000..a5187918f --- /dev/null +++ b/DaVinciTests/tests/options/TurboMC_2016_uDST.py @@ -0,0 +1,95 @@ +from Configurables import DaVinci, DecayTreeTuple, GaudiSequencer +from DecayTreeTuple import Configuration +from GaudiConf import IOHelper +from PhysConf.Filters import LoKi_Filters +from PhysSelPython.Selections import ( + AutomaticData, + CombineSelection, + RebuildSelection, + SelectionSequence +) +from StandardParticles import StdAllLooseANNPions +from TeslaTools import TeslaTruthUtils + +hlt2_line = 'Hlt2CharmHadLcpToPpKmPipTurbo' + +dtt = DecayTreeTuple('TupleLcTopKpi') +dtt.Inputs = ['{0}/Particles'.format(hlt2_line)] +dtt.Decay = '[Lambda_c+ -> ^p+ ^K- ^pi+]CC' +dtt.addBranches({ + 'Lc': '[Lambda_c+ -> p+ K- pi+]CC', + 'Lc_p': '[Lambda_c+ -> ^p+ K- pi+]CC', + 'Lc_K': '[Lambda_c+ -> p+ ^K- pi+]CC', + 'Lc_pi': '[Lambda_c+ -> p+ K- ^pi+]CC' +}) +dtt.ToolList += [ + 'TupleToolMCBackgroundInfo', + 'TupleToolMCTruth' +] +relations = [ + TeslaTruthUtils.getRelLoc(''), + # This location is required for truth-matching objects from Turbo++ + '/Event/Turbo/Relations/Hlt2/Protos/Charged' +] +mc_tools = [ + 'MCTupleToolKinematic' +] +TeslaTruthUtils.makeTruth(dtt, relations, mc_tools) + +# The Lcp line was a PersistReco line in 2016, so we have access to the whole +# HLT2 reconstruction here +combiner_sel = CombineSelection( + 'CombineLcpi', + inputs=[ + AutomaticData('{0}/Particles'.format(hlt2_line)), + RebuildSelection(StdAllLooseANNPions) + ], + DecayDescriptors=[ + '[Sigma_c++ -> Lambda_c+ pi+]cc', + '[Sigma_c0 -> Lambda_c+ pi-]cc' + ], + DaughtersCuts={ + 'pi+': 'PROBNNpi > 0.2' + }, + CombinationCut=( + 'in_range(0, (AM - AM1 - AM2), 170)' + ), + MotherCut=( + '(VFASPF(VCHI2PDOF) < 10) &' + 'in_range(0, (M - M1 - M2), 150)' + ) +) +selseq = SelectionSequence( + combiner_sel.name() + 'Sequence', + TopSelection=combiner_sel +) +sc_dtt = DecayTreeTuple('TupleScToLcpi_LcTopKpi') +sc_dtt.Inputs = [combiner_sel.outputLocation()] +sc_dtt.Decay = '[(Sigma_c++|Sigma_c0) -> ^(Lambda_c+ -> ^p+ ^K- ^pi+) ^X]CC' +sc_dtt.addBranches({ + 'Sc': '[Charm -> (Lambda_c+ -> p+ K- pi+) X]CC', + 'Lc': '[Charm -> ^(Lambda_c+ -> p+ K- pi+) X]CC', + 'Lc_p': '[Charm -> (Lambda_c+ -> ^p+ K- pi+) X]CC', + 'Lc_K': '[Charm -> (Lambda_c+ -> p+ ^K- pi+) X]CC', + 'Lc_pi': '[Charm -> (Lambda_c+ -> p+ K- ^pi+) X]CC', + 'Sc_pi': '[Charm -> (Lambda_c+ -> p+ K- pi+) ^X]CC' +}) +sc_dtt.ToolList += [ + 'TupleToolMCBackgroundInfo', + 'TupleToolMCTruth' +] +TeslaTruthUtils.makeTruth(sc_dtt, relations, mc_tools) +sc_seq = GaudiSequencer('SigmacSequence', Members=[selseq.sequence(), sc_dtt]) + +trigger_filter = LoKi_Filters( + HLT2_Code="HLT_PASS_RE('^{0}Decision$')".format(hlt2_line) +) + +DaVinci().EventPreFilters = trigger_filter.filters('TriggerFilters') +DaVinci().UserAlgorithms = [dtt, sc_seq] +DaVinci().TupleFile = 'TurboMC_2016_uDST.root' + +# Found with `lb-run LHCbDirac dirac-dms-lfn-accessURL --Protocol=xroot /lhcb/MC/2016/ALLSTREAMS.MDST/00063447/0000/00063447_00000001_7.AllStreams.mdst` +IOHelper().inputFiles([ + 'root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/swtest/lhcb/MC/2016/ALLSTREAMS.MDST/00063447/0000/00063447_00000001_7.AllStreams.mdst' +]) -- GitLab