/// <summary> /// create the results structures, including the methods map from (detector+multcounter) -> (detector+material) -> (results, method results) /// </summary> public void PrepareINCCResults() { IEnumerator iter = CountingAnalysisResults.GetATypedParameterEnumerator(typeof(Multiplicity)); while (iter.MoveNext()) { bool existed = false; Multiplicity mcr = (Multiplicity)iter.Current; try { existed = INCCAnalysisState.PrepareINCCResults(MeasOption, mcr, (MultiplicityCountingRes)CountingAnalysisResults[mcr]); if (!existed) // it was created just now in PrepareINCCResults { logger.TraceEvent(LogLevels.Verbose, 4028, "Preparing INCC {0} results for {1}", MeasOption.PrintName(), mcr.ToString()); } existed = INCCAnalysisState.PrepareINCCMethodResults(mcr, new INCCSelector(INCCAnalysisState.Methods.selector), this); if (!existed) // it was created just now in PrepareINCCMethodResults { logger.TraceEvent(LogLevels.Verbose, 4029, "Preparing INCC method {0} results for {1}", INCCAnalysisState.Methods.selector.ToString(), mcr.ToString()); } } catch (Exception ex) { logger.TraceEvent(LogLevels.Error, 4027, "PrepareINCCResults error: " + ex.Message); } } }
public MultiplicityCountingRes MultiplicityResults(Multiplicity pk) { if (CountingAnalysisResults.ContainsKey(pk)) { return((MultiplicityCountingRes)CountingAnalysisResults[pk]); } else { return(null); } }
/// <summary> /// Imprint a new measurement with as much information as possible from a results_rec. /// </summary> /// <param name="rec">The results_rec with the measurement details</param> /// <param name="meaId">Unique id for the measurement, from the results_rec fields</param> /// <param name="logger">logger handle</param> /// <returns>A new measurement</returns> public Measurement(INCCResults.results_rec rec, MeasId meaId, LMLoggers.LognLM logger) { HVCalibrationParameters hv = NCC.IntegrationHelpers.GetCurrentHVCalibrationParams(rec.det); MeasurementTuple mt = new MeasurementTuple(new DetectorList(rec.det), rec.tests, rec.norm, rec.bkg, rec.iso, rec.acq, hv); this.mt = mt; this.logger = logger; mid = meaId; InitMisc(); if (rec.det.ListMode) { AnalysisParams = NC.App.LMBD.CountingParameters(rec.det, applySRFromDetector: true); if (meaId.MeasOption.IsListMode()) // pure List Mode, not INCC5 { // for a list-mode-only measurement with a multiplicity analyzer the detector SR params must match at least one of the multiplicity analyzer SR params NCC.IntegrationHelpers.ApplyVSRChangesToDefaultDetector(this); } else // it is an INCC5 analysis driven with LM data { // prepare or identify an active CA entry with matching CA gatewidth and FA, with remaining SR params as the detector AnalysisParams.PrepareMatchingVSR(rec.det.MultiplicityParams); } } else { // prepare analyzer params from detector SR params AnalysisParams = NC.App.LMBD.CountingParameters(rec.det, applySRFromDetector: false); if (!AnalysisParams.Exists(w => { return((w is Multiplicity) && (w as Multiplicity).Equals(rec.det.MultiplicityParams)); })) { AnalysisParams.Add(rec.det.MultiplicityParams); } } // get the INCC5 analysis methods INCCAnalysisState = new INCCAnalysisState(); INCCSelector sel = new INCCSelector(rec.acq.detector_id, rec.acq.item_type); AnalysisMethods am; bool found = NC.App.DB.DetectorMaterialAnalysisMethods.TryGetValue(sel, out am); if (found) { am.selector = sel; // gotta do this so that the equality operator is correct INCCAnalysisState.Methods = am; } else { INCCAnalysisState.Methods = new AnalysisMethods(sel); } InitializeContext(clearCounterResults: true); PrepareINCCResults(); // a list mode measurement may not have a multiplicity analyzer at all, create on results, copying the current values if (CountingAnalysisResults.ContainsKey(rec.det.MultiplicityParams)) { MultiplicityCountingRes mcr = (MultiplicityCountingRes)CountingAnalysisResults[rec.det.MultiplicityParams]; if (rec.mcr.AB.Unset) { SDTMultiplicityCalculator.SetAlphaBeta(rec.det.MultiplicityParams, rec.mcr); // works only if MaxBins is set } mcr.CopyFrom(rec.mcr); // copy the mcr results onto the first moskey entry // the same results are copied to the full results structure MeasOptionSelector mos = new MeasOptionSelector(MeasOption, rec.det.MultiplicityParams); INCCResult result = INCCAnalysisState.Lookup(mos); result.CopyFrom(rec.mcr); } Stratum = new Stratum(rec.st); // the stratum from the results rec }