                             field = String(format: "%d", strip)
                         }
                     }
-                case 17:
+                case keyColumnStartWelSumm:
                     if row == 0 && startParticleType != .recoil {
                         let summ = getSummEnergyFrom(fissionsAlphaWelPerAct)
                         field = String(format: "%.7f", summ)
                     }
-                case 18:
+                case keyColumnStartWelEnergy:
                     if row < fissionsAlphaWelPerAct.count {
                         if let energy = getValueFrom(array: fissionsAlphaWelPerAct, row: row, key: kEnergy) {
                             field = String(format: "%.7f", energy as! Double)
                         }
                     }
-                case 19:
+                case keyColumnStartWelMarker:
                     if row < fissionsAlphaWelPerAct.count {
                         if let marker = getValueFrom(array: fissionsAlphaWelPerAct, row: row, key: kMarker) {
                             field = String(format: "%hu", marker as! CUnsignedShort)
                         }
                     }
-                case 20:
+                case keyColumnStartWelPosition:
                     if row < fissionsAlphaWelPerAct.count {
                         if let info = fissionsAlphaWelPerAct[row] as? [String: Any], let strip_0_15 = info[kStrip0_15], let encoder = info[kEncoder] {
                             field = String(format: "FWel%d.%d", encoder as! CUnsignedShort, (strip_0_15  as! CUnsignedShort) + 1)
                         }
                     }
-                case 21:
+                case keyColumnNeutrons:
                     if row == 0 && searchNeutrons {
                         field = String(format: "%llu", neutronsSummPerAct)
                     }
-                case 22:
+                case keyColumnNeutronsBackward:
                     if row == 0 && searchNeutrons {
                         field = String(format: "%llu", neutronsBackwardSummPerAct)
                     }
-                case 23:
+                case keyColumnGammaEnergy:
                     if row < gammaPerAct.count {
                         if let energy = getValueFrom(array: gammaPerAct, row: row, key: kEnergy) {
                             field = String(format: "%.7f", energy as! Double)
                         }
                     }
-                case 24:
+                case keyColumnGammaDeltaTime:
                     if row < gammaPerAct.count {
                         if let deltaTime = getValueFrom(array: gammaPerAct, row: row, key: kDeltaTime) {
                             field = String(format: "%lld", deltaTime as! CLongLong)
                         }
                     }
-                case 25:
+                case keyColumnSpecial1:
                     if row == 0 {
                         if let v = specialValue(0) {
                             field = String(format: "%hu", v)
                         }
                     }
-                case 26:
+                case keyColumnSpecial2:
                     if row == 0 {
                         if let v = specialValue(1) {
                             field = String(format: "%hu", v)
                         }
                     }
-                case 27:
+                case keyColumnSpecial3:
                     if row == 0 {
                         if let v = specialValue(2) {
                             field = String(format: "%hu", v)
                         }
                     }
-                case 28:
+                case keyColumnBeamEnergy:
                     if row == 0 {
                         if let f = beamRelatedValuesPerAct[dataProtocol.BeamEnergy] {
                             field = String(format: "%.1f", f)
                         }
                     }
-                case 29:
+                case keyColumnBeamCurrent:
                     if row == 0 {
                         if let f = beamRelatedValuesPerAct[dataProtocol.BeamCurrent] {
                             field = String(format: "%.2f", f)
                         }
                     }
-                case 30:
+                case keyColumnBeamBackground:
                     if row == 0 {
                         if let f = beamRelatedValuesPerAct[dataProtocol.BeamBackground] {
                             field = String(format: "%.1f", f)
                         }
                     }
-                case 31:
+                case keyColumnBeamIntegral:
                     if row == 0 {
                         if let f = beamRelatedValuesPerAct[dataProtocol.BeamIntegral] {
                             field = String(format: "%.1f", f)
                         }
                     }
-                case 32:
-                    if searchVETO {
-                        if row < vetoPerAct.count {
-                            if let eventNumber = getValueFrom(array: vetoPerAct, row: row, key: kEventNumber) {
-                                field = currentFileEventNumber(eventNumber as! CUnsignedLongLong)
-                            }
-                        }
-                    } else {
-                        field = alpha2EventNumber(row)
-                    }
-                case 33:
-                    if searchVETO {
-                        if row < vetoPerAct.count {
-                            if let energy = getValueFrom(array: vetoPerAct, row: row, key: kEnergy) {
-                                field = String(format: "%.7f", energy as! Double)
-                            }
-                        }
-                    } else {
-                        field = alpha2Energy(row)
-                    }
-                case 34:
-                    if searchVETO {
-                        if row < vetoPerAct.count {
-                            if let strip_0_15 = getValueFrom(array: vetoPerAct, row: row, key: kStrip0_15) {
-                                field = String(format: "%hu", (strip_0_15 as! CUnsignedShort) + 1)
-                            }
-                        }
-                    } else {
-                        field = alpha2Marker(row)
-                    }
-                case 35:
-                    if searchVETO {
-                        if row < vetoPerAct.count {
-                            if let deltaTime = getValueFrom(array: vetoPerAct, row: row, key: kDeltaTime) {
-                                field = String(format: "%lld", deltaTime as! CLongLong)
-                            }
-                        }
-                    } else {
-                        field = alphs2DeltaTime(row)
-                    }
-                case 36:
+                case keyColumnVetoEvent:
+                    if row < vetoPerAct.count {
+                        if let eventNumber = getValueFrom(array: vetoPerAct, row: row, key: kEventNumber) {
+                            field = currentFileEventNumber(eventNumber as! CUnsignedLongLong)
+                        }
+                    }
+                case keyColumnAlpha2Event:
                     field = alpha2EventNumber(row)
-                case 37:
+                case keyColumnVetoEnergy:
+                    if row < vetoPerAct.count {
+                        if let energy = getValueFrom(array: vetoPerAct, row: row, key: kEnergy) {
+                            field = String(format: "%.7f", energy as! Double)
+                        }
+                    }
+                case keyColumnAlpha2Energy:
                     field = alpha2Energy(row)
-                case 38:
+                case keyColumnVetoStrip:
+                    if row < vetoPerAct.count {
+                        if let strip_0_15 = getValueFrom(array: vetoPerAct, row: row, key: kStrip0_15) {
+                            field = String(format: "%hu", (strip_0_15 as! CUnsignedShort) + 1)
+                        }
+                    }
+                case keyColumnAlpha2Marker:
                     field = alpha2Marker(row)
-                case 39:
+                case keyColumnVetoDeltaTime:
+                    if row < vetoPerAct.count {
+                        if let deltaTime = getValueFrom(array: vetoPerAct, row: row, key: kDeltaTime) {
+                            field = String(format: "%lld", deltaTime as! CLongLong)
+                        }
+                    }
+                case keyColumnAlpha2DeltaTime:
                     field = alphs2DeltaTime(row)
                 default:
                     break

        logger.logCalibration(calibration.stringValue ?? "")
    }
    
    func logResultsHeader() {
        var special1: Int = 0
        var special2: Int = 0
        var special3: Int = 0
        if specialEventIds.count >= 1 {
            special1 = specialEventIds[0]
        }
        if specialEventIds.count >= 2 {
            special2 = specialEventIds[1]
        }
        if specialEventIds.count >= 3 {
            special3 = specialEventIds[2]
        }
        var startParticle: String
        switch startParticleType {
        case .fission:

        default:
            startParticle = ""
        }
        
        columns = [
            keyColumnRecoilEvent,
            keyColumnRecoilEnergy,
            keyColumnRecoilHeavyEnergy,
            keyColumnRecoilFrontMarker,
            keyColumnRecoilDeltaTime,
            keyColumnTof,
            keyColumnTofDeltaTime,
            keyColumnStartEvent,
            keyColumnStartFrontSumm,
            keyColumnStartFrontEnergy,
            keyColumnStartFrontMarker,
            keyColumnStartFrontDeltaTime,
            keyColumnStartFrontStrip,
            keyColumnStartBackEnergy,
            keyColumnStartBackMarker,
            keyColumnStartBackDeltaTime,
            keyColumnStartBackStrip,
            keyColumnStartWelSumm,
            keyColumnStartWelEnergy,
            keyColumnStartWelMarker,
            keyColumnStartWelPosition,
            keyColumnNeutrons,
            keyColumnNeutronsBackward,
            keyColumnGammaEnergy,
            keyColumnGammaDeltaTime,
            keyColumnSpecial1,
            keyColumnSpecial2,
            keyColumnSpecial3,
            keyColumnBeamEnergy,
            keyColumnBeamCurrent,
            keyColumnBeamBackground,
            keyColumnBeamIntegral
        ]
        if searchVETO {
            columns.append(contentsOf: [
                keyColumnVetoEvent,
                keyColumnVetoEnergy,
                keyColumnVetoStrip,
                keyColumnVetoDeltaTime
                ])
        }
        if searchAlpha2 {
            columns.append(contentsOf: [
                keyColumnAlpha2Event,
                keyColumnAlpha2Energy,
                keyColumnAlpha2Marker,
                keyColumnAlpha2DeltaTime
                ])
        }
        
        let headers = columns.joined(separator: ",").replacingOccurrences(of: "$", with: startParticle).components(separatedBy: ",") as [AnyObject]
        logger.writeLineOfFields(headers)
        logger.finishLine() // +1 line padding
    }
    
    func logActResults() {
        let rowsMax = max(1, [gammaPerAct, fissionsAlphaWelPerAct, recoilsFrontPerAct, fissionsAlphaBackPerAct, fissionsAlphaFrontPerAct, vetoPerAct, recoilsBackPerAct].max(by: { $0.count < $1.count })!.count)
        for row in 0 ..< rowsMax {
            for column in columns {
                var field = ""
                switch column {
                case keyColumnRecoilEvent:
                    if row < recoilsFrontPerAct.count {
                        if let eventNumberObject = getValueFrom(array: recoilsFrontPerAct, row: row, key: kEventNumber) {
                            field = currentFileEventNumber(eventNumberObject as! CUnsignedLongLong)
                        }
                    }
                case keyColumnRecoilEnergy:
                    if row < recoilsFrontPerAct.count {
                        if let recoilEnergy = getValueFrom(array: recoilsFrontPerAct, row: row, key: kEnergy) {
                            field = String(format: "%.7f", recoilEnergy as! Double)
                        }
                    }
                case keyColumnRecoilHeavyEnergy:
                    if row < recoilsFrontPerAct.count {
                        if let recoilHeavy = getValueFrom(array: recoilsFrontPerAct, row: row, key: kHeavy) {
                            field = String(format: "%.7f", recoilHeavy as! Double)
                        }
                    }
                case keyColumnRecoilFrontMarker:
                    if row < recoilsFrontPerAct.count {
                        if let marker = getValueFrom(array: recoilsFrontPerAct, row: row, key: kMarker) {
                            field = String(format: "%hu", marker as! CUnsignedShort)
                        }
                    }
                case keyColumnRecoilDeltaTime:
                    if row < recoilsFrontPerAct.count {
                        if let deltaTimeRecoilFission = getValueFrom(array: recoilsFrontPerAct, row: row, key: kDeltaTime) {
                            field = String(format: "%lld", deltaTimeRecoilFission as! CLongLong)
                        }
                    }
                case keyColumnTof:
                    if row < tofRealPerAct.count {
                        if let tof = getValueFrom(array: tofRealPerAct, row: row, key: kValue) {
                            let format = "%." + (unitsTOF == .channels ? "0" : "7") + "f"
                            field = String(format: format, tof as! Double)
                        }
                    }
                case keyColumnTofDeltaTime:
                    if row < tofRealPerAct.count {
                        if let deltaTimeTOFRecoil = getValueFrom(array: tofRealPerAct, row: row, key: kDeltaTime) {
                            field = String(format: "%lld", deltaTimeTOFRecoil as! CLongLong)
                        }
                    }
                case keyColumnStartEvent:
                    if row < fissionsAlphaFrontPerAct.count {
                        if let eventNumber = getValueFrom(array: fissionsAlphaFrontPerAct, row: row, key: kEventNumber) {
                            field = currentFileEventNumber(eventNumber as! CUnsignedLongLong)
                        }
                    }
                case keyColumnStartFrontSumm:
                    if row == 0 && startParticleType != .recoil {
                        let summ = getSummEnergyFrom(fissionsAlphaFrontPerAct)
                        field = String(format: "%.7f", summ)
                    }
                case keyColumnStartFrontEnergy:
                    if row < fissionsAlphaFrontPerAct.count {
                        if let energy = getValueFrom(array: fissionsAlphaFrontPerAct, row: row, key: kEnergy) {
                            field = String(format: "%.7f", energy as! Double)
                        }
                    }
                case keyColumnStartFrontMarker:
                    if row < fissionsAlphaFrontPerAct.count {
                        if let marker = getValueFrom(array: fissionsAlphaFrontPerAct, row: row, key: kMarker) {
                            field = String(format: "%hu", marker as! CUnsignedShort)
                        }
                    }
                case keyColumnStartFrontDeltaTime:
                    if row < fissionsAlphaFrontPerAct.count {
                        if let deltaTime = getValueFrom(array: fissionsAlphaFrontPerAct, row: row, key: kDeltaTime) {
                            field = String(format: "%lld", deltaTime as! CLongLong)
                        }
                    }
                case keyColumnStartFrontStrip:
                    if row < fissionsAlphaFrontPerAct.count {
                        if let info = fissionsAlphaFrontPerAct[row] as? [String: Any], let strip_0_15 = info[kStrip0_15], let encoder = info[kEncoder] {
                            let strip = stripConvertToFormat_1_48(strip_0_15 as! CUnsignedShort, encoder: encoder as! CUnsignedShort)
                            field = String(format: "%d", strip)
                        }
                    }
                case keyColumnStartBackEnergy:
                    let array = startParticleType == .recoil ? recoilsBackPerAct : fissionsAlphaBackPerAct
                    if row < array.count {
                        if let energy = getValueFrom(array: array, row: row, key: kEnergy) {
                            field = String(format: "%.7f", energy as! Double)
                        }
                    }
                case keyColumnStartBackMarker:
                    let array = startParticleType == .recoil ? recoilsBackPerAct : fissionsAlphaBackPerAct
                    if row < array.count {
                        if let marker = getValueFrom(array: array, row: row, key: kMarker) {
                            field = String(format: "%hu", marker as! CUnsignedShort)
                        }
                    }
                case keyColumnStartBackDeltaTime:
                    let array = startParticleType == .recoil ? recoilsBackPerAct : fissionsAlphaBackPerAct
                    if row < array.count {
                        if let deltaTime = getValueFrom(array: array, row: row, key: kDeltaTime) {
                            field = String(format: "%lld", deltaTime as! CLongLong)
                        }
                    }
                case keyColumnStartBackStrip:
                    let array = startParticleType == .recoil ? recoilsBackPerAct : fissionsAlphaBackPerAct
                    if row < array.count {
                        if let info = array[row] as? [String: Any], let strip_0_15 = info[kStrip0_15], let encoder = info[kEncoder] {
