Legacy trigger IDC cachefix ATR-20355
Attempt to solve the problems in ATR-20355. I previously cleared the IDC new event clearing (in !26692 (merged)) because I thought they were created fresh every event, but this is not the case in legacy trigger software.
I also clean up some const_cast and const correctness.
cc @tbold