Trivial MCTuple with MCPrimaries on spruced data results in segfault
The following MC tuple running on events with settings in test_spruce_MCtools.yaml
results in a segmentation fault with DaVinci v63r7:
from PyConf.reading import get_particles, get_mc_particles, get_mc_track_info, get_mc_header
import Functors as F
from DaVinciMCTools import MCReconstructible as MCRectible, MCReconstructed as MCRected
from FunTuple import FunctorCollection, functorcollections as functorcollections_original
from FunTuple import FunTuple_Particles as Funtuple, FunTuple_MCParticles as MCFuntuple
from DaVinci import Options, make_config
from DaVinciMCTools import MCTruthAndBkgCat
from PyConf.reading import get_pp2mcp_relations
def main(options: Options):
mc_data = get_mc_particles("/Event/Spruce/HLT2/MC/Particles")
mc_header = get_mc_header()
# PP2MCP relations
relations_charged = get_pp2mcp_relations(
"/Event/Spruce/HLT2/Relations/ChargedPP2MCP")
relations_neutral = get_pp2mcp_relations(
"/Event/Spruce/HLT2/Relations/NeutralPP2MCP")
# Get variables related to reconstructible information.
mcrtible = MCRectible(
input_mctrackinfo=get_mc_track_info()) # tes location of MC track info
# Get variables related to reconstructed information.
mcrted_all = MCRected(input_mcparticles=mc_data, use_best_mcmatch=False,
relations_charged=relations_charged,
relations_neutral=relations_neutral)
FC = functorcollections_original
mc_collections = [
FC.MCReconstructible(mcreconstructible_alg=mcrtible, extra_info=True),
#FC.MCReconstructed(mcreconstructed_alg=mcrted_all, extra_info=False),
#FC.MCHierarchy(),
#FC.MCVertexInfo(),
#FC.MCPromptDecay(),
]
evt_collections = [
FC.EventInfo(),
]
mc_evt_collections = [
FC.EventInfo(),
FC.MCPrimaries(mc_header=mc_header),
]
mc_field_vars = FunctorCollection()
for coll in mc_collections:
mc_field_vars += coll
evt_vars = FunctorCollection()
for coll in evt_collections:
evt_vars += coll
mc_evt_vars = FunctorCollection()
for coll in mc_evt_collections:
mc_evt_vars += coll
mc_fields = {"piplus": "[pi+]CC"};
mc_variables = {
"piplus": mc_field_vars,
}
mc_tuple = MCFuntuple(
name="MCTuple",
tuple_name="DecayTree",
fields=mc_fields,
variables=mc_variables,
event_variables=mc_evt_vars,
inputs=mc_data)
return make_config(options, [mc_data, mc_header, mc_tuple])
The following seems to be responsible:
The lines below might hint at the cause of the crash. If you see question
marks as part of the stack trace, try to recompile with debugging information
enabled and export CLING_DEBUG=1 environment variable before running.
You may get help by asking at the ROOT forum https://root.cern/forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at https://root.cern/bugs Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#7 0x00007f0dac05ce13 in Functors::PreparedFunctor<std::any ()>::PreparedFunctorImpl<Functors::detail::prepared<Functors::detail::ComposedFunctor<Functors::detail::composition::chain, Functors::Function, Functors::Function, Functors::Functional::Map<Functors::detail::ComposedFunctor<Functors::detail::composition::chain, Functors::Function, Functors::Function, Functors::Functional::ValueOr<float>, Functors::Common::X_Coordinate, Functors::Common::Position> >, Functors::detail::ComposedFunctor<Functors::detail::composition::bind, Functors::Function, Functors::Function, Functors::Simulation::MCHeader::AllPVs, Functors::Common::TES<LHCb::MCHeader> > > > >::operator()() const () from /tmp/ldufour/FunctorJitLib_0x9ccfa65cc6c84c00_0x198f3a85cffea851.so
#8 0x00007f0d9e37351d in std::__invoke_impl<std::any, Functors::PreparedFunctor<std::any ()>::IPreparedFunctor&>(std::__invoke_other, Functors::PreparedFunctor<std::any ()>::IPreparedFunctor&) (__f=...) at /cvmfs/lhcb.cern.ch/lib/lcg/releases/gcc/12.1.0-57c96/x86_64-centos7/include/c++/12.1.0/bits/invoke.h:61
#9 std::__invoke<Functors::PreparedFunctor<std::any ()>::IPreparedFunctor&>(Functors::PreparedFunctor<std::any ()>::IPreparedFunctor&) (__fn=...) at /cvmfs/lhcb.cern.ch/lib/lcg/releases/gcc/12.1.0-57c96/x86_64-centos7/include/c++/12.1.0/bits/invoke.h:97
#10 std::invoke<Functors::PreparedFunctor<std::any ()>::IPreparedFunctor&>(Functors::PreparedFunctor<std::any ()>::IPreparedFunctor&) (__fn=...) at /cvmfs/lhcb.cern.ch/lib/lcg/releases/gcc/12.1.0-57c96/x86_64-centos7/include/c++/12.1.0/functional:111
#11 Functors::PreparedFunctor<std::any ()>::operator()() const (this=0x7f0d96bc7ef0) at /workspace/build/REC/REC_v35r7/InstallArea/x86_64_v3-centos7-gcc12+detdesc-opt+g/include/Functors/Core.h:339
#12 FunTupleBase<Gaudi::NamedRange_<std::vector<LHCb::MCParticle const*, std::allocator<LHCb::MCParticle const*> >, __gnu_cxx::__normal_iterator<LHCb::MCParticle const* const*, std::vector<LHCb::MCParticle const*, std::allocator<LHCb::MCParticle const*> > > > >::fill_void_func_output (this=this
entry=0x130db580, ntuple=...) at ../Phys/FunTuple/src/FunTuple.cpp:758
#13 0x00007f0d9e37a3c5 in FunTupleBase<Gaudi::NamedRange_<std::vector<LHCb::MCParticle const*, std::allocator<LHCb::MCParticle const*> >, __gnu_cxx::__normal_iterator<LHCb::MCParticle const* const*, std::vector<LHCb::MCParticle const*, std::allocator<LHCb::MCParticle const*> > > > >::write_tuple<Gaudi::NamedRange_<std::vector<LHCb::MCParticle const*, std::allocator<LHCb::MCParticle const*> >, __gnu_cxx::__normal_iterator<LHCb::MCParticle const* const*, std::vector<LHCb::MCParticle const*, std::allocator<LHCb::MCParticle const*> > > >, true> (this=this
entry=0x130db580, vector_of_cands=...) at ../Phys/FunTuple/src/FunTuple.cpp:698
#14 0x00007f0d9e37a7da in FunTupleBase<Gaudi::NamedRange_<std::vector<LHCb::MCParticle const*, std::allocator<LHCb::MCParticle const*> >, __gnu_cxx::__normal_iterator<LHCb::MCParticle const* const*, std::vector<LHCb::MCParticle const*, std::allocator<LHCb::MCParticle const*> > > > >::operator() (this=0x130db580, particles=...) at ../Phys/FunTuple/src/FunTuple.cpp:675
#15 0x00007f0d9e359fb2 in _ZZN5Gaudi10Functional7details19filter_evtcontext_tIJNS_11NamedRange_ISt6vectorIPKN4LHCb10MCParticleESaIS8_EEN9__gnu_cxx17__normal_iteratorIPKS8_SA_EEEEEE5applyINS1_8ConsumerIFvRKSG_ENS0_6Traits11BaseClass_tINS5_7DetDesc23ConditionAccessorHolderI13GaudiTupleAlgEEEELb1EEESt5tupleIJ20DataObjectReadHandleISG_EEEEEDaRKT_RT0_ENKUlDpRKT_E_clIJSX_EEEDaS17_ (__closure=<optimized out>) at /cvmfs/lhcb.cern.ch/lib/lcg/releases/gcc/12.1.0-57c96/x86_64-centos7/include/c++/12.1.0/bits/new_allocator.h:90
The problem seems to be related to MCPrimaries
: excluding that solves the segfault.