private void CreateMultiplicityAnalyzer() { //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.BackgroundGateTimeStepInTics = 10; ah.det.MultiplicityParams.AccidentalsGateDelayInTics = 10; } else { //Default long delay = 4096 for slow. ah.det.MultiplicityParams.BackgroundGateTimeStepInTics = 40960; 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); }
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); }
private CountingAnalysisParameters CountingParameters(string detname) { DataTable dt = NC.App.Pest.GetACollection(DB.Pieces.CountingAnalyzers, detname); CountingAnalysisParameters cp = new AnalysisDefs.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) { string type = "AnalysisDefs."; // dev note: careful here, this is subject to bit rot if (dr["counter_type"].Equals(System.DBNull.Value)) { type += "BaseRate"; } else { type += (string)dr["counter_type"]; } System.Type t = System.Type.GetType(type); ConstructorInfo ci = t.GetConstructor(Type.EmptyTypes); SpecificCountingAnalyzerParams sca = (SpecificCountingAnalyzerParams)ci.Invoke(null); cp.Add(sca); sca.gateWidthTics = DB.Utils.DBUInt64(dr["gatewidth"]); if (t == typeof(Multiplicity)) { ((Multiplicity)sca).AccidentalsGateDelayInTics = DB.Utils.DBUInt64(dr["accidentalsgatewidth"]); ((Multiplicity)sca).BackgroundGateTimeStepInTics = DB.Utils.DBUInt64(dr["backgroundgatewidth"]); ((Multiplicity)sca).FA = (DB.Utils.DBBool(dr["FA"]) ? FAType.FAOn : FAType.FAOff); ((Multiplicity)sca).SR.gateLength = sca.gateWidthTics; } else if (t == typeof(Coincidence)) { ((Coincidence)sca).AccidentalsGateDelayInTics = DB.Utils.DBUInt64(dr["accidentalsgatewidth"]); ((Coincidence)sca).BackgroundGateTimeStepInTics = DB.Utils.DBUInt64(dr["backgroundgatewidth"]); //((Coincidence)sca).FA = FAType.FAOff; // always on?? wtf?? So confuse. Much checking. TODO: check this ((Coincidence)sca).SR.gateLength = sca.gateWidthTics; } sca.Active = DB.Utils.DBBool(dr["active"]); if (dr.Table.Columns.Contains("rank")) { sca.Rank = DB.Utils.DBUInt16(dr["rank"]); } } return(cp); }
public SpecificCountingAnalyzerParams ConstructCountingAnalyzerParams(DataRow dr) { string type = "AnalysisDefs."; // dev note: careful here, this is subject to bit rot if (dr["counter_type"].Equals(DBNull.Value)) { type += "BaseRate"; } else { type += (string)dr["counter_type"]; } Type t = Type.GetType(type); ConstructorInfo ci = t.GetConstructor(Type.EmptyTypes); SpecificCountingAnalyzerParams sca = (SpecificCountingAnalyzerParams)ci.Invoke(null); sca.gateWidthTics = DB.Utils.DBUInt64(dr["gatewidth"]); if (t == typeof(Multiplicity)) { ((Multiplicity)sca).AccidentalsGateDelayInTics = DB.Utils.DBUInt64(dr["accidentalsgatewidth"]); ((Multiplicity)sca).BackgroundGateTimeStepInTics = DB.Utils.DBUInt64(dr["backgroundgatewidth"]); ((Multiplicity)sca).FA = (DB.Utils.DBBool(dr["FA"]) ? FAType.FAOn : FAType.FAOff); ((Multiplicity)sca).SR.gateLength = sca.gateWidthTics; // predelay is on the SR member } else if (t == typeof(Coincidence)) { ((Coincidence)sca).AccidentalsGateDelayInTics = DB.Utils.DBUInt64(dr["accidentalsgatewidth"]); ((Coincidence)sca).BackgroundGateTimeStepInTics = DB.Utils.DBUInt64(dr["backgroundgatewidth"]); // ((Coincidence)sca).FA = FAType.FAOff; // always off by definition ((Coincidence)sca).SR.gateLength = sca.gateWidthTics; // predelay is on the SR member } sca.Active = DB.Utils.DBBool(dr["active"]); if (dr.Table.Columns.Contains("rank")) { sca.Rank = DB.Utils.DBUInt16(dr["rank"]); } return(sca); }
public void GenParamList(SpecificCountingAnalyzerParams skey) { GenParamList(); // ^ does the basic INCC5 and new LM cycle stuff // now add the skey stuff Table = "cycles"; }
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(); }
void ReconstructRow(DataGridViewRow row, SpecificCountingAnalyzerParams s, Type t, FAType FA) { if (t.Equals(typeof(Multiplicity))) { Multiplicity m = (Multiplicity)s; row.Cells[3].Value = m.SR.predelay.ToString(); row.Cells[3].Tag = m.SR.predelay; if (FA == FAType.FAOn) { row.Cells[4].Value = m.BackgroundGateTimeStepInTics.ToString(); row.Cells[4].Tag = m.BackgroundGateTimeStepInTics; } else { row.Cells[4].Value = m.AccidentalsGateDelayInTics.ToString(); row.Cells[4].Tag = m.AccidentalsGateDelayInTics; } } else if (t.Equals(typeof(Feynman))) { } else if (t.Equals(typeof(Rossi))) { } else if (t.Equals(typeof(TimeInterval))) { } else if (t.Equals(typeof(Coincidence))) { Coincidence c = (Coincidence)s; row.Cells[3].Value = c.SR.predelay.ToString(); row.Cells[3].Tag = c.SR.predelay; row.Cells[4].Value = c.AccidentalsGateDelayInTics.ToString(); row.Cells[4].Tag = c.AccidentalsGateDelayInTics; } row.Cells[0].Tag = s.Active; row.Cells[2].Tag = s.gateWidthTics; row.Cells[2].Value = s.gateWidthTics.ToString(); SetRODetails(row, t); }
bool CompareAnalyzers(SpecificCountingAnalyzerParams original, SpecificCountingAnalyzerParams candidate) { if (original == null || candidate == null) // skip empty rows return true; Type t = original.GetType(); bool pihfd = t.Equals(candidate.GetType()); if (pihfd) pihfd = (original.Active == candidate.Active); if (pihfd) pihfd = (original.gateWidthTics == candidate.gateWidthTics); if (pihfd) { if (t.Equals(typeof(Multiplicity))) { Multiplicity o = (Multiplicity)original; Multiplicity c = (Multiplicity)candidate; pihfd = (o.SR.predelay == c.SR.predelay); if (pihfd) { pihfd = o.FA == c.FA; if (pihfd) { if (o.FA == FAType.FAOff) pihfd = o.AccidentalsGateDelayInTics == c.AccidentalsGateDelayInTics; if (o.FA == FAType.FAOn) pihfd = o.BackgroundGateTimeStepInTics == c.BackgroundGateTimeStepInTics; } } } } return pihfd; }
string[] ToSimpleValueArray(SpecificCountingAnalyzerParams s) { Type t = s.GetType(); string[] vals = new string[5]; vals[0] = s.Active ? "yes" : "no"; if (t.Equals(typeof(Rossi)) || t.Equals(typeof(TimeInterval)) || t.Equals(typeof(Feynman))) { vals[1] = TNameMap(t, FAType.FAOff); vals[2] = s.gateWidthTics.ToString(); vals[3] = string.Empty; vals[4] = string.Empty; } else if (t.Equals(typeof(Multiplicity))) { vals[1] = TNameMap(t, ((Multiplicity)s).FA); vals[2] = s.gateWidthTics.ToString(); vals[3] = ((Multiplicity)s).SR.predelay.ToString(); if (((Multiplicity)s).FA == FAType.FAOn) { vals[4] = ((Multiplicity)s).BackgroundGateTimeStepInTics.ToString(); } else { vals[4] = ((Multiplicity)s).AccidentalsGateDelayInTics.ToString(); } } else if (t.Equals(typeof(Coincidence))) { vals[1] = TNameMap(t, FAType.FAOff); vals[2] = s.gateWidthTics.ToString(); vals[3] = ((Coincidence)s).SR.predelay.ToString(); vals[4] = ((Coincidence)s).AccidentalsGateDelayInTics.ToString(); } return vals; }
void SetRowDetails(DataGridViewRow row, SpecificCountingAnalyzerParams s) { row.Cells[0].Tag = s.Active; row.Cells[2].Tag = s.gateWidthTics; row.Tag = s; Type t = s.GetType(); row.Cells[3].ReadOnly = false; row.Cells[4].ReadOnly = false; if (t.Equals(typeof(Rossi)) || t.Equals(typeof(TimeInterval)) || t.Equals(typeof(Feynman))) { row.Cells[3].ReadOnly = true; row.Cells[4].ReadOnly = true; } else if (t.Equals(typeof(Multiplicity))) { row.Cells[3].Tag = ((Multiplicity)s).SR.predelay; if (((Multiplicity)s).FA == FAType.FAOn) { row.Cells[4].Tag = ((Multiplicity)s).BackgroundGateTimeStepInTics; } else { row.Cells[4].Tag = ((Multiplicity)s).AccidentalsGateDelayInTics; } } else if (t.Equals(typeof(Coincidence))) { row.Cells[3].Tag = ((Coincidence)s).SR.predelay; row.Cells[4].Tag = ((Coincidence)s).AccidentalsGateDelayInTics; } }