key4hep / k4FWCore

Core Components for the Gaudi-based Key4hep Framework
Apache License 2.0
10 stars 26 forks source link

Alternatives for `EventCounter` removed with`GaudiAlg` #219

Open m-fila opened 1 month ago

m-fila commented 1 month ago

A number of repositories uses the EventCounter that was part of the deprecated GaudiAlg:

The EventCounter algorithm itself is simple as it just increments its internal counter on each execution and prints the counter's value on finalize and heartbeat on execution:

The solutions involving a separate algorithm doing counting would require to put it in sequential sequencer when used with the AvalancheSchedulerSvc (no data dependencies declared so the algorithm could be executed in any order with the respect to the other algorithms)

Alternatively, the information about the event number as seen from a scheduler can be accesses with EventContext

tmadlener commented 3 weeks ago

Can we have a sort of combination of things? Something like an EventCounter algorithm that simply prints the event number from the EventContext for the hearbeat with an internal Gaudi::Accumulator::Counter for printing the summary?

m-fila commented 3 weeks ago

Can we have a sort of combination of things? Something like an EventCounter algorithm that simply prints the event number from the EventContext for the hearbeat with an internal Gaudi::Accumulator::Counter for printing the summary?

We can, no problem

As we discussed it's used mainly for debugging and it's not clear if there are better ways to debug especially in multi-threaded environment