From 30338aaf4809894a12fd1a0d6eb33876f1b2da6c Mon Sep 17 00:00:00 2001 From: Patrick Koppenburg <patrick.koppenburg@cern.ch> Date: Fri, 18 Feb 2022 09:06:18 +0100 Subject: [PATCH] Modernize xgen test --- .../option_davinci_tupling_from_xgen.py | 41 ++++++++++++++----- .../test_davinci_tupling_from_xgen.qmt | 3 -- .../refs/test_davinci_tupling_from_xgen.ref | 5 +-- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen.py b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen.py index ba383baed..b24c9f342 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen.py @@ -1,5 +1,5 @@ ############################################################################### -# (c) Copyright 2021-2022 CERN for the benefit of the LHCb Collaboration # +# (c) Copyright 2022 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". # @@ -10,10 +10,23 @@ ############################################################################### """ Read and process a .xgen file with the new DaVinci configuration. + +This is run as +./run davinci run-mc --user_algorithms DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen:main + +To test with another xgen file, copy the options above, edit the list of files below (can be local files) and make sure you adapt the database tags. +Then specify the decay descriptors. """ +xgenFiles = [ + "root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp3/testDV_read_xgen/Gauss-12143001-100ev-20211117.xgen" +] +conddb_tag = "sim-20171127-vc-md100" +dddb_tag = "dddb-20171126" + from FunTuple import FunctorCollection, FunTuple_MCParticles as FuntupleMC from PyConf.Algorithms import PrintMCTree from PyConf.dataflow import force_location +import Functors as F #FunTuple: define fields (branches) fields = { @@ -26,19 +39,18 @@ fields = { #FunTuple: define variables for the B meson variables_B = FunctorCollection({ - 'ETA': 'MCETA', - 'PHI': 'MCPHI', - 'PT': 'MCPT', - 'E': 'MCE', + 'ETA': F.ETA, + 'PHI': F.PHI, + 'ORIGIN_VX': F.ORIGIN_VX, + 'ORIGIN_VY': F.ORIGIN_VY, + 'ORIGIN_VZ': F.ORIGIN_VZ, + 'END_VX': F.END_VX, + 'END_VY': F.END_VY, + 'END_VZ': F.END_VZ, }) #FunTuple: define common variables -variables_all = FunctorCollection({ - 'P': 'MCP', - 'PX': 'MCPX', - 'PY': 'MCPY', - 'PZ': 'MCPZ', -}) +variables_all = FunctorCollection({'PT': F.PT, 'P': F.FOURMOMENTUM}) #FunTuple: associate functor collections to field (branch) name variables = { @@ -64,6 +76,13 @@ def main(): options.ntuple_file = "DV_tuple_xgen.root" options.process = "Hlt2" + options.input_files = xgenFiles + options.data_type = "Upgrade" + options.input_type = "XGEN" + options.simulation = True + options.conddb_tag = conddb_tag + options.dddb_tag = dddb_tag + printMC = PrintMCTree( MCParticles=bu2jpsik_line, ParticleNames=["B+", "B-"], OutputLevel=4) diff --git a/DaVinciExamples/tests/qmtest/tupling.qms/test_davinci_tupling_from_xgen.qmt b/DaVinciExamples/tests/qmtest/tupling.qms/test_davinci_tupling_from_xgen.qmt index 3ada0d2f5..3b174dd91 100644 --- a/DaVinciExamples/tests/qmtest/tupling.qms/test_davinci_tupling_from_xgen.qmt +++ b/DaVinciExamples/tests/qmtest/tupling.qms/test_davinci_tupling_from_xgen.qmt @@ -28,9 +28,6 @@ <argument name="timeout"><integer>600</integer></argument> <argument name="args"><set> <text>run-mc</text> - <text>--inputfiledb</text> - <text>test_read_xgen</text> - <text>$DAVINCIROOT/options/DaVinciDB-Example.yaml</text> <text>--user_algorithms</text> <text>../../python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen:main</text> </set></argument> diff --git a/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref b/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref index 24fde447b..af7ad353e 100644 --- a/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref +++ b/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref @@ -23,7 +23,7 @@ FSROutputStreamDstWriter INFO Set up File Summary Record FSROutputStreamDstWriter INFO Events output: 1 BuJpsiK_MCTuple SUCCESS Booked 1 N-Tuples and 0 Event Tag Collections BuJpsiK_MCTuple SUCCESS List of booked N-Tuples in directory "FILE1/BuJpsiK_MCTuple" -BuJpsiK_MCTuple SUCCESS ID=DecayTree Title="DecayTree" #items=24 {Bu_ETA,Bu_PHI,Bu_PT,Bu_E,Bu_P,Bu_PX,Bu_PY,Bu_PZ,Jpsi_P,Jpsi_PX,Jpsi_PY,Jpsi_PZ,Kp} +BuJpsiK_MCTuple SUCCESS ID=DecayTree Title="DecayTree" #items=33 {Bu_ETA,Bu_PHI,Bu_ORIGIN_VX,Bu_ORIGIN_VY,Bu_ORIGIN_VZ,Bu_END_VX,Bu_END_VY,Bu_END_V} LAZY_AND: DaVinci #=100 Sum=100 Eff=|( 100.0000 +- 0.00000 )%| NONLAZY_OR: FileSummaryRecords #=100 Sum=100 Eff=|( 100.0000 +- 0.00000 )%| LAZY_AND: GenFSR #=100 Sum=100 Eff=|( 100.0000 +- 0.00000 )%| @@ -53,6 +53,3 @@ BuJpsiK_MCTuple INFO Number of counters : 11 | "# non-empty events for field muminus" | 63 | | "# non-empty events for field muplus" | 63 | | "# processed events" | 100 | -ToolSvc.MCHybridFactory INFO Number of counters : 1 - | Counter | # | sum | mean/eff^* | rms/err^* | min | max | - | "# loaded from PYTHON" | 24 | -- GitLab