User hook (JITable) for track references during stepping#10085
Conversation
This commit implements a generic and customizable mechanism
to define and execute a callback during MC stepping. The purpose
of the callback is to create TrackReferences for certain conditions,
but can be used for other purposes (monitoring etc).
The callback just takes the instance to TVirtualMC
The default implementation creates a TrackReference on "IsStop"
whenever the current track already left a TrackReference previously.
The feature needs to be switched on via configurable Parameter
`SimCutParams.stepTrackRefHook=1`
Furthermore, the user can provide own callback implementations
via a macro file "MyHook.C". The implementation should follow the
following pattern:
```
o2::steer::O2MCApplicationBase::TrackRefFcn trackRefHook() { return [](TVirtualMC const* vmc) { auto stack = (o2::data::Stack*)vmc->GetStack(); if (vmc->IsTrackStop() && stack->currentTrackLeftTrackRef()) { // we add a stopping TrackRef when the current track already // registered previous TrackRefs stack->addTrackReference(o2::TrackReference(*vmc, 0)); } }; }
```
MyHook.C will be activated with
`SimCutParams.mCutParams.stepTrackRefHookFile=PATHTO/MyHook.C`
|
Error while checking build/O2/fullCI for 539e857 at 2022-10-14 21:17: Full log here. |
|
Error while checking build/O2/fullCI for f3de58e at 2022-10-15 02:35: Full log here. |
|
Reading the source code the default callback (if enabled) is one For me it is good default |
|
The standard hook is fine with me. I understand that this might not be the case once the hook changes, but it is definitely an expert action. Also, we will never create more TrackRefernces than there are particles in the stack. |
This commit implements a generic and customizable mechanism to define and execute a callback during MC stepping. The purpose of the callback is to create TrackReferences for certain conditions, but can be used for other purposes (monitoring etc). The callback just takes the instance to TVirtualMC
The default implementation creates a TrackReference on "IsStop" whenever the current track already left a TrackReference previously.
The feature needs to be switched on via configurable Parameter
SimCutParams.stepTrackRefHook=1Furthermore, the user can provide own callback implementations via a macro file "MyHook.C". The implementation should follow the following pattern:
MyHook.C will be activated with
SimCutParams.mCutParams.stepTrackRefHookFile=PATHTO/MyHook.C