Ejemplo n.º 1
0
        protected void ConstructContextContent(INCCStyleSection sec, Detector det)
        {
            sec.AddTwo("Facility:", meas.AcquireState.facility.Name);
            sec.AddTwo("Material balance area:", meas.AcquireState.mba.Name);
            sec.AddTwo("Detector type:", det.Id.Type); // todo: revisit this, there can be multiple detectors because there can be multiple physical and virtual SR Params used to create results
            sec.AddTwo("Detector id:", det.Id.DetectorId);
            sec.AddTwo("Electronics id:", det.Id.ElectronicsId);
            sec.AddTwo("Inventory change code:", meas.AcquireState.inventory_change_code);
            sec.AddTwo("I/O code:", meas.AcquireState.io_code);
            sec.AddTwo("Measurement date:", meas.MeasDate.ToString("yy.MM.dd     HH:mm:ss"));
            sec.AddTwo("Results file name:", meas.INCCResultsFileNames[meas.INCCResultsFileNames.Count - 1]);
            sec.AddTwo("Inspection number:", meas.AcquireState.campaign_id);

            if (AssaySelector.ForMass(meas.MeasOption) || meas.MeasOption == AssaySelector.MeasurementOption.rates)
            {
                /* item id only if an assay, calibration, holdup or rates only */
                //todo: need to check why item_id not stored in Measurement object directly....hn 5.14.2015
                // it is located on the AcquireParameters
                sec.AddTwo("Item id:", meas.AcquireState.item_id); // or       sec.AddTwo("Item id:",m.AcquireState.item);
            }
            if (AssaySelector.HasStratum(meas.MeasOption))
            {
                sec.AddTwo("Stratum id:", meas.AcquireState.stratum_id.Name);
                if (meas.Stratum != null)
                {
                    sec.AddTwo("Bias uncertainty:", meas.Stratum.bias_uncertainty);
                    sec.AddTwo("Random uncertainty:", meas.Stratum.random_uncertainty);
                    sec.AddTwo("Systematic uncertainty:", meas.Stratum.systematic_uncertainty);
                    sec.AddTwo("Relative std deviation:", meas.Stratum.relative_std_dev);
                }
                else
                {
                    sec.AddTwo("Bias uncertainty:", "0.0000");
                    sec.AddTwo("Random uncertainty:", "0.0000");
                    sec.AddTwo("Systematic uncertainty:", "0.0000");
                    sec.AddTwo("Relative std deviation:", "0.0000");
                }
            }
            if (AssaySelector.ForMass(meas.MeasOption))
            {
                sec.AddTwo("Material type:", meas.AcquireState.item_type);
                sec.AddTwo("Original declared mass:", meas.AcquireState.mass);
            }
            sec.AddTwo("Measurement option:", meas.MeasOption.PrintName());
            if (AssaySelector.DougsBasics(meas.MeasOption))
            {           /* well configuration */
                sec.AddTwo("Detector configuration:", meas.AcquireState.well_config.ToString());
            }
            sec.AddTwo("Data source:", det.Id.source.ToString());
            sec.AddTwo("QC tests:", meas.AcquireState.qc_tests ? "On" : "Off");
            ErrorCalculationTechnique ect = meas.AcquireState.error_calc_method.Override(meas.MeasOption, det.Id.SRType);

            if (ect != ErrorCalculationTechnique.None)
            {
                sec.AddTwo("Error calculation:", ect.ToString() + " method");
            }
            sec.AddTwo("Accidentals method:", meas.Tests.accidentalsMethod != AccidentalsMethod.None ? (meas.Tests.accidentalsMethod.ToString() + "d") : "Not set");
            sec.AddTwo("Inspector name:", meas.AcquireState.user_id);
            sec.AddTwo("Passive comment:", meas.AcquireState.comment);
        }
Ejemplo n.º 2
0
        protected Section ConstructReportSection(INCCReportSection section, Detector det, MeasOptionSelector moskey = null)
        {
            INCCStyleSection sec = null;

            try
            {
                switch (section)
                {
                case INCCReportSection.Header:
                    sec = new INCCStyleSection(null, 1);
                    sec.AddHeader(N.App.Name + " " + N.App.Config.VersionString);      // section header
                    break;

                case INCCReportSection.Context:
                    sec = new INCCStyleSection(null, 1);
                    ConstructContextContent(sec, det);
                    break;

                case INCCReportSection.Isotopics:
                    if (AssaySelector.ForMass(meas.MeasOption))
                    {
                        sec = new INCCStyleSection(null, 1);
                        sec.SetFPCurrentFormatPrecision(4);
                        Isotopics curiso = Isotopics.update_isotopics(1.0, meas.MeasDate, meas.Isotopics, meas.logger, N.App.AppContext.INCCParity);
                        if (curiso == null)
                        {
                            curiso = new Isotopics();
                            meas.Isotopics.CopyTo(curiso);
                            ctrllog.TraceEvent(LogLevels.Warning, 82034, "Using incorrect updated defaults for " + meas.Isotopics.id);
                        }
                        sec.AddTwo("Isotopics id:", meas.Isotopics.id);
                        sec.AddTwo("Isotopics source code:", meas.Isotopics.source_code.ToString());
                        sec.AddDualNumericRow("Pu238:", meas.Isotopics[Isotope.pu238], curiso[Isotope.pu238]);
                        sec.AddDualNumericRow("Pu239:", meas.Isotopics[Isotope.pu239], curiso[Isotope.pu239]);
                        sec.AddDualNumericRow("Pu240:", meas.Isotopics[Isotope.pu240], curiso[Isotope.pu240]);
                        sec.AddDualNumericRow("Pu241:", meas.Isotopics[Isotope.pu241], curiso[Isotope.pu241]);
                        sec.AddDualNumericRow("Pu242:", meas.Isotopics[Isotope.pu242], curiso[Isotope.pu242]);
                        sec.AddDualDateOnlyRow("Pu date:", meas.Isotopics.pu_date, curiso.pu_date);
                        sec.AddDualNumericRow("Am241:", meas.Isotopics[Isotope.am241], curiso[Isotope.am241]);
                        sec.AddDualDateOnlyRow("Am date:", meas.Isotopics.am_date, curiso.am_date);
                        // dev note: here is where the alternative K vals are added in the Euratom version
                    }
                    break;

                case INCCReportSection.ShiftRegister:
                    sec = new INCCStyleSection(null, 1);
                    ConstructSRSection(sec, moskey.MultiplicityParams, det);
                    break;

                case INCCReportSection.Adjustments:
                    sec = new INCCStyleSection(null, 1);
                    if (AssaySelector.ForMass(meas.MeasOption) || meas.MeasOption == AssaySelector.MeasurementOption.rates)
                    {
                        ushort push = sec.FPFormatPrecision;
                        sec.SetFPCurrentFormatPrecision(4);
                        sec.AddNumericRow("Normalization constant:", meas.Norm.currNormalizationConstant);
                        sec.SetFPCurrentFormatPrecision(push);
                    }
                    if (AssaySelector.UsesBackground(meas.MeasOption))
                    {
                        sec.AddNumericRow("Passive singles bkgrnd:", meas.Background.DeadtimeCorrectedSinglesRate);
                        sec.AddNumericRow("Passive doubles bkgrnd:", meas.Background.DeadtimeCorrectedDoublesRate);
                        sec.AddNumericRow("Passive triples bkgrnd:", meas.Background.DeadtimeCorrectedTriplesRate);

                        if (det.Id.SRType <= InstrType.AMSR)
                        {
                            sec.AddNumericRow("Passive scaler1 bkgrnd:", meas.Background.Scaler1.v);
                            sec.AddNumericRow("Passive scaler2 bkgrnd:", meas.Background.Scaler2.v);
                        }

                        sec.AddNumericRow("Active singles bkgrnd:", meas.Background.INCCActive.Singles);
                        sec.AddNumericRow("Active doubles bkgrnd:", meas.Background.INCCActive.Doubles);
                        sec.AddNumericRow("Active triples bkgrnd:", meas.Background.INCCActive.Triples);
                        if (det.Id.SRType <= InstrType.AMSR)
                        {
                            sec.AddNumericRow("Passive scaler1 bkgrnd:", meas.Background.INCCActive.Scaler1Rate);
                            sec.AddNumericRow("Passive scaler2 bkgrnd:", meas.Background.INCCActive.Scaler2Rate);
                        }
                    }
                    break;

                case INCCReportSection.CycleSummary:
                    sec = new INCCStyleSection(null, 1);
                    sec.AddIntegerRow(String.Format("Number {0} cycles:", meas.INCCAnalysisState.Methods.HasActiveSelected() || meas.INCCAnalysisState.Methods.HasActiveMultSelected()?"Active":"Passive"), (int)meas.Cycles.GetValidCycleCountForThisKey(moskey.MultiplicityParams));    //det.MultiplicityParams)); // could also use CycleList length but CycleList can be longer when a reanalysis occurs and the analysis processing stops short of the end of the list due to modified termination conditions
                    sec.AddNumericRow("Count time (sec):", (meas.Cycles.Count > 0 ? meas.Cycles[0].TS.TotalSeconds : 0.0));
                    break;

                case INCCReportSection.Messages:
                    List <MeasurementMsg> sl = null;
                    bool found = meas.Messages.TryGetValue(moskey.MultiplicityParams, out sl);
                    if (found)
                    {
                        sec = new INCCStyleSection(null, 1);
                        sec.AddHeader(String.Format("{0} messages", meas.INCCAnalysisState.Methods.HasActiveSelected() || meas.INCCAnalysisState.Methods.HasActiveMultSelected() ? "Active" : "Passive"));      /// todo: is there an active messages section header analog?
                        foreach (MeasurementMsg m in sl)
                        {
                            Row r = new Row();
                            r.Add(0, m.text);      // expand to log style with toString?
                            sec.Add(r);
                        }
                    }
                    break;

                case INCCReportSection.Reference:
                    sec = new INCCStyleSection(null, 1);
                    sec.AddHeader("Counting results, summaries and cycle counts file name");      // section header
                    Row resline = new Row(); resline.Add(0, "  " + meas.ResultsFileName);
                    sec.Add(resline);
                    break;

                default:
                    break;
                }
            }
            catch (Exception e)
            {
                ctrllog.TraceException(e);
            }
            return(sec);
        }