/// <summary> /// Transfer the results from the raw analyzers to the current cycle. /// A specific transfer is made for each type of result and for each of those results. /// The gathered results are mapped using the AnalysisParameters entries from the contextual Measurement to corresponding results in the cycle Results map /// </summary> /// <param name="m">Measurement originator of each analyzer param that maps to each result</param> public override bool TransferResults(CountingAnalysisParameters ap) { // accumulate totals on the cycle object from the time/hits processor AccumulateCycleSummary(); // has an effect only if called after StartNewBuffer and additional data has arrived during input processing. bool complete = true; int i = 0; foreach (BaseRate ba in ap.GetBases()) { complete &= cycle.Transfer(ba, Sup.GetIthRateResult(i)); i++; } i = 0; foreach (Multiplicity mu in (ap.GetMults(FAType.FAOn))) { complete &= cycle.Transfer(mu, Sup.GetIthMultiplicityResult(FAType.FAOn, i), i); i++; } i = 0; foreach (Multiplicity mu in (ap.GetMults(FAType.FAOff))) { complete &= cycle.Transfer(mu, Sup.GetIthMultiplicityResult(FAType.FAOff, i), i); i++; } i = 0; foreach (Coincidence co in ap.GetCoincidences()) { complete &= cycle.Transfer(co, Sup.GetIthCoincidenceMatrixResult(i)); i++; } i = 0; foreach (Rossi ro in (ap.GetRossis())) { complete &= cycle.Transfer(ro, Sup.GetIthRossiAlphaResult(i)); i++; } i = 0; foreach (Feynman fy in (ap.GetFeynmans())) { complete &= cycle.Transfer(fy, Sup.GetIthFeynmanResult(i)); i++; } i = 0; foreach (TimeInterval es in (ap.GetTimeIntervals())) { complete &= cycle.Transfer(es, Sup.GetIthTimeIntervalResult(i)); i++; } return(complete); }
public void ReplaceCounters(Detector det, CountingAnalysisParameters cap) { DB.CountingAnalysisParameters db = new DB.CountingAnalysisParameters(); DB.Detectors dets = new DB.Detectors(db.db); long l = dets.PrimaryKey(det.Id.DetectorName); if (l == -1) { return; } foreach (SpecificCountingAnalyzerParams s in cap) { DB.ElementList parms = s.ToDBElementList(); if (parms != null) { db.Delete(l, s.GetType().Name, parms); } } }
/// the details public void UpdateCounters(string detname, CountingAnalysisParameters cap) { DB.CountingAnalysisParameters db = new DB.CountingAnalysisParameters(); foreach(SpecificCountingAnalyzerParams s in cap) { DB.ElementList parms = s.ToDBElementList(); if (parms != null) { db.Update(detname, s.GetType().Name, parms); } } }
/// <summary> /// presumes multiple analyzer results per instrument, detached from specific detector and other settings (for LM) /// </summary> /// <param name="ap"></param> /// <returns></returns> public virtual bool TransferResults(CountingAnalysisParameters ap) { return true; }
private CountingAnalysisParameters CountingParameters(string detname) { DataTable dt = NC.App.Pest.GetACollection(DB.Pieces.CountingAnalyzers, detname); CountingAnalysisParameters cp = new CountingAnalysisParameters(); // 0 is mat name, 1 is det name, 2 is mat id, 3 is det id, 4 is first choice boolean foreach (DataRow dr in dt.Rows) { SpecificCountingAnalyzerParams sca = ConstructCountingAnalyzerParams(dr); cp.Add(sca); } return cp; }
public void ReplaceCounters(Detector det, CountingAnalysisParameters cap) { DB.CountingAnalysisParameters db = new DB.CountingAnalysisParameters(); db.DeleteAll(det.Id.DetectorName); InsertCounters(det.Id.DetectorName, cap); }
public void ReplaceCounters(Detector det, CountingAnalysisParameters cap) { DB.CountingAnalysisParameters db = new DB.CountingAnalysisParameters(); db.DeleteAll(det.Id.DetectorName); InsertCounters(det.Id.DetectorName, cap); }
public AnalysisWizard(AWSteps startHere, AcquireParameters lmap, Detector lmdet) { det = lmdet; ap = lmap; if (startHere == AWSteps.Step1) // fresh List Mode only { ResetMeasurement(); Integ.BuildMeasurement(ap, det, AssaySelector.MeasurementOption.unspecified); } //cntap = CountingAnalysisParameters.Copy(NC.App.Opstate.Measurement.AnalysisParams); alt = CountingAnalysisParameters.Copy(NC.App.Opstate.Measurement.AnalysisParams); InitializeComponent(); // Stack all the panels up on top of each other; window is set to autosize to whatever is visible. this.Step2APanel.Left = 4; this.Step2APanel.Top = 6; this.Step2BPanel.Left = 4; this.Step2BPanel.Top = 6; this.Step3Panel.Left = 4; this.Step3Panel.Top = 6; this.Step4Panel.Left = 4; this.Step4Panel.Top = 6; state = startHere; if (state != AWSteps.Step1) { fromINCCAcquire = true; ap.data_src = (state == AWSteps.Step2B ? ConstructedSource.Live : ConstructedSource.NCDFile); // default file type is NCD, updated in UI from acquire param details } CycleIntervalPatch(); // guard for bad LM cycle and interval // Set the visibilities correctly for the initial state UpdateUI(); }
/// <summary> /// presumes multiple analyzer results per instrument, detached from specific detector and other settings (for LM) /// </summary> /// <param name="ap"></param> /// <returns></returns> public virtual bool TransferResults(CountingAnalysisParameters ap) { return(true); }
// build up the requested analyses for this run from the list of analyzer params internal void PrepareAndStartCountingAnalyzers(CountingAnalysisParameters ap) { if (ap == null) { logger.TraceEvent(LogLevels.Error, 1519, "No counting analyzers specified"); return; } bool good = false; foreach (SpecificCountingAnalyzerParams sap in ap) { if (!sap.Active) // skip disabled analyzers continue; if (sap is BaseRate) { BaseRate b = (BaseRate)sap; good = State.Sup.AddRates(b.gateWidthTics); if (!good) { // perhaps the gate is too large // dev note : each analyzer should publish it's limits with constant attributes on the class good = State.Sup.AddRates(b.gateWidthTics = (ulong)1e7); logger.TraceEvent(LogLevels.Warning, 1512, "Rate analyzer gatewidth created with default {0} ticks", b.gateWidthTics); } } else if (sap is Multiplicity) { Multiplicity m = (Multiplicity)sap; good = State.Sup.AddMultiplicity(m, m.FA); } else if (sap is Rossi) { Rossi r = (Rossi)sap; good = State.Sup.AddRossi(r.gateWidthTics); } else if (sap is Feynman) { Feynman f = (Feynman)sap; good = State.Sup.AddFeynman(f.gateWidthTics); } else if (sap is TimeInterval) { TimeInterval ti = (TimeInterval)sap; good = State.Sup.AddTimeInterval(ti.gateWidthTics); } else if (sap is Coincidence) { Coincidence co = (Coincidence)sap; good = State.Sup.AddCoincidenceMatrix(co); } } }
/// <summary> /// Transfer the results from the raw analyzers to the current cycle. /// A specific transfer is made for each type of result and for each of those results. /// The gathered results are mapped using the AnalysisParameters entries from the contextual Measurement to corresponding results in the cycle Results map /// </summary> /// <param name="m">Measurement originator of each analyzer param that maps to each result</param> public override bool TransferResults(CountingAnalysisParameters ap) { // accumulate totals on the cycle object from the time/hits processor AccumulateCycleSummary(); // has an effect only if called after StartNewBuffer and additional data has arrived during input processing. bool complete = true; int i = 0; foreach (BaseRate ba in ap.GetBases()) { complete &= cycle.Transfer(ba, Sup.GetIthRateResult(i)); i++; } i = 0; foreach (Multiplicity mu in (ap.GetMults(FAType.FAOn))) { complete &= cycle.Transfer(mu, Sup.GetIthMultiplicityResult(FAType.FAOn, i), i); i++; } i = 0; foreach (Multiplicity mu in (ap.GetMults(FAType.FAOff))) { complete &= cycle.Transfer(mu, Sup.GetIthMultiplicityResult(FAType.FAOff, i), i); i++; } i = 0; foreach (Coincidence co in ap.GetCoincidences()) { complete &= cycle.Transfer(co, Sup.GetIthCoincidenceMatrixResult(i)); i++; } i = 0; foreach (Rossi ro in (ap.GetRossis())) { complete &= cycle.Transfer(ro, Sup.GetIthRossiAlphaResult(i)); i++; } i = 0; foreach (Feynman fy in (ap.GetFeynmans())) { complete &= cycle.Transfer(fy, Sup.GetIthFeynmanResult(i)); i++; } i = 0; foreach (TimeInterval es in (ap.GetTimeIntervals())) { complete &= cycle.Transfer(es, Sup.GetIthTimeIntervalResult(i)); i++; } return complete; }
// LMDAQ.DAQControl.gControl.SRWrangler.GetResults(); //} public override bool TransferResults(CountingAnalysisParameters ap) { // accumulate totals on the cycle object from the time/hits processor AccumulateCycleSummary(); // has an effect only if called after StartNewBuffer and additional data has arrived during input processing return true; }
// STATE 5 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void PreserveNewState() { // 1: create the analysis param objects // 2: associate the analysis params with the current detector/instrument definition (part of the contextual measurement state) // devnote: permitting only one per run FTTB, so clear the list! // NEXT: Need to support multiple analyzers of each type from the UI CountingAnalysisParameters cntap = new CountingAnalysisParameters(); foreach (string s in LMAnalyzers.Items) { AWAnalysisType at = CheckBoxTextMap(s); bool chosenForUse = LMAnalyzers.GetItemChecked(ixamap[(int)at]); switch (at) { case AWAnalysisType.Rossi: AnalysisDefs.Rossi r = alt.GetFirstRossi(activeOnly: false, addIfNotPresent: true); r.Active = chosenForUse; cntap.Add(r); break; case AWAnalysisType.Rates: this.Step4Param1TextBox.Text = this.SharedGateWidthTextBox.Text; AnalysisDefs.BaseRate b = alt.GetFirstRate(activeOnly: false, addIfNotPresent: true); b.Active = chosenForUse; cntap.Add(b); break; case AWAnalysisType.Event: this.Step4Param1TextBox.Text = this.SharedGateWidthTextBox.Text; AnalysisDefs.TimeInterval ti = alt.GetFirstTimeInterval(activeOnly: false, addIfNotPresent: true); ti.Active = chosenForUse; cntap.Add(ti); break; case AWAnalysisType.Feynman: this.Step4Param1TextBox.Text = this.SharedGateWidthTextBox.Text; AnalysisDefs.Feynman f = alt.GetFirstFeynman(activeOnly: false, addIfNotPresent: true); f.Active = chosenForUse; cntap.Add(f); break; case AWAnalysisType.CoinMat: // like mult infra AnalysisDefs.Coincidence co = alt.GetFirstCoincidence(activeOnly: false, addIfNotPresent: true); co.Active = chosenForUse; // NEXT: CoinMat is incomplete and untested // todo: these steps might occur during analysis processing too, check //MultiplicityCountingRes mcr1 = new MultiplicityCountingRes(co.FA, 0); //INCCCycleConditioning.calc_alpha_beta(co, mcr1); //det.AB.TransferIntermediates(mcr1.AB); // todo: the detector must get mFA predelay and gatewidth assigned back to it after the construction steps here cntap.Add(co); break; case AWAnalysisType.Mult: this.Step4Param1TextBox.Text = this.MultConvAccInitDelayTextBox.Text; this.Step4Param2TextBox.Text = this.MultConvAccGateWidthTextBox.Text; this.Step4Param3TextBox.Text = this.MultConvAccClockWidthTextBox.Text; AnalysisDefs.Multiplicity mFAOff = new AnalysisDefs.Multiplicity(AnalysisDefs.FAType.FAOff); mFAOff.SR = new ShiftRegisterParameters(det.SRParams); ulong u; if (UInt64.TryParse(this.MultConvAccClockWidthTextBox.Text, out u)) // ok mFAOff.AccidentalsGateDelayInTics = u; if (UInt64.TryParse(this.MultConvAccInitDelayTextBox.Text, out u)) // on SR mFAOff.SR.predelay = u; if (UInt64.TryParse(this.MultConvAccGateWidthTextBox.Text, out u)) // from SR def mFAOff.SetGateWidthTics(u); mFAOff.Active = chosenForUse; cntap.Add(mFAOff); break; case AWAnalysisType.MultFast: this.Step4Param1TextBox.Text = this.MultFastAccInitDelayTextBox.Text; this.Step4Param2TextBox.Text = this.MultFastAccGateWidthTextBox.Text; this.Step4Param3TextBox.Text = this.MultFastAccClockWidthTextBox.Text; AnalysisDefs.Multiplicity mFA = new AnalysisDefs.Multiplicity(AnalysisDefs.FAType.FAOn); mFA.SR = new ShiftRegisterParameters(det.SRParams); ulong v; if (UInt64.TryParse(this.MultFastAccInitDelayTextBox.Text, out v)) // ok mFA.SR.predelay = v; if (UInt64.TryParse(this.MultFastAccClockWidthTextBox.Text, out v)) // ok mFA.BackgroundGateTimeStepInTics = v; if (UInt64.TryParse(this.MultFastAccGateWidthTextBox.Text, out v)) // ok mFA.SetGateWidthTics(v); mFA.Active = chosenForUse; cntap.Add(mFA); break; default: break; } } // at last, assign the analyzer(s) to the global measurement structure NC.App.Opstate.Measurement.AnalysisParams = cntap; NC.App.LMBD.UpdateCounters(det, cntap); NC.App.DB.UpdateDetectorParams(det); // gw and predelay values! if (NC.App.AppContext.modified) NC.App.LMBD.UpdateLMINCCAppContext(); Integ.ApplyVSRChangesToDefaultDetector(NC.App.Opstate.Measurement); }
public void UpdateCounters(Detector det, CountingAnalysisParameters cap) { UpdateCounters(det.Id.DetectorName, cap); }
public IDDAcquireRatesOnly() { InitializeComponent(); // Generate an instance of the generic acquire dialog event handlers object (this now includes the AcquireParameters object used for change tracking) ah = new AcquireHandlers(); ah.mo = AssaySelector.MeasurementOption.rates; Text += " for detector " + ah.det.Id.DetectorName; // Populate the UI fields with values from the local AcquireParameters object QCTestsCheckbox.Checked = ah.ap.qc_tests; PrintResultsCheckBox.Checked = ah.ap.print; CommentAtEndCheckBox.Checked = ah.ap.ending_comment; NumCyclesTextBox.Text = Format.Rend(ah.ap.num_runs); CommentTextBox.Text = ah.ap.comment; CountTimeTextBox.Text = Format.Rend(ah.ap.run_count_time); ItemIdTextBox.Text = ah.ap.item_id; MeasPrecisionTextBox.Text = ah.ap.meas_precision.ToString("F2"); MinNumCyclesTextBox.Text = Format.Rend(ah.ap.min_num_runs); MaxNumCyclesTextBox.Text = Format.Rend(ah.ap.max_num_runs); if (ah.det.ListMode) { //Make sure we have a default analyzer for the LM instrument with parms as set in measurement parameters. ah.det.MultiplicityParams.gateWidthTics = (ulong)ah.det.SRParams.gateLengthMS * 10; if (ah.det.MultiplicityParams.FA == FAType.FAOn) { ah.det.MultiplicityParams.AccidentalsGateDelayInTics = 10; } else { ah.det.MultiplicityParams.AccidentalsGateDelayInTics = 40960; } // prepare analyzer params from detector SR params and only activate the SRParms analyzer for rates only CountingAnalysisParameters AnalysisParams = NCC.CentralizedState.App.LMBD.CountingParameters(ah.det, true); foreach (SpecificCountingAnalyzerParams existing in AnalysisParams) { existing.Active = false; } if (!AnalysisParams.Exists(w => { return((w is Multiplicity) && (w as Multiplicity).Equals(ah.det.MultiplicityParams)); })) { AnalysisParams.Insert(0, ah.det.MultiplicityParams); } SpecificCountingAnalyzerParams currentParms = AnalysisParams.Find(w => { return((w is Multiplicity) && (w as Multiplicity).Equals(ah.det.MultiplicityParams)); }); currentParms.Active = true; currentParms.Rank = 0; NCC.CentralizedState.App.DB.UpdateDetectorParams(ah.det); NCC.CentralizedState.App.DB.UpdateAcquireParams(ah.det); NCC.CentralizedState.App.LMBD.UpdateCounters(ah.det, AnalysisParams); } DataSourceComboBox.Items.Clear(); foreach (ConstructedSource cs in Enum.GetValues(typeof(ConstructedSource))) { if (cs.AcquireChoices() || cs.LMFiles(ah.det.Id.SRType)) { DataSourceComboBox.Items.Add(cs.NameForViewing(ah.det.Id.SRType)); } } if (ah.ap.acquire_type == AcquireConvergence.CycleCount) { UseNumCyclesRadioButton.Checked = true; } else if (ah.ap.acquire_type == AcquireConvergence.DoublesPrecision) { UseDoublesRadioButton.Checked = true; } else if (ah.ap.acquire_type == AcquireConvergence.TriplesPrecision) { UseTriplesRadioButton.Checked = true; } DataSourceComboBox.SelectedItem = ah.ap.data_src.NameForViewing(ah.det.Id.SRType); SetHelp(); }
public void ReplaceCounters(Detector det, CountingAnalysisParameters cap) { DB.CountingAnalysisParameters db = new DB.CountingAnalysisParameters(); DB.Detectors dets = new DB.Detectors(db.db); long l = dets.PrimaryKey(det.Id.DetectorName); if (l == -1) { return; } foreach (SpecificCountingAnalyzerParams s in cap) { DB.ElementList parms = s.ToDBElementList(); if (parms != null) { db.Delete(l, s.GetType().Name, parms); } } }
public void UpdateCounters(Detector det, CountingAnalysisParameters cap) { UpdateCounters(det.Id.DetectorName, cap); }
// LMDAQ.DAQControl.gControl.SRWrangler.GetResults(); //} public override bool TransferResults(CountingAnalysisParameters ap) { // accumulate totals on the cycle object from the time/hits processor AccumulateCycleSummary(); // has an effect only if called after StartNewBuffer and additional data has arrived during input processing return(true); }
private void PreserveNewState() { CheckActiveChecks(); if (PreserveAnalyzerChanges) { CountingAnalysisParameters cntap = new CountingAnalysisParameters(); foreach(DataGridViewRow row in AnalyzerGridView.Rows) { SpecificCountingAnalyzerParams r = Constructed(row); if (r == null) // empty row, so just skip it continue; row.Cells[0].Tag = r.Active; // reset the tag for the check box, it is the only one not updated elsewhere cntap.Add(r); r.modified = !CompareAnalyzers((SpecificCountingAnalyzerParams)row.Tag, r); } N.App.Opstate.Measurement.AnalysisParams = cntap; N.App.LMBD.ReplaceCounters(det, cntap); PreserveAnalyzerChanges = false; } if (N.App.AppContext.modified) N.App.LMBD.UpdateLMINCCAppContext(); }