コード例 #1
0
        /// <summary>
        /// Perform initialization at the start of a new cycle.
        /// </summary>
        /// <param name="cycle">The cycle.</param>
        public override void StartCycle(Cycle cycle, object param = null)
        {
            base.StartCycle(cycle, param);

            if (cycle != null) {
                m_parser.Reset((ulong) (Ptr32.Frequency * CentralizedState.App.Opstate.Measurement.AcquireState.lm.Interval));
                m_writingFile = CentralizedState.App.AppContext.LiveFileWrite;
            }
            if (param != null)
            {
                file = (NCCFile.PTRFilePair)param;
            }
        }
コード例 #2
0
ファイル: RDT.cs プロジェクト: tempbottle/INCC6
 public virtual void StartCycle(Cycle cycle, object param = null)
 {
     this.cycle = cycle;
 }
コード例 #3
0
ファイル: FileCtrlINCC5.cs プロジェクト: tempbottle/INCC6
        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);
            }
        }
コード例 #4
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
            Multiplicity key = new Multiplicity(ah.det.MultiplicityParams);

            for (int i = 0; i < MAX_MANUAL_ENTRIES; i++) // 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 AnalysisDefs.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 give "" 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();
        }
コード例 #5
0
ファイル: INCCKnew.cs プロジェクト: hnordquist/INCC6
 internal static unsafe run_rec MoveCycleToRunRec(Cycle c, Multiplicity mkey)
 {
     run_rec res = new run_rec();
     res.run_number = (ushort)c.seq;
     byte[] b = StringSquish(c.DataSourceId.dt.ToString("yy.MM.dd"), INCC.DATE_TIME_LENGTH);
     TransferUtils.Copy(b, res.run_date);
     b = StringSquish(c.DataSourceId.dt.ToString("HH:mm:ss"), INCC.DATE_TIME_LENGTH);
     TransferUtils.Copy(b, res.run_time);
     QCStatus qc = c.QCStatus(mkey);
     b = StringSquish(QCTestStatusExtensions.INCCString(qc), INCC.MAX_RUN_TESTS_LENGTH);
     TransferUtils.Copy(b, res.run_tests);
     res.run_count_time = c.TS.TotalSeconds;
     res.run_singles = c.Totals; // raw counts
     MultiplicityCountingRes mcr = c.MultiplicityResults(mkey);
     res.run_scaler1 = mcr.Scaler1.v;
     res.run_scaler2 = mcr.Scaler2.v;
     res.run_reals_plus_acc = mcr.RASum;
     res.run_acc = mcr.ASum;
     TransferUtils.CopyULongsToDbls(mcr.RAMult, res.run_mult_reals_plus_acc);
     TransferUtils.CopyULongsToDbls(mcr.NormedAMult, res.run_mult_acc);
     res.run_singles_rate = mcr.DeadtimeCorrectedSinglesRate.v; // correct counts or not?
     res.run_doubles_rate = mcr.DeadtimeCorrectedDoublesRate.v;
     res.run_triples_rate = mcr.DeadtimeCorrectedTriplesRate.v;
     res.run_scaler1_rate = mcr.Scaler1Rate.v;
     res.run_scaler2_rate = mcr.Scaler2Rate.v;
     res.run_multiplicity_mult = mcr.multiplication;
     res.run_multiplicity_alpha = mcr.multiAlpha;
     res.run_multiplicity_efficiency = mcr.efficiency;
     res.run_mass = mcr.Mass;
     res.run_high_voltage = c.HighVoltage;
     return res;
 }
コード例 #6
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
 Row[] GenTimeIntervalRows(TimeIntervalResult esr, Cycle c = null)
 {
     Row[] rows = new Row[3];
     rows[0] = GenTimeIntervalParamsRow(esr, c);
     Row[] rows2 = GenTimeIntervalDataRows(esr, c);
     rows[1] = rows2[0];
     rows[2] = rows2[1];
     return rows;
 }
コード例 #7
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
 Row[] GenTimeIntervalDataRows(TimeIntervalResult tir, Cycle c = null)
 {
     Row[] rows = { new Row(), new Row() };
     int shift = 0;
     if (c != null)  // add the cycle label column
     {
         rows[0].Add(0, c.seq.ToString());
         rows[1].Add(0, c.seq.ToString());
         shift = 1;
     }
     for (int i = 0; i <= tir.maxIndexOfNonzeroHistogramEntry; i++)
     {
         if (tir.timeIntervalHistogram[i] == 0)
             continue;
         rows[0].Add(i + shift, i.ToString());
         rows[1].Add(i + shift, tir.timeIntervalHistogram[i].ToString());
     }
     return rows;
 }
コード例 #8
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
        Row GenRossiParamsRow(RossiAlphaResultExt rar, Cycle c = null)
        {
            Row row = new Row();
            int shift = 0;
            if (c != null)
            {
                row.Add(0, c.seq.ToString());
                shift = 1;
            }

            row.Add((int)Rossi.GateWidth + shift, rar.gateWidth.ToString());
            row.Add((int)Rossi.Numgates + shift, rar.gateData.Length.ToString());
            return row;
        }
コード例 #9
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
 Row[] GenCoincidenceRows(CoincidenceMatrixResult cor, Cycle c = null)
 {
     Row[] rows = new Row[1 + cor.RACoincidenceRate.Length];
     rows[0] = GenCoincidenceParamsRow(cor, c); // ??
     Row[] rows2 = GenCoincidenceDataRows(cor, c); // RA numxnum and A numxnum and R numxnum
     Array.Copy(rows2, 0, rows, 1, rows2.Length);
     // removed the Cn header rows, rows[2] = rows2[1];
     return rows;
 }
コード例 #10
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
 Row GenCoincidenceParamsRow(CoincidenceMatrixResult cor, Cycle c = null)
 {
     Row row = new Row();
     int shift = 0;
     if (c != null)
     {
         row.Add(0, c.seq.ToString());
         shift = 1;
     }
     row.Add((int)CoincidenceMatrix.GateWidth + shift, (cor.coincidenceGateWidth * 1e-1).ToString());
     row.Add((int)CoincidenceMatrix.PreDelay + shift, (cor.coincidenceDeadDelay * 1e-1).ToString());
     row.Add((int)CoincidenceMatrix.LongDelay + shift, (cor.accidentalsDelay * 1e-1).ToString());
     return row;
 }
コード例 #11
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
 Row[] GenCoincidenceDataRows(CoincidenceMatrixResult cor, Cycle c = null)
 {
     int len = cor.RACoincidenceRate.Length;
     Row[] rows = new Row[len];
     for (int i = 0; i < len; i++)
         rows[i] = new Row();
     int shift = 0;
     for (int chn = 0; chn < len; chn++)
     {
         if (c != null)  // add the cycle label column
         {
             rows[chn].Add(0, c.seq.ToString());
             shift = 1;
         }
         int i = 0;
         //
         for (i = 0; i < len; i++)
         {
             rows[chn].Add(i + shift, cor.RACoincidenceRate[chn][i].ToString());
         }
         rows[chn].Add(i + shift, " "); i++;
         for (int j = 0; j < len; j++)
         {
             rows[chn].Add(i + shift + j, cor.ACoincidenceRate[chn][j].ToString());
         }
         i += 32;
         rows[chn].Add(i + shift, " "); i++;
         for (int j = 0; j < len; j++)
         {
             rows[chn].Add(i + shift + j, (cor.RACoincidenceRate[chn][j] - cor.ACoincidenceRate[chn][j]).ToString());
         }
     }
     return rows;
 }
コード例 #12
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
 Row[] GenChnCountsRows(Cycle c)
 {
     Row[] rows = new Row[2];
     rows[0] = GenRatesParamsRow(c); // interval and completed intervals
     Row[] rows2 = GenChnCountsRow(c); // the channel hits for the cycle
     rows[1] = rows2[0];
     return rows;
 }
コード例 #13
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
 Row[] GenChnCountsRows(RatesResultEnhanced rrm, Cycle c = null)
 {
     Row[] rows = new Row[2];
     rows[0] = GenRatesParamsRow(rrm, c); // interval and completed intervals
     Row[] rows2 = GenChnCountsRow(rrm, c); // the channel hits for the cycle
     rows[1] = rows2[0];
     return rows;
 }
コード例 #14
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
 Row[] GenChnCountsRow(Cycle c)
 {
     Row[] rows = { new Row() };
     int shift = 0;
     if (c != null)  // add the cycle label column
     {
         rows[0].Add(0, c.seq.ToString());
         shift = 1;
     }
     // the channel hits for the cycle
     for (int i = 0; i < N.ChannelCount; i++)
     {
         rows[0].Add(i + shift, c.HitsPerChannel[i].ToString());
     }
     return rows;
 }
コード例 #15
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
 Row[] GenChnCountsRow(RatesResultEnhanced rrm, Cycle c = null)
 {
     Row[] rows = { new Row() };
     int shift = 0;
     if (c != null)  // add the cycle label column
     {
         rows[0].Add(0, c.seq.ToString());
         shift = 1;
     }
     // the channel hits for the cycle
     for (int i = 0; i < N.ChannelCount; i++)
     {
         rows[0].Add(i + shift, rrm.neutronsPerChannel[i].ToString());
     }
     return rows;
 }
コード例 #16
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
        // print only up to the last non-zero entry, later use the Feynman X,Y dual row technique for this compression attempt
        Row GenRossiDataRow(RossiAlphaResultExt rar, Cycle c = null)
        {
            Row row = new Row();
            int shift = 0;
            if (c != null)
            {
                row.Add(0, c.seq.ToString());
                shift = 1;
            }
            int maxindex = rar.gateData.Length - 1;
            int i = 0;
            for (i = rar.gateData.Length - 1; i >= 0; i--)
            {
                if (rar.gateData[i] > 0)
                {
                    maxindex = i;
                    break;
                }
            }
            //happy dad!
            if (i == 0) // rolled all the way to the start ofthe array and found all 0s, empty bins!
            {
                maxindex = 0; // not 1000 and not -1
            }

            for (i = 0; i <= maxindex; i++)
            {
                row.Add(i + shift, rar.gateData[i].ToString());
            }
            return row;
        }
コード例 #17
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
        Row GenFeynmanDataRow(FeynmanResultExt fr, Cycle c = null)
        {
            Row row = new Row();
            int shift = 0;
            if (c != null)
            {
                row.Add(0, c.seq.ToString());
                shift = 1;
            }

            foreach (KeyValuePair<UInt32, UInt32> pair in fr.numGatesHavingNumNeutrons)
            {
                row.Add((int)pair.Key + shift, pair.Value.ToString());
            };

            return row;
        }
コード例 #18
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
 Row[] GenRossiRows(RossiAlphaResultExt rar, Cycle c = null)
 {
     Row[] rows = new Row[2];
     rows[0] = GenRossiParamsRow(rar, c);
     rows[1] = GenRossiDataRow(rar, c);
     return rows;
 }
コード例 #19
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
        Row GenFeynParamsRow(FeynmanResultExt fr, Cycle c = null)
        {
            Row row = new Row();
            int shift = 0;

            if (c != null)
            {
                row.Add(0, c.seq.ToString());
                shift = 1;
            }
            row.Add((int)Feynman.GateWidth + shift, fr.gateWidth.ToString());
            row.Add((int)Feynman.NumGates + shift, fr.numGatesHavingNumNeutrons.Count.ToString());
            row.Add((int)Feynman.CBar + shift, fr.cbar.ToString());
            row.Add((int)Feynman.C2Bar + shift, fr.c2bar.ToString());
            row.Add((int)Feynman.C3bar + shift, fr.c3bar.ToString());
            row.Add((int)Feynman.C + shift, fr.C.ToString());
            return row;
        }
コード例 #20
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
 Row GenTimeIntervalParamsRow(TimeIntervalResult esr, Cycle c = null)
 {
     Row row = new Row();
     int shift = 0;
     if (c != null)
     {
         row.Add(0, c.seq.ToString());
         shift = 1;
     }
     row.Add((int)TimeInterval.GateWidth + shift, esr.gateWidthInTics.ToString());
     row.Add((int)TimeInterval.Bins + shift, esr.maxIndexOfNonzeroHistogramEntry.ToString());
     return row;
 }
コード例 #21
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
 Row[] GenFeynRows(FeynmanResultExt fr, Cycle c = null)
 {
     Row[] rows = new Row[2];
     rows[0] = GenFeynParamsRow(fr, c);
     rows[1] = GenFeynmanDataRow(fr, c);
     return rows;
 }
コード例 #22
0
ファイル: INCCKnew.cs プロジェクト: hnordquist/INCC6
        // cf index only for AAS positional cycles
        unsafe ulong AddToCycleList(run_rec run, Detector det, int cfindex = -1)
        {
            Cycle cycle = new Cycle(mlogger);
            ulong MaxBins = 0;
            try
            {
                cycle.UpdateDataSourceId(ConstructedSource.INCCTransferCopy, // becomes transfer if reanalysis occurs
                                            det.Id.SRType,
                                            INCC.DateTimeFrom(TransferUtils.str(run.run_date, INCC.DATE_TIME_LENGTH), TransferUtils.str(run.run_time, INCC.DATE_TIME_LENGTH)), det.Id.FileName);
                meas.Add(cycle, cfindex);

                // mcr is created and stored in the cycle's CountingAnalysisResults
                MultiplicityCountingRes mcr = RunToCycle(run, cycle, det.MultiplicityParams);
                // AB is calculated at runtime when conditioning a cycle AFAICT, so its gotta be worked here at least once
                if (det.AB.Unset)
                {
                    ABKey abkey = new ABKey(det.MultiplicityParams, mcr);
                    LMRawAnalysis.SDTMultiplicityCalculator.SetAlphaBeta(abkey, det.AB);
                }
                mcr.AB.TransferIntermediates(det.AB);  // copy alpha beta onto the cycle's results
                MaxBins = mcr.MaxBins;
            }
            catch (Exception e)
            {
                mlogger.TraceEvent(LogLevels.Warning, 33085, "Cycle processing error {0} {1}", run.run_number, e.Message);
            }
            return MaxBins;
        }
コード例 #23
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
 Row[] GenHauckRows(HauckResult rar, Cycle c = null)
 {
     Row[] rows = new Row[2];
     //rows[0] = GenHauckParamsRow(rar, c);  // todo: along with columns and related details
     //rows[1] = GenHauckDataRow(rar, c);
     return rows;
 }
コード例 #24
0
ファイル: INCCKnew.cs プロジェクト: hnordquist/INCC6
        /// <summary>
        ///  Create the cycle counting results, add it to the measurement and copy the data from the run to the equivalent fields on the cycle
        /// </summary>
        /// <param name="run"></param>
        /// <param name="cycle"></param>
        public static unsafe MultiplicityCountingRes RunToCycle(run_rec run, Cycle cycle, Multiplicity key)
        {
            cycle.seq = run.run_number;
            cycle.TS = new TimeSpan(0, 0, (int)run.run_count_time);  // dev note: check if this is always only in seconds, or fractions of a second

            cycle.Totals = (ulong)run.run_singles;
            cycle.SinglesRate = run.run_singles / run.run_count_time; // use this value in the conditioning steps, it is not yet the DT corrected rate

            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

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

            mcr.DeadtimeCorrectedSinglesRate.v = run.run_singles_rate; // overridden later, not used
            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;

            mcr.RAMult = TransferUtils.multarrayxfer(run.run_mult_reals_plus_acc, INCC.MULTI_ARRAY_SIZE);
            mcr.NormedAMult = TransferUtils.multarrayxfer(run.run_mult_acc, INCC.MULTI_ARRAY_SIZE);
            mcr.MaxBins = (ulong)Math.Max(mcr.RAMult.Length, mcr.NormedAMult.Length);
            mcr.MinBins = (ulong)Math.Min(mcr.RAMult.Length, mcr.NormedAMult.Length);
            mcr.UnAMult = new ulong[mcr.MaxBins]; // todo: compute this
            return mcr;
        }
コード例 #25
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
 Row[] GenRatesDataRows(Cycle c)
 {
     Row[] rows = { new Row() };
     int shift = 0;
     if (c != null)  // add the cycle label column
     {
         rows[0].Add(0, c.seq.ToString());
         shift = 1;
     }
     // the channel hits/gatewidth for the cycle
     for (int i = 0; i < N.ChannelCount; i++)
     {
         double v = 0;
         if (c.TS.TotalSeconds != 0)
             v = c.HitsPerChannel[i] / c.TS.TotalSeconds;
         rows[0].Add(i + shift, v.ToString());
     }
     return rows;
 }
コード例 #26
0
ファイル: FileCtrlINCC5.cs プロジェクト: tempbottle/INCC6
        void AddTestDataCycle(int run, uint run_seconds, double run_count_time, Measurement meas, TestDataFile td, string pivot = "", int cfindex = -1)
        {
            Cycle cycle = new Cycle(datalog);
            try
            {
                cycle.UpdateDataSourceId(ConstructedSource.CycleFile, meas.Detectors[0].Id.SRType,
                        td.DTO.AddSeconds(run_seconds), td.Filename);
                cycle.seq = run;
                cycle.TS = TimeSpan.FromSeconds(run_count_time);  // dev note: check if this is always only in seconds, or fractions of a second
                                                                  // hn -- 9/4/14 -- not integer for count time.  Convert from double seconds here.
                                                                  // Joe still has force to int.  bleck!

                /* init run tests */
                cycle.SetQCStatus(meas.Detectors[0].MultiplicityParams, QCTestStatus.None); // multmult creates entry if not found
                meas.Add(cycle, cfindex);
                /* singles, reals + accidentals, accidentals */
                string l = td.reader.ReadLine();
                string[] zorks = l.Split((char[])null, StringSplitOptions.RemoveEmptyEntries);
                double[] v = new double[5];
                for (int z = 0; z < 5; z++)
                {
                    double d;
                    bool b = Double.TryParse(zorks[z], out d);
                    if (b)
                        v[z] = d;
                }
                cycle.Totals = (ulong)v[0];
                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 = v[4];
                mcr.RASum = v[3];
                mcr.Scaler1.v = v[1];
                mcr.Scaler2.v = v[2];
                cycle.SinglesRate = v[0] / run_count_time;

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

                mcr.RawSinglesRate.v = cycle.SinglesRate;

                /* number of multiplicity values */
                string mv = td.reader.ReadLine();
                UInt16 k = 0;
                UInt16.TryParse(mv, out k);
                if (k == 0)  // test data files require an entry with 1 bin set 0s for the absence of multiplicity, go figure
                {
                    ctrllog.TraceEvent(LogLevels.Error, 440, "This" + pivot + " cycle " + run.ToString() + " has no good multiplicity data.");
                    return;
                }
                mcr.MinBins = mcr.MaxBins = k;
                mcr.RAMult = new ulong[k];
                mcr.NormedAMult = new ulong[k];
                mcr.UnAMult = new ulong[k]; // todo: compute this
                /* multiplicity values */
                for (UInt16 j = 0; j < k; j++)
                {
                    string ra = td.reader.ReadLine();
                    string[] blorks = ra.Split((char[])null, StringSplitOptions.RemoveEmptyEntries);
                    double[] ve = new double[2];
                    for (int z = 0; z < 2; z++)
                    {
                        double d;
                        bool b = Double.TryParse(blorks[z], out d);
                        if (b)
                            ve[z] = d;
                    }
                    mcr.RAMult[j] = (ulong)ve[0];
                    mcr.NormedAMult[j] = (ulong)ve[1];
                }
                ctrllog.TraceEvent(LogLevels.Verbose, 5439, "Cycle " + cycle.seq.ToString() + pivot + ((mcr.RAMult[0] + mcr.NormedAMult[0]) > 0 ? " max:" + mcr.MaxBins.ToString() : " *"));

            }
            catch (Exception e)
            {
                ctrllog.TraceEvent(LogLevels.Warning, 33085, pivot + "cycle processing error {0} {1} {2}", run, e.Message, pivot);
            }
        }
コード例 #27
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
 Row GenRatesParamsRow(RatesResultEnhanced rrm, Cycle c = null)
 {
     Row row = new Row();
     int shift = 0;
     if (c != null)
     {
         row.Add(0, c.seq.ToString());
         shift = 1;
     }
     row.Add((int)RateInterval.GateWidth + shift, rrm.gateWidthInTics.ToString());
     row.Add((int)RateInterval.CompletedGates + shift, rrm.completedIntervals.ToString());
     row.Add((int)RateInterval.OverallTime + shift, rrm.totaltime.TotalSeconds.ToString());
     return row;
 }
コード例 #28
0
ファイル: RDT.cs プロジェクト: tempbottle/INCC6
 public virtual void StartCycle(Cycle cycle, object param = null)
 {
 }
コード例 #29
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
 Row GenRatesParamsRow(Cycle c)
 {
     Row row = new Row();
     int shift = 0;
     if (c != null)
     {
         row.Add(0, c.seq.ToString());
         shift = 1;
     }
     row.Add((int)RateIntervalCalc.OverallTime + shift, c.TS.TotalSeconds.ToString());
     return row;
 }
コード例 #30
0
        /// <summary>
        /// Perform initialization at the start of a new cycle.
        /// </summary>
        /// <param name="cycle">The cycle.</param>
        /// <param name="param">optional output file (MCAFile) class instance.</param>
        public override void StartCycle(Cycle cycle, object param = null)
        {
            base.StartCycle(cycle, param);

            if (cycle != null) {
                cycle.ExpectedTS = new TimeSpan((long)(CentralizedState.App.Opstate.Measurement.AcquireState.lm.Interval * TimeSpan.TicksPerSecond));
                writingFile = CentralizedState.App.AppContext.LiveFileWrite;
            }
            if (param != null)
            {
                file = (NCCFile.MCAFile)param;
            }
        }
コード例 #31
0
ファイル: RawAnalysisReport.cs プロジェクト: hnordquist/INCC6
 Row[] GenRatesRows(Cycle c = null)
 {
     Row[] rows = new Row[2];
     rows[0] = GenRatesParamsRow(c); // interval and completed intervals
     Row[] rows2 = GenRatesDataRows(c); // the channel rate for the cycle
     rows[1] = rows2[0];
     return rows;
 }