Example #1
0
 public Detector Clone()
 {
     // Clone this detector
     Detector clone = new Detector();
     clone.TypeName = TypeName;
     clone.CurrentHV = CurrentHV;
     clone.CurrentNumChannels = CurrentNumChannels;
     clone.Serialnumber = Serialnumber;
     clone.CurrentCoarseGain = CurrentCoarseGain;
     clone.CurrentFineGain = CurrentFineGain;
     clone.CurrentLivetime = CurrentLivetime;
     clone.CurrentLLD = CurrentLLD;
     clone.CurrentULD = CurrentULD;            
     clone.EnergyCurveCoefficients.AddRange(EnergyCurveCoefficients);
     return clone;
 }        
Example #2
0
 public FormAddDetector(Detector detector, List<DetectorType> detectorTypes)
 {
     InitializeComponent();
     Det = detector;
     DetectorTypes = detectorTypes;        
 }
Example #3
0
        public double CalculateDoserate(Detector det, dynamic GEFactorFunc)
        {
            // Calculate doserate for this spectrum

            if (det == null || GEFactorFunc == null)
                return 0d;                        
            
            Doserate = 0.0;

            // Trim off discriminators
            int startChan = (int)((double)det.CurrentNumChannels * ((double)det.CurrentLLD / 100.0));
            int endChan = (int)((double)det.CurrentNumChannels * ((double)det.CurrentULD / 100.0));
            if(endChan > det.CurrentNumChannels) // FIXME: Can not exceed 100% atm
                endChan = det.CurrentNumChannels;

            // Accumulate doserates of each channel
            for (int i = startChan; i < endChan; i++)
            {
                float sec = (float)Livetime / 1000000f;                
                float cps = Channels[i] / sec;
                double E = det.GetEnergy(i);
                if (E < 0.05) // Energies below 0.05 are invalid
                    continue;
                double GE = GEFactorFunc(E / 1000.0);
                double chanDose = GE * (cps * 60.0);
                Doserate += chanDose;                
            }

            return Doserate;
        }
Example #4
0
        int GetChannelFromEnergy(Detector det, double E, int startX, int endX)
        {
            // Locate a suitable channel for a given energy, return -1 if none is found

            // FIXME: O(log n) ?
            double epsilon = 2d;
            for (int x = startX; x < endX; x++)
            {
                double e = det.GetEnergy(x);
                if (Math.Abs(E - e) < epsilon)
                    return x;
            }
            return -1;
        }
Example #5
0
 public FormEnergyCurve(Detector detector, List<double> coeffList)
 {
     InitializeComponent();
     CoeffList = coeffList;
     Det = detector.Clone();            
 }
Example #6
0
 public void SetDetector(Detector det)
 {
     currentDetector = det;            
 }
Example #7
0
        public Session(string sessionPath, string name, string comment, float livetime, int iterations, Detector det, DetectorType detType)
        {
            Spectrums = new List<Spectrum>();
            Clear();            

            Name = name;
            Comment = comment;
            Livetime = livetime;
            Iterations = iterations;            
            Detector = det;
            DetectorType = detType;
            LoadGEFactor();

            if (!Directory.Exists(sessionPath + Path.DirectorySeparatorChar + Name))
                Directory.CreateDirectory(sessionPath + Path.DirectorySeparatorChar + Name);
        }
Example #8
0
        private void btnAddDetector_Click(object sender, EventArgs e)
        {
            FormAddDetector form = new FormAddDetector(null, settings.DetectorTypes);
            if (form.ShowDialog() == DialogResult.Cancel)
                return;

            Detector det = new Detector();
            det.TypeName = form.DetectorType;
            det.Serialnumber = form.Serialnumber;
            det.CurrentNumChannels = form.NumChannels;
            det.CurrentHV = form.HV;
            det.CurrentCoarseGain = form.CoarseGain;
            det.CurrentFineGain = form.FineGain;
            det.CurrentLivetime = form.Livetime;
            det.CurrentLLD = form.LLD;
            det.CurrentULD = form.ULD;
            settings.Detectors.Add(det);

            PopulateDetectorList();
            PopulateDetectors();
        }