00001 #include "FParameter.hh" 00002 #include "BaselineFinder.hh" 00003 #include "SumChannels.hh" 00004 #include "ConvertData.hh" 00005 #include "PulseFinder.hh" 00006 #include "intarray.hh" 00007 00008 #include <vector> 00009 00010 FParameter::FParameter(): 00011 ChannelModule(GetDefaultName(), "Calculate fprompt, the fraction of photons which arrive in the early time of a scintillation pulse") 00012 { 00013 AddDependency<PulseFinder>(); 00014 00016 //Register all the config handler parameters 00017 RegisterParameter("start_fparameter", start_fparameter = 0); 00018 RegisterParameter("num_fparameter", num_fparameter = 25); 00019 } 00020 00021 FParameter::~FParameter() 00022 { 00023 Finalize(); 00024 } 00025 00026 int FParameter::Initialize() 00027 { 00028 return 0; 00029 } 00030 00031 int FParameter::Process(ChannelData* chdata) 00032 { 00033 //Calculate F parameter for each channel on each board that is enabled 00034 00035 double* wave = chdata->GetWaveform(); 00036 for (size_t j = 0; j < chdata->pulses.size(); j++) 00037 { 00038 Pulse& pulse = chdata->pulses[j]; 00039 if (!chdata->baseline.found_baseline || !pulse.found_start || 00040 pulse.peak_saturated) 00041 continue; 00042 00043 if (pulse.start_index + (int)chdata->sample_rate*0.090 < pulse.end_index) 00044 pulse.f90 = (chdata->baseline.mean - 00045 wave[pulse.start_index + 00046 (int)(chdata->sample_rate*0.090)])/ 00047 pulse.peak_amplitude; 00048 00049 for (int k = pulse.start_index + start_fparameter; 00050 (k < pulse.start_index + start_fparameter + num_fparameter && 00051 k < pulse.end_index); 00052 k++) 00053 { 00054 pulse.f_param.push_back((chdata->baseline.mean - wave[k])/ 00055 pulse.peak_amplitude); 00056 } 00057 } 00058 00059 return 0; 00060 } 00061 00062 int FParameter::Finalize() 00063 { 00064 return 0; 00065 }