From b980cbaaf30af229d7581f69b9a7ff22f517308c Mon Sep 17 00:00:00 2001 From: "patrick.koppenburg@cern.ch" Date: Wed, 2 Feb 2022 17:26:02 +0100 Subject: [PATCH 1/9] Modernize xgen test --- .../option_davinci_tupling_from_xgen.py | 24 ++++++++++++------- .../refs/test_davinci_tupling_from_xgen.ref | 9 ++++--- 2 files changed, 22 insertions(+), 11 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 1b8b43da..2b63c3b6 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen.py @@ -10,10 +10,19 @@ ############################################################################### """ Read and process a .xgen file with the new DaVinci configuration. + +This is run as +./run davinci run-mc --inputfiledb test_read_xgen Phys/DaVinci/options/DaVinciDB-Example.yaml --user_algorithms DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen:main + +To test with another file, create a yaml file and do + +./run davinci run-mc --inputfiledb fileKey file.yaml --user_algorithms DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen:main + """ 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 branches branches = { @@ -26,18 +35,17 @@ branches = { #FunTuple: define variables for the B meson variables_B = FunctorCollection({ - 'ETA': 'MCETA', - 'PHI': 'MCPHI', - 'PT': 'MCPT', - 'E': 'MCE', + 'ETA': F.ETA, + 'PHI': F.PHI, + 'VX' : 'MCVFASPF(MCVX)', #LoKi + 'VY' : 'MCVFASPF(MCVY)', #LoKi + 'VZ' : 'MCVFASPF(MCVZ)', #LoKi }) #FunTuple: define common variables variables_all = FunctorCollection({ - 'P': 'MCP', - 'PX': 'MCPX', - 'PY': 'MCPY', - 'PZ': 'MCPZ', + 'PT': F.PT, + 'P': F.FOURMOMENTUM }) #FunTuple: associate functor collections to branch name diff --git a/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref b/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref index 61574144..08987e25 100644 --- a/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref +++ b/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref @@ -10,12 +10,15 @@ NTupleSvc INFO Added stream file:DV_tuple_xgen.root RootHistSvc INFO Writing ROOT histograms to: DV_histo_xgen.root HistogramPersistencySvc INFO Added successfully Conversion service:RootHistSvc FSROutputStreamDstWriter INFO Data source: EventDataSvc output: SVC='Gaudi::RootCnvSvc' +FunctorFactory INFO Cache miss for functor: ::Functors::Track::PseudoRapidity{}, now trying cling with headers [Event/MCParticle.h, Functors/TrackLike.h] +FunctorFactory INFO Cache miss for functor: ::Functors::Track::Phi{}, now trying cling with headers [Event/MCParticle.h, Functors/TrackLike.h] +FunctorFactory INFO Cache miss for functor: ::Functors::Track::TransverseMomentum{}, now trying cling with headers [Event/MCParticle.h, Functors/TrackLike.h] +FunctorFactory INFO Cache miss for functor: ::Functors::Track::FourMomentum{}, now trying cling with headers [Event/MCParticle.h, Functors/TrackLike.h] EventClockSvc.FakeEventTime INFO Event times generated from 0 with steps of 0 ApplicationMgr INFO Application Manager Initialized successfully DeFTDetector INFO Current FT geometry version = 63 ApplicationMgr INFO Application Manager Started successfully EventPersistencySvc INFO Added successfully Conversion service:RootCnvSvc -EventSelector INFO Stream:EventSelector.DataStreamTool_1 Def:DATAFILE='root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp3/testDV_read_xgen/Gauss-12143001-100ev-20211117.xgen' SVC='Gaudi::RootEvtSelector' OPT='READ' IgnoreChecksum='YES' EventSelector SUCCESS Reading Event record 1. Record number within stream 1: 1 RFileCnv INFO opening Root file "DV_tuple_xgen.root" for writing RCWNTupleCnv INFO Booked TTree with ID: DecayTree "DecayTree" in directory DV_tuple_xgen.root:/BuJpsiK_MCTuple @@ -24,7 +27,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=30 {Bu_VX,Bu_VY,Bu_VZ,Bu_ETA,Bu_PHI,Bu_PT,Bu_PE,Bu_PX,Bu_PY,Bu_PZ,Jpsi_PT,Jpsi_PE,Jps} BuJpsiK_MCTuple SUCCESS #WARNINGS = 185 Message = 'update_counters: No candidates found in this event. Skipping this event' LAZY_AND: DaVinci #=100 Sum=100 Eff=|( 100.0000 +- 0.00000 )%| NONLAZY_OR: FileSummaryRecords #=100 Sum=100 Eff=|( 100.0000 +- 0.00000 )%| @@ -57,4 +60,4 @@ BuJpsiK_MCTuple INFO Number of counters : 11 | "# processed events" | 100 | ToolSvc.MCHybridFactory INFO Number of counters : 1 | Counter | # | sum | mean/eff^* | rms/err^* | min | max | - | "# loaded from PYTHON" | 24 | + | "# loaded from PYTHON" | 3 | -- GitLab From 8c8ec5e092866321ee3be22c503139d4bbfda881 Mon Sep 17 00:00:00 2001 From: Gitlab CI Date: Wed, 2 Feb 2022 16:31:56 +0000 Subject: [PATCH 2/9] Fixed formatting patch generated by https://gitlab.cern.ch/lhcb/DaVinci/-/jobs/19226619 --- .../tupling/option_davinci_tupling_from_xgen.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 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 2b63c3b6..962c0cf9 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen.py @@ -37,16 +37,13 @@ branches = { variables_B = FunctorCollection({ 'ETA': F.ETA, 'PHI': F.PHI, - 'VX' : 'MCVFASPF(MCVX)', #LoKi - 'VY' : 'MCVFASPF(MCVY)', #LoKi - 'VZ' : 'MCVFASPF(MCVZ)', #LoKi + 'VX': 'MCVFASPF(MCVX)', #LoKi + 'VY': 'MCVFASPF(MCVY)', #LoKi + 'VZ': 'MCVFASPF(MCVZ)', #LoKi }) #FunTuple: define common variables -variables_all = FunctorCollection({ - 'PT': F.PT, - 'P': F.FOURMOMENTUM -}) +variables_all = FunctorCollection({'PT': F.PT, 'P': F.FOURMOMENTUM}) #FunTuple: associate functor collections to branch name variables = { -- GitLab From 4b99dd97407cb5c7165bc22344a398223caff75e Mon Sep 17 00:00:00 2001 From: Patrick Koppenburg Date: Fri, 11 Feb 2022 13:19:12 +0100 Subject: [PATCH 3/9] Update option_davinci_tupling_from_xgen.py --- .../DaVinciExamples/tupling/option_davinci_tupling_from_xgen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 962c0cf9..e7a72fe9 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 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". # -- GitLab From b5a83fde5e73af385926718e5b6e25457f9d99b6 Mon Sep 17 00:00:00 2001 From: "patrick.koppenburg@cern.ch" Date: Tue, 15 Feb 2022 10:02:19 +0100 Subject: [PATCH 4/9] Fix test --- .../tests/refs/test_davinci_tupling_from_xgen.ref | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref b/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref index dd0f69dc..3061f583 100644 --- a/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref +++ b/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref @@ -10,10 +10,6 @@ NTupleSvc INFO Added stream file:DV_tuple_xgen.root RootHistSvc INFO Writing ROOT histograms to: DV_histo_xgen.root HistogramPersistencySvc INFO Added successfully Conversion service:RootHistSvc FSROutputStreamDstWriter INFO Data source: EventDataSvc output: SVC='Gaudi::RootCnvSvc' -FunctorFactory INFO Cache miss for functor: ::Functors::Track::PseudoRapidity{}, now trying cling with headers [Event/MCParticle.h, Functors/TrackLike.h] -FunctorFactory INFO Cache miss for functor: ::Functors::Track::Phi{}, now trying cling with headers [Event/MCParticle.h, Functors/TrackLike.h] -FunctorFactory INFO Cache miss for functor: ::Functors::Track::TransverseMomentum{}, now trying cling with headers [Event/MCParticle.h, Functors/TrackLike.h] -FunctorFactory INFO Cache miss for functor: ::Functors::Track::FourMomentum{}, now trying cling with headers [Event/MCParticle.h, Functors/TrackLike.h] EventClockSvc.FakeEventTime INFO Event times generated from 0 with steps of 0 ApplicationMgr INFO Application Manager Initialized successfully DeFTDetector INFO Current FT geometry version = 63 @@ -27,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=30 {Bu_VX,Bu_VY,Bu_VZ,Bu_ETA,Bu_PHI,Bu_PT,Bu_PE,Bu_PX,Bu_PY,Bu_PZ,Jpsi_PT,Jpsi_PE,Jps} 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 )%| -- GitLab From ecddf116e4ece2aa8ac3ee4ad73c57250f89888c Mon Sep 17 00:00:00 2001 From: Patrick Koppenburg Date: Tue, 15 Feb 2022 10:31:37 +0100 Subject: [PATCH 5/9] Use Rec!2652 --- .../tupling/option_davinci_tupling_from_xgen.py | 9 ++++++--- .../tests/refs/test_davinci_tupling_from_xgen.ref | 3 --- 2 files changed, 6 insertions(+), 6 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 59ec9002..6387289d 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen.py @@ -37,9 +37,12 @@ fields = { variables_B = FunctorCollection({ 'ETA': F.ETA, 'PHI': F.PHI, - 'VX': 'MCVFASPF(MCVX)', #LoKi - 'VY': 'MCVFASPF(MCVY)', #LoKi - 'VZ': 'MCVFASPF(MCVZ)', #LoKi + '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 diff --git a/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref b/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref index 3061f583..76744410 100644 --- a/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref +++ b/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref @@ -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" | 3 | -- GitLab From ebdc045b8868536116201b5ad27aabb4170bfab0 Mon Sep 17 00:00:00 2001 From: Gitlab CI Date: Tue, 15 Feb 2022 09:32:04 +0000 Subject: [PATCH 6/9] Fixed formatting patch generated by https://gitlab.cern.ch/lhcb/DaVinci/-/jobs/19537629 --- .../tupling/option_davinci_tupling_from_xgen.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 6387289d..e31c9a83 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen.py @@ -38,11 +38,11 @@ variables_B = FunctorCollection({ 'ETA': F.ETA, 'PHI': F.PHI, 'ORIGIN_VX': F.ORIGIN_VX, - 'ORIGIN_VY': F.ORIGIN_VY, - 'ORIGIN_VZ': F.ORIGIN_VZ, + '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, + 'END_VY': F.END_VY, + 'END_VZ': F.END_VZ, }) #FunTuple: define common variables -- GitLab From dedc071a4fcdf1f6c06389a9957fba75d2ea503f Mon Sep 17 00:00:00 2001 From: "patrick.koppenburg@cern.ch" Date: Tue, 15 Feb 2022 16:11:15 +0100 Subject: [PATCH 7/9] fix test again --- DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref b/DaVinciExamples/tests/refs/test_davinci_tupling_from_xgen.ref index 76744410..af7ad353 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=30 {Bu_VX,Bu_VY,Bu_VZ,Bu_ETA,Bu_PHI,Bu_PT,Bu_PE,Bu_PX,Bu_PY,Bu_PZ,Jpsi_PT,Jpsi_PE,Jps} +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 )%| -- GitLab From daf47c6f4f7083c6dcde7d28d9245f9e9de092e8 Mon Sep 17 00:00:00 2001 From: Patrick Koppenburg Date: Wed, 16 Feb 2022 13:11:19 +0100 Subject: [PATCH 8/9] No dependency on yaml --- .../option_davinci_tupling_from_xgen.py | 20 ++++++++++++++----- .../test_davinci_tupling_from_xgen.qmt | 3 --- 2 files changed, 15 insertions(+), 8 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 e31c9a83..b39534ea 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen.py @@ -12,13 +12,16 @@ Read and process a .xgen file with the new DaVinci configuration. This is run as -./run davinci run-mc --inputfiledb test_read_xgen Phys/DaVinci/options/DaVinciDB-Example.yaml --user_algorithms DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen:main - -To test with another file, create a yaml file and do - -./run davinci run-mc --inputfiledb fileKey file.yaml --user_algorithms DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen:main +./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 """ +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 @@ -72,6 +75,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 3ada0d2f..3b174dd9 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 @@ 600 run-mc - --inputfiledb - test_read_xgen - $DAVINCIROOT/options/DaVinciDB-Example.yaml --user_algorithms ../../python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen:main -- GitLab From fec9f593088443f64a14ed7f890a07f83f40af95 Mon Sep 17 00:00:00 2001 From: Patrick Koppenburg Date: Wed, 16 Feb 2022 13:13:54 +0100 Subject: [PATCH 9/9] No dependency on yaml --- .../tupling/option_davinci_tupling_from_xgen.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 b39534ea..b24c9f34 100644 --- a/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen.py +++ b/DaVinciExamples/python/DaVinciExamples/tupling/option_davinci_tupling_from_xgen.py @@ -14,7 +14,8 @@ 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 +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" -- GitLab