Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MarlinProcessorWrapper loops extra event with EvtMax=-1 in ApplicationMgr #208

Open
dudarboh opened this issue Dec 9, 2024 · 4 comments · May be fixed by #210
Open

MarlinProcessorWrapper loops extra event with EvtMax=-1 in ApplicationMgr #208

dudarboh opened this issue Dec 9, 2024 · 4 comments · May be fixed by #210

Comments

@dudarboh
Copy link

dudarboh commented Dec 9, 2024

Issue

Running Gaudi over all events with EvtMax=-1 (the default from the documentation) tries to run one extra event with MarlinProcessprWrapper. Running with EvtMax=manually_set_max_events works without errors.

Reproducible

Running the default reconstruction test from ILDConfig

k4run ILDReconstruction.py --inputFiles=bbudsc_3evt_SIM.slcio

with

EvtMax=-1

Relevant output in the end:

[ MESSAGE0 "MyRecoMCTruthLinker"]  processEvent 2  - 0
MyAIDAProcessor   WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyStatusmonitor   WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MySplitCollecti...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
VXDPlanarDigiPr...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
SITPlanarDigiPr...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
FTDPixelPlanarD...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
FTDStripPlanarD...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
FTDDDSpacePoint...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
SETPlanarDigiPr...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
SETDDSpacePoint...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyTPCDigiProcessorWARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyClupatraProce...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MySiliconTracki...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyForwardTracking WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyTrackSubsetPr...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyFullLDCTracki...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyCompute_dEdxP...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyV0Finder        WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyKinkFinder      WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyRefitProcesso...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyRefitProcesso...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MergeCollection...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MergeCollection...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyEcalBarrelDigi  WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyEcalBarrelReco  WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyEcalBarrelGap...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyEcalEndcapDigi  WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyEcalEndcapReco  WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyEcalEndcapGap...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyEcalRingDigi    WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyEcalRingReco    WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyHcalBarrelDigi  WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyHcalBarrelReco  WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyHcalEndcapDigi  WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyHcalEndcapReco  WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyHcalRingDigi    WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyHcalRingReco    WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MySimpleBCalDigi  WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MySimpleLCalDigi  WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MySimpleLHCalDigi WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyDDSimpleMuonDigiWARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyDDMarlinPandora WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyAdd4MomCovMat...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyAddClusterPro...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyComputeShower...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyphotonCorrect...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyPi0Finder       WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyEtaFinder       WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyEtaPrimeFinder  WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyGammaGammaSol...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyDistilledPFOC...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyLikelihoodPID   WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyRecoMCTruthLi...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
VertexFinder      WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
TrackLengthProc...WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
TOFEstimators0ps  WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
TOFEstimators10ps WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
TOFEstimators50ps WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
TOFEstimators100psWARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
MyPfoAnalysis     WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
CollPacherREC     WARNING LCIO Event reading returned nullptr, so MarlinProcessorWrapper won't execute
EDM4hepOutput       ERROR Could not write event, because the following collections are not present: BCAL, BeamCalCollection, BuildUpVertex, BuildUpVertex_RP, BuildUpVertex_RP_startVertices, BuildUpVertex_V0, BuildUpVertex_V0_RP, BuildUpVertex_V0_RP_startVertices, BuildUpVertex_V0_associatedParticles, BuildUpVertex_associatedParticles, ClupatraTrackSegments, ClupatraTrackSegments_dQdx, ClupatraTracks, ClupatraTracks_dQdx, ClusterMCTruthLink, DistilledPFOs, ECalBarrelSiHitsEven, ECalBarrelSiHitsOdd, ECalEndcapSiHitsEven, ECalEndcapSiHitsOdd, EcalBarrelCollection, EcalBarrelCollectionDigi, EcalBarrelCollectionGapHits, EcalBarrelCollectionRec, EcalBarrelRelationsSimDigi, EcalBarrelRelationsSimRec, EcalEndcapRingCollection, EcalEndcapRingCollectionDigi, EcalEndcapRingCollectionRec, EcalEndcapRingRelationsSimDigi, EcalEndcapRingRelationsSimRec, EcalEndcapsCollection, EcalEndcapsCollectionDigi, EcalEndcapsCollectionGapHits, EcalEndcapsCollectionRec, EcalEndcapsRelationsSimDigi, EcalEndcapsRelationsSimRec, EventHeader, FTDCollection, FTDPixelTrackerHitRelations, FTDPixelTrackerHits, FTDSpacePointRelations, FTDSpacePoints, FTDStripTrackerHitRelations, FTDStripTrackerHits, FTD_PIXELCollection, FTD_STRIPCollection, ForwardTracks, ForwardTracks_dQdx, GammaGammaCandidateEtaPrimes, GammaGammaCandidateEtaPrimes_startVertices, GammaGammaCandidateEtas, GammaGammaCandidateEtas_startVertices, GammaGammaCandidatePi0s, GammaGammaCandidatePi0s_startVertices, GammaGammaParticles, HcalBarrelCollectionDigi, HcalBarrelCollectionRec, HcalBarrelRegCollection, HcalBarrelRelationsSimDigi, HcalBarrelRelationsSimRec, HcalEndcapRingCollection, HcalEndcapRingCollectionDigi, HcalEndcapRingCollectionRec, HcalEndcapRingRelationsSimDigi, HcalEndcapRingRelationsSimRec, HcalEndcapsCollection, HcalEndcapsCollectionDigi, HcalEndcapsCollectionRec, HcalEndcapsRelationsSimDigi, HcalEndcapsRelationsSimRec, KinkRecoParticles, KinkRecoParticles_startVertices, KinkVertices, KinkVertices_associatedParticles, LCAL, LHCAL, LHCalCollection, LumiCalCollection, MCParticles, MCParticlesSkimmed, MCTruthClusterLink, MCTruthMarlinTrkTracksLink, MCTruthRecoLink, MUON, MarlinTrkTracks, MarlinTrkTracksKaon, MarlinTrkTracksKaonMCP, MarlinTrkTracksKaon_dQdx, MarlinTrkTracksMCTruthLink, MarlinTrkTracksProton, MarlinTrkTracksProtonMCP, MarlinTrkTracksProton_dQdx, MarlinTrkTracks_dQdx, PandoraClusters, PandoraPFANewStartVertices, PandoraPFANewStartVertices_associatedParticles, PandoraPFOs, PandoraPFOs_PID_BasicVariablePID, PandoraPFOs_PID_LikelihoodPID, PandoraPFOs_PID_LowMomMuID, PandoraPFOs_PID_ShowerShapesPID, PandoraPFOs_PID_TOFEstimators0ps, PandoraPFOs_PID_TOFEstimators100ps, PandoraPFOs_PID_TOFEstimators10ps, PandoraPFOs_PID_TOFEstimators50ps, PandoraPFOs_PID_TrackLengthProcessor, PandoraPFOs_PID_dEdxPID, PandoraPFOs_startVertices, PrimaryVertex, PrimaryVertex_RP, PrimaryVertex_RP_startVertices, PrimaryVertex_associatedParticles, ProngRecoParticles, ProngRecoParticles_startVertices, ProngVertices, ProngVertices_associatedParticles, RecoMCTruthLink, RelationBCalHit, RelationLHcalHit, RelationLcalHit, RelationMuonHit, SETCollection, SETSpacePointRelations, SETSpacePoints, SETTrackerHitRelations, SETTrackerHits, SITCollection, SITTrackerHitRelations, SITTrackerHits, SiTracks, SiTracks_dQdx, SplitRecoParticles, SplitRecoParticles_startVertices, SplitVertices, SplitVertices_associatedParticles, SubsetTracks, SubsetTracks_dQdx, TPCCollection, TPCLowPtCollection, TPCSpacePointCollection, TPCTrackerHitRelations, TPCTrackerHits, ToolSvc.OutputConversion_CaloHitContributions, V0RecoParticles, V0RecoParticles_startVertices, V0Vertices, V0Vertices_associatedParticles, VXDCollection, VXDTrackerHitRelations, VXDTrackerHits, YokeBarrelCollection, YokeEndcapsCollection
EDM4hepOutput       ERROR Maximum number of errors ( 'ErrorMax':1) reached.
EventLoopMgr      WARNING Execution of algorithm EDM4hepOutput failed
EventLoopMgr        ERROR Error processing event loop.
EventLoopMgr        ERROR Terminating event processing loop due to errors
EventLoopMgr        ERROR Terminating event processing loop due to errors
ApplicationMgr       INFO Application Manager Stopped successfully

Expected result should be exactly as

Running the default reconstruction test from ILDConfig

k4run ILDReconstruction.py --inputFiles=bbudsc_3evt_SIM.slcio

with

EvtMax=3

The same output now:

[ MESSAGE0 "MyRecoMCTruthLinker"]  processEvent 2  - 0
ApplicationMgr       INFO Application Manager Stopped successfully

Environment

AlmaLinux/RockyLinux/RHEL 9 detected
Setting up the Key4hep software stack release latest-opt from CVMFS
Use the following command to reproduce the current environment: 

        source /cvmfs/sw.hsf.org/key4hep/setup.sh -r 2024-11-28

If you have any issues, comments or requests, open an issue at https://github.com/key4hep/key4hep-spack/issues

Note

The EDM4HEP root file is still produced, but one (I guess the last) event is empty.
Seems like an off-by-one error and MarlinProcessprWrapper counts from 1 in this particular case.
This also may arise from the difference between Marlin and Gaudi:
In Gaudi all events is set by EvtMax=-1
In Marlin all events is set by MaxRecordNumber = 0

@tmadlener
Copy link
Contributor

I thought we had fixed this already. See #154

@dudarboh
Copy link
Author

dudarboh commented Dec 9, 2024

#154 is empty and says it is a duplicate of #94.
#94 links to key4hep/k4FWCore#159
key4hep/k4FWCore#159 fixes seg. fault.
And indeed, it does not seg. faults, but catches the empty collections in the "last event" and simply writes empty event in the file.

It also mentioned that key4hep/k4FWCore#125 is potentially related that was fixed in key4hep/k4FWCore#132. But if I understand correctly, it just changes the return code of the program.

But we obviously do not count events properly... This is still here.

@tmadlener
Copy link
Contributor

The underlying problem in this case is that there is no real way here to stop at the "end of an event", we can only schedule a stop during the event to stop after the current event. It should be possible to schedule the stop at the right event to make this appear as if it has stopped after the event.

@dudarboh
Copy link
Author

Ah sorry, I had an impression yesterday that it missed one event because of this error.
But I probably overlooked something because it was late evening...
I cross-checked again today and all three ttbar events seem written correctly.
So it is just a "fancy output in the end" issue and not a "missing events/not working" issue
My bad.

@tmadlener tmadlener linked a pull request Dec 10, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants