21 using namespace Diana;
25 fPulseLabel = GetString(
"PulseLabel",
"DAQ@Pulse",
false);
29 fNoiseCoherenceOwner = GetString(
"NoiseCoherenceOwner",
"NoiseFrequencyCoherence",
false);
30 fNoiseCoherenceInput = GetString(
"NoiseCoherenceInput",
"");
45 const int chan = pi.GetChannelId();
49 if(fMap.find(chan) == fMap.end()) {
50 fMap[chan].BlackSheep =
false;
51 GlobalHandle<QInt> dHandle(
"Dataset");
52 GlobalData().Get(
"",&dHandle,
"");
53 GlobalHandle<QAverageVectorC> Coherence_Handle(
"Coherence");
54 Coherence_Handle.SetDataset(dHandle.Get());
55 Coherence_Handle.SetChannel(chan);
56 GlobalData().Get(fNoiseCoherenceOwner,&Coherence_Handle,fNoiseCoherenceInput);
58 if(!Coherence_Handle.IsValid()) {
59 Coherence_Handle.SetRun(hdr.
GetRun());
61 GlobalData().Get(fNoiseCoherenceOwner,&Coherence_Handle,fNoiseCoherenceInput);
63 if(!Coherence_Handle.IsValid()) {
64 Warn(
"%s. Channel %d will not be processed",Coherence_Handle.GetError().GetDescription().c_str(),chan);
65 fMap[chan].BlackSheep =
true;
67 fMap[chan].fCoherence = Coherence_Handle.Get();
74 if(neighbours.
Size() != 1)
return;
76 const QEvent& neigh = neighbours[0];
80 if(chan != chanB)
return;
82 const QVector& samples= pulse.GetSamples();
83 const int size = samples.Size();
85 if(size != (
int)samplesB.Size())
return;
90 GlobalData().Get(
"",&
rHandle,
"");
97 lastSampleB += hdrB.
GetTime().GetFromStartRunNs()/samplPeriod;
98 Long64_t firstSample = hdr.
GetTime().GetFromStartRunNs()/samplPeriod-pi.GetMasterSample().GetSampleIndex();
99 if(firstSample-lastSampleB != 1) {
107 QVectorC TransformedPulseB(size);
108 QVectorC TransformedPulse(size);
112 Error(
"QFFTRealComplex::TransformToFreq: pulse B");
118 Error(
"QFFTRealComplex::TransformToFreq: pulse ");
122 for(
int i =1; i < size; i++) {
123 TransformedPulse[i] -= TransformedPulseB[i]*chanInfo.
fCoherence[i];
131 ev.
Get<
QPulse>(
"Pulse").SetSamplesADC(output);
QRunDataHandle rHandle(753)
QChannelRunData chanRunData
#define REGISTER_MODULE(clazz)
one-line description of your module
void Init(Diana::QEvent &ev)
Init method.
void Do(Diana::QEvent &ev, const Diana::QEventList &neighbours)
Do method. Declare and implement only one of the two versions.
bool wrapped into a QObject
basic channel and run based info. Used in the QRunData object.
double fSamplingFrequency
sampling frequency in Hz
list of references to const QEvent (s)
size_t Size() const
number of QEvent (s)
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.
Raw event: bolometer channel, trigger positions and types.
const QSampleInfo & GetMasterSample() const
Get MasterSample.
const int & GetChannelId() const
Get ChannelId.
Raw event: sampled waveform.
Wrapper for a specific QRealComplexFFT algorithm class.
virtual int TransformFromFreq(const QVectorC &FT, QVector &spectrum, bool compress=false)
transform from the frequencies to the times
virtual int TransformToFreq(const QVector &data, QVectorC &FFT, bool compress=false)
transform from the times to the frequencies
global handle for QRunData
const QChannelRunData & GetChannelRunData(const int channel) const
get channel based run data quantities
Int_t GetSampleIndex() const
Get SampleIndex from the beginning of the waveform.
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...
Diana::QVectorC fCoherence