Hi All,
I seem to be having a memory issue with a ROOT script. I load two 1D histograms and then take the FFT of each. It seems that when I execute fft1->GetPointsComplex(re_full1,im_full1), I receive the following error:
root [0] .x deconv.C
*** Error in `/home/root-6.06.06/bin/root.exe’: malloc(): memory corruption: 0x00000000035f91e0 ***
I am not really sure where my memory is going. Here is the script I am working with:
//
#include <stdio.h>
#include <TMath.h>
#include <TCanvas.h>
#include <iostream>
#include <TROOT.h>
#include <TChain.h>
#include <TObject.h>
#include <TRandom.h>
#include <TFile.h>
#include <math.h>
#include <TF1Convolution.h>
#include <TF1.h>
#include <TH1F.h>
#include <TGraph.h>
#include <TVirtualFFT.h>
#include <TH1D.h>
#include <complex.h>
//using namespace std;
//using namespace RooFit;
void deconv()
{
TFile *f1 = new TFile( "/home/jason/code/dataAnalysisCode/062016Bates/001.root" );
TH1F *combineTOF1=(TH1F*)f1->Get("arate_ch0");
TH1F *combineTOF2=(TH1F*)f1->Get("arate2_ch0");
//////////////////////////////////////////////
//Compute the transform of gamma flash////////////////////////////////////////
int n=4000;
TH1 *hm1 =0;
TVirtualFFT::SetTransform(0);
hm1 = combineTOF1->FFT(hm1, "MAG");
//Look at the phase of the output
TH1 *hp1 = 0;
hp1 = combineTOF1->FFT(hp1, "PH");
//Look at the DC component and the Nyquist harmonic:
Double_t re1, im1;
TVirtualFFT *fft1 = TVirtualFFT::GetCurrentTransform();
//Use the following method to get the full output:
Double_t *re_full1 = new Double_t[n];
Double_t *im_full1 = new Double_t[n];
fft1->GetPointsComplex(re_full1,im_full1);
//Other code follows here
}