Example #1
0
        AcquireParameters ConfigureAcquireState(Detector det, AcquireParameters def, INCCReviewFile irf)
        {
            AcquireParameters acq = NC.App.DB.LastAcquireFor(det);

            if (acq == null)
            {
                acq = new AcquireParameters(def);
            }
            acq.MeasDateTime = irf.dt; acq.lm.TimeStamp = irf.dt;
            acq.num_runs     = irf.num_runs; // RequestedRepetitions
            int tx = def.comment.IndexOf(" (Original file name");

            if (tx >= 0)
            {
                acq.comment = def.comment.Substring(0, tx);
            }
            else
            {
                acq.comment = def.comment;
            }
            acq.comment         += " (Original file name " + System.IO.Path.GetFileName(irf.Path) + ")";
            acq.detector_id      = String.Copy(det.Id.DetectorId);
            acq.meas_detector_id = string.Copy(acq.detector_id);

            // iid should have been added from the NOP processing above
            ItemId iid = NC.App.DB.ItemIds.Get(irf.item);

            if (iid == null)
            {
                ctrllog.TraceEvent(LogLevels.Warning, 5439, "Item id '" + irf.item + "' is referenced by the Review file measurement data, but is not found in op. rev. files or the database");
            }
            else
            {
                acq.ApplyItemId(iid);
                INCCDB.Descriptor s = NC.App.DB.Stratums.Get(iid.stratum);
                INCCDB.Descriptor m = NC.App.DB.MBAs.Get(iid.mba);
                if (s != null)
                {
                    acq.stratum_id = s;
                }
                if (m != null)
                {
                    acq.mba = m;
                }
            }
            // todo: also need to account for iid UMass to mass condition

            INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, acq.item_type, irf.dt);
            if (NC.App.DB.AcquireParametersMap().ContainsKey(sel))  // only one allowed, same for actual measurement
            {
                NC.App.DB.AcquireParametersMap().Remove(sel);
            }
            NC.App.DB.AcquireParametersMap().Add(sel, acq);
            NC.App.DB.UpdateAcquireParams(acq, det.ListMode);
            return(acq);
        }
Example #2
0
 AssaySelector.MeasurementOption NCCMeasOption(INCCReviewFile irf)
 {
     // INCC5 semantics: ASCII vV 86 118, bB 66 98, nN 78 110
     AssaySelector.MeasurementOption mo = AssaySelector.MeasurementOption.unspecified;
     if (irf.meas_option == 118 || irf.meas_option == 86)
     {
         mo = AssaySelector.MeasurementOption.verification;
     }
     else if (irf.meas_option == 66 || irf.meas_option == 98)
     {
         mo = AssaySelector.MeasurementOption.background;
     }
     else if (irf.meas_option == 78 || irf.meas_option == 110)
     {
         mo = AssaySelector.MeasurementOption.normalization;
     }
     return(mo);
 }
Example #3
0
        unsafe void AddReviewFileCycle(int i, run_rec_ext run, INCCReviewFile.run_rec_ext_plus rrep, Measurement meas, string fn)
        {
            Cycle cycle = new Cycle(datalog);
            try
            {
                cycle.UpdateDataSourceId(ConstructedSource.ReviewFile, meas.Detectors[0].Id.SRType,
                        rrep.dt, fn);
                cycle.seq = (run.run_number > 0 ? run.run_number : i); // INCC run record sequence numbers start at 1
                cycle.TS = TimeSpan.FromSeconds(run.run_count_time);

                /* init run tests */
                cycle.SetQCStatus(meas.Detectors[0].MultiplicityParams, QCTestStatus.Pass, run.run_high_voltage); // multmult creates entry if not found
                meas.Add(cycle);
                /* singles, reals + accidentals, accidentals */
                cycle.Totals = (ulong)run.run_singles;
                MultiplicityCountingRes mcr = new MultiplicityCountingRes(meas.Detectors[0].MultiplicityParams.FA, cycle.seq); // multmult
                cycle.CountingAnalysisResults.Add(meas.Detectors[0].MultiplicityParams, mcr); // multmult
                mcr.AB.TransferIntermediates(meas.Detectors[0].AB);  // copy alpha beta onto the cycle's results 
                mcr.Totals = cycle.Totals;
                mcr.TS = cycle.TS;
                mcr.ASum = run.run_acc;
                mcr.RASum = run.run_reals_plus_acc;
                mcr.Scaler1.v = run.run_scaler1;
                mcr.Scaler2.v = run.run_scaler2;
                cycle.SinglesRate = run.run_singles / run.run_count_time;

                // assign the hits to a single channel (0)
                cycle.HitsPerChannel[0] = cycle.Totals;

                mcr.RawSinglesRate.v = cycle.SinglesRate;

                // now back-compute the actual limits of the bins
                for (int n = rrep.n_mult - 1; n >= 0; n--)
                {
                    if ((run.run_mult_reals_plus_acc[n] > 0.0) || (run.run_mult_acc[n] > 0.0))
                    {
                        mcr.MinBins = mcr.MaxBins = (ulong)(n + 1);
                        break;
                    }
                }
                mcr.RAMult = new ulong[mcr.MaxBins];
                mcr.NormedAMult = new ulong[mcr.MaxBins];
                mcr.UnAMult = new ulong[mcr.MaxBins]; // todo: compute this

                // copy the bin values, if any
                for (UInt16 j = 0; j < mcr.MaxBins; j++)
                {
                    mcr.RAMult[j] = (ulong)run.run_mult_reals_plus_acc[j];
                    mcr.NormedAMult[j] = (ulong)run.run_mult_acc[j];
                }
                ctrllog.TraceEvent(LogLevels.Verbose, 5439, "Cycle " + cycle.seq.ToString() + (rrep.n_mult > 0 ? " n_:" + rrep.n_mult.ToString() + " max:" + mcr.MaxBins.ToString() : " *"));
            }
            catch (Exception e)
            {
                ctrllog.TraceEvent(LogLevels.Warning, 33085, "Cycle processing error {0} {1}", run, e.Message);
            }
        }
Example #4
0
 AssaySelector.MeasurementOption NCCMeasOption(INCCReviewFile irf)
 {
     // INCC5 semantics: ASCII vV 86 118, bB 66 98, nN 78 110
     AssaySelector.MeasurementOption mo = AssaySelector.MeasurementOption.unspecified;
     if (irf.meas_option == 118 || irf.meas_option == 86) mo = AssaySelector.MeasurementOption.verification;
     else if (irf.meas_option == 66 || irf.meas_option == 98) mo = AssaySelector.MeasurementOption.background;
     else if (irf.meas_option == 78 || irf.meas_option == 110) mo = AssaySelector.MeasurementOption.normalization;
     return mo;
 }
Example #5
0
        AcquireParameters ConfigureAcquireState(Detector det, AcquireParameters def, INCCReviewFile irf)
        {
            AcquireParameters acq = NC.App.DB.LastAcquireFor(det);
            if (acq == null)
                acq = new AcquireParameters(def);
            acq.MeasDateTime = irf.dt; acq.lm.TimeStamp = irf.dt;
            acq.num_runs = irf.num_runs; // RequestedRepetitions
            int tx = def.comment.IndexOf(" (Original file name");
            if (tx >= 0)
                acq.comment = def.comment.Substring(0, tx);
            else
                acq.comment = def.comment;
            acq.comment += " (Original file name " + System.IO.Path.GetFileName(irf.Path) + ")";
            acq.detector_id = String.Copy(det.Id.DetectorId);
            acq.meas_detector_id = string.Copy(acq.detector_id);

            // iid should have been added from the NOP processing above
            ItemId iid = NC.App.DB.ItemIds.Get(irf.item);
            if (iid == null)
            {
                ctrllog.TraceEvent(LogLevels.Warning, 5439, "Item id '" + irf.item + "' is referenced by the Review file measurement data, but is not found in op. rev. files or the database");
            }
            else
            {
                acq.ApplyItemId(iid);
                INCCDB.Descriptor s = NC.App.DB.Stratums.Get(iid.stratum);
                INCCDB.Descriptor m = NC.App.DB.MBAs.Get(iid.mba);
                if (s != null)
                    acq.stratum_id = s;
                if (m != null)
                    acq.mba = m;
            }
            // todo: also need to account for iid UMass to mass condition

            INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, acq.item_type, irf.dt);
            if (NC.App.DB.AcquireParametersMap().ContainsKey(sel))  // only one allowed, same for actual measurement
            {
                NC.App.DB.AcquireParametersMap().Remove(sel);
            }
            NC.App.DB.AcquireParametersMap().Add(sel, acq);
            NC.App.DB.UpdateAcquireParams(acq, det.ListMode);
            return acq;
        }
Example #6
0
        public virtual INCCTransferBase Restore()
        {
            // current file

            INCCTransferBase result = null;
            switch (mft)
            {
                case eFileType.eInitialDataDetector:
                    {
                        INCCInitialDataDetectorFile idd = new INCCInitialDataDetectorFile(mlogger, mpath);
                        bool good = idd.Restore(mpath);
                        if (good)
                            result = idd; // this now has the structs ready
                    }
                    break;
                case eFileType.eInitialDataCalibration:
                    {
                        INCCInitialDataCalibrationFile idcal = new INCCInitialDataCalibrationFile(mlogger, mpath);
                        bool good = idcal.Restore(mpath);
                        if (good)
                            result = idcal; // this now has the structs ready
                    }
                    break;
                case eFileType.eTransfer:
                    {
                        INCCTransferFile idt = new INCCTransferFile(mlogger, mpath);
                        bool good = idt.Restore(mpath);
                        if (good)
                            result = idt; // this now has the structs ready
                    }
                    break;
                case eFileType.eNCC:
                    {
                        INCCReviewFile irf = new INCCReviewFile(mlogger, mpath);
                        bool good = irf.Restore(mpath);
                        if (good)
                            result = irf; // this now has the structs ready
                    }
                    break;
                case eFileType.eUnknown:
                    mlogger.TraceEvent(LogLevels.Info, 34007, "Skipping {0}", mpath);
                    break;
                default:  // for future expansion
                    // dev note: NOP and COP files are just CSV or Tab-delimited text files, so no binary matching is needed, so I am moving the handling of these to another class (OPfiles)
                    mlogger.TraceEvent(LogLevels.Info, 34008, "Not processing the unsupported file {0}", mpath);
                    break;
            };

            return result;
        }
Example #7
0
        public virtual INCCTransferBase Restore()
        { // current file
            INCCTransferBase result = null;

            switch (mft)
            {
            case eFileType.eInitialDataDetector:
            {
                INCCInitialDataDetectorFile idd = new INCCInitialDataDetectorFile(mlogger, mpath);
                bool good = idd.Restore(mpath);
                if (good)
                {
                    result = idd;         // this now has the structs ready
                }
            }
            break;

            case eFileType.eInitialDataCalibration:
            {
                INCCInitialDataCalibrationFile idcal = new INCCInitialDataCalibrationFile(mlogger, mpath);
                bool good = idcal.Restore(mpath);
                if (good)
                {
                    result = idcal;         // this now has the structs ready
                }
            }
            break;

            case eFileType.eTransfer:
            {
                INCCTransferFile idt  = new INCCTransferFile(mlogger, mpath);
                bool             good = idt.Restore(mpath);
                if (good)
                {
                    result = idt;         // this now has the structs ready
                }
            }
            break;

            case eFileType.eNCC:
            {
                INCCReviewFile irf  = new INCCReviewFile(mlogger, mpath);
                bool           good = irf.Restore(mpath);
                if (good)
                {
                    result = irf;         // this now has the structs ready
                }
            }
            break;

            case eFileType.eUnknown:
                mlogger.TraceEvent(LogLevels.Info, 34007, "Skipping {0}", mpath);
                break;

            default:      // for future expansion
                // dev note: NOP and COP files are just CSV or Tab-delimited text files, so no binary matching is needed, so I am moving the handling of these to another class (OPfiles)
                mlogger.TraceEvent(LogLevels.Info, 34008, "Not processing the unsupported file {0}", mpath);
                break;
            }
            ;

            return(result);
        }