Message Passing Issues with Redirection
This is a follow-up of #167 (closed).
Sebatstian reports an issue with message passing. The example is taken straight from the manual and is now working at all.
Copying my answer from the forum:
the reason is a bit intricate and only shows up on TRACE
logging level:
|18:31:20.428| (TRACE) Running event 3 [DetectorHistogrammer:detector1_low_noise]
|18:31:20.428| (TRACE) Not all required messages are received for DetectorHistogrammer:detector1_low_noise, skipping module!
|18:31:20.428| (TRACE) Running event 3 [DetectorHistogrammer:detector1_high_noise]
|18:31:20.428| (TRACE) Not all required messages are received for DetectorHistogrammer:detector1_high_noise, skipping module!
The underlying reason is discussed in an old ticket and summarized below:
- The
DetectorHistogrammer
requires two input messages:PixelHit
andMCParticle
, the former optional, the latter mandatory to be able to calculate efficiencies. - Your
DepositionPointCharge
dispatchesMCParticle
(unnamed message) andDepositedCharge
. - The
DefaultDigitizer
receives an (unnamed)PixelCharge
message and dispatches a namedPixelHit
. - The
DetectorHistogrammer
listens forhigh_noise
-named messages, receives the namedPixelHit
message but no namedMCParticle
message.
I have not yet found a clean/clear way of solving this issue but I agree that the setup as you have it is a sensible configuration that we should make working.
The only solution I came up with so far is to write a MessageRelay
module which you can find here:
[MessageRelay]
include = MCParticle
output = "low_noise"
which redispatches unnamed messages (in this case) under a new name:
|18:43:56.218| (TRACE) (Event 3) [R:DepositionPointCharge:detector1] Sending message Message<allpix::MCParticle> from DepositionPointCharge:detector1 to generic listener MessageRelay:detector1_high_noise
[...]
|18:47:14.291| (DEBUG) (Event 3) [R:MessageRelay:detector1_low_noise] Relaying 1 messages
|18:47:14.291| (DEBUG) (Event 3) [R:MessageRelay:detector1_low_noise] Relaying message with 1 objects from detector detector1
|18:47:14.291| (TRACE) (Event 3) [R:MessageRelay:detector1_low_noise] Sending message Message<allpix::MCParticle> from MessageRelay:detector1_low_noise to DetectorHistogrammer:detector1_low_noise
|18:47:14.291| (TRACE) Running event 3 [DetectorHistogrammer:detector1_low_noise]
|18:47:14.291| (DEBUG) (Event 3) [R:DetectorHistogrammer:detector1_low_noise] Received 2 pixel hits
However, in its current version (and probably the current version of the messaging system) this doesn't work with multiple relays because messages start piling up...
|18:49:39.962| (TRACE) Running event 3 [MessageRelay:detector1_low_noise]
|18:49:39.962| (DEBUG) (Event 3) [R:MessageRelay:detector1_low_noise] Relaying 1 messages
|18:49:39.962| (DEBUG) (Event 3) [R:MessageRelay:detector1_low_noise] Relaying message with 1 objects from detector detector1
|18:49:39.962| (TRACE) (Event 3) [R:MessageRelay:detector1_low_noise] Sending message Message<allpix::MCParticle> from MessageRelay:detector1_low_noise to DetectorHistogrammer:detector1_low_noise
|18:49:39.962| (TRACE) (Event 3) [R:MessageRelay:detector1_low_noise] Sending message Message<allpix::MCParticle> from MessageRelay:detector1_low_noise to generic listener MessageRelay:detector1_high_noise
|18:49:39.962| (TRACE) (Event 3) [R:MessageRelay:detector1_low_noise] Message relay received Message<allpix::MCParticle> named low_noise
[...]
|18:49:39.984| (TRACE) Running event 3 [MessageRelay:detector1_high_noise]
|18:49:39.984| (DEBUG) (Event 3) [R:MessageRelay:detector1_high_noise] Relaying 2 messages
|18:49:39.984| (DEBUG) (Event 3) [R:MessageRelay:detector1_high_noise] Relaying message with 1 objects from detector detector1
|18:49:39.984| (TRACE) (Event 3) [R:MessageRelay:detector1_high_noise] Sending message Message<allpix::MCParticle> from MessageRelay:detector1_high_noise to DetectorHistogrammer:detector1_high_noise
|18:49:39.984| (TRACE) (Event 3) [R:MessageRelay:detector1_high_noise] Sending message Message<allpix::MCParticle> from MessageRelay:detector1_high_noise to generic listener MessageRelay:detector1_low_noise
|18:49:39.984| (TRACE) (Event 3) [R:MessageRelay:detector1_high_noise] Message relay received Message<allpix::MCParticle> named high_noise
|18:49:39.984| (DEBUG) (Event 3) [R:MessageRelay:detector1_high_noise] Relaying message with 1 objects from detector detector1
|18:49:39.984| (TRACE) (Event 3) [R:MessageRelay:detector1_high_noise] Sending message Message<allpix::MCParticle> from MessageRelay:detector1_high_noise to DetectorHistogrammer:detector1_high_noise
|18:49:39.985| (FATAL) Error during execution of run:
Unexpected message Message<allpix::MCParticle> received by module DetectorHistogrammer:detector1_high_noise (only a single one expected per event)
Please check your configuration and modules. Cannot continue.
@slachnit any ideas? You might not have dug into our message hub so far..