Ejemplo n.º 1
0
        public void ShowOther()
        {
            Detector           det      = Integ.GetCurrentAcquireDetector();
            IDDMeasurementList measlist = new IDDMeasurementList();

            measlist.Init(mlist,
                          AssaySelector.MeasurementOption.verification,
                          goal: IDDMeasurementList.EndGoal.Reanalysis, lmonly: false, inspnum: "All", detector: det);
            if (measlist.bGood)
            {
                DialogResult = measlist.ShowDialog();
                if (DialogResult == DialogResult.OK)
                {
                    Measurement m = measlist.GetSingleSelectedMeas();
                    if (m == null)
                    {
                        return;
                    }
                    det = m.Detector;                                                                                             // use detector as re-constructed from the original measurement
                    // get the cycles for the selected measurement from the database, and add them to the current measurement
                    CycleList cl = N.App.DB.GetCycles(det, m.MeasurementId, DetectorDefs.ConstructedSource.DB, m.AnalysisParams); // APluralityOfMultiplicityAnalyzers: // URGENT: get all the cycles associated with each analzyer, restoring into the correct key->result pair
                    m.Add(cl);
                    new IDDReanalysisAssay(m, det).ShowDialog();
                }
            }
            else
            {
                DialogResult = DialogResult.None;
            }
        }
Ejemplo n.º 2
0
        void InitData()
        {
            int n = this.Width / _Interval + 1;//计算需储存数据个数

            if (_Datas[0] == null)
            {
                _Datas[0] = new CycleList <float>(n);
            }
            else
            {
                _Datas[0].SetCapacity(n);
            }

            if (_Datas[1] == null)
            {
                _Datas[1] = new CycleList <float>(n);
            }
            else
            {
                _Datas[1].SetCapacity(n);
            }

            //设置极值
            low  = float.PositiveInfinity;
            high = float.NegativeInfinity;
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            var list = new List <int>()
            {
                0, 1, 2, 3, 4
            };
            var cycleList = new CycleList <int>()
            {
                0, 1, 2, 3, 4
            };

            for (int i = 0; i < 15; i++)
            {
                Console.Write(cycleList[i] + " ");
            }
            Console.WriteLine();
            cycleList.Reset();
            for (int i = 0; i < 15; i++)
            {
                Console.Write(cycleList.GetNext() + " ");
            }
            Console.WriteLine();
            for (int i = 0; i < 15; i++)
            {
                Console.Write(list.GetCycled(i) + " ");
            }
        }
Ejemplo n.º 4
0
    void Start()
    {
        GameObject rootGo = GameObject.Find("BladeRoot");

        if (rootGo == null)
        {
            rootGo = new GameObject("BladeRoot");
            rootGo.transform.position = Vector3.zero;
        }

        Parent = rootGo.transform;

        // objects and mesh creation.
        GameObject go = new GameObject(gameObject.name + "_trail");

        go.layer                = LayerMask.NameToLayer("TransparentFX");
        go.transform.parent     = Parent;
        go.transform.position   = Vector3.zero;
        go.transform.rotation   = Quaternion.identity;
        go.transform.localScale = Vector3.one;
        MeshFilter filter = go.AddComponent <MeshFilter>();

        _renderer = go.AddComponent <MeshRenderer>();
        SetMaterial(BladeMaterial);

        _mesh       = new Mesh();
        _mesh.name  = gameObject.name + "_TrailMesh";
        filter.mesh = _mesh;

        // create vertex buffers map.
        if (Fragments <= 0)
        {
            Debug.Log("Error blade effect parameter:" + gameObject.transform.parent.parent.gameObject.name);
            Fragments = 20;
        }
        _position = new Vector3[Fragments * 2];
        _texcoord = new Vector2[Fragments * 2];
        _vertAnim = new float[Fragments];
        _indices  = new int[Fragments * 6];
        for (int i = 0; i < Fragments; ++i)
        {
            _indices[i * 6]     = i * 2;
            _indices[i * 6 + 1] = i * 2 + 1;
            _indices[i * 6 + 2] = i * 2 + 2;
            _indices[i * 6 + 3] = i * 2 + 2;
            _indices[i * 6 + 4] = i * 2 + 1;
            _indices[i * 6 + 5] = i * 2 + 3;
        }
        _indices[(Fragments - 1) * 6 + 2] = 0;
        _indices[(Fragments - 1) * 6 + 3] = 0;
        _indices[(Fragments - 1) * 6 + 5] = 1;

        _vertlist = new CycleList(0, Fragments);

        _refPoints      = new Vector3[4];
        _nextResampling = 0;
    }
 //计算最大值
 private float ComputHigh(CycleList <float> Datas)
 {
     if (Datas.Amount > 0)
     {
         float r = Datas[0];
         for (int i = 0; i < Datas.Amount; i++)
         {
             if (Datas[i] > r)
             {
                 r = Datas[i];
             }
         }
         return(r);
     }
     return(0);
 }
Ejemplo n.º 6
0
        void PlotThePlots(CycleList cl, Multiplicity mkey)
        {
            Series s1 = Singles.Series["Vals"];

            s1.MarkerStyle       = MarkerStyle.Circle;
            s1.MarkerColor       = System.Drawing.Color.SkyBlue;
            s1.MarkerSize        = 5;
            s1.MarkerBorderColor = System.Drawing.Color.DarkCyan;
            s1.Color             = System.Drawing.Color.MediumPurple;

            Series s2 = Doubles.Series["Vals"];

            s2.MarkerStyle       = MarkerStyle.Circle;
            s2.MarkerColor       = System.Drawing.Color.SkyBlue;
            s2.MarkerSize        = 5;
            s2.MarkerBorderColor = System.Drawing.Color.DarkCyan;
            s2.Color             = System.Drawing.Color.MediumPurple;

            Series s3 = Triples.Series["Vals"];

            s3.MarkerStyle       = MarkerStyle.Circle;
            s3.MarkerColor       = System.Drawing.Color.SkyBlue;
            s3.MarkerSize        = 5;
            s3.MarkerBorderColor = System.Drawing.Color.DarkCyan;
            s3.Color             = System.Drawing.Color.MediumPurple;

            int i = 0;

            foreach (Cycle c in cl)
            {
                i++;
                MultiplicityCountingRes mcr = c.MultiplicityResults(mkey);
                bool somtingfunnyhere       = (c.QCStatus(mkey).status != QCTestStatus.Pass);

                int idx = s1.Points.AddXY(i, mcr.DeadtimeCorrectedSinglesRate.v);  // next: vary color and shape based on cycle status/outlier status
                s2.Points.AddXY(i, mcr.DeadtimeCorrectedDoublesRate.v);
                s3.Points.AddXY(i, mcr.DeadtimeCorrectedTriplesRate.v);
                if (somtingfunnyhere)
                {
                    s1.Points[idx].MarkerColor = System.Drawing.Color.Orchid;
                    s2.Points[idx].MarkerColor = System.Drawing.Color.Orchid;
                    s3.Points[idx].MarkerColor = System.Drawing.Color.Orchid;
                    s1.Points[idx].ToolTip     = string.Format("#{0} {1}", c.seq, c.QCStatus(mkey).INCCString());
                    s3.Points[idx].ToolTip     = s2.Points[idx].ToolTip = s1.Points[idx].ToolTip;
                }
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 不会改变运行状态,只重新初始化数据.
        /// </summary>
        public void Reset()
        {
            Buffer = new CycleList <byte>(PackageLengthMax * 2);
            Buffer.OnThrowObeject += new CycleList <byte> .ThrowObeject(Buffer_OnThrowObeject);

            ReceiveFrame = new CycleList <ZFrame>(5);
            ReceiveFrame.OnThrowObeject += new CycleList <ZFrame> .ThrowObeject(ReceiveFrame_OnThrowObeject);

            ReceiveBlock = new CycleList <ZBlock>(50);
            ReceiveBlock.OnThrowObeject += new CycleList <ZBlock> .ThrowObeject(ReceiveBlock_OnThrowObeject);

            ZFrame SendFrame = new ZFrame();

            SendBlock  = new CycleList <ZBlock>(BlockNumMax);
            SendBuffer = new byte[PackageLengthMax];

            _ReceiveFrameNum = 0;
            _ReceiveBlockNum = 0;
            _LostByteNum     = 0;
            _LostFrameNum    = 0;
            _LostBlockNum    = 0;
            _ErrorFrameNum   = 0;
            _ErrorBlockNum   = 0;
        }
Ejemplo n.º 8
0
 void ExpandMaxBins(ulong _MaxBins, CycleList cl, Multiplicity key)
 {
     foreach(Cycle c in cl)
     {
         MultiplicityCountingRes cmcr = (MultiplicityCountingRes)c.CountingAnalysisResults[key];
         if (_MaxBins > (ulong)cmcr.RAMult.Length || _MaxBins > (ulong)cmcr.NormedAMult.Length)
             Bloat(_MaxBins, cmcr);
     }
 }
        /// <summary>
        /// 不会改变运行状态,只重新初始化数据.
        /// </summary>
        public void Reset()
        {
            Buffer = new CycleList<byte>(PackageLengthMax * 2);
            Buffer.OnThrowObeject += new CycleList<byte>.ThrowObeject(Buffer_OnThrowObeject);

            ReceiveFrame = new CycleList<ZFrame>(5);
            ReceiveFrame.OnThrowObeject += new CycleList<ZFrame>.ThrowObeject(ReceiveFrame_OnThrowObeject);

            ReceiveBlock = new CycleList<ZBlock>(50);
            ReceiveBlock.OnThrowObeject += new CycleList<ZBlock>.ThrowObeject(ReceiveBlock_OnThrowObeject);

            ZFrame SendFrame = new ZFrame();
            SendBlock = new CycleList<ZBlock>(BlockNumMax);
            SendBuffer = new byte[PackageLengthMax];

            _ReceiveFrameNum = 0;
            _ReceiveBlockNum = 0;
            _LostByteNum = 0;
            _LostFrameNum = 0;
            _LostBlockNum = 0;
            _ErrorFrameNum = 0;
            _ErrorBlockNum = 0;
        }
Ejemplo n.º 10
0
        //// BUTTONCLICK HANDLERS ///////////////////////////////////////////////

        public DialogResult OKButton_Click(object sender, EventArgs e)
        {
            DialogResult dr = DialogResult.Cancel;

            if (ap.modified)
            {
                INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, ap.item_type, DateTime.Now);
                ap.MeasDateTime = sel.TimeStamp; ap.lm.TimeStamp = sel.TimeStamp;
                NC.App.DB.AcquireParametersMap().Add(sel, ap);  // it's a new one, not the existing one modified
                NC.App.DB.UpdateAcquireParams(ap, det.ListMode);
            }

            // The acquire is set to occur, build up the measurement state
            AnalysisWizard.ResetMeasurement();
            Integ.BuildMeasurement(ap, det, mo);

            switch (ap.data_src)
            {
            case ConstructedSource.Live:                 // set up the instrument list for the action controller
                UIIntegration.Controller.file = false;   // make sure to use the DAQ controller, not the file controller
                NC.App.AppContext.FileInput   = null;    // reset the cmd line file input flag
                if (det.ListMode)
                {
                    // patch override lm.Interval with run_count_time from dialog
                    NC.App.Opstate.Measurement.AcquireState.lm.Interval = NC.App.Opstate.Measurement.AcquireState.run_count_time;

                    // Check NC.App.Opstate.Measurement.AnalysisParams for at least one VSR
                    // If not present, inform and pop up the wizard
                    // If present, inform with new dialog, do not pop up the wizard
                    if (NC.App.Opstate.Measurement.AnalysisParams.HasMultiplicity())
                    {
                        dr = DialogResult.OK;
                    }
                    else
                    {
                        AnalysisWizard awl = new AnalysisWizard(AnalysisWizard.AWSteps.Step2B, ap, det);      // analyzers are created in here, placed on global measurement
                        dr = awl.ShowDialog();
                        if (dr == DialogResult.OK)
                        {
                            NC.App.DB.UpdateAcquireParams(ap);     //update it again
                            NC.App.DB.UpdateDetector(det);
                        }
                    }

                    if (dr == DialogResult.OK)
                    {
                        // if ok, the analyzers are set up, so can kick it off now.
                        UIIntegration.Controller.ActivateDetector(det);
                    }
                }
                else
                {
                    SRInstrument sri = new SRInstrument(det);
                    sri.selected = true;
                    sri.Init(NC.App.Loggers.Logger(LMLoggers.AppSection.Data), NC.App.Loggers.Logger(LMLoggers.AppSection.Analysis));
                    if (!Instruments.All.Contains(sri))
                    {
                        Instruments.All.Add(sri);     // add to global runtime list
                    }
                    dr = DialogResult.OK;
                }
                break;

            case ConstructedSource.DB:
                NC.App.AppContext.DBDataAssay = true;
                UIIntegration.Controller.file = true;
                IDDAcquireDBMeas dbdlg = new IDDAcquireDBMeas(this);
                if (dbdlg.HasItems())
                {
                    dr = dbdlg.ShowDialog();
                    if (dr == DialogResult.OK)
                    {
                        DateTimeOffset dto = dbdlg.measurementId.MeasDateTime;
                        DateTimeOffset cur = new DateTimeOffset(dto.Ticks, dto.Offset);
                        NC.App.Logger(NCCReporter.LMLoggers.AppSection.App).TraceEvent(NCCReporter.LogLevels.Info, 87654,
                                                                                       "Using " + dto.ToString("MMM dd yyy HH:mm:ss.ff K"));

                        // get the cycles for the selected measurement from the database, and add them to the current measurement
                        CycleList cl = NC.App.DB.GetCycles(det, dbdlg.measurementId);
                        foreach (Cycle cycle in cl)     // add the necessary meta-data to the cycle identifier instance
                        {
                            cycle.UpdateDataSourceId(ap.data_src, det.Id.SRType,
                                                     cur.AddTicks(cycle.TS.Ticks), det.Id.FileName);
                            cur = cycle.DataSourceId.dt;
                        }

                        NC.App.Opstate.Measurement.Add(cl);

                        // TODO: for Reanalysis, a full reconstruction of the measurement state based on the ResultsRec state and the method parameter map contents (for Calib and Verif)
                    }
                }
                else
                {
                    MessageBox.Show("No items found in database matching these parameters", "WARNING");
                }
                break;

            case ConstructedSource.Manual:
                UIIntegration.Controller.file = true;
                NC.App.AppContext.DBDataAssay = true;
                IDDManualDataEntry mdlg = new IDDManualDataEntry();
                mdlg.AH = this;
                dr      = mdlg.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    // the work is done in the dialog class
                }
                break;

            case ConstructedSource.CycleFile:
                NC.App.AppContext.TestDataFileAssay = true;
                UIIntegration.Controller.file       = true;
                dr = UIIntegration.GetUsersFile("Select a test data (disk) file", NC.App.AppContext.FileInput, "INCC5 Test data (disk)", "dat");
                break;

            case ConstructedSource.ReviewFile:
                NC.App.AppContext.ReviewFileAssay = true;
                UIIntegration.Controller.file     = true;
                dr = UIIntegration.GetUsersFile("Select an NCC file", NC.App.AppContext.FileInput, "INCC5 Review", "NCC");
                break;

            case ConstructedSource.NCDFile:
                NC.App.AppContext.NCDFileAssay = true;
                UIIntegration.Controller.file  = true;
                if (NC.App.Opstate.Measurement.MeasOption == AssaySelector.MeasurementOption.unspecified)
                {
                    AnalysisWizard aw = new AnalysisWizard(AnalysisWizard.AWSteps.Step2A, ap, det);
                    dr = aw.ShowDialog();     // show LM-relevant acquire-style settings for modification or confirmation
                }
                else
                {
                    dr = UIIntegration.GetUsersFilesFolder("Select NCD files or folder", NC.App.AppContext.FileInput, "LMMM NCD", "ncd");
                }
                break;

            case ConstructedSource.SortedPulseTextFile:
                NC.App.AppContext.PulseFileAssay = true;
                UIIntegration.Controller.file    = true;
                if (NC.App.Opstate.Measurement.MeasOption == AssaySelector.MeasurementOption.unspecified)
                {
                    AnalysisWizard aw1 = new AnalysisWizard(AnalysisWizard.AWSteps.Step2A, ap, det);
                    dr = aw1.ShowDialog();      // show LM-relevant acquire-style settings for modification or confirmation
                }
                else
                {
                    dr = UIIntegration.GetUsersFilesFolder("Select pulse files or folder", NC.App.AppContext.FileInput, "pulse", "txt");
                }
                break;

            case ConstructedSource.PTRFile:
                NC.App.AppContext.PTRFileAssay = true;
                UIIntegration.Controller.file  = true;
                if (NC.App.Opstate.Measurement.MeasOption == AssaySelector.MeasurementOption.unspecified)
                {
                    AnalysisWizard aw2 = new AnalysisWizard(AnalysisWizard.AWSteps.Step2A, ap, det);
                    dr = aw2.ShowDialog();      // show LM-relevant acquire-style settings for modification or confirmation
                }
                else
                {
                    dr = UIIntegration.GetUsersFilesFolder("Select PTR-32 files or folder", NC.App.AppContext.FileInput, "PTR-32", "bin", "chn");
                }
                break;

            case ConstructedSource.NILAFile:
                NC.App.AppContext.NILAFileAssay = true;
                UIIntegration.Controller.file   = true;
                dr = UIIntegration.GetUsersFilesFolder("Select NILA files or folder", NC.App.AppContext.FileInput, "MTS NILA", "dat");
                //dr = DialogResult.Cancel;
                break;

            default:
                break;
            }
            return(dr);
        }
Ejemplo n.º 11
0
        private void OKBtn_Click(object sender, EventArgs e)
        {
            ClipboardMonitor.OnClipboardChange -= new ClipboardMonitor.OnClipboardChangeEventHandler(ClipboardMonitor_OnClipboardChange);
            ClipboardMonitor.Stop(); // do not forget to stop

            ClearMeasCycles();
            CycleList newCycles = new CycleList();
            // NEXT: manual entry needs more work to get it completed, but you have a good start here
            Multiplicity key = new Multiplicity(ah.det.MultiplicityParams); // APluralityOfMultiplicityAnalyzers: expand in some logical manner, e.g. enable user to select the analyzer and related results for manual entry and assignment

            for (int i = 0; i < MAX_MANUAL_ENTRIES; i++)                    // hard-coded limits are ... lame
            {
                DataGridViewRow r = cyclesGridView.Rows[i];
                if (r.Cells == null || (r.Cells[1].Value == null) || r.Cells[1].Value.ToString() == string.Empty)
                {
                    break;
                }

                Cycle cycle = new Cycle(m_log);

                ulong tots = 0, r_acc = 0, acc = 0;
                ulong.TryParse(r.Cells[1].Value.ToString(), out tots);
                ulong.TryParse((string)r.Cells[2].FormattedValue, out r_acc); // FormattedValue gives "" instead of the null checked for in the conditional above
                ulong.TryParse((string)r.Cells[3].FormattedValue, out acc);

                newCycles.Add(cycle);
                cycle.Totals      = tots;
                cycle.TS          = new TimeSpan(0, 0, 0, 0, (int)(1000 * m_counttime)); // milliseconds permitted for LM and future
                cycle.SinglesRate = tots / m_counttime;
                cycle.SetQCStatus(key, QCTestStatus.Pass);
                cycle.seq = i + 1;

                MultiplicityCountingRes mcr = new MultiplicityCountingRes(key.FA, cycle.seq);
                cycle.CountingAnalysisResults.Add(key, mcr);
                mcr.Totals = cycle.Totals;
                mcr.TS     = cycle.TS;
                mcr.ASum   = acc;
                mcr.RASum  = r_acc;

                // assign the hits to a single channel (0)
                cycle.HitsPerChannel[0] = tots;
                mcr.RawSinglesRate.v    = cycle.SinglesRate;

                // no alpha-beta, mult bins, HV, doubles, triples, raw nor corrected
            }

            int seq = 0;

            foreach (Cycle cycle in newCycles)  // add the necessary meta-data to the cycle identifier instance
            {
                seq++;
                cycle.UpdateDataSourceId(ConstructedSource.Manual, ah.det.Id.SRType,
                                         new DateTimeOffset(m_refDate.AddTicks(cycle.TS.Ticks * cycle.seq)), string.Empty);
            }
            NC.App.Opstate.Measurement.Add(newCycles);
            if (newCycles.Count > 0)
            {
                DialogResult = DialogResult.OK;
            }
            Close();
        }
Ejemplo n.º 12
0
        // assumes initalized measurement with at least one cycle, and at least one defined counting analysis result indexed by the detector's mult params, including VSRs fror LM
        void ComputeFromINCC5SRData(Measurement m, bool ABCorrected = false)
        {
            string pre = (m.AcquireState.data_src == ConstructedSource.Reanalysis ? "Rec" : "C");

            ctrllog.TraceEvent(LogLevels.Info, 34071, pre + "omputing: '" + m.MeasurementId.MeasDateTime.ToString() + ", " + m.MeasOption.PrintName() + "'");
            if (m.Cycles.Count < 1)
            {
                ctrllog.TraceEvent(LogLevels.Error, 34830, "Skipping, no cycles on '" + m.MeasurementId.MeasDateTime.ToString() + ", " + m.MeasOption.PrintName() + "'");
                return;
            }

            if (m.CountingAnalysisResults.Count < 1 || !m.CountingAnalysisResults.HasMultiplicity)
            {
                ctrllog.TraceEvent(LogLevels.Error, 34831, "Bad match between detector and this file type." + (!m.CountingAnalysisResults.HasMultiplicity ? " No Multiplicity counter defined." : ""));
                return; //bad match between detector and this file type.
            }

            SRInstrument PseudoInstrument = new SRInstrument(m.Detector);

            PseudoInstrument.selected = true;
            if (!Instruments.Active.Contains(PseudoInstrument))
            {
                Instruments.Active.Add(PseudoInstrument); // add to global runtime list
            }
            m.CurrentRepetition = 0;
            NC.App.Opstate.SOH  = OperatingState.Living;

            try
            {
                MultiplicityCountingRes mcr = (MultiplicityCountingRes)m.CountingAnalysisResults[m.Detector.MultiplicityParams]; // APluralityOfMultiplicityAnalyzers: check for use of multiple analyzers
                // start counting using the per-cycle accumulation of summary results
                Array.Clear(mcr.RAMult, 0, mcr.RAMult.Length);
                Array.Clear(mcr.NormedAMult, 0, mcr.NormedAMult.Length);
                Array.Clear(mcr.UnAMult, 0, mcr.UnAMult.Length);

                mcr.AB.TransferIntermediates(src: m.Detector.AB);                  // remove, redundant copy in most cases
                CycleList cl = m.Cycles;
                m.Cycles = new CycleList();
                foreach (Cycle cycle in cl)             // process incrementally to match expected outlier processing behavior from INCC
                {
                    if (NC.App.Opstate.IsQuitRequested) // exit via abort or quit/save, follow-on code decides to continue with processing
                    {
                        ctrllog.TraceEvent(LogLevels.Warning, 430, "Cycle first-pass processing " + NC.App.Opstate.CancelStopAbortStateRep + " at sequence #" + cycle.seq + ", " + m.CurrentRepetition);
                        break;
                    }
                    m.CurrentRepetition++;
                    m.Cycles.Add(cycle);
                    m.SetQCStatus(cycle);
                    CycleProcessing.ApplyTheCycleConditioningSteps(cycle, m);
                    m.CycleStatusTerminationCheck(cycle);
                    ctrllog.TraceEvent(LogLevels.Verbose, 5439, "Cycle " + cycle.seq.ToString());
                    if (m.CurrentRepetition % 8 == 0)
                    {
                        FireEvent(EventType.ActionInProgress, this);
                    }
                }
                FireEvent(EventType.ActionInProgress, this);
                // trim any None's that were not processed (occurs during a cancel/stop intervention)
                m.Cycles.Trim(m.Detector.MultiplicityParams); // APluralityOfMultiplicityAnalyzers: expand when detector has multiple analyzers
            }
            catch (Exception e)
            {
                NC.App.Opstate.SOH = OperatingState.Trouble;
                ctrllog.TraceException(e, true);
                ctrllog.TraceEvent(LogLevels.Warning, 430, "Processing stopped at cycle " + m.CurrentRepetition);
            }
            finally
            {
                NC.App.Loggers.Flush();
            }

            if (!NC.App.Opstate.IsAbortRequested)  // stop/quit means continue with what is available
            {
                if (m.HasReportableData)
                {
                    m.CalculateMeasurementResults();
                    new ReportMangler(ctrllog).GenerateReports(m);
                    m.SaveMeasurementResults();
                }
            }
            NC.App.Opstate.ResetTokens();
            Instruments.All.Remove(PseudoInstrument);
        }
        void InitData()
        {
            int n = this.Width / _Interval + 1;//计算需储存数据个数
            if (_Datas[0] == null)
            {
                _Datas[0] = new CycleList<float>(n);
            }
            else
            {
                _Datas[0].SetCapacity(n);
            }

            if (_Datas[1] == null)
            {
                _Datas[1] = new CycleList<float>(n);
            }
            else
            {
                _Datas[1].SetCapacity(n);
            }

            //设置极值
            low = float.PositiveInfinity;
            high = float.NegativeInfinity;
        }
Ejemplo n.º 14
0
        private void OKBtn_Click(object sender, EventArgs e)
        {
            ClipboardMonitor.OnClipboardChange -= new ClipboardMonitor.OnClipboardChangeEventHandler(ClipboardMonitor_OnClipboardChange);
            ClipboardMonitor.Stop(); // do not forget to stop

            ClearMeasCycles();
            CycleList newCycles = new CycleList();
            // NEXT: manual entry needs more work to get it completed, but you have a good start here
            Multiplicity key = new Multiplicity(ah.det.MultiplicityParams);  // APluralityOfMultiplicityAnalyzers: expand in some logical manner, e.g. enable user to select the analyzer and related results for manual entry and assignment
            for (int i = 0; i < MAX_MANUAL_ENTRIES; i++) // hard-coded limits are ... lame
            {
                DataGridViewRow r = cyclesGridView.Rows[i];
                if (r.Cells == null || (r.Cells[1].Value == null) || r.Cells[1].Value.ToString() == string.Empty)
                    break;

                Cycle cycle = new Cycle(m_log);

                ulong tots = 0, r_acc = 0, acc = 0;
                ulong.TryParse(r.Cells[1].Value.ToString(), out tots);
                ulong.TryParse((string)r.Cells[2].FormattedValue, out r_acc); // FormattedValue gives "" instead of the null checked for in the conditional above
                ulong.TryParse((string)r.Cells[3].FormattedValue, out acc);

                newCycles.Add(cycle);
                cycle.Totals = tots;
                cycle.TS = new TimeSpan(0, 0, 0, 0, (int)(1000 * m_counttime)); // milliseconds permitted for LM and future
                cycle.SinglesRate = tots / m_counttime;
                cycle.SetQCStatus(key, QCTestStatus.Pass);
                cycle.seq = i+1;

                MultiplicityCountingRes mcr = new MultiplicityCountingRes(key.FA, cycle.seq);
                cycle.CountingAnalysisResults.Add(key, mcr);
                mcr.Totals = cycle.Totals;
                mcr.TS = cycle.TS;
                mcr.ASum = acc;
                mcr.RASum = r_acc;

                // assign the hits to a single channel (0)
                cycle.HitsPerChannel[0] = tots;
                mcr.RawSinglesRate.v = cycle.SinglesRate;

                // no alpha-beta, mult bins, HV, doubles, triples, raw nor corrected

            }

            int seq = 0;
            foreach (Cycle cycle in newCycles)  // add the necessary meta-data to the cycle identifier instance
            {
                seq++;
                cycle.UpdateDataSourceId(ConstructedSource.Manual, ah.det.Id.SRType,
                    new DateTimeOffset(m_refDate.AddTicks(cycle.TS.Ticks * cycle.seq)), string.Empty);
            }
            NC.App.Opstate.Measurement.Add(newCycles);
            if (newCycles.Count > 0)
                DialogResult = DialogResult.OK;
            Close();
        }
Ejemplo n.º 15
0
 public DataMap()
 {
     InitializeComponent();
     DataList = new CycleList<PointF>(2000);
 }
 //计算最小值
 private float ComputLow(CycleList<float> Datas)
 {
     if (Datas.Amount > 0)
     {
         float r = Datas[0];
         for (int i = 0; i < Datas.Amount; i++)
         {
             if (Datas[i] < r)
                 r = Datas[i];
         }
         return r;
     }
     else
         return 0;
 }
Ejemplo n.º 17
0
 public DataMap()
 {
     InitializeComponent();
     DataList = new CycleList <PointF>(2000);
 }
Ejemplo n.º 18
0
 internal object GetStringRepresentation()
 {
     return
         (string.Join(" -> ", CycleList.Select(r => "[" + r.TargetRepresentation + "]")));
 }
Ejemplo n.º 19
0
        void PlotThePlots(CycleList cl, Multiplicity mkey)
        {
            Series s1 = Singles.Series["Vals"];
            s1.MarkerStyle = MarkerStyle.Circle;
            s1.MarkerColor = System.Drawing.Color.SkyBlue;
            s1.MarkerSize = 5;
            s1.MarkerBorderColor = System.Drawing.Color.DarkCyan;
            s1.Color = System.Drawing.Color.MediumPurple;

            Series s2 = Doubles.Series["Vals"];
            s2.MarkerStyle = MarkerStyle.Circle;
            s2.MarkerColor = System.Drawing.Color.SkyBlue;
            s2.MarkerSize = 5;
            s2.MarkerBorderColor = System.Drawing.Color.DarkCyan;
            s2.Color = System.Drawing.Color.MediumPurple;

            Series s3 = Triples.Series["Vals"];
            s3.MarkerStyle = MarkerStyle.Circle;
            s3.MarkerColor = System.Drawing.Color.SkyBlue;
            s3.MarkerSize = 5;
            s3.MarkerBorderColor = System.Drawing.Color.DarkCyan;
            s3.Color = System.Drawing.Color.MediumPurple;

            int i = 0;
            foreach (Cycle c in cl)
            {
                i++;
                MultiplicityCountingRes mcr = c.MultiplicityResults(mkey);
                bool somtingfunnyhere = (c.QCStatus(mkey).status != QCTestStatus.Pass);

                int idx = s1.Points.AddXY(i, mcr.DeadtimeCorrectedSinglesRate.v);  // next: vary color and shape based on cycle status/outlier status
                s2.Points.AddXY(i, mcr.DeadtimeCorrectedDoublesRate.v);
                s3.Points.AddXY(i, mcr.DeadtimeCorrectedTriplesRate.v);
                if (somtingfunnyhere)
                {
                    s1.Points[idx].MarkerColor = System.Drawing.Color.Orchid;
                    s2.Points[idx].MarkerColor = System.Drawing.Color.Orchid;
                    s3.Points[idx].MarkerColor = System.Drawing.Color.Orchid;
                    s1.Points[idx].ToolTip = string.Format("#{0} {1}", c.seq, c.QCStatus(mkey).INCCString());
                    s3.Points[idx].ToolTip = s2.Points[idx].ToolTip = s1.Points[idx].ToolTip;
                }

            }
        }
Ejemplo n.º 20
0
        //// BUTTONCLICK HANDLERS ///////////////////////////////////////////////

        public DialogResult OKButton_Click(object sender, EventArgs e)
        {
            DialogResult dr = DialogResult.Cancel;

            if (ap.modified)
            {
                INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, ap.item_type, DateTime.Now);
                ap.MeasDateTime = sel.TimeStamp; ap.lm.TimeStamp = sel.TimeStamp;
                NC.App.DB.AddAcquireParams(sel, ap);  // it's a new one, not the existing one modified
            }

            // The acquire is set to occur
            if (ap.data_src != ConstructedSource.Reanalysis)  // Reanalysis is a bit backwards, the correct measurement is fully constructed before this point
            {
                LMAcquire.ResetMeasurement();
            }

            switch (ap.data_src)
            {
            case ConstructedSource.Live:                 // set up the instrument list for the action controller
                Integ.BuildMeasurement(ap, det, mo);
                UIIntegration.Controller.file = false;   // make sure to use the DAQ controller, not the file controller
                NC.App.AppContext.FileInput   = null;    // reset the cmd line file input flag
                if (det.ListMode)
                {
                    // patch override lm.Interval with run_count_time from dialog
                    // the acquire dialogs field values, as seen and modified by the user, override the LM-only acquire settings for virtual SR measurements
                    NC.App.Opstate.Measurement.AcquireState.lm.Interval = NC.App.Opstate.Measurement.AcquireState.run_count_time;
                    NC.App.Opstate.Measurement.AcquireState.lm.Cycles   = NC.App.Opstate.Measurement.AcquireState.num_runs;

                    // Check NC.App.Opstate.Measurement.AnalysisParams for at least one VSR
                    // If not present, inform and pop up the wizard
                    // If present, inform with new dialog, do not pop up the wizard
                    if (NC.App.Opstate.Measurement.AnalysisParams.HasMatchingVSR(det.MultiplicityParams))
                    {
                        dr = DialogResult.OK;
                    }
                    else
                    {
                        dr = (new LMAcquire(ap, det, fromINCC5Acq: true)).ShowDialog();        // analyzers are created in here, placed on global measurement
                        if (dr == DialogResult.OK)
                        {
                            NC.App.DB.UpdateAcquireParams(ap);     //update it again
                            NC.App.DB.UpdateDetector(det);
                        }
                    }

                    if (dr == DialogResult.OK)
                    {
                        // if ok, the analyzers are set up, so can kick it off now.
                        UIIntegration.Controller.ActivateDetector(det);
                    }
                }
                else
                {
                    SRInstrument sri = new SRInstrument(det);
                    sri.selected = true;
                    sri.Init(NC.App.Loggers.Logger(LMLoggers.AppSection.Data), NC.App.Loggers.Logger(LMLoggers.AppSection.Analysis));
                    if (!Instruments.All.Contains(sri))
                    {
                        Instruments.All.Add(sri);     // add to global runtime list
                    }
                    dr = DialogResult.OK;
                }
                break;

            case ConstructedSource.DB:
                NC.App.AppContext.DBDataAssay = true;
                UIIntegration.Controller.file = true;
                IDDAcquireDBMeas dbdlg = new IDDAcquireDBMeas(this);
                if (dbdlg.HasItems())
                {
                    dr = dbdlg.ShowDialog();
                    if (dr == DialogResult.OK)
                    {
                        Integ.BuildMeasurement(ap, det, mo);
                        DateTimeOffset dto = dbdlg.measurementId.MeasDateTime;
                        NC.App.Logger(LMLoggers.AppSection.App).TraceEvent(LogLevels.Info, 87654,
                                                                           "Using " + dto.ToString("MMM dd yyy HH:mm:ss.ff K"));
                        NC.App.Opstate.Measurement.MeasDate = dto;
                        // get the cycles for the selected measurement from the database, and add them to the current measurement
                        CycleList cl = NC.App.DB.GetCycles(det, dbdlg.measurementId, ap.data_src);     // APluralityOfMultiplicityAnalyzers: // URGENT: get all the cycles associated with each analzyer, restoring into the correct key->result pair
                        NC.App.Opstate.Measurement.Add(cl);
                        // use the cycle time interval as found in the data, taking the first entry because equal intervals are assumed
                        if (cl.Count > 0)
                        {
                            NC.App.Opstate.Measurement.AcquireState.lm.Interval             = NC.App.Opstate.Measurement.AcquireState.run_count_time
                                                                                            = cl[0].TS.TotalSeconds;
                        }
                        NC.App.DB.UpdateAcquireParams(ap);     //update it again
                    }
                }
                else
                {
                    MessageBox.Show("No items found in database matching these parameters", "WARNING");
                }
                break;

            case ConstructedSource.Manual:
                UIIntegration.Controller.file = true;
                NC.App.AppContext.DBDataAssay = true;
                IDDManualDataEntry mdlg = new IDDManualDataEntry();
                mdlg.AH = this;
                dr      = mdlg.ShowDialog(); // the work constructing the measurement is done in the dialog class
                break;

            case ConstructedSource.Reanalysis:
                UIIntegration.Controller.file = true;
                NC.App.AppContext.DBDataAssay = true;
                dr = DialogResult.OK;
                // the measurement re-creation work is done in the IDDReanalysisAssay dialog class prior to reaching this point
                break;

            case ConstructedSource.CycleFile:
                Integ.BuildMeasurementMinimal(ap, det, mo);                          // the measurement is reconstructed before each test data file processing, so this is meant as a carrier for certain kick-off values
                NC.App.AppContext.TestDataFileAssay = true;
                UIIntegration.Controller.file       = true;
                dr = UIIntegration.GetUsersFile("Select a test data (disk) file", NC.App.AppContext.FileInput, "INCC5 Test data (disk)", "dat", "cnn");
                break;

            case ConstructedSource.ReviewFile:
                Integ.BuildMeasurementMinimal(ap, det, mo);                          // acquire type and measurement option are read from each NCC file itself, so this instance is an acquire state kick-off carrier value
                NC.App.AppContext.ReviewFileAssay = true;
                UIIntegration.Controller.file     = true;
                dr = UIIntegration.GetUsersFile("Select an NCC file", NC.App.AppContext.FileInput, "INCC5 Review", "NCC");
                break;

            case ConstructedSource.NCDFile:
                Integ.BuildMeasurement(ap, det, mo);
                NC.App.AppContext.NCDFileAssay = true;
                UIIntegration.Controller.file  = true;
                if (det.ListMode || NC.App.Opstate.Measurement.MeasOption.IsListMode())
                {
                    dr = (new LMAcquire(ap, det, fromINCC5Acq: true)).ShowDialog();      // show LM-relevant acquire-style settings for modification or confirmation
                }
                else
                {
                    dr = UIIntegration.GetUsersFilesFolder("Select NCD files or folder", NC.App.AppContext.FileInput, "LMMM NCD", "ncd");
                }
                break;

            case ConstructedSource.SortedPulseTextFile:
                Integ.BuildMeasurement(ap, det, mo);
                NC.App.AppContext.PulseFileAssay = true;
                UIIntegration.Controller.file    = true;
                if (det.ListMode || NC.App.Opstate.Measurement.MeasOption.IsListMode())
                {
                    dr = (new LMAcquire(ap, det, fromINCC5Acq: true)).ShowDialog();      // show LM-relevant acquire-style settings for modification or confirmation
                }
                else
                {
                    dr = UIIntegration.GetUsersFilesFolder("Select pulse files or folder", NC.App.AppContext.FileInput, "pulse", "txt");
                }
                break;

            case ConstructedSource.PTRFile:
                Integ.BuildMeasurement(ap, det, mo);
                NC.App.AppContext.PTRFileAssay = true;
                UIIntegration.Controller.file  = true;
                if (det.ListMode || NC.App.Opstate.Measurement.MeasOption.IsListMode())
                {
                    dr = (new LMAcquire(ap, det, fromINCC5Acq: true)).ShowDialog();      // show LM-relevant acquire-style settings for modification or confirmation
                }
                else
                {
                    dr = UIIntegration.GetUsersFilesFolder("Select PTR-32 files or folder", NC.App.AppContext.FileInput, "PTR-32", "bin", "chn");
                }
                break;

            case ConstructedSource.MCA527File:
                Integ.BuildMeasurement(ap, det, mo);
                NC.App.AppContext.MCA527FileAssay = true;
                UIIntegration.Controller.file     = true;
                if (det.ListMode || NC.App.Opstate.Measurement.MeasOption.IsListMode())
                {
                    dr = (new LMAcquire(ap, det, fromINCC5Acq: true)).ShowDialog();      // show LM-relevant acquire-style settings for modification or confirmation
                }
                else
                {
                    dr = UIIntegration.GetUsersFilesFolder("Select MCA files or folder", NC.App.AppContext.FileInput, "MCA527", "mca");
                }
                break;

            default:
                break;
            }
            return(dr);
        }
Ejemplo n.º 21
0
        protected Section ConstructReportSection(ReportSections section, CycleList cycles)
        {
            Section sec = null;
            if (!(bool)selectedReportSections.GetValue((int)section))
                return sec;
            try
            {
                switch (section)
                {
                    // these have multiple rows based on the report content
                    case ReportSections.CycleSource:
                        sec = new Section(typeof(CycleSource), 1, 1, 1, "Cycle");
                        sec[1].Add(0, "Cycle source");
                        break;
                    case ReportSections.MultiplicityDistributions:
                        sec = DoAcrossForManyMults("Cycle multiplicity distributions", typeof(eMultiplicityDistributions), true);
                        break;
                    case ReportSections.ChannelCounts:
                        break;
                    case ReportSections.ChannelRates:
                        break;
                    case ReportSections.ComputedMultiplicityIntermediates:
                        sec = DoAcrossForManyMults("Cycle moments (NNV)", typeof(ComputedMultiplicityIntermediates), true);
                        break;
                    case ReportSections.RawCycles:
                    {
                        ConstructedSource src = ConstructedSource.Unknown;
                        InstrType inst = InstrType.Unknown;
                        if (cycles.Count > 0)
                        {
                            src = cycles[0].DataSourceId.source;
                            inst = cycles[0].DataSourceId.SRType;
                        }
                        if (cycles.Count > 0 && src.MightHaveScalerData(inst)) // anything that might have Scaler data
                            sec = DoAcrossForManyMults("Cycle raw data", typeof(INCCCycles), true);
                        else
                            sec = DoAcrossForManyMults("Cycle raw data", typeof(RawCycles), true);
                    }
                        break;
                    case ReportSections.DTCRateCycles:
                        sec = DoAcrossForManyMults("Cycle DTC rate data", typeof(DTCRateCycles), true);
                        break;
                    case ReportSections.RateCycles:
                        sec = DoAcrossForManyMults("Cycle rate data", typeof(RateCycles), true);
                        break;
                    case ReportSections.RepResults:
                        break;
                    case ReportSections.RepDytlewskiResults:

                        break;
                }
                if (sec == null) // no mult-based data
                    return sec;
                Row[] temp = null;
                foreach (Cycle cyc in cycles)
                {
                    switch (section)
                    {
                        // these have multiple rows based on the report content
                        case ReportSections.MultiplicityDistributions:
                            int repeat = meas.CountingAnalysisResults.GetResultsCount(typeof(Multiplicity));
                            temp = GenMultDistRows(cyc.CountingAnalysisResults, cyc.seq); // done: uses # of analyzers and goes across
                            Section sec2 = new Section(typeof(eMultiplicityDistributions), 0, 0, temp.Length, "Cycle " + cyc.seq, repeat);
                            sec.AddRange(sec2);
                            sec.AddRange(temp);
                            break;
                        case ReportSections.ChannelCounts:
                            //    sec.Add(GenChannelCountsRows(cyc));
                            break;
                        case ReportSections.ChannelRates:
                            //    sec.Add(GenChannelCountsRows(cyc));
                            break;
                        case ReportSections.ComputedMultiplicityIntermediates:
                            temp = GenMultiplicityIntermediatesRow(cyc.CountingAnalysisResults, cyc); // alpha and beta are only in the summary because they do not change (gatelength-based)
                            sec.AddRange(temp);
                            break;
                        case ReportSections.RawCycles:
                            if (cyc.DataSourceId.source.SRDAQ(cyc.DataSourceId.SRType))
                                sec.Add(GenINCCCycleRow(cyc));
                            else
                                sec.Add(GenRawCycleRow(cyc)); // done: uses # of analyzers and goes across
                            break;
                        case ReportSections.DTCRateCycles:
                            sec.Add(GenRateCycleRow(cyc, dtc:true));  // # of analyzers and goes across
                            break;
                        case ReportSections.RateCycles:
                            sec.Add(GenRateCycleRow(cyc));
                            break;
                        case ReportSections.RepResults:
                            //    sec.Add(GenResultsCycleRow(cyc));
                            break;
                        case ReportSections.RepDytlewskiResults:
                            //    sec.Add(GenDytlewskiResultsCycleRow(cyc));
                            break;
                        case ReportSections.CycleSource:
                            sec.Add(GenCycleSourceRow(cyc));
                            break;
                    }
                }
            }
            catch (Exception e)
            {
                ctrllog.TraceException(e);
            }
            return sec;
        }
Ejemplo n.º 22
0
 private void OKBtn_Click(object sender, EventArgs e)
 {
     if (CurrentDetectorRadioButton.Checked)
     {
         IDDSaveCampaignId f = new IDDSaveCampaignId();
         DialogResult      r = f.ShowDialog();
         if (r == DialogResult.OK)
         {
             string dest = UIIntegration.GetUsersFolder("Select Directory for Saving Measurement Data", string.Empty);
             if (string.IsNullOrEmpty(dest))
             {
                 return;
             }
             IDDMeasurementList measlist = new IDDMeasurementList();
             measlist.Init(f.FilteredList,
                           AssaySelector.MeasurementOption.unspecified,
                           lmonly: false, goal: IDDMeasurementList.EndGoal.Transfer, inspnum: f.inspnum, detector: f.det);
             DialogResult dr = DialogResult.None;
             if (measlist.bGood)
             {
                 measlist.ShowDialog();
             }
             dr = measlist.DialogResult;
             if (dr != DialogResult.OK)
             {
                 return;
             }
             List <Measurement> mlist = measlist.GetSelectedMeas();
             foreach (Measurement m in mlist)
             {
                 CycleList cl = NC.App.DB.GetCycles(f.det, m.MeasurementId, m.AcquireState.data_src);                         // APluralityOfMultiplicityAnalyzers: // URGENT: get all the cycles associated with each analyzer, restoring into the correct key->result pair
                 m.Cycles.AddRange(cl);
                 // NEXT: m.CFCyles for AAS not used for INCC6 created measurements, only INCC5 transfer measurements have them m.Add(c, i);
                 m.INCCAnalysisResults.TradResultsRec = NC.App.DB.ResultsRecFor(m.MeasurementId);
                 m.ReportRecalc();                         // dev note: not strictly from INCC5, but based on usage complaint from LANL
             }
             List <INCCTransferFile> itdl = INCCKnew.XFerFromMeasurements(mlist);
             foreach (INCCTransferFile itd in itdl)
             {
                 itd.Save(dest);
             }
         }
     }
     else if (AllDetectorsRadioButton.Checked)
     {
         string dest = UIIntegration.GetUsersFolder("Select Directory for Saving Measurement Data", string.Empty);
         if (string.IsNullOrEmpty(dest))
         {
             return;
         }
         List <Detector> l = NC.App.DB.Detectors;
         foreach (Detector det in l)
         {
             List <Measurement> mlist = NC.App.DB.MeasurementsFor(det.Id.DetectorId);
             foreach (Measurement m in mlist)
             {
                 CycleList cl = NC.App.DB.GetCycles(det, m.MeasurementId, m.AcquireState.data_src);                         // APluralityOfMultiplicityAnalyzers: // URGENT: get all the cycles associated with each analyzer, restoring into the correct key->result pair
                 m.Add(cl);
                 if (m.MeasOption == AssaySelector.MeasurementOption.rates)
                 {
                     return;
                 }
                 else
                 {
                     m.INCCAnalysisResults.TradResultsRec = NC.App.DB.ResultsRecFor(m.MeasurementId);
                 }
             }
             List <INCCTransferFile> itdl = INCCKnew.XFerFromMeasurements(mlist);
             foreach (INCCTransferFile itd in itdl)
             {
                 itd.Save(dest);
             }
         }
     }
 }
Ejemplo n.º 23
0
        // dev note: could make this a single function on four subclassed variants of a parent class
        protected Section ConstructReportSection(RawReportSections section, CycleList cycles)
        {
            Section sec = null;

            if (!(bool)selectedReportSections.GetValue((int)section))  // user selection
                return sec;
            try
            {
                int i = 1;
                Row[] temp;
                IEnumerator iter;
                switch (section)
                {
                    case RawReportSections.CoincidenceMatrix:
                        iter = meas.CountingAnalysisResults.GetATypedParameterEnumerator(typeof(AnalysisDefs.Coincidence), true);
                        while (iter.MoveNext())
                        {
                            SpecificCountingAnalyzerParams sap = (SpecificCountingAnalyzerParams)iter.Current;
                            if (sec == null) sec = new Section(typeof(CoincidenceMatrix), 1);
                            Row r = new Row(); r.Add(0, "Coincidence RA, A and R Matrix results (" + i + ")");
                            if (sap.suspect || !meas.CountingAnalysisResults.ContainsKey(sap))
                            {
                                r.Add(1, "Unusable results");
                                r.Add(2, sap.reason);
                                continue;
                            }
                            sec.AddLabelAndColumn(r, "Cycle");
                            Row hcrow = sec[sec.Count - 1];
                            hcrow.Clear();
                            hcrow.TS = CoincidenceHeader;
                            hcrow.GenFromEnum(typeof(CoincidenceMatrix), "Cycle", 0);
                            foreach (Cycle cyc in cycles)
                            {
                                CoincidenceMatrixResult cor = (CoincidenceMatrixResult)cyc.CountingAnalysisResults[sap];
                                temp = GenCoincidenceRows(cor, cyc);
                                sec.AddRange(temp);
                            }
                            i++;
                        }
                        break;
                    case RawReportSections.HitsPerChn: // using  cycle.HitsPerChannel
                        //iter = meas.CountingAnalysisResults.GetATypedParameterEnumerator(typeof(AnalysisDefs.BaseRate), true);
                        //while (iter.MoveNext())
                        //{
                        //    SpecificCountingAnalyzerParams sap = (SpecificCountingAnalyzerParams)iter.Current;
                        //    if (sec == null) sec = new Section(typeof(RateInterval), 1);
                        //    Row r = new Row(); r.Add(0, "Hits per channel (" + i + ")");
                        //    if (sap.suspect || !meas.CountingAnalysisResults.ContainsKey(sap))
                        //    {
                        //        r.Add(1, "Unusable results");
                        //        r.Add(2, sap.reason);
                        //        continue;
                        //    }
                        //    sec.AddLabelAndColumn(r, "Cycle");
                        //    Row hcrow = sec[sec.Count - 1];
                        //    hcrow.Clear();
                        //    hcrow.TS = RateHeader;
                        //    hcrow.GenFromEnum(typeof(RateInterval), "Cycle", 0);
                        //    foreach (Cycle cyc in cycles)
                        //    {
                        //        RatesResultEnhanced ccrrm = (RatesResultEnhanced)cyc.CountingAnalysisResults[sap];
                        //        temp = GenChnCountsRows(ccrrm, cyc);
                        //        sec.AddRange(temp);
                        //    }
                        //    i++;
                        //}

                        {
                            if (sec == null) sec = new Section(typeof(RateIntervalCalc), 1);
                            Row r = new Row(); r.Add(0, "Hits per channel");
                            sec.AddLabelAndColumn(r, "Cycle");
                            Row hcrow = sec[sec.Count - 1];
                            hcrow.Clear();
                            hcrow.TS = RateHeader;
                            hcrow.GenFromEnum(typeof(RateInterval), "Cycle", 0);
                            foreach (Cycle cyc in cycles)
                            {
                                temp = GenChnCountsRows(cyc);
                                sec.AddRange(temp);
                            }
                            i++;
                        }
                        break;
                    case RawReportSections.RatePerChn: // Using cycle.HitsPerChannel
                        {
                            if (sec == null) sec = new Section(typeof(RateIntervalCalc), 1);
                            Row r = new Row(); r.Add(0, "Channel hits per second");
                            sec.AddLabelAndColumn(r, "Cycle");
                            Row hcrow = sec[sec.Count - 1];
                            hcrow.Clear();
                            hcrow.TS = RateHeader;
                            hcrow.GenFromEnum(typeof(RateInterval), "Cycle", 0);
                            foreach (Cycle cyc in cycles)
                            {
                                temp = GenRatesRows(cyc);
                                sec.AddRange(temp);
                            }
                            i++;
                        }
                        break;
                    case RawReportSections.Feynman:
                        iter = meas.CountingAnalysisResults.GetATypedParameterEnumerator(typeof(AnalysisDefs.Feynman), true);
                        while (iter.MoveNext())
                        {
                            SpecificCountingAnalyzerParams sap = (SpecificCountingAnalyzerParams)iter.Current;
                            if (sec == null) sec = new Section(typeof(Feynman), 1);
                            Row r = new Row(); r.Add(0, "Feynman results (" + i + ")");
                            sec.AddLabelAndColumn(r, "Cycle");
                            foreach (Cycle cyc in cycles)
                            {
                                Object obj;
                                bool there = cyc.CountingAnalysisResults.TryGetValue(sap, out obj);
                                if (!there)
                                    continue;
                                temp = GenFeynRows((FeynmanResultExt)obj, cyc);
                                sec.AddRange(temp);
                            }
                            i++;
                        }
                        break;
                    case RawReportSections.Rossi:
                        iter = meas.CountingAnalysisResults.GetATypedParameterEnumerator(typeof(AnalysisDefs.Rossi), true);
                        while (iter.MoveNext())
                        {
                            if (sec == null) sec = new Section(typeof(Rossi), 1);
                            SpecificCountingAnalyzerParams sap = (SpecificCountingAnalyzerParams)iter.Current;
                            Row r = new Row(); r.Add(0, "Rossi-" + '\u03B1' + " results (" + i + ")");
                            sec.AddLabelAndColumn(r, "Cycle");
                            foreach (Cycle cyc in cycles)
                            {
                                Object obj;
                                bool there = cyc.CountingAnalysisResults.TryGetValue(sap, out obj);
                                if (!there)
                                    continue;
                                temp = GenRossiRows((RossiAlphaResultExt)obj, cyc);
                                sec.AddRange(temp);
                            }
                            i++;
                        }
                        break;
                    case RawReportSections.TimeInterval:
                        iter = meas.CountingAnalysisResults.GetATypedParameterEnumerator(typeof(AnalysisDefs.TimeInterval), true);
                        while (iter.MoveNext())
                        {
                            if (sec == null) sec = new Section(typeof(TimeInterval), 1);
                            SpecificCountingAnalyzerParams sap = (SpecificCountingAnalyzerParams)iter.Current;
                            Row r = new Row(); r.Add(0, "Time Interval results (" + i + ")");
                            sec.AddLabelAndColumn(r, "Cycle");
                            foreach (Cycle cyc in cycles)
                            {
                                Object obj;
                                bool there = cyc.CountingAnalysisResults.TryGetValue(sap, out obj);
                                if (!there)
                                    continue;
                                temp = GenTimeIntervalRows((TimeIntervalResult)obj, cyc);
                                sec.AddRange(temp);
                            }
                            i++;
                        }
                        break;
                }
            }
            catch (Exception e)
            {
                ctrllog.TraceException(e);
            }

            return sec;
        }