Exemple #1
0
        private CountingAnalysisParameters CountingParameters(string detname)
        {
            DataTable dt = NC.App.Pest.GetACollection(DB.Pieces.CountingAnalyzers, detname);
            CountingAnalysisParameters cp = new AnalysisDefs.CountingAnalysisParameters();

            // 0 is mat name, 1 is det name, 2 is mat id, 3 is det id, 4 is first choice boolean
            foreach (DataRow dr in dt.Rows)
            {
                string type = "AnalysisDefs.";   // dev note: careful here, this is subject to bit rot
                if (dr["counter_type"].Equals(System.DBNull.Value))
                {
                    type += "BaseRate";
                }
                else
                {
                    type += (string)dr["counter_type"];
                }
                System.Type     t  = System.Type.GetType(type);
                ConstructorInfo ci = t.GetConstructor(Type.EmptyTypes);
                SpecificCountingAnalyzerParams sca = (SpecificCountingAnalyzerParams)ci.Invoke(null);
                cp.Add(sca);
                sca.gateWidthTics = DB.Utils.DBUInt64(dr["gatewidth"]);
                if (t == typeof(Multiplicity))
                {
                    ((Multiplicity)sca).AccidentalsGateDelayInTics   = DB.Utils.DBUInt64(dr["accidentalsgatewidth"]);
                    ((Multiplicity)sca).BackgroundGateTimeStepInTics = DB.Utils.DBUInt64(dr["backgroundgatewidth"]);
                    ((Multiplicity)sca).FA            = (DB.Utils.DBBool(dr["FA"]) ? FAType.FAOn : FAType.FAOff);
                    ((Multiplicity)sca).SR.gateLength = sca.gateWidthTics;
                }
                else if (t == typeof(Coincidence))
                {
                    ((Coincidence)sca).AccidentalsGateDelayInTics   = DB.Utils.DBUInt64(dr["accidentalsgatewidth"]);
                    ((Coincidence)sca).BackgroundGateTimeStepInTics = DB.Utils.DBUInt64(dr["backgroundgatewidth"]);
                    //((Coincidence)sca).FA = FAType.FAOff;  // always on?? wtf?? So confuse. Much checking. TODO: check this
                    ((Coincidence)sca).SR.gateLength = sca.gateWidthTics;
                }
                sca.Active = DB.Utils.DBBool(dr["active"]);
                if (dr.Table.Columns.Contains("rank"))
                {
                    sca.Rank = DB.Utils.DBUInt16(dr["rank"]);
                }
            }
            return(cp);
        }
        private CountingAnalysisParameters CountingParameters(string detname)
        {
            DataTable dt = NC.App.Pest.GetACollection(DB.Pieces.CountingAnalyzers, detname);
            CountingAnalysisParameters cp = new AnalysisDefs.CountingAnalysisParameters();

            // 0 is mat name, 1 is det name, 2 is mat id, 3 is det id, 4 is first choice boolean
            foreach (DataRow dr in dt.Rows)
            {
                string type = "AnalysisDefs.";   // dev note: careful here, this is subject to bit rot
                if (dr["counter_type"].Equals(System.DBNull.Value))
                    type += "BaseRate";
                else
                    type += (string)dr["counter_type"];
                System.Type t = System.Type.GetType(type);
                ConstructorInfo ci = t.GetConstructor(Type.EmptyTypes);
                SpecificCountingAnalyzerParams sca = (SpecificCountingAnalyzerParams)ci.Invoke(null);
                cp.Add(sca);
                sca.gateWidthTics = DB.Utils.DBUInt64(dr["gatewidth"]);
                if (t == typeof(Multiplicity))
                {
                    ((Multiplicity)sca).AccidentalsGateDelayInTics = DB.Utils.DBUInt64(dr["accidentalsgatewidth"]);
                    ((Multiplicity)sca).BackgroundGateTimeStepInTics = DB.Utils.DBUInt64(dr["backgroundgatewidth"]);
                    ((Multiplicity)sca).FA = (DB.Utils.DBBool(dr["FA"]) ? FAType.FAOn : FAType.FAOff);
                    ((Multiplicity)sca).SR.gateLength = sca.gateWidthTics;
                }
                else if (t == typeof(Coincidence))
                {
                    ((Coincidence)sca).AccidentalsGateDelayInTics = DB.Utils.DBUInt64(dr["accidentalsgatewidth"]);
                    ((Coincidence)sca).BackgroundGateTimeStepInTics = DB.Utils.DBUInt64(dr["backgroundgatewidth"]);
                    //((Coincidence)sca).FA = FAType.FAOff;  // always on?? wtf?? So confuse. Much checking. TODO: check this
                    ((Coincidence)sca).SR.gateLength = sca.gateWidthTics;
                }
                sca.Active = DB.Utils.DBBool(dr["active"]);
                if (dr.Table.Columns.Contains("rank"))
                    sca.Rank = DB.Utils.DBUInt16(dr["rank"]);
            }
            return cp;
        }
Exemple #3
0
 public CountingAnalysisParameters(CountingAnalysisParameters src) : base(src)
 {
 }