FairRoot/PandaRoot
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PndHypGeSpectrumAnalyser Class Reference

#include <PndHypGeSpectrumAnalyser.h>

Public Member Functions

 PndHypGeSpectrumAnalyser (TH1D *hEnergySpec_ext, Int_t nPeaks=2, Int_t FuncWidthExt=100)
 
 PndHypGeSpectrumAnalyser (TH1D *hEnergySpec_ext, vector< double > *Energies_ext, Int_t FuncWidthExt=100)
 
 PndHypGeSpectrumAnalyser (TH1D *hEnergySpec_ext, TString Nuclei, Int_t FuncWidthExt=100)
 
virtual ~PndHypGeSpectrumAnalyser ()
 
TH1D * GetEnergySpectrum ()
 
void SetEnergySpectrum (TH1D *hEnergySpec_ext)
 
Int_t AnalyseSpectrum ()
 
Int_t AnalyseSimulationSpectrum ()
 
Int_t FindPeaks ()
 
Int_t FitPeaks ()
 
Int_t DrawCalibratedSpectrum ()
 
Int_t DrawSimulationSpectrum ()
 
Int_t DoEnergyCalibration ()
 
Int_t CalculateFWHM ()
 
Int_t CalculateFWTM ()
 
Double_t CalculateEfficiency ()
 
Double_t GetFWHM511 ()
 
Double_t GetFWTM511 ()
 
Double_t GetFWHMCo1 ()
 
Double_t GetFWTMCo1 ()
 
Double_t GetFWHMCo ()
 
Double_t GetFWTMCo ()
 
Double_t GetFWHMAl ()
 
Double_t GetFWTMAl ()
 
Double_t GetEfficiency ()
 
Double_t GetEfficiencyError ()
 
Double_t GetCountsCo ()
 
Int_t CompareNuclei (TString NucleiName)
 
void SetTxtFileOutputName (TString TxtFilename_ext)
 
void SetRootFileOutputName (TString RootFilename_ext)
 
void SetOutputPath (TString OutputPath_ext)
 
Int_t ExportToTextFile (TString TxtFilename_ext="test.txt")
 
Int_t ExportToRootFile (TString RootFilename_ext="test.root")
 
void SetSearchRange (Double_t RangeMin, Double_t RangeMax)
 
void SetGaussianFitting ()
 
Bool_t IsGaussianFitting ()
 
void SetFreeSkewedFitting ()
 
Bool_t IsFreeSkewedFitting ()
 
void SetSecondGausianFitting ()
 
Bool_t IsSecondGausianFitting ()
 
void SetNewFunctionFitting ()
 
Bool_t IsNewFunctionFitting ()
 
void SetNoDrawingMode (Bool_t NoDrawingMode_ext=true)
 
Bool_t IsNoDrawingMode ()
 
void SetInputHistogramResolution (Double_t InputHistogramResolution_ext)
 
void SetNumberOfSimEvents (Int_t NumberOfSimEvents_ext, Bool_t OnlyTwoPiSimulated=1)
 

Private Member Functions

Double_t FindUpperSigmaFitLimit (Double_t threshold, Float_t StartingPoint)
 
void PeakSort ()
 
Double_t Calibrate (Double_t Channel)
 
Double_t CalculateLowerErrorLeft (Double_t threshold, TH1D *histo, Double_t StartingValue)
 
Double_t CalculateUpperErrorLeft (Double_t threshold, TH1D *histo, Double_t StartingValue)
 
Double_t CalculateLowerErrorRight (Double_t threshold, TH1D *histo, Double_t StartingValue)
 
Double_t CalculateUpperErrorRight (Double_t threshold, TH1D *histo, Double_t StartingValue)
 

Private Attributes

TCanvas * fEnergySpecCanvas
 
TH1D * fhEnergySpectrum
 
TCanvas * fCalSpecCanvas
 
TH1D * fhCalibratedSpectrum
 
TCanvas * fSubstractCanvas
 
TH1D * fhSubstractSpectrum
 
TSpectrum * fSpectrum
 
Float_t * PeaksPosX
 
Float_t * PeaksPosY
 
Int_t nPeaks
 
Int_t nPeaksFound
 
TF1 * FitFunc [50]
 
TF1 * FitFuncWithoutBg [50]
 
TF1 * CalibratedFunction [50]
 
TF1 * FuncGaus [50]
 
TF1 * FuncSmoothedStep [50]
 
TF1 * FuncLinear [50]
 
TF1 * FuncTail [50]
 
Int_t FuncWidth
 
vector< double > PeakFitX
 
vector< double > PeakFitXError
 
vector< double > PeakCounts
 
TGraphErrors * fgCalibration
 
TCanvas * fCalCanvas
 
TF1 * CalFunc
 
Double_t Amplitude [50]
 
Double_t FWHMHeight [50]
 
Double_t FWHMlow [50]
 
Double_t FWHMlowLeftBorder [50]
 
Double_t FWHMlowRightBorder [50]
 
Double_t FWHMlowLeftBorderEnergy [50]
 
Double_t FWHMlowRightBorderEnergy [50]
 
Double_t FWHMhigh [50]
 
Double_t FWHMhighLeftBorder [50]
 
Double_t FWHMhighRightBorder [50]
 
Double_t FWHMhighLeftBorderEnergy [50]
 
Double_t FWHMhighRightBorderEnergy [50]
 
Double_t FWHMlowEnergy [50]
 
Double_t FWHMhighEnergy [50]
 
Double_t FWTMHeight [50]
 
Double_t FWTMlow [50]
 
Double_t FWTMhigh [50]
 
Double_t FWTMlowEnergy [50]
 
Double_t FWTMhighEnergy [50]
 
TH1D * fhFitErrorhistogram [50]
 
map< double, double > FWHM_ch
 
map< double, double > FWHM_en
 
map< double, double > FWTM_ch
 
map< double, double > FWTM_en
 
vector< double > Energies
 
vector< double > EnergyErrors
 
TString OutputPath
 
ofstream TxtFile
 
TString TxtFilename
 
TFile * RootFile
 
TString RootFilename
 
Bool_t BreakProgram
 
Int_t fFittingMethod
 
Bool_t NoDrawingMode
 
Double_t fFEPEfficiency
 
Double_t fFEPEfficiencyError
 
Double_t fInputHistogramResolution
 
Int_t fNumberOfSimEvents
 
Int_t fSolidAngleCorrectionFactor
 

Detailed Description

Definition at line 44 of file PndHypGeSpectrumAnalyser.h.

Constructor & Destructor Documentation

PndHypGeSpectrumAnalyser::PndHypGeSpectrumAnalyser ( TH1D *  hEnergySpec_ext,
Int_t  nPeaks = 2,
Int_t  FuncWidthExt = 100 
)
PndHypGeSpectrumAnalyser::PndHypGeSpectrumAnalyser ( TH1D *  hEnergySpec_ext,
vector< double > *  Energies_ext,
Int_t  FuncWidthExt = 100 
)

Definition at line 50 of file PndHypGeSpectrumAnalyser.cxx.

References Energies, fFittingMethod, fhEnergySpectrum, fSpectrum, FuncWidth, NoDrawingMode, and nPeaks.

50  : PeaksPosX(0), PeaksPosY(0)
51 // constructor with energies from external array
52 {
53  fhEnergySpectrum = hEnergySpec_ext;
54  nPeaks = Energies.size();
55  FuncWidth = FuncWidthExt;
56  fSpectrum = new TSpectrum(nPeaks);
58  NoDrawingMode = false;
59 }
PndHypGeSpectrumAnalyser::PndHypGeSpectrumAnalyser ( TH1D *  hEnergySpec_ext,
TString  Nuclei,
Int_t  FuncWidthExt = 100 
)

Definition at line 61 of file PndHypGeSpectrumAnalyser.cxx.

References CompareNuclei(), fFittingMethod, fhEnergySpectrum, fSpectrum, FuncWidth, NoDrawingMode, and nPeaks.

61  : PeaksPosX(0), PeaksPosY(0)
62 // constructor with energies from internal database
63 {
64  fhEnergySpectrum = hEnergySpec_ext;
65  FuncWidth = FuncWidthExt;
66  nPeaks =CompareNuclei(Nuclei);
67 
68  fSpectrum = new TSpectrum(nPeaks);
70  NoDrawingMode = false;
71 }
Int_t CompareNuclei(TString NucleiName)
PndHypGeSpectrumAnalyser::~PndHypGeSpectrumAnalyser ( )
virtual

Definition at line 74 of file PndHypGeSpectrumAnalyser.cxx.

References fSpectrum.

75 {
76  delete fSpectrum;
77  //delete fEnergySpecCanvas;
78  //delete fhEnergySpectrum;
79  //delete fCalSpecCanvas;
80  //delete fhCalibratedSpectrum;
81  //delete fSubstractCanvas;
82  //delete fhSubstractSpectrum;
83  //delete PeaksPosX;
84  //delete PeaksPosY;
85 }

Member Function Documentation

Int_t PndHypGeSpectrumAnalyser::AnalyseSimulationSpectrum ( )

Definition at line 111 of file PndHypGeSpectrumAnalyser.cxx.

References BreakProgram, CalculateEfficiency(), CalculateFWHM(), CalculateFWTM(), DrawSimulationSpectrum(), ExportToRootFile(), FitPeaks(), and nPeaks.

112 {
113  if (nPeaks == -1 || BreakProgram == -1)
114  {
115  std::cerr << "*******Nuclei not found!" << endl;
116  return -1;
117  }
118  FitPeaks();
119 
120  CalculateFWHM();
121  CalculateFWTM();
123  DrawSimulationSpectrum(); // after FWHM and FWTM for TArrow s
124  //ExportToTextFile();
126  return 0;
127 }
Int_t ExportToRootFile(TString RootFilename_ext="test.root")
Int_t PndHypGeSpectrumAnalyser::AnalyseSpectrum ( )

Definition at line 92 of file PndHypGeSpectrumAnalyser.cxx.

References BreakProgram, CalculateFWHM(), CalculateFWTM(), DoEnergyCalibration(), DrawCalibratedSpectrum(), ExportToRootFile(), ExportToTextFile(), FindPeaks(), FitPeaks(), and nPeaks.

93 {
94  if (nPeaks == -1 || BreakProgram == -1)
95  {
96  std::cerr << "*******Nuclei not found!" << endl;
97  return -1;
98  }
99  FindPeaks();
100  FitPeaks();
102 
103  CalculateFWHM();
104  CalculateFWTM();
105  DrawCalibratedSpectrum(); // after FWHM and FWTM for TArrow s
108  return 0;
109 }
Int_t ExportToRootFile(TString RootFilename_ext="test.root")
Int_t ExportToTextFile(TString TxtFilename_ext="test.txt")
Double_t PndHypGeSpectrumAnalyser::CalculateEfficiency ( )
Int_t PndHypGeSpectrumAnalyser::CalculateFWHM ( )

Definition at line 532 of file PndHypGeSpectrumAnalyser.cxx.

References Amplitude, CalculateLowerErrorLeft(), CalculateLowerErrorRight(), CalculateUpperErrorLeft(), CalculateUpperErrorRight(), Calibrate(), Energies, fhFitErrorhistogram, FitFunc, FWHM_ch, FWHM_en, FWHMHeight, FWHMhigh, FWHMhighEnergy, FWHMhighLeftBorder, FWHMhighLeftBorderEnergy, FWHMhighRightBorder, FWHMhighRightBorderEnergy, FWHMlow, FWHMlowEnergy, FWHMlowLeftBorder, FWHMlowLeftBorderEnergy, FWHMlowRightBorder, FWHMlowRightBorderEnergy, i, and nPeaksFound.

Referenced by AnalyseSimulationSpectrum(), and AnalyseSpectrum().

533 {
534  for(Int_t i = 0; i <nPeaksFound; i++)
535  {
536  Amplitude[i] = FitFunc[i]->GetMaximum()-FitFunc[i]->GetMinimum(); // Easy way to substract the background, only the lower part on the high energy side is substracted
537  FWHMHeight[i] = FitFunc[i]->GetMaximum()-Amplitude[i]/2;
538  FWHMlow[i] = FitFunc[i]->GetX(FWHMHeight[i],FitFunc[i]->GetXmin(),FitFunc[i]->GetMaximumX());
539  cout << FitFunc[i]->Eval(FWHMlow[i]) << "t" << fhFitErrorhistogram[i]->GetBinContent(fhFitErrorhistogram[i]->FindBin(FWHMlow[i])) << endl;
542 
543  FWHMhigh[i] = FitFunc[i]->GetX(FWHMHeight[i],FitFunc[i]->GetMaximumX(),FitFunc[i]->GetXmax());
544 
547 
550 
555 
556  cout << "low " << FWHMlowEnergy[i] << "\t"<< FWHMlowLeftBorderEnergy[i] << "\t" << FWHMlowRightBorderEnergy[i]<< endl;
557  cout << "high " << FWHMhighEnergy[i] << "\t"<< FWHMhighLeftBorderEnergy[i] << "\t" << FWHMhighRightBorderEnergy[i]<< endl;
558  FWHM_ch.insert(std::pair<double,double>(Energies[i],FWHMhigh[i]-FWHMlow[i]));
559  FWHM_en.insert(std::pair<double,double>(Energies[i],FWHMhighEnergy[i]-FWHMlowEnergy[i]));
560  //std::cout << "FWHMlow" << FWHMlow << "\t\tFWHMhigh" << FWHMhigh << endl;
561  //std::cout << "FWHMlowEn" << FWHMlowEnergy << "\t\tFWHMhighEn" << FWHMhighEnergy << endl;
562  //std::cout << FWHMhighEnergy-FWHMlowEnergy<< endl;
563  }
564  //std::map<double,double>::const_iterator it=FWHM_en.begin();
565  //for (it=FWHM_en.begin(); it!=FWHM_en.end(); ++it)
566  //std::cout << it->first << " => " << it->second << '\n';
567  return 0;
568 }
Int_t i
Definition: run_full.C:25
Double_t CalculateUpperErrorLeft(Double_t threshold, TH1D *histo, Double_t StartingValue)
Double_t CalculateUpperErrorRight(Double_t threshold, TH1D *histo, Double_t StartingValue)
Double_t CalculateLowerErrorRight(Double_t threshold, TH1D *histo, Double_t StartingValue)
Double_t Calibrate(Double_t Channel)
Double_t CalculateLowerErrorLeft(Double_t threshold, TH1D *histo, Double_t StartingValue)
Int_t PndHypGeSpectrumAnalyser::CalculateFWTM ( )

Definition at line 570 of file PndHypGeSpectrumAnalyser.cxx.

References Amplitude, Calibrate(), Energies, FitFunc, FWTM_ch, FWTM_en, FWTMHeight, FWTMhigh, FWTMhighEnergy, FWTMlow, FWTMlowEnergy, i, and nPeaksFound.

Referenced by AnalyseSimulationSpectrum(), and AnalyseSpectrum().

571 {
572  for(Int_t i = 0; i <nPeaksFound; i++)
573  {
574  Amplitude[i] = FitFunc[i]->GetMaximum()-FitFunc[i]->GetMinimum(); // Easy way to substract the background, only the lower part on the high energy side is substracted
575  FWTMHeight[i] = FitFunc[i]->GetMaximum()-Amplitude[i]*9/10;
576  FWTMlow[i] = FitFunc[i]->GetX(FWTMHeight[i],FitFunc[i]->GetXmin(),FitFunc[i]->GetMaximumX());
577  FWTMhigh[i] = FitFunc[i]->GetX(FWTMHeight[i],FitFunc[i]->GetMaximumX(),FitFunc[i]->GetXmax());
580  FWTM_ch.insert(std::pair<double,double>(Energies[i],FWTMhigh[i]-FWTMlow[i]));
581  FWTM_en.insert(std::pair<double,double>(Energies[i],FWTMhighEnergy[i]-FWTMlowEnergy[i]));
582  //std::cout << "FWTMlow" << FWTMlow << "\t\tFWTMhigh" << FWTMhigh << endl;
583  //std::cout << "FWTMlowEn" << FWTMlowEnergy << "\t\tFWTMhighEn" << FWTMhighEnergy << endl;
584  //std::cout << FWTMhighEnergy-FWTMlowEnergy<< endl;
585  }
586  //std::map<double,double>::const_iterator it=FWTM_en.begin();
587  //for (it=FWTM_en.begin(); it!=FWTM_en.end(); ++it)
588  //std::cout << it->first << " => " << it->second << '\n';
589 
590  return 0;
591 }
Int_t i
Definition: run_full.C:25
Double_t Calibrate(Double_t Channel)
Double_t PndHypGeSpectrumAnalyser::CalculateLowerErrorLeft ( Double_t  threshold,
TH1D *  histo,
Double_t  StartingValue 
)
private

Definition at line 1056 of file PndHypGeSpectrumAnalyser.cxx.

References Double_t, and i.

Referenced by CalculateFWHM().

1057 {
1058  Int_t i = 0;
1059  Double_t LowerErrorValue;
1060  while (threshold < histo->GetBinContent(histo->FindBin(StartingValue) - i)+ histo->GetBinErrorUp(histo->FindBin(StartingValue) - i))
1061  {
1062  cout << "t" << threshold << endl;
1063  cout << histo->GetBinContent(histo->FindBin(StartingValue)) << endl;
1064  i++;
1065  if (i == 100) break;
1066  LowerErrorValue= histo->GetBinCenter(histo->FindBin(StartingValue) - (i-1));
1067  cout <<"bla " << LowerErrorValue << endl;
1068  }
1069  LowerErrorValue= histo->GetBinCenter(histo->FindBin(StartingValue) - (i-1));
1070  return LowerErrorValue;
1071 }
Int_t i
Definition: run_full.C:25
Double_t
double threshold
Double_t PndHypGeSpectrumAnalyser::CalculateLowerErrorRight ( Double_t  threshold,
TH1D *  histo,
Double_t  StartingValue 
)
private

Definition at line 1086 of file PndHypGeSpectrumAnalyser.cxx.

References Double_t, and i.

Referenced by CalculateFWHM().

1087 {
1088  Int_t i = 0;
1089  Double_t LowerErrorValue;
1090  while (threshold > histo->GetBinContent(histo->FindBin(StartingValue) - i)- histo->GetBinErrorLow(histo->FindBin(StartingValue) - i))
1091  {
1092  i++;
1093  if (i == 100) break;
1094  }
1095  LowerErrorValue= histo->GetBinCenter(histo->FindBin(StartingValue) - (i-1));
1096  return LowerErrorValue;
1097 }
Int_t i
Definition: run_full.C:25
Double_t
double threshold
Double_t PndHypGeSpectrumAnalyser::CalculateUpperErrorLeft ( Double_t  threshold,
TH1D *  histo,
Double_t  StartingValue 
)
private

Definition at line 1073 of file PndHypGeSpectrumAnalyser.cxx.

References Double_t, and i.

Referenced by CalculateFWHM().

1074 {
1075  Int_t i = 0;
1076  Double_t UpperErrorValue;
1077  while (threshold > histo->GetBinContent(histo->FindBin(StartingValue) + i)- histo->GetBinErrorLow(histo->FindBin(StartingValue) + i))
1078  {
1079  i++;
1080  if (i == 100) break;
1081  //cout << "i" << i << endl;
1082  }
1083  UpperErrorValue= histo->GetBinCenter(histo->FindBin(StartingValue) + (i-1));
1084  return UpperErrorValue;
1085 }
Int_t i
Definition: run_full.C:25
Double_t
double threshold
Double_t PndHypGeSpectrumAnalyser::CalculateUpperErrorRight ( Double_t  threshold,
TH1D *  histo,
Double_t  StartingValue 
)
private

Definition at line 1099 of file PndHypGeSpectrumAnalyser.cxx.

References Double_t, and i.

Referenced by CalculateFWHM().

1100 {
1101  Int_t i = 0;
1102  Double_t UpperErrorValue;
1103  while (threshold < histo->GetBinContent(histo->FindBin(StartingValue) + i)+ histo->GetBinErrorUp(histo->FindBin(StartingValue) + i))
1104  {
1105  i++;
1106  if (i == 100) break;
1107  }
1108  UpperErrorValue= histo->GetBinCenter(histo->FindBin(StartingValue) + (i-1));
1109  return UpperErrorValue;
1110 }
Int_t i
Definition: run_full.C:25
Double_t
Double_t PndHypGeSpectrumAnalyser::Calibrate ( Double_t  Channel)
private

Definition at line 862 of file PndHypGeSpectrumAnalyser.cxx.

References a, b, c, CalFunc, and Double_t.

Referenced by CalculateFWHM(), CalculateFWTM(), and DrawCalibratedSpectrum().

863 {
864  Double_t a = CalFunc->GetParameter(0);
865  Double_t b = CalFunc->GetParameter(1);
866  Double_t c = CalFunc->GetParameter(2);
867  return a + b *Channel + c * Channel * Channel;
868 }
TTree * b
Int_t a
Definition: anaLmdDigi.C:126
Double_t
Int_t PndHypGeSpectrumAnalyser::CompareNuclei ( TString  NucleiName)

Definition at line 594 of file PndHypGeSpectrumAnalyser.cxx.

References Energies, and EnergyErrors.

Referenced by PndHypGeSpectrumAnalyser().

595 {
596  NucleiName.ToLower();
597  if(!NucleiName.CompareTo("co60") )
598  {
599  //npeaks = 2;
600  std::cout << "Found Co60"<< endl;
601  Energies.push_back(1172.23);
602  EnergyErrors.push_back(0.030);
603  Energies.push_back(1332.51);
604  EnergyErrors.push_back(0.015);
605  return Energies.size();
606  }
607 
608  if(!NucleiName.CompareTo("co60bg") )
609  {
610  //npeaks = 2;
611  std::cout << "Found Co60 and K40"<< endl;
612  Energies.push_back(1172.23); //keV
613  EnergyErrors.push_back(0.030); //keV
614  Energies.push_back(1332.51); //keV
615  EnergyErrors.push_back(0.015); //keV
616  Energies.push_back(1460.83); //keV
617  EnergyErrors.push_back(0.1); // placeholder, real value unknown
618  return Energies.size(); // 3 peaks
619  }
620 
621  if( !NucleiName.CompareTo( "eu152") )
622  {
623  std::cout << "Found Eu152"<< endl;
624  Energies.push_back(121.78); //keV
625  EnergyErrors.push_back(0.1); // placeholder, real value unknown
626  Energies.push_back(244.70); //keV
627  EnergyErrors.push_back(0.1); // placeholder, real value unknown
628  Energies.push_back(344.28); //keV
629  EnergyErrors.push_back(0.1); // placeholder, real value unknown
630  Energies.push_back(411.1); //keV
631  EnergyErrors.push_back(0.1); // placeholder, real value unknown
632  Energies.push_back(444.0); //keV
633  EnergyErrors.push_back(0.1); // placeholder, real value unknown
634  Energies.push_back(778.90); //keV
635  EnergyErrors.push_back(0.1); // placeholder, real value unknown
636  Energies.push_back(867.4); //keV
637  EnergyErrors.push_back(0.1); // placeholder, real value unknown
638  Energies.push_back(964.08); //keV
639  EnergyErrors.push_back(0.1); // placeholder, real value unknown
640  Energies.push_back(1085.9); //keV
641  EnergyErrors.push_back(0.1); // placeholder, real value unknown
642  Energies.push_back(1112.1); //keV
643  EnergyErrors.push_back(0.1); // placeholder, real value unknown
644  Energies.push_back(1408.0); //keV
645  EnergyErrors.push_back(0.1); // placeholder, real value unknown
646  return Energies.size(); // 11 peaks
647  }
648  if( !NucleiName.CompareTo( "eu152bg") )
649  {
650  std::cout << "Found Eu152 and K40"<< endl;
651  return Energies.size();
652  }
653 
654  if(!NucleiName.CompareTo("cs137") )
655  {
656  std::cout << "Found Cs137"<< endl;
657  return Energies.size();
658  }
659 
660  if(!NucleiName.CompareTo("cs137bg") )
661  {
662  std::cout << "Found Cs137 and K40"<< endl;
663  return Energies.size();
664  }
665 
666  if(!NucleiName.CompareTo("na22") )
667  {
668  std::cout << "Found Na22"<< endl;
669  return Energies.size();
670  }
671 
672  if(!NucleiName.CompareTo("na22bg") )
673  {
674  std::cout << "Found Na22 and K40"<< endl;
675  return Energies.size();
676  }
677  if(!NucleiName.CompareTo("jülich") )
678  {
679  //npeaks = 5;
680  std::cout << "Found jülich beam time configuration"<< endl;
681  Energies.push_back(510.998928);
682  EnergyErrors.push_back(0.000011);
683  Energies.push_back(1172.23);
684  EnergyErrors.push_back(0.030);
685  Energies.push_back(1332.51);
686  EnergyErrors.push_back(0.015);
687  Energies.push_back(1778.969);
688  EnergyErrors.push_back(0.012);
689  Energies.push_back(2504.74);
690  EnergyErrors.push_back(0.1); //0,1keV random
691  return Energies.size();
692  }
693  if(!NucleiName.CompareTo("jülich2") )
694  {
695  //npeaks = 5;
696  std::cout << "Found jülich beam time configuration"<< endl;
697  Energies.push_back(510.998928);
698  EnergyErrors.push_back(0.000011);
699  Energies.push_back(1172.23);
700  EnergyErrors.push_back(0.030);
701  Energies.push_back(1332.51);
702  EnergyErrors.push_back(0.015);
703  Energies.push_back(1778.969);
704  EnergyErrors.push_back(0.012);
705  return Energies.size();
706  }
707  //std::cerr << "****************Nuclei not found!***************" <<endl;
708  return -1;
709 }
Int_t PndHypGeSpectrumAnalyser::DoEnergyCalibration ( )

Definition at line 513 of file PndHypGeSpectrumAnalyser.cxx.

References CalFunc, Energies, EnergyErrors, fCalCanvas, fgCalibration, nPeaksFound, PeakFitX, and PeakFitXError.

Referenced by AnalyseSpectrum().

514 {
515  std::cout << "Starting energy calibration" << endl;
516  fCalCanvas = new TCanvas("fCalCanvas","Energy Calibration",800,600); //all "canvas stuff" may need changes for go4
517  fCalCanvas->cd();
518 
519  fgCalibration = new TGraphErrors(nPeaksFound,&(PeakFitX[0]),&(Energies[0]),&(PeakFitXError[0]),&(EnergyErrors[0]));
520  fgCalibration->SetMarkerSize(2);
521  fgCalibration->GetXaxis()->SetTitle("Pulse height [a.u.]");
522  fgCalibration->GetYaxis()->SetTitle("#gamma energy [keV]");
523 
524  //CalFunc = new TF1("CalFunc","pol2",0,8000);
525  CalFunc = new TF1("CalFunc","pol1",0,8000);
526  fgCalibration->Draw("AP");
527  fgCalibration->Fit(CalFunc);
528 
529  return 0;
530 }
Int_t PndHypGeSpectrumAnalyser::DrawCalibratedSpectrum ( )

Definition at line 758 of file PndHypGeSpectrumAnalyser.cxx.

References CalFunc, Calibrate(), CalibratedFunction, Double_t, fCalSpecCanvas, fFittingMethod, fhCalibratedSpectrum, fhEnergySpectrum, FitFunc, FWHM_en, FWHMHeight, FWHMhighEnergy, FWHMlowEnergy, FWTM_en, FWTMHeight, FWTMhighEnergy, FWTMlowEnergy, GetParameter(), i, nbins, and nPeaksFound.

Referenced by AnalyseSpectrum().

759 {
760  std::cout << "Drawing of CalibratedSpectrum" <<endl;
761  fCalSpecCanvas = new TCanvas("fCalSpecCanvas", "Calibrated spectrum",800,600); //all "canvas stuff" may need changes for go4
762  fCalSpecCanvas->cd();
763  fhEnergySpectrum->GetXaxis()->UnZoom();
764  //fhCalibratedSpectrum = new TH1D("fhCalibratedSpectrum","Calibrated spectrum;Energy [keV];Counts [a.u.]",fhEnergySpectrum->GetNbinsX(),Calibrate(fhEnergySpectrum->GetXaxis()->GetBinCenter(fhEnergySpectrum->GetXaxis()->GetFirst())),Calibrate(fhEnergySpectrum->GetXaxis()->GetBinCenter(fhEnergySpectrum->GetXaxis()->GetLast())));
765 
766  //create new bins for calibrated spectrum. These bins have variable bin size due to the non-linear energy calibration
767  const int nbins = fhEnergySpectrum->GetNbinsX();
768  double new_bins[nbins+1];
769  for(int i=0; i <= nbins; i++)
770  {
771  new_bins[i] = Calibrate( fhEnergySpectrum-> GetBinLowEdge(i+1) );
772  //std::cout << new_bins[i]<<endl;
773  }
774  fhCalibratedSpectrum = new TH1D("fhCalibratedSpectrum","Calibrated spectrum;Energy [keV];Counts [a.u.]",fhEnergySpectrum->GetNbinsX(),new_bins);
775  for(Int_t i = 0; i<=fhEnergySpectrum->GetNbinsX(); i++)
776  {
777  fhCalibratedSpectrum->Fill(Calibrate(fhEnergySpectrum->GetXaxis()->GetBinCenter(i)),fhEnergySpectrum->GetBinContent(i));
778  }
779  fhCalibratedSpectrum->SetStats(0);
780  fhCalibratedSpectrum->Draw();
781 
782  std::map<double,double>::const_iterator it=FWHM_en.begin();
783  std::map<double,double>::const_iterator it2=FWTM_en.begin();
784  for(Int_t i = 0;i< nPeaksFound; i++)
785  {
786 
787  CalibratedFunction[i] = new TF1(*FitFunc[i]);
788  //adapt parameters to energy spectrum
789  Double_t OldSigma = CalibratedFunction[i]->GetParameter(2);
790 
791  if (fFittingMethod != 4)
792  {
793  // adapt sigmas to new x-axis
796  //adapt x0's to nes x-axis
799  // not necessary atm!!!!! --- adapt amplitudes, this has to be done, because of the par[2] (sigma) in the denominator in front of the gausian part. Since the gausian ampl. (par[0]) is in the denominator of any other part their ampl. must be adapted too. The lin. bg gradient must not be adapted, because the factors from the change of x and par[0] cancel each other
800  //CalibratedFunction[i]->SetParameter(0,CalibratedFunction[i]->GetParameter(0)*CalibratedFunction[i]->GetParameter(2)/OldSigma);
801  //std::cout << "new ampl" << CalibratedFunction[i]->GetParameter(0) << endl;
802  //CalibratedFunction[i]->SetParameter(3,CalibratedFunction[i]->GetParameter(3)*CalibratedFunction[i]->GetParameter(2)/OldSigma);
803  //CalibratedFunction[i]->SetParameter(5,CalibratedFunction[i]->GetParameter(5)*CalibratedFunction[i]->GetParameter(2)/OldSigma);
804  //function range must be adapted
805 
806  //pol1 bg must be adapted to new y-axis, ATTENTION!!! This version is only viable for pol1 CalFunc!!!!!!!!!
807  CalibratedFunction[i]->SetParameter(5,CalibratedFunction[i]->GetParameter(5)-CalibratedFunction[i]->GetParameter(4)*CalFunc->GetParameter(0));
808  CalibratedFunction[i]->SetParameter(4,CalibratedFunction[i]->GetParameter(4)/CalFunc->GetParameter(1));
809  }
810  else
811  {
812  // after lunch
813  //sigmagaus and sigmaskew
816 
817  //X0gaus and X0skew
820 
821  //lambda skew
823 
824  //amplitude skew
826 
827 
828  }
829  CalibratedFunction[i]->SetRange(Calibrate(CalibratedFunction[i]->GetXmin()),Calibrate(CalibratedFunction[i]->GetXmax()));
830  //CalibratedFunction[i]->Print();
831  CalibratedFunction[i]->Draw("same");
832  //FitFunc[i]->Print();
833  TArrow *FWHMArrow = new TArrow(FWHMlowEnergy[i], FWHMHeight[i],FWHMhighEnergy[i],FWHMHeight[i],0.02,"<|>");
834  FWHMArrow->Draw("");
835  TArrow *FWTMArrow = new TArrow(FWTMlowEnergy[i], FWTMHeight[i],FWTMhighEnergy[i],FWTMHeight[i],0.02,"<|>");
836  FWTMArrow->Draw("");
837  char TextBuffer[50];
838  sprintf(TextBuffer,"%.2f keV",it->second);
839  //TextBuffer = "test";
840  TText *FWHMText = new TText(CalibratedFunction[i]->GetParameter(1),FWHMHeight[i]*1.05, TextBuffer);
841  FWHMText->SetTextAlign(22);
842  FWHMText->SetTextFont(63);
843  FWHMText->SetTextSizePixels(22);
844  FWHMText->Draw();
845  sprintf(TextBuffer,"%.2f keV",it2->second);
846  TText *FWTMText = new TText(CalibratedFunction[i]->GetParameter(1),FWTMHeight[i]+FWHMHeight[i]*0.05, TextBuffer);
847  FWTMText->SetTextAlign(22);
848  FWTMText->SetTextFont(63);
849  FWTMText->SetTextSizePixels(22);
850  FWTMText->Draw();
851  it++;
852  it2++;
853  }
854  return 0;
855 }
Int_t i
Definition: run_full.C:25
cout<< "ifile "<< ifile<< endl;cout<< " momentum sampled over "<< nsteps<< " with step width "<< 1.5/nsteps<< endl;cout<< endl;cout<< "MEAN DEDX PARAMETRIZATION"<< endl;cout<< "mom limits "<< mean_inf<< " "<< mean_sup<< endl;cout<< "mu: ";for(int param=0;param< npardedx;param++) cout<< fdedx-> GetParameter(param)<< "
Double_t
int nbins
Definition: full_core_ntp.C:33
Double_t Calibrate(Double_t Channel)
Int_t PndHypGeSpectrumAnalyser::DrawSimulationSpectrum ( )

Definition at line 857 of file PndHypGeSpectrumAnalyser.cxx.

Referenced by AnalyseSimulationSpectrum().

858 {
859 
860 }
Int_t PndHypGeSpectrumAnalyser::ExportToRootFile ( TString  RootFilename_ext = "test.root")

Definition at line 896 of file PndHypGeSpectrumAnalyser.cxx.

References Double_t, fCalCanvas, fCalSpecCanvas, fhEnergySpectrum, FitFunc, FWHM_en, FWTM_en, i, nPeaksFound, OutputPath, PeakCounts, RootFile, RootFilename, and TString.

Referenced by AnalyseSimulationSpectrum(), and AnalyseSpectrum().

897 {
898  TString RootFilenameWithPath;
899  if (OutputPath)
900  RootFilenameWithPath = OutputPath;
901  if (!RootFilename)
902  RootFilename += RootFilename_ext;
903  RootFilenameWithPath += RootFilename;
904 
905  RootFile = (TFile*)gROOT->FindObject(RootFilenameWithPath);
906  if (RootFile)
907  RootFile->Close();
908  RootFile = new TFile(RootFilenameWithPath,"RECREATE",RootFilenameWithPath);
909 
910  TNtuple* DataNTuple = new TNtuple("DataNTuple","Data ntuple","PeakNumber:Energy:FWHM:FWTM:FWTMtoFWHMratio:PeakCounts");
911  Double_t wEnergy,wFWHM,wFWTM,wRatio,wPeakCounts; // w means "write"
912  Int_t wPeakNumber;
913  std::map<double,double>::const_iterator it=FWHM_en.begin();
914  std::map<double,double>::const_iterator it2=FWTM_en.begin();
915  for(Int_t i = 0; i < nPeaksFound; i++)
916  {
917  wPeakNumber = i;
918  wEnergy= it->first;
919  wFWHM = it->second;
920  wFWTM = it2->second;
921  wRatio = it2->second/it->second;
922  wPeakCounts = PeakCounts[i];
923  DataNTuple->Fill(wPeakNumber,wEnergy,wFWHM,wFWTM,wRatio,wPeakCounts);
924  it++;
925  it2++;
926  }
927  DataNTuple->Write();
928  FitFunc[2]->Write();
929  fhEnergySpectrum->Write();
930  fCalCanvas->Write();
931  fCalSpecCanvas->Write();
932  RootFile->Close();
933  return 0;
934 }
Int_t i
Definition: run_full.C:25
Double_t
Int_t PndHypGeSpectrumAnalyser::ExportToTextFile ( TString  TxtFilename_ext = "test.txt")

Definition at line 871 of file PndHypGeSpectrumAnalyser.cxx.

References fhEnergySpectrum, FWHM_en, FWTM_en, OutputPath, PeakCounts, TString, TxtFile, and TxtFilename.

Referenced by AnalyseSpectrum().

872 {
873  TString TxtFilenameWithPath;
874  if (OutputPath)
875  TxtFilenameWithPath = OutputPath;
876  if (!TxtFilename)
877  TxtFilename = TxtFilename_ext;
878  TxtFilenameWithPath += TxtFilename;
879  TxtFile.open(TxtFilenameWithPath.Data());
880  TxtFile << "File:\t" << fhEnergySpectrum->GetTitle()<< endl;
881  TxtFile << "Nuclei:\t" << endl;
882  TxtFile << "Energy [keV]\t\tFWHM [keV]\t\tFWTM [keV]\t\tFWTM/FWHM\t\tPeakCounts" << endl;
883 
884  std::map<double,double>::const_iterator it=FWHM_en.begin();
885  std::map<double,double>::const_iterator it2=FWTM_en.begin();
886  Int_t j=0;
887  for (it=FWHM_en.begin(); it!=FWHM_en.end(); ++it)
888  {
889  TxtFile << it->first << "\t\t" << it->second <<"\t\t"<< it2->second <<"\t\t" << it2->second/it->second << "\t\t" << PeakCounts[j] << endl;
890  it2++;
891  j++;
892  }
893  TxtFile.close();
894  return 0;
895 }
Int_t PndHypGeSpectrumAnalyser::FindPeaks ( )

Definition at line 129 of file PndHypGeSpectrumAnalyser.cxx.

References fEnergySpecCanvas, fhEnergySpectrum, fSpectrum, i, nPeaksFound, PeakSort(), PeaksPosX, and PeaksPosY.

Referenced by AnalyseSpectrum().

130 {
131  fEnergySpecCanvas =new TCanvas("fEnergySpecCanvas", "Uncalibrated spectrum",800,600);
132  fEnergySpecCanvas->cd();
133  nPeaksFound = fSpectrum->Search(fhEnergySpectrum,5,"",0.001); //must (maybe) be adapted to spectrum; peaks found are sorted by their height (y value)
134  PeaksPosX = (Float_t*) fSpectrum->GetPositionX();
135  PeaksPosY = (Float_t*) fSpectrum->GetPositionY();
136  std::cout << "Found " << nPeaksFound << " Peaks:" <<endl;
137  for(Int_t i =0;i< nPeaksFound;i++)
138  {
139  std::cout << "Peak "<< i+1 <<": X " << PeaksPosX[i]<<"\t\tY " << PeaksPosY[i] << endl;
140  }
141  PeakSort(); // sorts peaks by their x position to make energy calibration easier
142  return 0;
143 }
Int_t i
Definition: run_full.C:25
Double_t PndHypGeSpectrumAnalyser::FindUpperSigmaFitLimit ( Double_t  threshold,
Float_t  StartingPoint 
)
private

Definition at line 711 of file PndHypGeSpectrumAnalyser.cxx.

References Double_t, fhEnergySpectrum, and threshold.

Referenced by FitPeaks().

712 {
713  //find fitting range of sigma. this is done by starting at "starting point" and than finding the position when the peak goes bellow a certain threshold.
714  Int_t StartBin = fhEnergySpectrum->FindBin((Double_t)StartingPoint);
715  //std::cout << "StartBin" << StartBin;
716 
717  for (Int_t bin=StartBin;bin<=fhEnergySpectrum->GetNbinsX();bin++)
718  {
719  //std::cout << bin<<"\t\t\tSpecValue\t\t"<<fhEnergySpectrum->GetBinContent(bin) << endl;
720  if (fhEnergySpectrum->GetBinContent(bin) < threshold)
721  {
722  //std::cout << fhEnergySpectrum->GetBinCenter(bin)<< "\t\t"<<StartingPoint << endl;
723  return fhEnergySpectrum->GetBinCenter(bin)-StartingPoint;
724  }
725  }
726  return -1;
727 }
Double_t
double threshold
Int_t PndHypGeSpectrumAnalyser::FitPeaks ( )

Definition at line 145 of file PndHypGeSpectrumAnalyser.cxx.

References Double_t, fEnergySpecCanvas, fFittingMethod, fhEnergySpectrum, fhFitErrorhistogram, fhSubstractSpectrum, FindUpperSigmaFitLimit(), FitFunc, FitFuncWithoutBg, PndHypGePeakFitFunction::FreeSkewedOnly(), fSubstractCanvas, func, FuncGaus, FuncLinear, FuncSmoothedStep, FuncTail, FuncWidth, PndHypGePeakFitFunction::GausOnly(), GetParameter(), i, PndHypGePeakFitFunction::LinearOnly(), PndHypGePeakFitFunction::NewFunction(), nPeaksFound, PeakCounts, PeakFitX, PeakFitXError, PndHypGePeakFitFunction::PeakFunc(), PndHypGePeakFitFunction::PeakFuncDoubleGausian(), PndHypGePeakFitFunction::PeakFuncFreeSkewedPositionWithoutFirstGausian(), PndHypGePeakFitFunction::PeakFuncGaussian(), PeaksPosX, PeaksPosY, PndHypGePeakFitFunction::SecondGausOnly(), PndHypGePeakFitFunction::SkewedOnly(), PndHypGePeakFitFunction::SmoothedStepOnly(), and sqrt().

Referenced by AnalyseSimulationSpectrum(), and AnalyseSpectrum().

146 {
147  char buf[40];
148  //TVirtualFitter::SetDefaultFitter("Minuit2");
149  //TVirtualFitter::SetDefaultFitter("Fumili2");
150  TVirtualFitter::SetPrecision(1e-5);
152  //FitFunc = new *TF1[nPeaksFound];
153  //TF1 *FitFunc[nPeaksFound];
154  Int_t npar =0;
155  if (!fEnergySpecCanvas)
156  fEnergySpecCanvas =new TCanvas("fEnergySpecCanvas", "Uncalibrated spectrum",800,600);
157  fEnergySpecCanvas->cd();
158 
159  fhEnergySpectrum->GetXaxis()->SetTitle("Pulse height [a.u.]");
160  fhEnergySpectrum->GetYaxis()->SetTitle("Counts");
161  for(Int_t i = 0; i < nPeaksFound;i++)
162  {
163 
164  if (fFittingMethod == 0) // simple gaussian + step + lin bg
165  // par[0]: amplitude gaus, par[1]: x0; par[2]: sigma, par[3]: amplitude step, par[4]: gradient of lin bg
166  {
167  npar = 6;
168  sprintf(buf,"FitFunc_%d",i+1);
169  FitFunc[i] = new TF1(buf,func,&PndHypGePeakFitFunction::PeakFuncGaussian,(Double_t) PeaksPosX[i]-FuncWidth,(Double_t) PeaksPosX[i]+FuncWidth,npar,"PndHypGePeakFitFunction","PeakFuncGaussian"); // width has to be adapted
170  }
171  if (fFittingMethod == 1)
172  {
173  npar = 8;
174  sprintf(buf,"FitFunc_%d",i+1);
175  FitFunc[i] = new TF1(buf,func,&PndHypGePeakFitFunction::PeakFunc,(Double_t) PeaksPosX[i]-FuncWidth,(Double_t) PeaksPosX[i]+FuncWidth,npar,"PndHypGePeakFitFunction","PeakFunc"); // width has to be adapted
176  }
177 
178  if (fFittingMethod == 2) // more parameters!!!
179  {
180  npar = 10;
181  sprintf(buf,"FitFunc_%d",i+1);
182  //FitFunc[i] = new TF1(buf,func,&PndHypGePeakFitFunction::PeakFuncFreeSkewedPosition,(Double_t) PeaksPosX[i]-FuncWidth,(Double_t) PeaksPosX[i]+FuncWidth,npar,"PndHypGePeakFitFunction","PeakFuncFreeSkewedPosition"); // width has to be adapted
183  FitFunc[i] = new TF1(buf,func,&PndHypGePeakFitFunction::PeakFuncFreeSkewedPositionWithoutFirstGausian,(Double_t) PeaksPosX[i]-2*FuncWidth,(Double_t) PeaksPosX[i]+FuncWidth,npar,"PndHypGePeakFitFunction","PeakFuncFreeSkewedPosition"); // width has to be adapted
184 
185  }
186 
187  if (fFittingMethod == 3) // second gausian as tail!!!
188  {
189  npar = 9;
190  sprintf(buf,"FitFunc_%d",i+1);
191  FitFunc[i] = new TF1(buf,func,&PndHypGePeakFitFunction::PeakFuncDoubleGausian,(Double_t) PeaksPosX[i]-2*FuncWidth,(Double_t) PeaksPosX[i]+FuncWidth,npar,"PndHypGePeakFitFunction","PeakFuncDoubleGausian"); // width has to be adapted
192  }
193  if (fFittingMethod == 4) // second gausian as tail!!!
194  {
195  npar = 8;
196  sprintf(buf,"FitFunc_%d",i+1);
197  FitFunc[i] = new TF1(buf,func,&PndHypGePeakFitFunction::NewFunction,(Double_t) PeaksPosX[i]-2*FuncWidth,(Double_t) PeaksPosX[i]+FuncWidth,npar,"PndHypGePeakFitFunction","NewFunction"); // width has to be adapted
198  }
199  FitFunc[i]->SetNpx(100000);
200 
201  if (fFittingMethod != 4)
202  {
203  //setting parameter names, start values and limits
204  sprintf(buf,"AmplGaus_%d",i+1);
205  FitFunc[i]->SetParName(0,buf);
206  if (fFittingMethod == 2)
207  FitFunc[i]->FixParameter(0,0);
208  else
209  {
210  FitFunc[i]->SetParameter(0,PeaksPosY[i]*1.001-fhEnergySpectrum->GetBinContent(fhEnergySpectrum->FindBin(PeaksPosX[i]-FuncWidth)));
211 
212  //if (PeaksPosY[i]>1000) // take small peaks (bigger portion of background) into account (lower lower limit needed)
213  FitFunc[i]->SetParLimits(0,PeaksPosY[i]*0.95-fhEnergySpectrum->GetBinContent(fhEnergySpectrum->FindBin(PeaksPosX[i]-FuncWidth)),PeaksPosY[i]*1.02-fhEnergySpectrum->GetBinContent(fhEnergySpectrum->FindBin(PeaksPosX[i]-FuncWidth)));
214  }
215  //else
216  // FitFunc[i]->SetParLimits(0,PeaksPosY[i]*0.8,PeaksPosY[i]*1.01);
217 
218  sprintf(buf,"x0_%d",i+1);
219  FitFunc[i]->SetParName(1,buf);
220  FitFunc[i]->SetParameter(1,PeaksPosX[i]);
221  //FitFunc[i]->SetParLimits(1,PeaksPosX[i]-1,PeaksPosX[i]+1);
222  FitFunc[i]->SetParLimits(1,PeaksPosX[i]-10,PeaksPosX[i]+10);
223  if (fFittingMethod == 2)
224  FitFunc[i]->FixParameter(1,0);
225 
226  sprintf(buf,"sigma_%d",i+1);
227  FitFunc[i]->SetParName(2,buf);
228  FitFunc[i]->SetParameter(2,1);
229  Double_t UpperSigmaFitLimit = FindUpperSigmaFitLimit(PeaksPosY[i]*0.3, PeaksPosX[i]);
230  FitFunc[i]->SetParLimits(2,0,UpperSigmaFitLimit);
231  //std::cout << FindUpperSigmaFitLimit(PeaksPosY[i]*0.5, PeaksPosX[i])<< endl;
232  //if (fFittingMethod == 2)
233  //FitFunc[i]->FixParameter(2,0);
234 
235  sprintf(buf,"AmplSmoStep_%d",i+1);
236  FitFunc[i]->SetParName(3,buf);
237  // FitFunc[i]->SetParameter(3,fhEnergySpectrum->GetBinContent(fhEnergySpectrum->FindBin(PeaksPosX[i]-FuncWidth/2)));
238  FitFunc[i]->SetParameter(3,40);
239 
240  //FitFunc[i]->FixParameter(3,0);
241  FitFunc[i]->SetParLimits(3,0.000001,100);
242  //cout << "AAAAA" << fhEnergySpectrum->GetBinContent(fhEnergySpectrum->FindBin(PeaksPosX[i]-FuncWidth)) << endl;
243 
244  sprintf(buf,"linBg_%d",i+1);
245  FitFunc[i]->SetParName(4,buf);
246  FitFunc[i]->SetParameter(4,-0.3);
247  FitFunc[i]->SetParLimits(4,-10,0);
248  if (fFittingMethod == 2)
249  FitFunc[i]->FixParameter(4,0);
250 
251 
252  sprintf(buf,"constBg_%d",i+1);
253  FitFunc[i]->SetParName(5,buf);
254  //FitFunc[i]->SetParameter(5,fhEnergySpectrum->GetBinContent(fhEnergySpectrum->FindBin(PeaksPosX[i]-FuncWidth))/2);
255  FitFunc[i]->SetParameter(5,300);
256  FitFunc[i]->SetParLimits(5,200,700);
257 
258  // FitFunc[i]->SetParLimits(5,0,fhEnergySpectrum->GetBinContent(fhEnergySpectrum->FindBin(PeaksPosX[i]-FuncWidth))+10*PeaksPosX[i]);
259  if (fFittingMethod == 1 || fFittingMethod == 2)
260  {
261  // additional parameters for this fitting function
262  // par[5]: amplitude skewed gaus, par[6]: beta
263 
264  sprintf(buf,"AmplSkGaus_%d",i+1);
265  FitFunc[i]->SetParName(6,buf);
266  //FitFunc[i]->SetParameter(6,PeaksPosY[i]*0.01);
267  FitFunc[i]->SetParameter(6,PeaksPosY[i]*0.66);
268  //FitFunc[i]->FixParameter(6,0);
269 
270  FitFunc[i]->SetParLimits(6,PeaksPosY[i]*0.2,PeaksPosY[i]);
271 
272  sprintf(buf,"beta_%d",i+1);
273  FitFunc[i]->SetParName(7,buf);
274  FitFunc[i]->SetParameter(7,10);
275  //FitFunc[i]->FixParameter(7,1);
276  FitFunc[i]->SetParLimits(7,0.000001,100);
277 
278  }
279  if (fFittingMethod == 2)
280  {
281  // additional parameters for this fitting function
282  // par[7]: x0_s, par[8]: sigma_s
283 
284  sprintf(buf,"x0SkewedGaus_%d",i+1);
285  FitFunc[i]->SetParName(8,buf);
286  FitFunc[i]->SetParameter(8,PeaksPosX[i]);
287  //FitFunc[i]->FixParameter(8,0);
288  FitFunc[i]->SetParLimits(8,PeaksPosX[i]-1,PeaksPosX[i]+10);
289 
290  sprintf(buf,"sigmaSkewedGausn_%d",i+1);
291  FitFunc[i]->SetParName(9,buf);
292  FitFunc[i]->SetParameter(9,1);
293  FitFunc[i]->SetParLimits(9,0.1,UpperSigmaFitLimit);
294  //FitFunc[i]->FixParameter(9,1);
295 
296  }
297 
298  if (fFittingMethod == 3)
299  {
300  // additional parameters for this fitting function
301  // par[5]: amplitude second gaus, par[6]: x0_ second gaus, par[7]: sigma second gaus
302 
303  sprintf(buf,"AmplSecondGaus_%d",i+1);
304  FitFunc[i]->SetParName(6,buf);
305  FitFunc[i]->SetParameter(6,PeaksPosY[i]*0.01);
306  //FitFunc[i]->FixParameter(6,0);
307  if (PeaksPosY[i]*0.02-fhEnergySpectrum->GetBinContent(fhEnergySpectrum->FindBin(PeaksPosX[i]-FuncWidth)) > 0)
308  FitFunc[i]->SetParLimits(6,PeaksPosY[i]*0.02-fhEnergySpectrum->GetBinContent(fhEnergySpectrum->FindBin(PeaksPosX[i]-FuncWidth)),PeaksPosY[i]*0.2-fhEnergySpectrum->GetBinContent(fhEnergySpectrum->FindBin(PeaksPosX[i]-FuncWidth)));
309  else
310  FitFunc[i]->SetParLimits(6,0,PeaksPosY[i]*0.2-fhEnergySpectrum->GetBinContent(fhEnergySpectrum->FindBin(PeaksPosX[i]-FuncWidth)));
311 
312  sprintf(buf,"x0SecondGaus_%d",i+1);
313  FitFunc[i]->SetParName(7,buf);
314  FitFunc[i]->SetParameter(7,PeaksPosX[i]-2);
315  //FitFunc[i]->FixParameter(7,0);
316  FitFunc[i]->SetParLimits(7,PeaksPosX[i]-4,PeaksPosX[i]-1);
317 
318  sprintf(buf,"sigmaSecondGaus_%d",i+1);
319  FitFunc[i]->SetParName(8,buf);
320  FitFunc[i]->SetParameter(8,1);
321  FitFunc[i]->SetParLimits(8,0.1,UpperSigmaFitLimit*5);
322  //FitFunc[i]->FixParameter(8,1);
323  }
324  }
325  else
326  {
327  //setting parameter names, start values and limits
328  sprintf(buf,"lambda_%d",i+1);
329  FitFunc[i]->SetParName(0,buf);
330  FitFunc[i]->SetParameter(0,0.1);
331  FitFunc[i]->SetParLimits(0,0.01,1);
332 
333  sprintf(buf,"XPosSkew_%d",i+1);
334  FitFunc[i]->SetParName(1,buf);
335  FitFunc[i]->SetParameter(1,PeaksPosX[i]);
336  FitFunc[i]->SetParLimits(1,PeaksPosX[i]*0.99,PeaksPosX[i]*1.01);
337 
338  sprintf(buf,"SigmaSkew_%d",i+1);
339  FitFunc[i]->SetParName(2,buf);
340  FitFunc[i]->SetParameter(2,5);
341  FitFunc[i]->SetParLimits(2,0.1,50);
342 
343  sprintf(buf,"AmplitudeSkew_%d",i+1);
344  FitFunc[i]->SetParName(3,buf);
345  FitFunc[i]->SetParameter(3,PeaksPosY[i]*10);
346  FitFunc[i]->SetParLimits(3,0.1,PeaksPosY[i]*15);
347 
348  sprintf(buf,"AmplitudeGaus_%d",i+1);
349  FitFunc[i]->SetParName(4,buf);
350  FitFunc[i]->SetParameter(4,PeaksPosY[i]);
351  FitFunc[i]->SetParLimits(4,PeaksPosY[i]*0.05,PeaksPosY[i]*2.5);
352 
353  sprintf(buf,"XPosGaus_%d",i+1);
354  FitFunc[i]->SetParName(5,buf);
355  FitFunc[i]->SetParameter(5,PeaksPosX[i]);
356  FitFunc[i]->SetParLimits(5,PeaksPosX[i]*0.99,PeaksPosX[i]*1.01);
357 
358  sprintf(buf,"SigmaGaus_%d",i+1);
359  FitFunc[i]->SetParName(6,buf);
360  FitFunc[i]->SetParameter(6,5);
361  FitFunc[i]->SetParLimits(6,0.1,20);
362 
363  sprintf(buf,"Offset_%d",i+1);
364  FitFunc[i]->SetParName(7,buf);
365  FitFunc[i]->SetParameter(7,500);
366  FitFunc[i]->SetParLimits(7,0.1,1000);
367 
368 
369 
370  }
371  std::cout << "Start Fitting Peak " << i << endl;
372  fEnergySpecCanvas->cd();
373  if(i==0)
374  fhEnergySpectrum->Fit(FitFunc[i],"R E");
375  else
376  fhEnergySpectrum->Fit(FitFunc[i],"R E +");
377 
378  //cout << npar << endl;
379 
380  fhFitErrorhistogram[i] = new TH1D("h", "Fitted gaussian with .95 conf.band", 3*FuncWidth/fhEnergySpectrum->GetBinWidth(fhEnergySpectrum->FindBin(FitFunc[i]->GetMaximumX())), (Double_t) PeaksPosX[i]-2*FuncWidth,(Double_t) PeaksPosX[i]+FuncWidth);
381  (TVirtualFitter::GetFitter())->GetConfidenceIntervals(fhFitErrorhistogram[i]);
382  if (i == 0)
383  {
384  TFile *bla = new TFile("bla.root","RECREATE");
385  TCanvas *c123 = new TCanvas("c123","",800,600);
386  fhEnergySpectrum->Draw();
387  fhFitErrorhistogram[i]->SetLineColor(kGreen);
388  fhFitErrorhistogram[i]->Draw("e3 same");
389  c123->Write();
390  fhEnergySpectrum->Write();
391  fhFitErrorhistogram[i]->Write();
392  bla->Close();
393  }
394  //TCanvas *c1233 = new TCanvas("c1233","",800,600);
395  //TVirtualFitter *fitter = TVirtualFitter::GetFitter();
396  //TMatrixD CovMatrix(npar,npar,fitter->GetCovarianceMatrix());
397  //TMatrixD Matrix2(npar,npar,fitter->GetCovarianceMatrix());
398 
399 
400  //CovMatrix.Print();
401  //cout << "Determinant: " << CovMatrix.Determinant() << endl;
402 
403  cout << "Chi²" << FitFunc[i]->GetChisquare() << endl;
404  cout << "NDF" << FitFunc[i]-> GetNDF() << endl;
405  cout << "Chi²_red" << FitFunc[i]->GetChisquare()/FitFunc[i]-> GetNDF() << endl;
406  //PeakFitX.push_back(FitFunc[i]->GetParameter(1));
407  //PeakFitXError.push_back(FitFunc[i]->GetParError(1));
408  if (fFittingMethod !=4)
409  {
410  PeakFitX.push_back(FitFunc[i]->GetParameter(8));
411  PeakFitXError.push_back(FitFunc[i]->GetParError(8));
412 
413  FitFuncWithoutBg[i] = new TF1(*FitFunc[i]);
414  FitFuncWithoutBg[i]->SetParameter(3,0);
415  FitFuncWithoutBg[i]->SetParameter(4,0);
416  }
417  else
418  {
419  PeakFitX.push_back(FitFunc[i]->GetParameter(5));
420  PeakFitXError.push_back(FitFunc[i]->GetParError(5));
421 
422  FitFuncWithoutBg[i] = new TF1(*FitFunc[i]);
423  FitFuncWithoutBg[i]->SetParameter(7,0);
424  }
425 
426 
427  //cout << "test" << endl;
428  //FitFuncWithoutBg[i]->Draw("same");
429  PeakCounts.push_back(FitFuncWithoutBg[i]->Integral(FitFuncWithoutBg[i]->GetXmin(),FitFuncWithoutBg[i]->GetXmax()));
430  //std::cout << "Integral:\t" <<FitFuncWithoutBg[i]->Integral(FitFuncWithoutBg[i]->GetXmin(),FitFuncWithoutBg[i]->GetXmax())<< endl;
431 
432 
433 
434 
435  }
436  // draw single components of fit - new loop is needed to make all of them visible (drawing must be done after all the fiting above, otherwise only components of last peak are drawn (possibly due to "+" option of multiple fits???))
437  if (fFittingMethod != 4)
438  for(Int_t i = 0; i < nPeaksFound;i++)
439  {
440  // basic components
441 
442  sprintf(buf,"FuncGaus_%d",i+1);
443  FuncGaus[i] = new TF1(buf,func,&PndHypGePeakFitFunction::GausOnly,(Double_t) PeaksPosX[i]-FuncWidth,(Double_t) PeaksPosX[i]+FuncWidth,npar,"PndHypGePeakFitFunction","GausOnly");
444  FuncGaus[i]->SetParameters(FitFunc[i]->GetParameters());
445  FuncGaus[i]->SetNpx(100000);
446  FuncGaus[i]->SetLineColor( kGreen );
447  FuncGaus[i]->Draw( "SAME" );
448 
449  sprintf(buf,"FuncSmoothedStep_%d",i+1);
450  FuncSmoothedStep[i] = new TF1(buf,func,&PndHypGePeakFitFunction::SmoothedStepOnly,(Double_t) PeaksPosX[i]-FuncWidth,(Double_t) PeaksPosX[i]+FuncWidth,npar,"PndHypGePeakFitFunction","SmoothedStepOnly");
451  FuncSmoothedStep[i]->SetParameters(FitFunc[i]->GetParameters());
452  FuncSmoothedStep[i]->SetNpx(100000);
453  FuncSmoothedStep[i]->SetLineColor( kMagenta );
454  FuncSmoothedStep[i]->Draw( "SAME" );
455 
456  sprintf(buf,"FuncLinear_%d",i+1);
457  FuncLinear[i] = new TF1(buf,func,&PndHypGePeakFitFunction::LinearOnly,(Double_t) PeaksPosX[i]-FuncWidth,(Double_t) PeaksPosX[i]+FuncWidth,npar,"PndHypGePeakFitFunction","LinearOnly");
458  FuncLinear[i]->SetParameters(FitFunc[i]->GetParameters());
459  FuncLinear[i]->SetNpx(100000);
460  FuncLinear[i]->SetLineColor( kYellow );
461  FuncLinear[i]->Draw( "SAME" );
462 
463 
464  //components depending on the fitting model
465 
466  if (fFittingMethod == 1)
467  {
468  sprintf(buf,"SkewedGausian_%d",i+1);
469  FuncTail[i] = new TF1(buf,func,&PndHypGePeakFitFunction::SkewedOnly,(Double_t) PeaksPosX[i]-FuncWidth,(Double_t) PeaksPosX[i]+FuncWidth,npar,"PndHypGePeakFitFunction","SkewedOnly");
470  FuncTail[i]->SetParameters(FitFunc[i]->GetParameters());
471  FuncTail[i]->SetNpx(100000);
472  FuncTail[i]->SetLineColor( kBlack );
473  FuncTail[i]->Draw( "SAME" );
474  }
475 
476  if (fFittingMethod == 2)
477  {
478  sprintf(buf,"SkewedGausian_%d",i+1);
479  FuncTail[i] = new TF1(buf,func,&PndHypGePeakFitFunction::FreeSkewedOnly,(Double_t) PeaksPosX[i]-FuncWidth,(Double_t) PeaksPosX[i]+FuncWidth,npar,"PndHypGePeakFitFunction","FreeSkewedOnly");
480  FuncTail[i]->SetParameters(FitFunc[i]->GetParameters());
481  FuncTail[i]->SetNpx(100000);
482  FuncTail[i]->SetLineColor( kBlack );
483  FuncTail[i]->Draw( "SAME" );
484  }
485 
486  if (fFittingMethod == 3)
487  {
488  sprintf(buf,"SecondGausian_%d",i+1);
489  FuncTail[i] = new TF1(buf,func,&PndHypGePeakFitFunction::SecondGausOnly,(Double_t) PeaksPosX[i]-FuncWidth,(Double_t) PeaksPosX[i]+FuncWidth,npar,"PndHypGePeakFitFunction","SecondGausOnly");
490  FuncTail[i]->SetParameters(FitFunc[i]->GetParameters());
491  FuncTail[i]->SetNpx(100000);
492  FuncTail[i]->SetLineColor( kBlack );
493  FuncTail[i]->Draw( "SAME" );
494  }
495  }
496 
497 
498  fhSubstractSpectrum = new TH1D("fhSubstractSpectrum","Substracted spectrum; Channel; Counts", fhEnergySpectrum->GetNbinsX(),fhEnergySpectrum->GetXaxis()->GetXmin(),fhEnergySpectrum->GetXaxis()->GetXmax());
499  fSubstractCanvas= new TCanvas("fSubstractCanvas","Substracted spectrum",800,600);
500  fSubstractCanvas->cd();
501  for (Int_t i=0;i < nPeaksFound; i++)
502  {
503  for (Double_t iValue = (Double_t) PeaksPosX[i]-FuncWidth; iValue <= (Double_t) PeaksPosX[i]+FuncWidth; iValue += fhEnergySpectrum->GetBinWidth(100))
504  {
505  fhSubstractSpectrum->Fill(fhEnergySpectrum->GetBinCenter(fhEnergySpectrum->FindBin(iValue)), fhEnergySpectrum->GetBinContent(fhEnergySpectrum->FindBin(iValue))-FitFunc[i]->Eval(fhEnergySpectrum->GetBinCenter(fhEnergySpectrum->FindBin(iValue))));
506  fhSubstractSpectrum->SetBinError(fhEnergySpectrum->FindBin(iValue), sqrt(fhEnergySpectrum->GetBinContent(fhEnergySpectrum->FindBin(iValue))));
507  //cout <<fhEnergySpectrum->GetBinContent(fhEnergySpectrum->FindBin(iValue))-FitFunc[i]->Eval(fhEnergySpectrum->GetBinCenter(fhEnergySpectrum->FindBin(iValue))) <<" " <<FitFunc[i]->Eval(fhEnergySpectrum->GetBinCenter(fhEnergySpectrum->FindBin(iValue))) <<endl;
508  }
509  }
510  fhSubstractSpectrum->Draw("E1");
511  return 0;
512 }
Double_t LinearOnly(Double_t *x, Double_t *par)
Int_t i
Definition: run_full.C:25
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
TF1 * func
cout<< "ifile "<< ifile<< endl;cout<< " momentum sampled over "<< nsteps<< " with step width "<< 1.5/nsteps<< endl;cout<< endl;cout<< "MEAN DEDX PARAMETRIZATION"<< endl;cout<< "mom limits "<< mean_inf<< " "<< mean_sup<< endl;cout<< "mu: ";for(int param=0;param< npardedx;param++) cout<< fdedx-> GetParameter(param)<< "
Double_t SecondGausOnly(Double_t *x, Double_t *par)
Double_t PeakFunc(Double_t *x, Double_t *par)
Double_t NewFunction(Double_t *x, Double_t *par)
Double_t PeakFuncDoubleGausian(Double_t *x, Double_t *par)
Double_t
Double_t SkewedOnly(Double_t *x, Double_t *par)
Double_t FreeSkewedOnly(Double_t *x, Double_t *par)
Double_t SmoothedStepOnly(Double_t *x, Double_t *par)
Double_t GausOnly(Double_t *x, Double_t *par)
Double_t FindUpperSigmaFitLimit(Double_t threshold, Float_t StartingPoint)
Double_t PeakFuncGaussian(Double_t *x, Double_t *par)
Double_t PeakFuncFreeSkewedPositionWithoutFirstGausian(Double_t *x, Double_t *par)
Double_t PndHypGeSpectrumAnalyser::GetCountsCo ( )

Definition at line 1051 of file PndHypGeSpectrumAnalyser.cxx.

1052 {
1053  return 0; //NIY
1054 }
Double_t PndHypGeSpectrumAnalyser::GetEfficiency ( )

Definition at line 1132 of file PndHypGeSpectrumAnalyser.cxx.

References fFEPEfficiency.

1133 {
1134  return fFEPEfficiency;
1135 }
Double_t PndHypGeSpectrumAnalyser::GetEfficiencyError ( )

Definition at line 1137 of file PndHypGeSpectrumAnalyser.cxx.

References fFEPEfficiencyError.

1138 {
1139  return fFEPEfficiencyError;
1140 }
TH1D* PndHypGeSpectrumAnalyser::GetEnergySpectrum ( )
inline

Definition at line 52 of file PndHypGeSpectrumAnalyser.h.

Double_t PndHypGeSpectrumAnalyser::GetFWHM511 ( )

Definition at line 1008 of file PndHypGeSpectrumAnalyser.cxx.

References FWHM_en.

1009 {
1010  return FWHM_en[ 510.998928 ];
1011 }
Double_t PndHypGeSpectrumAnalyser::GetFWHMAl ( )

Definition at line 1034 of file PndHypGeSpectrumAnalyser.cxx.

References FWHM_en.

1035 {
1036  return FWHM_en[ 1778.969 ];
1037 }
Double_t PndHypGeSpectrumAnalyser::GetFWHMCo ( )

Definition at line 1026 of file PndHypGeSpectrumAnalyser.cxx.

References FWHM_en.

1027 {
1028  return FWHM_en[ 1332.51 ];
1029 }
Double_t PndHypGeSpectrumAnalyser::GetFWHMCo1 ( )

Definition at line 1017 of file PndHypGeSpectrumAnalyser.cxx.

References FWHM_en.

1018 {
1019  return FWHM_en[ 1172.23 ];
1020 }
Double_t PndHypGeSpectrumAnalyser::GetFWTM511 ( )

Definition at line 1012 of file PndHypGeSpectrumAnalyser.cxx.

References FWTM_en.

1013 {
1014  return FWTM_en[ 510.998928 ];
1015 }
Double_t PndHypGeSpectrumAnalyser::GetFWTMAl ( )

Definition at line 1038 of file PndHypGeSpectrumAnalyser.cxx.

References FWTM_en.

1039 {
1040  return FWTM_en[ 1778.969 ];
1041 }
Double_t PndHypGeSpectrumAnalyser::GetFWTMCo ( )

Definition at line 1030 of file PndHypGeSpectrumAnalyser.cxx.

References FWTM_en.

1031 {
1032  return FWTM_en[ 1332.51 ];
1033 }
Double_t PndHypGeSpectrumAnalyser::GetFWTMCo1 ( )

Definition at line 1021 of file PndHypGeSpectrumAnalyser.cxx.

References FWTM_en.

1022 {
1023  return FWTM_en[ 1172.23 ];
1024 }
Bool_t PndHypGeSpectrumAnalyser::IsFreeSkewedFitting ( )

Definition at line 975 of file PndHypGeSpectrumAnalyser.cxx.

References fFittingMethod.

976 {
977  if (fFittingMethod == 2)
978  return 1;
979  else
980  return 0;
981 }
Bool_t PndHypGeSpectrumAnalyser::IsGaussianFitting ( )

Definition at line 961 of file PndHypGeSpectrumAnalyser.cxx.

References fFittingMethod.

962 {
963  if (fFittingMethod == 0)
964  return 1;
965  else
966  return 0;
967 }
Bool_t PndHypGeSpectrumAnalyser::IsNewFunctionFitting ( )

Definition at line 1001 of file PndHypGeSpectrumAnalyser.cxx.

References fFittingMethod.

1002 {
1003  if (fFittingMethod == 4)
1004  return 1;
1005  else
1006  return 0;
1007 }
Bool_t PndHypGeSpectrumAnalyser::IsNoDrawingMode ( )

Definition at line 1046 of file PndHypGeSpectrumAnalyser.cxx.

References NoDrawingMode.

1047 {
1048  return NoDrawingMode;
1049 }
Bool_t PndHypGeSpectrumAnalyser::IsSecondGausianFitting ( )

Definition at line 988 of file PndHypGeSpectrumAnalyser.cxx.

References fFittingMethod.

989 {
990  if (fFittingMethod == 3)
991  return 1;
992  else
993  return 0;
994 }
void PndHypGeSpectrumAnalyser::PeakSort ( )
private

Definition at line 729 of file PndHypGeSpectrumAnalyser.cxx.

References i, nPeaksFound, PeaksPosX, and PeaksPosY.

Referenced by FindPeaks().

730 {
731  std::cout << "Sorting Peaks" << endl;
732  Float_t *arrayOrig = new Float_t[nPeaksFound];
733  for(int i = 0;i<nPeaksFound; ++i)
734  arrayOrig[i] = PeaksPosX[i];
735  std::sort(PeaksPosX, PeaksPosX + nPeaksFound); //sorting Peak Positions (lower to greater x)
736 
737  Float_t buffy[nPeaksFound];
738  for (Int_t i = 0;i < nPeaksFound; ++i) //placing Amplitude to the coresponding Peak Position
739  {
740  for (Int_t j = 0; j < nPeaksFound; ++j)
741  {
742  if (arrayOrig[i]==PeaksPosX[j])
743  {
744  buffy[j] = PeaksPosY[i];
745  }
746  }
747  }
748  for(int i = 0;i<nPeaksFound; ++i)
749  {
750  PeaksPosY[i] = buffy[i];
751  }
752  for (int i = 0; i < nPeaksFound; ++i)
753  std::cout <<"("<< PeaksPosX[i]<<"," << PeaksPosY[i] << ") ";
754  std::cout << endl;
755 }
Int_t i
Definition: run_full.C:25
void PndHypGeSpectrumAnalyser::SetEnergySpectrum ( TH1D *  hEnergySpec_ext)

Definition at line 87 of file PndHypGeSpectrumAnalyser.cxx.

References fhEnergySpectrum.

88 {
89  fhEnergySpectrum = hEnergySpec_ext;
90 }
void PndHypGeSpectrumAnalyser::SetFreeSkewedFitting ( )

Definition at line 970 of file PndHypGeSpectrumAnalyser.cxx.

References fFittingMethod.

971 {
972  fFittingMethod =2;
973 }
void PndHypGeSpectrumAnalyser::SetGaussianFitting ( )

Definition at line 956 of file PndHypGeSpectrumAnalyser.cxx.

References fFittingMethod.

957 {
958  fFittingMethod =0;
959 }
void PndHypGeSpectrumAnalyser::SetInputHistogramResolution ( Double_t  InputHistogramResolution_ext)

Definition at line 1128 of file PndHypGeSpectrumAnalyser.cxx.

References fInputHistogramResolution.

1129 {
1130  fInputHistogramResolution = InputHistogramResolution_ext;
1131 }
void PndHypGeSpectrumAnalyser::SetNewFunctionFitting ( )

Definition at line 996 of file PndHypGeSpectrumAnalyser.cxx.

References fFittingMethod.

997 {
998  fFittingMethod =4;
999 }
void PndHypGeSpectrumAnalyser::SetNoDrawingMode ( Bool_t  NoDrawingMode_ext = true)

Definition at line 1042 of file PndHypGeSpectrumAnalyser.cxx.

References NoDrawingMode.

1043 {
1044  NoDrawingMode = NoDrawingMode_ext;
1045 }
void PndHypGeSpectrumAnalyser::SetNumberOfSimEvents ( Int_t  NumberOfSimEvents_ext,
Bool_t  OnlyTwoPiSimulated = 1 
)

Definition at line 1120 of file PndHypGeSpectrumAnalyser.cxx.

References fNumberOfSimEvents, and fSolidAngleCorrectionFactor.

1121 {
1122  fNumberOfSimEvents = NumberOfSimEvents_ext;
1123  if (OnlyTwoPiSimulated)
1125  else
1127 }
void PndHypGeSpectrumAnalyser::SetOutputPath ( TString  OutputPath_ext)

Definition at line 950 of file PndHypGeSpectrumAnalyser.cxx.

References OutputPath.

951 {
952  OutputPath = OutputPath_ext;
953 }
void PndHypGeSpectrumAnalyser::SetRootFileOutputName ( TString  RootFilename_ext)

Definition at line 945 of file PndHypGeSpectrumAnalyser.cxx.

References RootFilename.

946 {
947  RootFilename = RootFilename_ext;
948 }
void PndHypGeSpectrumAnalyser::SetSearchRange ( Double_t  RangeMin,
Double_t  RangeMax 
)

Definition at line 936 of file PndHypGeSpectrumAnalyser.cxx.

References fhEnergySpectrum.

937 {
938  fhEnergySpectrum->GetXaxis()->SetRangeUser(RangeMin,RangeMax);
939 }
void PndHypGeSpectrumAnalyser::SetSecondGausianFitting ( )

Definition at line 983 of file PndHypGeSpectrumAnalyser.cxx.

References fFittingMethod.

984 {
985  fFittingMethod =3;
986 }
void PndHypGeSpectrumAnalyser::SetTxtFileOutputName ( TString  TxtFilename_ext)

Definition at line 941 of file PndHypGeSpectrumAnalyser.cxx.

References TxtFilename.

942 {
943  TxtFilename = TxtFilename_ext;
944 }

Member Data Documentation

Double_t PndHypGeSpectrumAnalyser::Amplitude[50]
private

Definition at line 154 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWHM(), and CalculateFWTM().

Bool_t PndHypGeSpectrumAnalyser::BreakProgram
private
TF1* PndHypGeSpectrumAnalyser::CalFunc
private
TF1* PndHypGeSpectrumAnalyser::CalibratedFunction[50]
private

Definition at line 137 of file PndHypGeSpectrumAnalyser.h.

Referenced by DrawCalibratedSpectrum().

vector<double> PndHypGeSpectrumAnalyser::Energies
private
vector<double> PndHypGeSpectrumAnalyser::EnergyErrors
private

Definition at line 183 of file PndHypGeSpectrumAnalyser.h.

Referenced by CompareNuclei(), and DoEnergyCalibration().

TCanvas* PndHypGeSpectrumAnalyser::fCalCanvas
private

Definition at line 151 of file PndHypGeSpectrumAnalyser.h.

Referenced by DoEnergyCalibration(), and ExportToRootFile().

TCanvas* PndHypGeSpectrumAnalyser::fCalSpecCanvas
private

Definition at line 123 of file PndHypGeSpectrumAnalyser.h.

Referenced by DrawCalibratedSpectrum(), and ExportToRootFile().

TCanvas* PndHypGeSpectrumAnalyser::fEnergySpecCanvas
private

Definition at line 120 of file PndHypGeSpectrumAnalyser.h.

Referenced by FindPeaks(), and FitPeaks().

Double_t PndHypGeSpectrumAnalyser::fFEPEfficiency
private

Definition at line 199 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateEfficiency(), and GetEfficiency().

Double_t PndHypGeSpectrumAnalyser::fFEPEfficiencyError
private

Definition at line 200 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateEfficiency(), and GetEfficiencyError().

Int_t PndHypGeSpectrumAnalyser::fFittingMethod
private
TGraphErrors* PndHypGeSpectrumAnalyser::fgCalibration
private

Definition at line 150 of file PndHypGeSpectrumAnalyser.h.

Referenced by DoEnergyCalibration().

TH1D* PndHypGeSpectrumAnalyser::fhCalibratedSpectrum
private

Definition at line 124 of file PndHypGeSpectrumAnalyser.h.

Referenced by DrawCalibratedSpectrum().

TH1D* PndHypGeSpectrumAnalyser::fhEnergySpectrum
private
TH1D* PndHypGeSpectrumAnalyser::fhFitErrorhistogram[50]
private

Definition at line 175 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWHM(), and FitPeaks().

TH1D* PndHypGeSpectrumAnalyser::fhSubstractSpectrum
private

Definition at line 127 of file PndHypGeSpectrumAnalyser.h.

Referenced by FitPeaks().

Double_t PndHypGeSpectrumAnalyser::fInputHistogramResolution
private

Definition at line 201 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateEfficiency(), and SetInputHistogramResolution().

TF1* PndHypGeSpectrumAnalyser::FitFunc[50]
private
TF1* PndHypGeSpectrumAnalyser::FitFuncWithoutBg[50]
private

Definition at line 136 of file PndHypGeSpectrumAnalyser.h.

Referenced by FitPeaks().

Int_t PndHypGeSpectrumAnalyser::fNumberOfSimEvents
private

Definition at line 202 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateEfficiency(), and SetNumberOfSimEvents().

Int_t PndHypGeSpectrumAnalyser::fSolidAngleCorrectionFactor
private

Definition at line 203 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateEfficiency(), and SetNumberOfSimEvents().

TSpectrum* PndHypGeSpectrumAnalyser::fSpectrum
private
TCanvas* PndHypGeSpectrumAnalyser::fSubstractCanvas
private

Definition at line 126 of file PndHypGeSpectrumAnalyser.h.

Referenced by FitPeaks().

TF1* PndHypGeSpectrumAnalyser::FuncGaus[50]
private

Definition at line 138 of file PndHypGeSpectrumAnalyser.h.

Referenced by FitPeaks().

TF1* PndHypGeSpectrumAnalyser::FuncLinear[50]
private

Definition at line 140 of file PndHypGeSpectrumAnalyser.h.

Referenced by FitPeaks().

TF1* PndHypGeSpectrumAnalyser::FuncSmoothedStep[50]
private

Definition at line 139 of file PndHypGeSpectrumAnalyser.h.

Referenced by FitPeaks().

TF1* PndHypGeSpectrumAnalyser::FuncTail[50]
private

Definition at line 141 of file PndHypGeSpectrumAnalyser.h.

Referenced by FitPeaks().

Int_t PndHypGeSpectrumAnalyser::FuncWidth
private

Definition at line 145 of file PndHypGeSpectrumAnalyser.h.

Referenced by FitPeaks(), and PndHypGeSpectrumAnalyser().

map<double,double> PndHypGeSpectrumAnalyser::FWHM_ch
private

Definition at line 177 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWHM().

map<double,double> PndHypGeSpectrumAnalyser::FWHM_en
private
Double_t PndHypGeSpectrumAnalyser::FWHMHeight[50]
private

Definition at line 155 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWHM(), and DrawCalibratedSpectrum().

Double_t PndHypGeSpectrumAnalyser::FWHMhigh[50]
private

Definition at line 161 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWHM().

Double_t PndHypGeSpectrumAnalyser::FWHMhighEnergy[50]
private

Definition at line 167 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWHM(), and DrawCalibratedSpectrum().

Double_t PndHypGeSpectrumAnalyser::FWHMhighLeftBorder[50]
private

Definition at line 162 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWHM().

Double_t PndHypGeSpectrumAnalyser::FWHMhighLeftBorderEnergy[50]
private

Definition at line 164 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWHM().

Double_t PndHypGeSpectrumAnalyser::FWHMhighRightBorder[50]
private

Definition at line 163 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWHM().

Double_t PndHypGeSpectrumAnalyser::FWHMhighRightBorderEnergy[50]
private

Definition at line 165 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWHM().

Double_t PndHypGeSpectrumAnalyser::FWHMlow[50]
private

Definition at line 156 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWHM().

Double_t PndHypGeSpectrumAnalyser::FWHMlowEnergy[50]
private

Definition at line 166 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWHM(), and DrawCalibratedSpectrum().

Double_t PndHypGeSpectrumAnalyser::FWHMlowLeftBorder[50]
private

Definition at line 157 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWHM().

Double_t PndHypGeSpectrumAnalyser::FWHMlowLeftBorderEnergy[50]
private

Definition at line 159 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWHM().

Double_t PndHypGeSpectrumAnalyser::FWHMlowRightBorder[50]
private

Definition at line 158 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWHM().

Double_t PndHypGeSpectrumAnalyser::FWHMlowRightBorderEnergy[50]
private

Definition at line 160 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWHM().

map<double,double> PndHypGeSpectrumAnalyser::FWTM_ch
private

Definition at line 179 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWTM().

map<double,double> PndHypGeSpectrumAnalyser::FWTM_en
private
Double_t PndHypGeSpectrumAnalyser::FWTMHeight[50]
private

Definition at line 169 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWTM(), and DrawCalibratedSpectrum().

Double_t PndHypGeSpectrumAnalyser::FWTMhigh[50]
private

Definition at line 171 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWTM().

Double_t PndHypGeSpectrumAnalyser::FWTMhighEnergy[50]
private

Definition at line 173 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWTM(), and DrawCalibratedSpectrum().

Double_t PndHypGeSpectrumAnalyser::FWTMlow[50]
private

Definition at line 170 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWTM().

Double_t PndHypGeSpectrumAnalyser::FWTMlowEnergy[50]
private

Definition at line 172 of file PndHypGeSpectrumAnalyser.h.

Referenced by CalculateFWTM(), and DrawCalibratedSpectrum().

Bool_t PndHypGeSpectrumAnalyser::NoDrawingMode
private
Int_t PndHypGeSpectrumAnalyser::nPeaks
private
Int_t PndHypGeSpectrumAnalyser::nPeaksFound
private
TString PndHypGeSpectrumAnalyser::OutputPath
private

Definition at line 185 of file PndHypGeSpectrumAnalyser.h.

Referenced by ExportToRootFile(), ExportToTextFile(), and SetOutputPath().

vector<double> PndHypGeSpectrumAnalyser::PeakCounts
private

Definition at line 148 of file PndHypGeSpectrumAnalyser.h.

Referenced by ExportToRootFile(), ExportToTextFile(), and FitPeaks().

vector<double> PndHypGeSpectrumAnalyser::PeakFitX
private

Definition at line 146 of file PndHypGeSpectrumAnalyser.h.

Referenced by DoEnergyCalibration(), and FitPeaks().

vector<double> PndHypGeSpectrumAnalyser::PeakFitXError
private

Definition at line 147 of file PndHypGeSpectrumAnalyser.h.

Referenced by DoEnergyCalibration(), and FitPeaks().

Float_t* PndHypGeSpectrumAnalyser::PeaksPosX
private

Definition at line 129 of file PndHypGeSpectrumAnalyser.h.

Referenced by FindPeaks(), FitPeaks(), and PeakSort().

Float_t* PndHypGeSpectrumAnalyser::PeaksPosY
private

Definition at line 130 of file PndHypGeSpectrumAnalyser.h.

Referenced by FindPeaks(), FitPeaks(), and PeakSort().

TFile* PndHypGeSpectrumAnalyser::RootFile
private

Definition at line 190 of file PndHypGeSpectrumAnalyser.h.

Referenced by ExportToRootFile().

TString PndHypGeSpectrumAnalyser::RootFilename
private

Definition at line 191 of file PndHypGeSpectrumAnalyser.h.

Referenced by ExportToRootFile(), and SetRootFileOutputName().

ofstream PndHypGeSpectrumAnalyser::TxtFile
private

Definition at line 187 of file PndHypGeSpectrumAnalyser.h.

Referenced by ExportToTextFile().

TString PndHypGeSpectrumAnalyser::TxtFilename
private

Definition at line 188 of file PndHypGeSpectrumAnalyser.h.

Referenced by ExportToTextFile(), and SetTxtFileOutputName().


The documentation for this class was generated from the following files: