#ifndef __CINT__ // includes in case of compilation
#include "TBenchmark.h"
#include "TCanvas.h"
#include "TH1.h"
#include "VManagerFrameL.h"
#include "FrameL.h"
#include "VFrDataBase.h"
#include "Frv.h"
#endif
void scrollspectrum()
{
// This simple example opens a demo frame channel using a metadatabase,// plots a vector and it's spectrum.// The vector is scrolled 1 s at a time, nvecmax times.// The extraction of the vector shows that one can select a vector// without having to think about the frame boundaries.// The length of the vector is arbitrary and is only limited by the available// amount of memory.// It is also shown how to use the FFT from the signal analysis library
TCanvas* c1;
VFrameChannel* fc;
gBenchmark->Start("scrollspectrum");
FrVect* frv;
// Max number of vectors displayedInt_t nvecmax = 20;
// Time step of the scrollDouble_t tistep = 1;
// Length of the displayed vectorDouble_t veclength = 4;
// Start timeDouble_t time = 600000000.1;
// Open a new window (canvas) and split it
c1 = new TCanvas("c1","c1",1);
c1->Divide(1,2);
c1->cd(2);
// Open a frame channel
fc = new VFrameChannel("demoDB.root");
// Get the first vector
frv = fc->GetVect("adc.MYGO_ADC1",time,veclength);
Int_t nvec = 0;
while ( (frv!=0) && (nvec<nvecmax) ) {
nvec++;
printf("nvect = %d, time = %fn",nvec,time);
// Draws the vector in the first pad
c1->cd(1); // go to the first pad
gVM->Draw(frv);
// Calculates the spectrumFrvRFFT* fft;
fft = FrvRFFTFor(0,frv);
// Draws the spectrum in the second pad
c1->cd(2); // go to the second pad
gVM->Draw(fft->amplitude);
gPad->SetLogx(1);
gPad->SetLogy(1);
// Update the canvas
c1->cd();
gPad->Update();
// Release the various variables allocated
FrVectFree(frv);
FrvRFFTFree(fft);
time += tistep;
frv = fc->GetVect("adc.MYGO_ADC1",time,veclength); // Get the next vector
}
gBenchmark->Show("scrollspectrum");
// Do some garbage collection
if (frv) FrVectFree(frv);
delete fc;
}
- ROOT page - VEGA page - Class index - Top of the page This page has been automatically generated. If you have any comments or suggestions
about the page layout send a mail to
, or
contact
with any questions or problems regarding ROOT or VEGA.