key4hep / k4EDM4hep2LcioConv

EDM4hep to LCIO Converter
1 stars 11 forks source link

Seg fault when running `lcio2edm4hep`? #78

Closed alexandertuna closed 2 months ago

alexandertuna commented 2 months ago

Hi developers, @headunderheels and I are playing with the lcio2edm4hep executable and a few lcio files. One of our lcio files causes lcio2edm4hep to have a segmentation violation. I have hypotheses about what is happening, but I think you would figure it out much faster in case you have a moment.

To reproduce (< 1 min):

# File size: 20 MB
# `check_missing_cols` is from LCIO
wget http://osdf-public.tempest.uchicago.edu:1094/ospool/uc-shared/public/futurecolliders/tuna/data/photonGun_E_0_50_reco_10400.slcio
check_missing_cols photonGun_E_0_50_reco_10400.slcio --minimal > patch.txt
lcio2edm4hep photonGun_E_0_50_reco_10400.slcio tmp patch.txt

Log file: log.lcio2edm4hep.2024_07_01_19h00m00s.txt

Thanks for any help! And thanks for writing this nice software. Alex


tmadlener commented 2 months ago

Thanks for report and the nice reproducer. I can reproduce this on my end, and I am fairly certain that the "issue" in this case is that one of the events does not have any SimCalorimeterHits. In that case we seem to not create a CaloHitContribution collection. Hence, podio crashes (or throws an exception with a bit more information on newer versions) because it requires all events to have the same contents (collection wise). We had a similar issue already in https://github.com/key4hep/k4FWCore/issues/156, but apparently we didn't properly back port that. I will prepare a fix later today.

Just for completeness (and for my curiosity), where did you get the software from? (i.e. a key4hep nightlies / release stack or a MuColl container, or somewhere else)

The event in question is most likely this one:

VENT: 10454
RUN: 0
DETECTOR: MuColl_10TeV_v0A
COLLECTIONS: (see below)
///////////////////////////////////

---------------------------------------------------------------------------
COLLECTION NAME               COLLECTION TYPE          NUMBER OF ELEMENTS  
===========================================================================
AllTracks                     Track                            0
ECalBarrelCollection          SimCalorimeterHit                0
ECalEndcapCollection          SimCalorimeterHit                0
HCalBarrelCollection          SimCalorimeterHit                0
HCalEndcapCollection          SimCalorimeterHit                0
IBTrackerHits                 TrackerHitPlane                  6
IBTrackerHitsRelations        LCRelation                       6
IETrackerHits                 TrackerHitPlane                  0
IETrackerHitsRelations        LCRelation                       0
InnerTrackerBarrelCollection  SimTrackerHit                   19
InnerTrackerEndcapCollection  SimTrackerHit                    0
JetOut                        ReconstructedParticle            0
MCParticle                    MCParticle                     175
MCParticle_SiTracks           LCRelation                       0
MCParticle_SiTracks_Refitted  LCRelation                       0
MUON                          CalorimeterHit                   0
OBTrackerHits                 TrackerHitPlane                  0
OBTrackerHitsRelations        LCRelation                       0
OETrackerHits                 TrackerHitPlane                  0
OETrackerHitsRelations        LCRelation                       0
OuterTrackerBarrelCollection  SimTrackerHit                    0
OuterTrackerEndcapCollection  SimTrackerHit                    0
PandoraClusters               Cluster                          0
PandoraPFOs                   ReconstructedParticle            0
PandoraStartVertices          Vertex                           0
RelationMuonHit               LCRelation                       0
SeedTracks                    Track                            0
SiTracks                      Track                            0
SiTracks_Refitted             Track                            0
VBTrackerHits                 TrackerHitPlane                  0
VBTrackerHitsRelations        LCRelation                       0
VETrackerHits                 TrackerHitPlane                  0
VETrackerHitsRelations        LCRelation                       0
VertexBarrelCollection        SimTrackerHit                    0
VertexEndcapCollection        SimTrackerHit                    0
YokeBarrelCollection          SimCalorimeterHit                0
YokeEndcapCollection          SimCalorimeterHit                0
---------------------------------------------------------------------------
tmadlener commented 2 months ago

If you have created #79, which fixes the issue for me and I can successfully convert the whole event.

alexandertuna commented 2 months ago

Thanks very much @tmadlener !

the "issue" in this case is that one of the events does not have any SimCalorimeterHits

That makes sense to us! We were suspicious of this event, too. Thanks for tracking it down in the code.

where did you get the software from? (i.e. a key4hep nightlies / release stack or a MuColl container, or somewhere else)

This is from a mucol container, yep. I'm not sure how to check software versions within this container. Do you have a suggestion for that? I noticed lcio2edm4hep and k4run don't have --version arguments.

If you have created https://github.com/key4hep/k4EDM4hep2LcioConv/pull/79, which fixes the issue for me and I can successfully convert the whole event.

Awesome!! Sounds great to me.

tmadlener commented 2 months ago

Thanks for the clarifications. Not a lot of our (aka Key4hep) stuff currently has a --version flag. podio-dump --version should give you a hint. But with the link to dockerhub I basically know enough already :)