17 using namespace Diana;
21 fAvgNoiseInput = GetString(
"AvgNoiseInput",
"");
22 fAvgPulseInputHomeMade = GetString(
"AvgPulseInput",
"");
24 fAvgPulseSlowOwner = GetString(
"AvgPulseSlowOwner",
"AveragePulses",
true);
25 fAvgPulseFastOwner = GetString(
"AvgPulseFastOwner",
"AveragePulses",
true);
26 fAvgNoiseOwner = GetString(
"AvgNoiseOwner",
"NoiseAvgPowerSpectrum",
false);
27 fMaxJitter = GetInt(
"MaxJitter",15);
29 fDebugOn = GetBool(
"DebugOn",
false,
false);
30 fInterpolationOn = GetBool(
"InterpolationOn",
true,
true);
31 fUseDiff = GetBool(
"UseDiff",
true,
true);
32 fTomV = GetBool(
"ConvertTomV",
true,
false);
42 ev.
Add<QVector>(
"FitFunction");
43 ev.
Add<QVector>(
"FilteredSlow");
44 ev.
Add<QVector>(
"FilteredFast");
46 fPulseLabel = GetString(
"PulseLabel",
"DAQ@Pulse",
false);
61 GlobalData().Get(
"",&
rHandle,
"");
67 if(fTomV) ADC2mV = channelRunData.
fADC2mV;
70 if(fMap.find(chan) == fMap.end()) {
72 GlobalHandle<QInt> dHandle(
"Dataset");
73 GlobalData().Get(
"",&dHandle,
"");
76 fMap[chan].BlackSheep =
false;
79 AVG_Noise_Handle.SetDataset(dHandle.Get());
80 GlobalData().Get(fAvgNoiseOwner,&AVG_Noise_Handle,fAvgNoiseInput);
81 if(!AVG_Noise_Handle.IsValid()) {
82 Warn(
"%s. Channel %d will not be processed",AVG_Noise_Handle.GetError().GetDescription().c_str(),chan);
83 fMap[chan].BlackSheep =
true;
86 AVG_Pulse_Slow_Handle.SetDataset(dHandle.Get());
87 GlobalData().Get(fAvgPulseSlowOwner,&AVG_Pulse_Slow_Handle,fAvgPulseInputHomeMade);
88 if(!fMap[chan].BlackSheep && !AVG_Pulse_Slow_Handle.IsValid()) {
89 Warn(
"%s. Channel %d will not be processed",AVG_Pulse_Slow_Handle.GetError().GetDescription().c_str(),chan);
90 fMap[chan].BlackSheep =
true;
93 AVG_Pulse_Fast_Handle.SetDataset(dHandle.Get());
94 GlobalData().Get(fAvgPulseFastOwner,&AVG_Pulse_Fast_Handle,fAvgPulseInputHomeMade);
95 if(!fMap[chan].BlackSheep && !AVG_Pulse_Fast_Handle.IsValid()) {
96 Warn(
"%s. Channel %d will not be processed",AVG_Pulse_Fast_Handle.GetError().GetDescription().c_str(),chan);
97 fMap[chan].BlackSheep =
true;
99 if(!fMap[chan].BlackSheep) {
101 fMap[chan].ADC2Time = 1000./samplingFreq;
103 QVector avg_noise = AVG_Noise_Handle.Get();
104 QVector avg_pulse_slow = AVG_Pulse_Slow_Handle.Get();
105 QVector avg_pulse_fast = AVG_Pulse_Fast_Handle.Get();
111 if (fMap[chan].BlackSheep)
return;
114 const QVector& Samples = rawPulse.
GetSamples();
115 QError err = fMap[chan].of2->Filter(Samples);
118 double a1, a2,integral, jitter;
120 if(fInterpolationOn){
121 err = fMap[chan].of2->GetInterpolated(jitter,a1,a2,integral);
124 jitter = fMap[chan].of2->GetJitterAtMinimum();
125 fMap[chan].of2->GetAmplitude(a1,a2,integral);
130 ev.
Get<
QDouble>(
"Integral") = integral*ADC2mV/samplingFreq;
132 ev.
Get<
QDouble>(
"ChiSquare") = fMap[chan].
of2->GetChiSquareAtMinimium();
133 ev.
Get<
QDouble>(
"Jitter") = jitter*fMap[chan].ADC2Time;
137 fMap[chan].of2->GetFiltered(AP1f,AP2f);
138 ev.
Get<QVector>(
"FilteredSlow") = AP2f;
139 ev.
Get<QVector>(
"FilteredFast") = AP1f;
QOptimumFilter of2(ap2, an,-1, false)
QRunDataHandle rHandle(753)
#define REGISTER_MODULE(clazz)
one-line description of your module
void Init(Diana::QEvent &ev)
Init method.
void Do(Diana::QEvent &ev)
Do method. Declare and implement only one of the two versions.
global handle for average noise power spectra
global handle for average pulse
base types wrapped into a QObject. Currently implemented types are QInt QDouble and QFloat....
Dual component optimum filter.
basic channel and run based info. Used in the QRunData object.
double fSamplingFrequency
sampling frequency in Hz
double fADC2mV
conversion: mV = ADC * fADC2mV
error class with error type and description
const Q & GetByLabel(const QEventLabel &label) const
Get a QObject in read mode by label.
void RequireByLabel(const QEventLabel &label) const
notify the QEvent that we need a QObject, if not found an exception is thrown
void Require(const std::string &owner, const std::string &name) const
notify the QEvent that we need a QObject, if not found an exception is thrown
void Get(const char *owner, ReadHandle< Q > &handle) const
Get a QObject Handle in read mode.
void Add(WriteHandle< Q > &handle)
Add a QObject to the event.
Diana::QVector GetFitFunction(const double jitter, const double a1) const
Raw event: bolometer channel, trigger positions and types.
const int & GetChannelId() const
Get ChannelId.
Raw event: sampled waveform.
const Diana::QVector & GetSamples() const
Get Samples casted to double (QVector instead of QVectorI). Use this method in place of GetSamplesADC...
global handle for QRunData
const QChannelRunData & GetChannelRunData(const int channel) const
get channel based run data quantities
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...