switched PRunSingleHistoRRF where possible to smart pointers.
This commit is contained in:
parent
8e7fda92e1
commit
be29e55834
@ -38,6 +38,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <TString.h>
|
#include <TString.h>
|
||||||
#include <TObjArray.h>
|
#include <TObjArray.h>
|
||||||
@ -1068,13 +1069,13 @@ Double_t PRunSingleHistoRRF::GetMainFrequency(PDoubleVector &data)
|
|||||||
// create histo
|
// create histo
|
||||||
Double_t startTime = (fGoodBins[0]-fT0s[0]) * fTimeResolution;
|
Double_t startTime = (fGoodBins[0]-fT0s[0]) * fTimeResolution;
|
||||||
Int_t noOfBins = fGoodBins[1]-fGoodBins[0]+1;
|
Int_t noOfBins = fGoodBins[1]-fGoodBins[0]+1;
|
||||||
TH1F *histo = new TH1F("data", "data", noOfBins, startTime-fTimeResolution/2.0, startTime+fTimeResolution/2.0+noOfBins*fTimeResolution);
|
std::unique_ptr<TH1F> histo = std::make_unique<TH1F>("data", "data", noOfBins, startTime-fTimeResolution/2.0, startTime+fTimeResolution/2.0+noOfBins*fTimeResolution);
|
||||||
for (Int_t i=fGoodBins[0]; i<=fGoodBins[1]; i++) {
|
for (Int_t i=fGoodBins[0]; i<=fGoodBins[1]; i++) {
|
||||||
histo->SetBinContent(i-fGoodBins[0]+1, data[i]);
|
histo->SetBinContent(i-fGoodBins[0]+1, data[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fourier transform
|
// Fourier transform
|
||||||
PFourier *ft = new PFourier(histo, FOURIER_UNIT_FREQ);
|
std::unique_ptr<PFourier> ft = std::make_unique<PFourier>(histo.get(), FOURIER_UNIT_FREQ);
|
||||||
ft->Transform(F_APODIZATION_STRONG);
|
ft->Transform(F_APODIZATION_STRONG);
|
||||||
|
|
||||||
// find frequency maximum
|
// find frequency maximum
|
||||||
@ -1099,10 +1100,6 @@ Double_t PRunSingleHistoRRF::GetMainFrequency(PDoubleVector &data)
|
|||||||
// clean up
|
// clean up
|
||||||
if (power)
|
if (power)
|
||||||
delete power;
|
delete power;
|
||||||
if (ft)
|
|
||||||
delete ft;
|
|
||||||
if (histo)
|
|
||||||
delete histo;
|
|
||||||
|
|
||||||
return freqMax;
|
return freqMax;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user