Skip to content
Snippets Groups Projects
Commit e1ccb975 authored by Sevda Esen's avatar Sevda Esen Committed by Gerhard Raven
Browse files

add a test for old dst files

parent 57c113bc
No related branches found
No related tags found
2 merge requests!1103Draft: Add AnalysisHelpers to DaVinci Stack,!733Adapt to LHCb!3528 - Enforce use of an encoding/decoding key (TCK) in all Hlt encoders/decoders, do not use online-reserved bits in SourceID, remove explicit mention of 'packed' locations, enable 'stable' persist reco locations
input_files:
- root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp3/tests/spruce_all_lines_realtimereco_newPacking.dst
annsvc_config: root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp3/tests/spruce_all_lines_realtime_newPacking.tck.json
data_type: Upgrade
input_type: ROOT
simulation: true
conddb_tag: sim-20171127-vc-md100
dddb_tag: dddb-20171126
histo_file: sprucing_histos.root
ntuple_file: sprucing_tuple.root
input_raw_format: 0.3
process: Spruce
<?xml version="1.0" ?>
<!--
###############################################################################
# (c) Copyright 2021-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". #
# #
# 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. #
###############################################################################
-->
<!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'>
<!--
#######################################################
# SUMMARY OF THIS TEST
# ...................
# Author: pkoppenb
# Purpose: Test for All functors
# Prerequisites: None
#######################################################
-->
<extension class="GaudiTest.GaudiExeTest" kind="test">
<argument name="program"><text>lbexec</text></argument>
<!-- Minimum bias dst processed using topo {2,3} hlt2 lines and all sprucing lines -->
<argument name="extra_options_yaml"><text>
input_files:
- root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp3/tests/spruce_all_lines_realtimereco_newPacking.dst'
annsvc_config: 'root://eoslhcb.cern.ch//eos/lhcb/wg/dpa/wp3/tests/spruce_all_lines_realtime_newPacking.tck.json'
data_type: Upgrade
input_type: ROOT
simulation: true
conddb_tag: sim-20171127-vc-md100
dddb_tag: dddb-20171126
input_raw_format: 0.3
lumi: false
ntuple_file: 'DV_example_allFunctors_ntp_old.root'
print_freq: 1
process: 'Spruce'
stream: 'default'
</text></argument>
<argument name="timeout"><integer>1000</integer></argument>
<argument name="args"><set>
<text>DaVinciExamples.tupling.AllFunctors:alg_config</text>
</set></argument>
<argument name="validator"><text>
findReferenceBlock("""B0DsK_Tuple SUCCESS Booked 1 N-Tuples and 0 Event Tag Collections"""
, stdout, result, causes, signature_offset = 0)
import sys, os, glob
from ROOT import TFile
B_vars_stored = ['B0_ALLPVX', 'B0_ALLPVY', 'B0_ALLPVZ', 'B0_ALV', 'B0_BKGCAT', 'B0_BPVCORRM', 'B0_BPVDIRA', 'B0_BPVDLS', 'B0_BPVETA', 'B0_BPVFD', 'B0_BPVFDCHI2', 'B0_BPVFDIRX', 'B0_BPVFDIRY', 'B0_BPVFDIRZ', 'B0_BPVFDVECX', 'B0_BPVFDVECY', 'B0_BPVFDVECZ', 'B0_BPVIP', 'B0_BPVIPCHI2', 'B0_BPVLTIME', 'B0_BPVVDRHO', 'B0_BPVVDX', 'B0_BPVVDY', 'B0_BPVVDZ', 'B0_BPVX', 'B0_BPVY', 'B0_BPVZ', 'B0_CHARGE', 'B0_CHI2', 'B0_CHI2DOF', 'B0_CHILD1_PT', 'B0_DOCA', 'B0_DOCACHI2', 'B0_DTF_BPVIPCHI2', 'B0_DTF_PT', 'B0_Delta_END_VZ_DsB0', 'B0_Ds_END_VZ', 'B0_END_VRHO', 'B0_END_VX', 'B0_END_VY', 'B0_END_VZ', 'B0_ENERGY', 'B0_ETA', 'B0_FOURMOMENTUME', 'B0_FOURMOMENTUMX', 'B0_FOURMOMENTUMY', 'B0_FOURMOMENTUMZ', 'B0_IS_ABS_ID_pi', 'B0_IS_ID_pi', 'B0_IS_NOT_H', 'B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PARTICLE_ID', 'Kaon_PHI', 'Kaon_PID_E', 'Kaon_PID_K', 'Kaon_PID_MU', 'Kaon_PID_P', 'Kaon_PID_PI', 'Kaon_PROBNN_D', 'Kaon_PROBNN_E', 'Kaon_PROBNN_GHOST', 'Kaon_PROBNN_K', 'Kaon_PROBNN_MU', 'Kaon_PROBNN_P', 'Kaon_PROBNN_PI', 'Kaon_PT', 'Kaon_PX', 'Kaon_PY', 'Kaon_PZ', 'Kaon_REFERENCEPOINT_X', 'Kaon_REFERENCEPOINT_Y', 'Kaon_REFERENCEPOINT_Z', 'Kaon_SHOWER_SHAPE', 'Kaon_TX', 'Kaon_TY', 'ODINTCK', 'PV_SIZE', 'RUNNUMBER', 'TCK', 'nPVs', 'pip_ALLPVX', 'pip_ALLPVY', 'pip_ALLPVZ', 'pip_BKGCAT', 'pip_BPVIP', 'pip_BPVIPCHI2', 'pip_BPVX', 'pip_BPVY', 'pip_BPVZ', 'pip_CHARGE', 'pip_CHI2', 'pip_CHI2DOF', 'pip_DTF_BPVIPCHI2', 'pip_DTF_PT', 'pip_ENERGY', 'pip_ETA', 'pip_FOURMOMENTUME', 'pip_FOURMOMENTUMX', 'pip_FOURMOMENTUMY', 'pip_FOURMOMENTUMZ', 'pip_GHOSTPROB', 'pip_ISMUON', 'pip_IS_ABS_ID_pi', 'pip_IS_ID_pi', 'pip_IS_NOT_H', 'pip_IS_PHOTON', 'pip_MASS', 'pip_MC_MOTHER_ID', 'pip_MINIP', 'pip_MINIPCHI2', 'pip_OBJECT_KEY', 'pip_ORIGIN_VX', 'pip_ORIGIN_VY', 'pip_ORIGIN_VZ', 'pip_P', 'pip_PARTICLE_ID', 'pip_PHI', 'pip_PID_E', 'pip_PID_K', 'pip_PID_MU', 'pip_PID_P', 'pip_PID_PI', 'pip_PROBNN_D', 'pip_PROBNN_E', 'pip_PROBNN_GHOST', 'pip_PROBNN_K', 'pip_PROBNN_MU', 'pip_PROBNN_P', 'pip_PROBNN_PI', 'pip_PT', 'pip_PX', 'pip_PY', 'pip_PZ', 'pip_REFERENCEPOINT_X', 'pip_REFERENCEPOINT_Y', 'pip_REFERENCEPOINT_Z', 'pip_SHOWER_SHAPE', 'pip_TX', 'pip_TY', 'B0_ALLPV_IP', 'B0_ALLPV_FD', 'Ds_ALLPV_IP', 'Ds_ALLPV_FD']
#sort the expected vars
B_vars_stored = sorted(B_vars_stored)
#open the TFile and TTree
ntuple = './DV_example_allFunctors_ntp.root'
if not os.path.isfile(ntuple): raise Exception(f"File: {ntuple} does not exist!")
f = TFile.Open(ntuple)
t_B = f.Get('B0DsK_Tuple/DecayTree')
#sort the stores vars
b_names = sorted([b.GetName() for b in t_B.GetListOfLeaves()])
B_excluded_1 = set(B_vars_stored) - set(b_names)
B_excluded_2 = set(b_names) - set(B_vars_stored)
if len(B_excluded_1) != 0: raise Exception('Number of stored variables is less than what is expected. The extra variables expected are: ' , B_excluded_1)
if len(B_excluded_2) != 0: raise Exception('Number of stored variables is greater than what is expected. The extra variables stored are: ', B_excluded_2)
f.Close()
print('Test successfully completed!')
os.system(f"rm {ntuple}")
countErrorLines({"FATAL":0, "ERROR":0})
</text></argument>
</extension>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment