ANNIEsoft / ToolAnalysis

Other
10 stars 53 forks source link

EventBuilding - fix for aux channels not being saved #228

Closed mnieslony closed 1 year ago

mnieslony commented 1 year ago

Bug discovered by @ricfregian which prevents auxiliary channels (such as the AmBe SiPMs) raw waveforms from being stored in the output file when using the default event building mode TankAndMRDAndCTC(AndLAPPD).

During the orphan movement in the ANNIEEventBuilder, the code checks whether a certain electronics channel combination is associated with a regular channel or with an auxiliary channel. However, the relevant code reads

current_chankey = TankPMTCrateSpaceToChannelNumMap[current_cratespace];

Even if the vector current_cratespace does not exist yet as a key in the TanKPMTCrateSpaceToChannelNumMap, it will be inserted by this operation. As a consequence, due to this call in the orphan movement, all electronics channels associated with auxiliary channels will be inserted into the TankPMTCrateSpaceToChannelNumMap for regular channels. They will therefore all be recognized as regular channels with channelkey 0.

This bug leads to auxiliary channels not being saved in the case of using the option for raw waveforms. When using the EventBuilding with Hit information (i.e. with the PhaseIIADCCalibrator and PhaseIIADCHitFinder, not saving the raw waveforms), this bug does not occur since the separation of normal and auxiliary channels happens already in the PhaseII* tools and not in the ANNIEEventBuilder tool.

The bug does also not appear when using the Tank mode of the event builder, since in that case no orphan movement occurs.