Пример #1
0
 public void ResetStatus(Multiplicity mkey, QCTestStatus st = QCTestStatus.None)
 {
     for (int i = 0; i < this.Count; i++)
     {
         this[i].SetQCStatus(mkey, st);
     }
 }
Пример #2
0
 public IEnumerator <Cycle> GetFilteredCycleListForThisKey(QCTestStatus filter, Multiplicity mkey)
 {
     for (int i = 0; i < Count; i++)
     {
         if (this[i].QCStatusHasFlag(filter, mkey))
         {
             yield return(this[i]);
         }
     }
 }
Пример #3
0
 public bool QCStatusHasFlag(QCTestStatus filter, Multiplicity key)
 {
     if (qcstatus.ContainsKey(key))
     {
         return(QCStatus(key).status.HasFlag(filter));
     }
     else
     {
         return(false);
     }
 }
Пример #4
0
 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);
     }
 }
Пример #5
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);
        }
Пример #6
0
        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);
            }
        }
Пример #7
0
        /// <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));
                }
            }
        }
Пример #8
0
        /// <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));
        }
Пример #9
0
        unsafe static void RunValuesToResults(run_rec_ext run, Cycle cycle, Multiplicity key, MultiplicityCountingRes mcr)
        {
            cycle.seq = run.run_number;
            cycle.TS  = TimeSpan.FromSeconds(run.run_count_time); // is not always whole seconds hn 10-1.

            cycle.Totals      = (ulong)run.run_singles;
            cycle.SinglesRate = run.run_singles / run.run_count_time;

            // table lookup on the strings, so test status is correct
            string       s    = TransferUtils.str(run.run_tests, INCC.MAX_RUN_TESTS_LENGTH);
            QCTestStatus qcts = QCTestStatusExtensions.FromString(s);

            cycle.SetQCStatus(key, qcts); // creates entry if not found


            mcr.Totals = cycle.Totals;
            mcr.TS     = cycle.TS;

            mcr.DeadtimeCorrectedSinglesRate.v = run.run_singles_rate;
            mcr.DeadtimeCorrectedDoublesRate.v = run.run_doubles_rate;
            mcr.DeadtimeCorrectedTriplesRate.v = run.run_triples_rate;

            mcr.RASum = (ulong)run.run_reals_plus_acc;
            mcr.ASum  = (ulong)run.run_acc;

            mcr.efficiency     = run.run_multiplicity_efficiency;
            mcr.mass           = run.run_mass;
            mcr.multiAlpha     = run.run_multiplicity_alpha;
            mcr.multiplication = run.run_multiplicity_mult;
            cycle.HighVoltage  = run.run_high_voltage;

            // assign the hits to a single channel (0)
            cycle.HitsPerChannel[0] = run.run_singles;
            mcr.RawSinglesRate.v    = run.run_singles_rate;
            mcr.RawDoublesRate.v    = run.run_doubles_rate;
            mcr.RawTriplesRate.v    = run.run_triples_rate;

            mcr.Scaler1.v     = run.run_scaler1;
            mcr.Scaler2.v     = run.run_scaler2;
            mcr.Scaler1Rate.v = run.run_scaler1_rate;
            mcr.Scaler2Rate.v = run.run_scaler2_rate;

            long index = 0;

            for (ulong i = 0; i < INCC.SR_EX_MAX_MULT; i++)
            {
                if (run.run_mult_acc[i] > 0 || run.run_mult_reals_plus_acc[i] > 0)
                {
                    index = (long)i;
                }
            }

            mcr.MaxBins = (ulong)index + 1;
            mcr.MinBins = (ulong)index + 1;

            mcr.NormedAMult = new ulong[mcr.MaxBins];
            mcr.RAMult      = new ulong[mcr.MaxBins];
            mcr.UnAMult     = new ulong[mcr.MaxBins];

            // was not setting these to the right values hn 10-2
            for (ulong i = 0; i < (ulong)mcr.MaxBins; i++)
            {
                mcr.RAMult[i]      = (ulong)run.run_mult_reals_plus_acc[i];
                mcr.NormedAMult[i] = (ulong)run.run_mult_acc[i];
            }
            mcr.RASum = run.run_reals_plus_acc;
            mcr.ASum  = run.run_acc;
            mcr.AB.Resize((int)mcr.MaxBins);
        }
Пример #10
0
 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);
 }
Пример #11
0
 public bool QCStatusHasFlag(QCTestStatus filter, Multiplicity key)
 {
     if (qcstatus.ContainsKey(key))
     return QCStatus(key).status.HasFlag(filter);
     else
         return false;
 }