ROOTObjectWriter produces inconsistent trees if first event does not deposit charge
Summary
If there is no energy deposited in one of the detectors in the very first event, no DepositedCharge
message is sent out and the ROOTTreeWriter will not allocate a tree for this. This means, the tree is only created when the first message is received, resulting in a different number of entries e.g. for the MCTrack
and the DepositedCharge
tree as well as a misalignment between the entries.
An alternative is that very little energy is deposited but not pass the threshold. Then we do send messages (and create trees) for DepositedCharge
, PropagatedCharge
, PixelCharge
but do not create the PixelHit
tree because it fell below threshold.
In general that's not a problem and the tree would be filled with an empty entry, but if it's the first event, the tree is not created and will thus result in a broken output file.
The same holds true for other messages, the general problem is how we determine which trees need to be created.
What is the current bug behavior?
Sanity of output trees depend on content of very first event simulated.
What is the expected correct behavior?
Output trees should always contain the same number of entries ( = number of events simulated) independently of the first event of the simulation. Their entries should always correspond to each other.
(cc) @smurphy