示例#1
0
        public bool Equals(SpecificCountingAnalyzerParams scap1, SpecificCountingAnalyzerParams scap2)
        {
            if (scap1.gateWidthTics == scap2.gateWidthTics && scap1.reason.Equals(scap2.reason) && scap1.suspect == scap2.suspect)
            {
                System.Type t1 = scap1.GetType();
                System.Type t2 = scap2.GetType();
                if (t1.Equals(t2))
                {
                    if (t1.Equals(typeof(Multiplicity)))
                    {
                        return(Multiplicity.Compare((Multiplicity)scap1, (Multiplicity)scap2) == 0);
                    }
                    else if (t1.Equals(typeof(Coincidence)))
                    {
                        return(((Coincidence)scap1).Equals((Coincidence)scap2));
                    }
                }

                return(t1.Equals(t2));
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        public bool PrepareMatchingVSR(Multiplicity mul)
        {
            Multiplicity match = null;
            bool         anew  = false;
            // Find a type match for existing SR settings
            // 1: fast == fast, conv == conv.
            int matchidx = FindIndex(x => ((x is Multiplicity) && (x as Multiplicity).FA == mul.FA));

            // 2: if no fast/conv found, create by copying, add to list
            if (matchidx < 0)
            {
                match = new Multiplicity(mul.FA);
                match.CopyValues(mul);
                Add(match);
                anew = true;
            }
            else
            {
                match = (Multiplicity)this[matchidx];
            }
            // 2: If not active, activate it.
            // Q: deactivate all others?
            match.Active = true;
            // 3: mark for display in GUI
            match.Rank = SpecificCountingAnalyzerParams.Select;             // values < 0 flag uses for UI sorting and selection
            return(anew);
        }
示例#3
0
 public void ResetStatus(Multiplicity mkey, QCTestStatus st = QCTestStatus.None)
 {
     for (int i = 0; i < this.Count; i++)
     {
         this[i].SetQCStatus(mkey, st);
     }
 }
示例#4
0
        /// <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);
                }
            }
        }
示例#5
0
        public bool Transfer(Multiplicity mup, MultiplicityResult mr, int idx)
        {
            if (mr == null)
            {
                return(true);
            }
            bool res = true;

            try
            {
                SetQCStatus(mup, QCTestStatus.Pass);  // marked Pass at the outset
                MultiplicityCountingRes lmcs = new MultiplicityCountingRes(mup.FA, idx);
                countresults.Add(mup, lmcs);
                lmcs.Totals = Totals;
                lmcs.TransferRawResult(mr);
                lmcs.TS = new TimeSpan(TS.Ticks);
            }
            catch (OutOfMemoryException e)
            {
                mup.reason = "Multiplicity transfer " + e.Message;
                res        = false;
                logger.TraceEvent(LogLevels.Error, 87406, mup.reason);
            }
            return(res);
        }
示例#6
0
文件: Cycle.cs 项目: radtek/INCC6
        public QCStatus QCStatus(Multiplicity key)
        {
            QCStatus val = new QCStatus();
            bool     ok  = qcstatus.TryGetValue(key, out val);

            return(val);
        }
示例#7
0
文件: Cycle.cs 项目: radtek/INCC6
        public bool HasEntry(Multiplicity key)
        {
            QCStatus val = null;
            bool     ok  = qcstatus.TryGetValue(key, out val);

            return(ok);
        }
示例#8
0
文件: Cycle.cs 项目: radtek/INCC6
        public bool Transfer(Multiplicity mup, MultiplicityResult mr, int idx)
        {
            if (mr == null)
            {
                return(true);
            }
            bool res = true;

            try
            {
                SetQCStatus(mup, QCTestStatus.Pass);  // marked Pass at the outset
                MultiplicityCountingRes lmcs = new MultiplicityCountingRes(mup.FA, idx);
                countresults.Add(mup, lmcs);
                lmcs.Totals = Totals;
                lmcs.TransferRawResult(mr);
                lmcs.TS = new TimeSpan(TS.Ticks);
                if (dsid.SRType.IsListMode() && lmcs.FA == FAType.FAOff)
                {
                    lmcs.LMTS[1] = TimeSpan.FromTicks((long)mr.TotalMeasurementTics);//Slow
                }
                else if (dsid.SRType.IsListMode() && lmcs.FA == FAType.FAOn)
                {
                    lmcs.LMTS[0] = TimeSpan.FromTicks((long)mr.TotalMeasurementTics);//Slow
                }
            }
            catch (OutOfMemoryException e)
            {
                mup.reason = "Multiplicity transfer " + e.Message;
                res        = false;
                logger?.TraceEvent(LogLevels.Error, 87406, mup.reason);
            }
            return(res);
        }
示例#9
0
 public void AddDireMessage(string s, int id, Multiplicity mul)
 {
     LookupMessageList(mul).Add(new MeasurementMsg(LogLevels.Critical, id, s));
     if (logger != null)
     {
         logger.TraceEvent(LogLevels.Critical, id, s);
     }
 }
示例#10
0
        public int GetMatchingVSRIndex(Multiplicity mul)
        {
            int matchidx = FindIndex(x =>
                                     ((x is Multiplicity) &&
                                      (x as Multiplicity).FA == mul.FA) &&           // same FA
                                     x.Active &&                                     // active
                                     (x as Multiplicity).EqualsButForLMValues(mul)); // everything but gatewidth and predelay are the same

            return(matchidx);
        }
示例#11
0
 public IEnumerator <Cycle> GetValidCycleListForThisKey(Multiplicity mkey)
 {
     for (int i = 0; i < Count; i++)
     {
         if (this[i].QCStatusValid(mkey))
         {
             yield return(this[i]);
         }
     }
 }
示例#12
0
文件: Cycle.cs 项目: radtek/INCC6
 public MultiplicityCountingRes MultiplicityResults(Multiplicity pk)
 {
     if (CountingAnalysisResults.ContainsKey(pk))
     {
         return((MultiplicityCountingRes)CountingAnalysisResults[pk]);
     }
     else
     {
         return(null);
     }
 }
示例#13
0
        /// <summary>
        /// Remove all cycles starting after the first unset cycle on the list.
        /// useful for catching cancelled measurements in-place
        /// </summary>
        /// <param name="mkey"></param>
        public void Trim(Multiplicity mkey)
        {
            int start = this.FindIndex(e => { return(e.QCStatus(mkey).Unset()); });

            if (start < 0)
            {
                return;
            }
            this.RemoveRange(start, this.Count - start);
            this.TrimExcess();
        }
示例#14
0
文件: Cycle.cs 项目: radtek/INCC6
 public bool QCStatusValid(Multiplicity key)
 {
     if (qcstatus.ContainsKey(key))
     {
         return(QCStatus(key).status == QCTestStatus.Pass);
     }
     else
     {
         return(false);
     }
 }
示例#15
0
文件: Cycle.cs 项目: radtek/INCC6
 public bool QCStatusWeaklyValidForTHisKey(Multiplicity key)
 {
     if (qcstatus.ContainsKey(key))
     {
         return(QCStatus(key).status != QCTestStatus.None);
     }
     else
     {
         return(false);
     }
 }
示例#16
0
文件: Cycle.cs 项目: radtek/INCC6
 public bool QCStatusHasFlag(QCTestStatus filter, Multiplicity key)
 {
     if (qcstatus.ContainsKey(key))
     {
         return(QCStatus(key).status.HasFlag(filter));
     }
     else
     {
         return(false);
     }
 }
示例#17
0
        internal List <MeasurementMsg> LookupMessageList(Multiplicity mul)
        {
            List <MeasurementMsg> sl = null;
            bool beendonegot         = Messages.TryGetValue(mul, out sl);

            if (!beendonegot)
            {
                sl = new List <MeasurementMsg>();
                Messages.Add(mul, sl);
            }
            return(sl);
        }
示例#18
0
        public uint GetStatusCycleCountForThisKey(QCTestStatus filter, Multiplicity mkey)
        {
            uint j = 0;

            for (int i = 0; i < this.Count; i++)
            {
                if (this[i].QCStatusHasFlag(filter, mkey))
                {
                    j++;
                }
            }
            return(j);
        }
示例#19
0
        public uint GetValidCycleCountForThisKey(Multiplicity mkey)
        {
            uint j = 0;

            for (int i = 0; i < this.Count; i++)
            {
                if (this[i].QCStatusValid(mkey))
                {
                    j++;
                }
            }
            return(j);
        }
示例#20
0
        public uint GetTotalCycleCountForThisKey(Multiplicity mkey)
        {
            uint j = 0;

            for (int i = 0; i < this.Count; i++)
            {
                if (this[i].HasEntry(mkey))
                {
                    j++;
                }
            }
            return(j);
        }
示例#21
0
文件: Cycle.cs 项目: radtek/INCC6
 public bool QCStatusHasChecksumError(Multiplicity key)
 {
     if (qcstatus.ContainsKey(key))
     {
         QCTestStatus ts = QCStatus(key).status;
         return((ts == QCTestStatus.Checksum1) || (ts == QCTestStatus.Checksum2) ||
                (ts == QCTestStatus.Checksum3)); // err yeah, guess I could use the flags and mask for true here
     }
     else
     {
         return(false);
     }
 }
示例#22
0
文件: Cycle.cs 项目: radtek/INCC6
        public void SetQCStatus(Multiplicity key, QCTestStatus newval, double voltage = -1)
        {
            QCStatus val = new QCStatus();
            bool     ok  = qcstatus.TryGetValue(key, out val);

            if (!ok)
            {
                qcstatus.Add(key, new QCStatus(newval, voltage));
            }
            else
            {
                qcstatus[key] = new QCStatus(newval, voltage);
            }
        }
示例#23
0
        public Multiplicity GetFirstMultiplicityAnalyzer()
        {
            List <SpecificCountingAnalyzerParams> l =
                FindAll(p => { return(p.ActiveConstraint(true) && p is Multiplicity); });

            if (l != null && l.Count > 0)
            {
                return((Multiplicity)l[0]);
            }
            else
            {
                Multiplicity t = new Multiplicity();
                return(t);
            }
        }
示例#24
0
文件: Cycle.cs 项目: radtek/INCC6
        /// <summary>
        /// Create parameter list for the results on a cycle
        /// </summary>
        /// <param name="mkey">The multiplicity parameters used to select the specific results. There can be more than one such results set per cycle.</param>
        public void GenParamList(Multiplicity mkey)
        {
            GenParamList(); // ^ does the basic INCC5 and new LM cycle stuff

            // now add the mkey stuff
            Table = "cycles";
            MultiplicityCountingRes pmcr   = null;
            QCTestStatus            status = QCTestStatus.None;

            if (CountingAnalysisResults.HasMultiplicity)
            {
                try
                {
                    pmcr   = (MultiplicityCountingRes)CountingAnalysisResults[mkey];
                    status = qcstatus[mkey].status;
                }
                catch (Exception) // mkey not found happens when a param is changed on a VSR that is not reflected back to the default [0] SR
                {
                    logger?.TraceEvent(LogLevels.Warning, 7832, "Cycle status not set in DB, mkey mismatch: " + mkey.ToString());
                }
            }
            if (pmcr == null)
            {
                pmcr = new MultiplicityCountingRes();  // null results
            }
            ps.Add(new DBParamEntry("scaler1", pmcr.Scaler1.v));
            ps.Add(new DBParamEntry("scaler2", pmcr.Scaler2.v));
            ps.Add(new DBParamEntry("reals_plus_acc", pmcr.RASum));
            ps.Add(new DBParamEntry("acc", pmcr.ASum));
            ps.Add(new DBParamEntry("mult_reals_plus_acc", pmcr.RAMult));
            ps.Add(new DBParamEntry("mult_acc", pmcr.NormedAMult));
            ps.Add(new DBParamEntry("scaler1_rate", pmcr.Scaler1Rate.v));
            ps.Add(new DBParamEntry("scaler2_rate", pmcr.Scaler2Rate.v));
            ps.Add(new DBParamEntry("doubles_rate", pmcr.RawDoublesRate.v));
            ps.Add(new DBParamEntry("triples_rate", pmcr.RawTriplesRate.v));
            ps.Add(new DBParamEntry("multiplicity_mult", pmcr.multiplication));
            ps.Add(new DBParamEntry("multiplicity_alpha", pmcr.multiAlpha));
            ps.Add(new DBParamEntry("multiplicity_efficiency", pmcr.efficiency));
            ps.Add(new DBParamEntry("mass", pmcr.mass));
            ps.Add(new DBParamEntry("status", (int)status));
            {                   // la super hack-a-whack
                DB.DB db = new DB.DB(true);
                if (db.TableHasColumn(Table, "mult_acc_un"))
                {
                    ps.Add(new DBParamEntry("mult_acc_un", pmcr.UnAMult));
                }
            }
        }
示例#25
0
        public Multiplicity GetFirstMult(FAType ft, out bool addedIfNotPresent)
        {
            addedIfNotPresent = false;
            List <SpecificCountingAnalyzerParams> l = GetMults(ft, activeOnly: false);

            if (l != null && l.Count > 0)
            {
                return((Multiplicity)l[0]);
            }
            else
            {
                Multiplicity t = new Multiplicity(ft);
                addedIfNotPresent = true;
                Add(t);
                return(t);
            }
        }
示例#26
0
文件: Cycle.cs 项目: tempbottle/INCC6
        /// <summary>
        /// Create parameter list for the results on a cycle
        /// </summary>
        /// <param name="mkey">The multiplicity parameters used to select the specific results. There can be more than one such results set per cycle.</param>
        public void GenParamList(Multiplicity mkey)
        {
            GenParamList(); // does the basic INCC5 and new LM cycle stuff

            //now add the mkey stuff
            Table = "cycles";
            MultiplicityCountingRes pmcr   = null;
            QCTestStatus            status = QCTestStatus.None;

            if (CountingAnalysisResults.HasMultiplicity)
            {
                try
                {
                    pmcr   = (MultiplicityCountingRes)CountingAnalysisResults[mkey];
                    status = qcstatus[mkey].status;
                }
                catch (Exception) // mkey not found happens when a param is changed on a VSR that is not reflected back to the default [0] SR
                {
                    logger.TraceEvent(NCCReporter.LogLevels.Warning, 7832, "Status not set due to mkey issue: " + mkey.ToString());
                }
            }
            if (pmcr == null)
            {
                pmcr = new MultiplicityCountingRes();  // null results
            }
            ps.Add(new DBParamEntry("scaler1", pmcr.Scaler1.v));
            ps.Add(new DBParamEntry("scaler2", pmcr.Scaler2.v));
            ps.Add(new DBParamEntry("reals_plus_acc", pmcr.RASum));
            ps.Add(new DBParamEntry("acc", pmcr.ASum));
            ps.Add(new DBParamEntry("mult_reals_plus_acc", pmcr.RAMult));
            ps.Add(new DBParamEntry("mult_acc", pmcr.NormedAMult));
            ps.Add(new DBParamEntry("scaler1_rate", pmcr.Scaler1Rate.v));
            ps.Add(new DBParamEntry("scaler2_rate", pmcr.Scaler2Rate.v));
            ps.Add(new DBParamEntry("doubles_rate", pmcr.RawDoublesRate.v));
            ps.Add(new DBParamEntry("triples_rate", pmcr.RawTriplesRate.v));
            ps.Add(new DBParamEntry("multiplicity_mult", pmcr.multiplication));
            ps.Add(new DBParamEntry("multiplicity_alpha", pmcr.multiAlpha));
            ps.Add(new DBParamEntry("multiplicity_efficiency", pmcr.efficiency));
            ps.Add(new DBParamEntry("mass", pmcr.mass));
            ps.Add(new DBParamEntry("status", (Int32)status));
        }
示例#27
0
 protected void ConstructSRSection(INCCStyleSection sec, Multiplicity mu, Detector det)
 {
     // if this is based on a virtual SR then show it
     if (det.Id.source.UsingVirtualSRCounting(det.Id.SRType))
     {
         sec.AddTwo(" Virtual shift register:", mu.ToString());
     }
     sec.AddTwo("Predelay:", mu.SR.predelayMS);
     sec.AddTwo("Gate length:", mu.SR.gateLengthMS);
     if (det.Id.SRType == InstrType.DGSR)
     {
         sec.AddTwo("Gate length2:", mu.SR.gateLengthMS);
     }
     sec.AddIntegerRow("High voltage:", (Int32)mu.SR.highVoltage);
     sec.SetFPCurrentFormatPrecision(4);
     sec.AddTwo("Die away time:", mu.SR.dieAwayTimeMS);
     sec.AddTwo("Efficiency:", mu.SR.efficiency);
     sec.AddTwo("Multiplicity deadtime:", mu.SR.deadTimeCoefficientMultiplicityinNanoSecs);
     sec.AddTwo("Coefficient A deadtime:", mu.SR.deadTimeCoefficientAinMicroSecs);
     sec.AddTwo("Coefficient B deadtime:", mu.SR.deadTimeCoefficientBinPicoSecs);
     sec.AddTwo("Coefficient C deadtime:", mu.SR.deadTimeCoefficientCinNanoSecs);
     sec.AddTwo("Doubles gate fraction:", mu.SR.doublesGateFraction);
     sec.AddTwo("Triples gate fraction:", mu.SR.triplesGateFraction);
 }
示例#28
0
        // 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);
        }
示例#29
0
 // These are live adders, they use for now for the dt ts
 // NEXT: DB restore messages whilst retaining timestamps
 public List <MeasurementMsg> GetMessageList(Multiplicity mul)
 {
     return(LookupMessageList(mul));
 }
示例#30
0
 public void AddWarningMessage(string s, int id, Multiplicity mul)
 {
     LookupMessageList(mul).Add(new MeasurementMsg(LogLevels.Warning, id, s));
     logger.TraceEvent(NCCReporter.LogLevels.Warning, id, s);
 }
示例#31
0
        public bool HasMatchingVSR(Multiplicity mul)
        {
            int matchidx = GetMatchingVSRIndex(mul);

            return(matchidx >= 0);
        }