23 #ifndef GW_CALIBCO60_H
33 #ifndef ROOT_TSpectrum
34 #include "TSpectrum.h"
57 CalibCo60::CalibCo60()
63 CalibCo60::~CalibCo60()
69 void CalibCo60::Calibrate(
const TH1 *, TF1 *
function, Double_t channel1, Double_t channel2, Option_t *)
72 channel1 = TMath::Abs(channel1);
73 channel2 = TMath::Abs(channel2);
74 if (channel1 == channel2) {
75 printf(
"info in <Calibco60::DoCalib> parameters are identical !!\n");
79 if (channel1 > channel2) {
80 Double_t
tmp = channel2;
89 fRaw[0] = channel1; fRaw[1] = channel2;
91 fTabulated[0] = 1173.228 ; fTabulated[1] = 1332.492;
93 BaseCalib::Calibrate(
function);
97 void CalibCo60::Calibrate(
const TH1 *
histo, TF1 *
function, Option_t* , Double_t sigma,
98 Option_t* SearchOption, Double_t threshold)
108 Int_t NbPeaks = spectrum.Search(histo,sigma,SearchOption,threshold);
110 printf(
"info in <CalibCo60::DoCalib> ERROR !! Number of Peaks found < 2 !!\n");
116 Int_t *index =
new Int_t[NbPeaks];
117 TMath::Sort(NbPeaks,spectrum.GetPositionY(),index,1);
119 p1.
SetPosition(spectrum.GetPositionX()[index[0]]); p1.SetIntensity(spectrum.GetPositionY()[index[0]]);
120 p2.SetPosition(spectrum.GetPositionX()[index[1]]); p2.SetIntensity(spectrum.GetPositionY()[index[1]]);
123 printf(
"Nb Peaks found = %i\n",NbPeaks);
124 for (Int_t i=0 ; i<NbPeaks ; i++) {
125 printf(
" [%i] Position : %8.3f Intensity : %8.3f\n",i,spectrum.GetPositionX()[i],spectrum.GetPositionY()[i]);
131 fTabulated[0] = 1173.228 ; fTabulated[1] = 1332.492;
134 if (p1.GetPosition() == p2.GetPosition()) {
135 printf(
"info in <Calibco60::DoCalib> The 2 most intense peaks have got the same positions !! Abort calibration !!\n");
138 if (p1.GetPosition() < p2.GetPosition()) {
139 fRaw[0] = p1.GetPosition(); fRaw[1] = p2.GetPosition();
141 fRaw[0] = p2.GetPosition(); fRaw[1] = p1.GetPosition();
144 BaseCalib::Calibrate(
function);
147 if (index)
delete [] index;
printf("******************************************************************** \n")
virtual void SetPosition(const Double_t position, Option_t *axis="X")
Set Position of peak.
header file for a general 1D peak
A graphical interface for placing schematic peak onto a 1D histogram with a given position...
CalibCo60 is a service class in order to find calibration coefficients for a TH1 espacially with Co60...