예제 #1
0
 // uses # of analyzers and goes across
 Row GenRawSumsRow(CountingResultsMap map)
 {
     Row row = new Row();
     IEnumerator iter = map.GetMultiplicityEnumerator();
     int ecount = System.Enum.GetValues(typeof(RawSums)).Length;
     int entries = 0, repeat = 0;
     while (iter.MoveNext())
     {
         repeat = (ecount * entries);
         //Multiplicity mkey = (Multiplicity)((KeyValuePair<SpecificCountingAnalyzerParams, object>)(iter.Current)).Key;  // clean up this syntax, it's silly
         MultiplicityCountingRes mcr = (MultiplicityCountingRes)((KeyValuePair<SpecificCountingAnalyzerParams, object>)(iter.Current)).Value;
         row.Add((int)RawSums.Singles + repeat, meas.SinglesSum.ToString());
         row.Add((int)RawSums.RA + repeat, mcr.RASum.ToString());
         row.Add((int)RawSums.A + repeat, mcr.ASum.ToString());
         //Detector d = meas.Detectors.GetIt(mkey.sr)
         //if (d.Id.SRType <= LMDAQ.InstrType.AMSR)
         //{
         //    //row.Add((int)RawSums.Scaler1, m.Scaler1Sum.ToString());
         //    //row.Add((int)RawSums.Scaler2, m.Scaler2Sum.ToString());
         //}
         entries++;
     }
     return row;
 }
예제 #2
0
        // done: uses # of analyzers and goes across
        Row[] GenMultDistRows(CountingResultsMap map, int cycle)
        {
            ulong minbins = 0, maxbins = 0;
            IEnumerator iter = map.GetATypedResultEnumerator(typeof(AnalysisDefs.Multiplicity));
            while (iter.MoveNext())
            {
                MultiplicityCountingRes mcr = (MultiplicityCountingRes)iter.Current;
                //GetMaxNonZeroLength(mcr.RAMult, mcr.NormedAMult, ref newlen);
                minbins = Math.Max(mcr.MinBins, minbins);
                maxbins = Math.Max(mcr.MaxBins, maxbins);
                //newlen = maxbins;
            }
            int ecount = cycle < 1 ? System.Enum.GetValues(typeof(DistributionsAndAlphaBeta)).Length : System.Enum.GetValues(typeof(eMultiplicityDistributions)).Length;
            Row[] rows = new Row[maxbins];
            int repeat = 0;
            iter = map.GetMultiplicityEnumerator();
            for (ulong i = 0; i < minbins; i++)
            {
                rows[i] = new Row();
                rows[i].Add(0, i.ToString());
            }
            for (ulong i = minbins; i < maxbins; i++)
            {
                rows[i] = new Row();
                rows[i].Add(0, i.ToString());
            }
            int step = 0;
            while (iter.MoveNext())
            {
                MultiplicityCountingRes mcr = (MultiplicityCountingRes)((KeyValuePair<SpecificCountingAnalyzerParams, object>)(iter.Current)).Value;
                repeat = 1 + (ecount * step);

                for (ulong i = 0; i < minbins; i++)
                {
                    double RA, A, alpha, beta;
                    if ((ulong)mcr.RAMult.Length <= i)
                        RA = 0;
                    else
                        RA = mcr.RAMult[i];
                    if ((ulong)mcr.NormedAMult.Length <= i)
                        A = 0;
                    else
                        A = mcr.NormedAMult[i];
                    if ((ulong)mcr.alpha.Length <= i)
                        alpha = 0;
                    else
                        alpha = mcr.alpha[i];
                    if ((ulong)mcr.beta.Length <= i)
                        beta = 0;
                    else
                        beta = mcr.beta[i];
                    rows[i].Add((int)DistributionsAndAlphaBeta.RA + repeat, RA.ToString());
                    rows[i].Add((int)DistributionsAndAlphaBeta.A + repeat, A.ToString());
                    if (cycle < 1)
                    {
                        rows[i].Add((int)DistributionsAndAlphaBeta.Alpha + repeat, alpha.ToString());
                        rows[i].Add((int)DistributionsAndAlphaBeta.Beta + repeat, beta.ToString());
                    }
                }
                for (ulong i = minbins; i < maxbins; i++)
                {
                    double RA, A, alpha, beta;
                    if ((ulong)mcr.RAMult.Length <= i)
                        RA = 0;
                    else
                        RA = mcr.RAMult[i];
                    if ((ulong)mcr.NormedAMult.Length <= i)
                        A = 0;
                    else
                        A = mcr.NormedAMult[i];
                    if ((ulong)mcr.alpha.Length <= i)
                        alpha = 0;
                    else
                        alpha = mcr.alpha[i];
                    if ((ulong)mcr.beta.Length <= i)
                        beta = 0;
                    else
                        beta = mcr.beta[i];
                    rows[i].Add((int)DistributionsAndAlphaBeta.RA + repeat, RA.ToString());
                    rows[i].Add((int)DistributionsAndAlphaBeta.A + repeat, A.ToString());
                    if (cycle < 1)
                    {
                        rows[i].Add((int)DistributionsAndAlphaBeta.Alpha + repeat, alpha.ToString());
                        rows[i].Add((int)DistributionsAndAlphaBeta.Beta + repeat, beta.ToString());
                    }
                }
                step++;
            }
            return rows;
        }