Skip to content
Snippets Groups Projects
test_example-tupling-basic.qmt 3.4 KiB
Newer Older
Maurizio Martinelli's avatar
Maurizio Martinelli committed
<?xml version="1.0" ?>
<!--
###############################################################################
# (c) Copyright 2020-2023 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".   #
#                                                                             #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization  #
# or submit itself to any jurisdiction.                                       #
###############################################################################
Maurizio Martinelli's avatar
Maurizio Martinelli committed
-->
<!DOCTYPE extension  PUBLIC '-//QM/2.3/Extension//EN'  'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'>
<extension class="GaudiTest.GaudiExeTest" kind="test">
  <argument name="program"><text>lbexec</text></argument>
  <argument name="args"><set>
    <text>DaVinciExamples.tupling.basic:main</text>
  </set></argument>
  <argument name="options_yaml_fn"><text>$DAVINCIEXAMPLESROOT/example_data/Upgrade_Bd2KstarMuMu_ldst.yaml</text></argument>
  <argument name="extra_options_yaml"><text>
    ntuple_file: DV-example-tupling-basic-ntp.root
    histo_file: DV-example-tupling-basic-his.root
    evt_max: 10
    input_raw_format: 4.3
Sevda Esen's avatar
Sevda Esen committed
    input_process: Brunel
</text></argument>
Maurizio Martinelli's avatar
Maurizio Martinelli committed
<argument name="timeout"><integer>3600</integer></argument>
<argument name="validator"><text>
findReferenceBlock("""
Abhijit Mathad's avatar
Abhijit Mathad committed
RFileCnv                               INFO dumping contents of /NTUPLES/FILE1
TFile: name=DV-example-tupling-basic-ntp.root, title=Gaudi Trees, option=CREATE
******************************************************************************
*Tree    :DecayTree : DecayTree                                              *
Maurizio Martinelli's avatar
Maurizio Martinelli committed
""", stdout, result, causes, signature_offset = 0)
countErrorLines({"FATAL":0, "ERROR":0})

import os
from DaVinciTests.QMTest.check_helpers import get_pandas_dataframe, df_has_nan

ntuple  = './DV-example-tupling-basic-ntp.root'


if not os.path.isfile(ntuple):
    causes.append(f"File {ntuple} does not exist!")

df1 = get_pandas_dataframe(ntuple, 'DimuonsTuple/DecayTree')
df2 = get_pandas_dataframe(ntuple, 'KsTuple/DecayTree')

# Check ntuples structure
if df1.empty:
    causes.append(f"File {ntuple}: ntuple 'DimuonsTuple/DecayTree' does not contain any branches")
    causes.append(f"File: {ntuple}: ntuple 'KsTuple/DecayTree' does not contain any branches")
if df1.shape != (9, 12):
    causes.append("Ntuple 'DimuonsTuple/DecayTree' not with expected number of entries and/or branches")
# FIXME: check disabled because 8(7) candidates are tupled with(out) DD4hep!
# No appetite to investigate since we should soon update the input files used.
#if df2.shape != (8, 10):
#    causes.append("Ntuple 'KsTuple/DecayTree' not with expected number of entries and/or branches")

# Check there are no NaN values in the ntuples
if df_has_nan(df1):
    causes.append("Ntuple 'DimuonsTuple/DecayTree' contains NaN entries")
if df_has_nan(df2):
    causes.append("Ntuple 'KsTuple/DecayTree' contains NaN entries")

print('Test successfully completed!')
#os.system(f"rm {ntuple}")
#os.system(f"rm {ntuple_new}")
Maurizio Martinelli's avatar
Maurizio Martinelli committed
<argument name="exit_code"><integer>1</integer></argument>
</text></argument>
Maurizio Martinelli's avatar
Maurizio Martinelli committed
</extension>