# Cropping a 2-D histogram (TH2F)

Hi,

I have taken the fourier transform of a TH2F histogram containing upwards of 42 500 entries with 100x100 bins ranging from 0 to 1000.

First problem:
It says that my transformed histogram only contains 10 000 entries, is the number of entries generated as in the code below something that can be altered?

Second problem:
I would like to crop the middle part of the histogram(figure at the bottom of the page). Or rather set it to 0. Then do an iFFT and plot it again.

The following is the code of my attempt, which I have based on someone elses attempt at rebinning but I am not 100% comfortable with the method.

``` TH1 * fft_900; fft_900 = posB->FFT(fft_900,"MAG"); double xbins; // Only 1/4 of the original area left if we remove 0.25 on each side. double ybins; for (int i = 0;i<25;i++){ xbins[i]=25+i*50/25; //I was thinking I wanted to include the part from 25 to 75 ybins[i]=25+i*50/25; } TH2F *cropfft = new TH2F("cropfft",fft_900->GetTitle(),100,xbins,100,ybins); TAxis *xaxis = fft_900->GetXaxis(); TAxis *yaxis = fft_900->GetYaxis(); for (int j=1; j<=yaxis->GetNbins();j++){ for (int k=1; k<=xaxis->GetNbins();k++){ cropfft->Fill(xaxis->GetBinCenter(k),yaxis->GetBinCenter(j),fft_900->GetBinContent(k,j)); } }``` ```TH2F *cropfft = new TH2F("cropfft", fft_900->GetTitle(), (sizeof(xbins) / sizeof(xbins) - 1), xbins, (sizeof(ybins) / sizeof(ybins) - 1), ybins);```

Many thanks Pepe.

sizeof(xbins) I assume return 25,
does sizeof(double) return 2^8? Do you mind explaining further what the purpose of it is?

Also, if I would want to set the outer bins to 0 instead of removing them how would I go about that?