Beispiel #1
0
        /// <summary>
        /// InstantiateMultiplicityAnalyzerFastBackground() creates a multiplicity analyzer.
        /// gateWidthInTics is the length of the gate for neutron counting, in 100-nSec tics.
        /// preDelayInTics is the time after the trigger until opening the gate for neutron counting, in 100-nSec tics.
        /// Note this MAFB has no longDelayInTics parameter.  Instead, it has a sibling FastBackgroundAnalysis
        /// that does the fast-background calculations for us.  The MAFB object gets a pointer to this sibling FBA.
        /// </summary>
        /// <param name="gateWidthInTics"></param>
        /// <param name="preDelayInTics"></param>
        public bool InstantiateMultiplicityAnalyzerFastBackground(UInt64 gateWidthInTics, UInt64 preDelayInTics,
                                                                  UInt64 backgroundGateTimeStepInTics,
                                                                  double deadTimeCoefficientTinNanoSecs,
                                                                  double deadTimeCoefficientAinMicroSecs,
                                                                  double deadTimeCoefficientBinPicoSecs,
                                                                  double deadTimeCoefficientCinNanoSecs)
        {
            FastBackgroundAnalysis fba;
            MultiplicityAnalysisFastBackground ma;
            int i;

            //set up the Fast-Background Analyzer.
            //see if necessary analyzer is already in the list
            fba = null;
            for (i = 0; i < fastBackgroundAnalyzers.Count; i++)
            {
                if (((fastBackgroundAnalyzers[i].gateWidthInTics / timeBaseConversion) == gateWidthInTics)
                    && ((fastBackgroundAnalyzers[i].gateStepInTics / timeBaseConversion) == backgroundGateTimeStepInTics))
                {
                    fba = fastBackgroundAnalyzers[i];
                    i = fastBackgroundAnalyzers.Count;

                    log.TraceEvent(LogLevels.Info, (int)AnalyzerEventCode.AnalyzerHandlerEvent, "Already have a FastBackgroundAnalyzer with gate of " + gateWidthInTics + " tics and step of " + backgroundGateTimeStepInTics + " tics.");
                }
            }
            if (fba == null)  //...then no previous analyzer, so make one...
            {
                fba = new FastBackgroundAnalysis(gateWidthInTics * timeBaseConversion, backgroundGateTimeStepInTics * timeBaseConversion);
                fastBackgroundAnalyzers.Add(fba);

                log.TraceEvent(LogLevels.Info, (int)AnalyzerEventCode.AnalyzerHandlerEvent, "Created a FastBackgroundAnalyzer with gate of " + gateWidthInTics + " tics and step of " + backgroundGateTimeStepInTics + " tics.");
            }

            //now make the "foreground" analyzer
            ma = new MultiplicityAnalysisFastBackground(ticSizeInSeconds,
                                                        gateWidthInTics * timeBaseConversion, preDelayInTics * timeBaseConversion,
                                                        fba,
                                                        deadTimeCoefficientTinNanoSecs,
                                                        deadTimeCoefficientAinMicroSecs,
                                                        deadTimeCoefficientBinPicoSecs,
                                                        deadTimeCoefficientCinNanoSecs);
            multiplicityFastBackgroundAnalyzers.Add(ma);

            log.TraceEvent(LogLevels.Info, (int)AnalyzerEventCode.AnalyzerHandlerEvent, "Created a MultiplicityFastBGAnalyzer with gate= " + gateWidthInTics
                                                                                             + " tics, predelay= " + preDelayInTics
                                                                                             + " tics, coeffT= " + deadTimeCoefficientTinNanoSecs
                                                                                             + " ns, coeffA= " + deadTimeCoefficientAinMicroSecs
                                                                                             + " us, coeffB= " + deadTimeCoefficientBinPicoSecs
                                                                                             + " ps, coeffC= " + deadTimeCoefficientCinNanoSecs
                                                                                             + " ns");

            return (true);
        }
        public MultiplicityAnalysisFastBackground(double theTicSizeInSeconds, UInt64 gateWidthInTics, UInt64 preDelayInTics, FastBackgroundAnalysis fba,
                                                  double deadTimeCoefficientTinNanoSecs,
                                                  double deadTimeCoefficientAinMicroSecs,
                                                  double deadTimeCoefficientBinPicoSecs,
                                                  double deadTimeCoefficientCinNanoSecs)
            : base(theTicSizeInSeconds) //tell the inherited SDTMultiplicityCounter the ticSize
        {
            int i;

            //store the initialization parameters
            backgroundAnalyzer = fba;
            multiplicityGateWidth = gateWidthInTics;
            multiplicityDeadDelay = preDelayInTics;
            totalWindow = gateWidthInTics + preDelayInTics;

            //store the SingleDoubleTriple-calculation parameters
            deadTimeCoeffTinNanoSecs = deadTimeCoefficientTinNanoSecs;
            deadTimeCoeffAinMicroSecs = deadTimeCoefficientAinMicroSecs;
            deadTimeCoeffBinPicoSecs = deadTimeCoefficientBinPicoSecs;
            deadTimeCoeffCinNanoSecs = deadTimeCoefficientCinNanoSecs;

#if USE_SPINTIME
            spinTimeTotal = 0;
            spinTimeStart = 0;
            spinTimeReady = false;
#endif

            //empty the multiplicity array
            for (i = 0; i < RawAnalysisProperties.maxNeutronsPerMultiplicityGate; i++)
            {
                multiplicity[i] = 0;
            }

            totalMeasurementTime = 0.0;

            //initialize the event holders
            inputEventNumNeutrons = new UInt32[RawAnalysisProperties.maxEventsPerBlock];
            inputEventTime = new UInt64[RawAnalysisProperties.maxEventsPerBlock];
            numEventsThisBlock = 0;

            //create the circular linked list
            theEventCircularLinkedList = new NeutronEvent(0);
            startOfList = theEventCircularLinkedList;
            endOfList = theEventCircularLinkedList;
            for (i = 1; i < RawAnalysisProperties.circularListBlockIncrement; i++)
            {
                endOfList.next = new NeutronEvent(i);
                endOfList = endOfList.next;
            }
            numObjectsInCircularLinkedList = RawAnalysisProperties.circularListBlockIncrement;
            endOfList.next = startOfList;
            endOfList = startOfList;

            numCircuits = 0;

            //set up the MAFB BackgroundWorker
            keepRunning = true;
            isReadyToAnalyze = false;
            MAFBWorker = new BackgroundWorker();
            MAFBWorker.WorkerSupportsCancellation = false;
            MAFBWorker.DoWork += new DoWorkEventHandler(MAFBWorkerDoWork);
            MAFBWorker.RunWorkerAsync();

            //pause until the MAFBWorker is working
            while (MAFBWorker.IsBusy == false)
            {
                Thread.Sleep(1);
            }
        }
        public MultiplicityAnalysisFastBackground(double theTicSizeInSeconds, UInt64 gateWidthInTics, UInt64 preDelayInTics, FastBackgroundAnalysis fba,
                                                  double deadTimeCoefficientTinNanoSecs,
                                                  double deadTimeCoefficientAinMicroSecs,
                                                  double deadTimeCoefficientBinPicoSecs,
                                                  double deadTimeCoefficientCinNanoSecs)
            : base(theTicSizeInSeconds) //tell the inherited SDTMultiplicityCounter the ticSize
        {
            int i;

            //store the initialization parameters
            backgroundAnalyzer    = fba;
            multiplicityGateWidth = gateWidthInTics;
            multiplicityDeadDelay = preDelayInTics;
            totalWindow           = gateWidthInTics + preDelayInTics;

            //store the SingleDoubleTriple-calculation parameters
            deadTimeCoeffTinNanoSecs  = deadTimeCoefficientTinNanoSecs;
            deadTimeCoeffAinMicroSecs = deadTimeCoefficientAinMicroSecs;
            deadTimeCoeffBinPicoSecs  = deadTimeCoefficientBinPicoSecs;
            deadTimeCoeffCinNanoSecs  = deadTimeCoefficientCinNanoSecs;

#if USE_SPINTIME
            spinTimeTotal = 0;
            spinTimeStart = 0;
            spinTimeReady = false;
#endif

            //empty the multiplicity array
            for (i = 0; i < RawAnalysisProperties.maxNeutronsPerMultiplicityGate; i++)
            {
                multiplicity[i] = 0;
            }

            totalMeasurementTime = 0.0;

            //initialize the event holders
            inputEventNumNeutrons = new UInt32[RawAnalysisProperties.maxEventsPerBlock];
            inputEventTime        = new UInt64[RawAnalysisProperties.maxEventsPerBlock];
            numEventsThisBlock    = 0;

            //create the circular linked list
            theEventCircularLinkedList = new NeutronEvent(0);
            startOfList = theEventCircularLinkedList;
            endOfList   = theEventCircularLinkedList;
            for (i = 1; i < RawAnalysisProperties.circularListBlockIncrement; i++)
            {
                endOfList.next = new NeutronEvent(i);
                endOfList      = endOfList.next;
            }
            numObjectsInCircularLinkedList = RawAnalysisProperties.circularListBlockIncrement;
            endOfList.next = startOfList;
            endOfList      = startOfList;

            numCircuits = 0;

            //set up the MAFB BackgroundWorker
            keepRunning      = true;
            isReadyToAnalyze = false;
            MAFBWorker       = new BackgroundWorker();
            MAFBWorker.WorkerSupportsCancellation = false;
            MAFBWorker.DoWork += new DoWorkEventHandler(MAFBWorkerDoWork);
            MAFBWorker.RunWorkerAsync();

            //pause until the MAFBWorker is working
            while (MAFBWorker.IsBusy == false)
            {
                Thread.Sleep(1);
            }
        }