8 #include "KVAlphaCalibration.h" 
   74    if (NumberOfPeak_ <= 0) {
 
   75       std::cerr << 
"ERROR in KVAlphaCalibration Constructor : The number of peak you want to fit has to be positive" << std::endl;
 
   93    if (Intensity_ <= 0) {
 
   94       std::cerr << 
"ERROR in KVAlphaCalibration::SetPeak : Normalization factor can not be equal nor inferior to 0" << std::endl;
 
  134    if (SigmaOfTSpectrum_ <= 0) {
 
  135       std::cerr << 
"ERROR in KVAlphaCalibration::SetParameters : SigmaOfTSpectrum can not be equal nor inferior to 0" << std::endl;
 
  141    if (SigmaOfGaussian_ <= 0) {
 
  142       std::cerr << 
"ERROR in KVAlphaCalibration::SetParameters : SigmaOfGaussian can not be equal nor inferior to 0" << std::endl;
 
  148    if (ThresholdOfTSpectrum_ <= 0) {
 
  149       std::cerr << 
"ERROR in KVAlphaCalibration::SetParameters : ThresholdOfTSpectrumOfTSpectrum can not be equal nor inferior to 0" << std::endl;
 
  174    if (j != 0 && j != 1) {
 
  175       std::cerr << 
"ERROR in KVAlphaCalibration::GetLinerFitParameter : You asked for a wrong parameter value, it needs to be 1 or 0" 
  177                 << 
"-> Ignoring command" << std::endl;
 
  204       std::cerr << 
"ERROR in KVAlphaCalibration::GetGaussianFitParameter : You asked for a wrong parameter value, it needs to be between 0 or " 
  207                 << 
"-> Ignoring command" << std::endl;
 
  234       std::cerr << 
"ERROR in KVAlphaCalibration::GetGaussianFitParameter : You asked for a wrong parameter value, it needs to be between 0 or " 
  237                 << 
"-> Ignoring command" << std::endl;
 
  281    if (debug_) std::cerr << 
"DEBUG IN FitInit : Searching for peaks in histogram" << std::endl;
 
  284 #if ROOT_VERSION_CODE > ROOT_VERSION(5,99,01) 
  291    for (
unsigned int i = 0; i < npeaks; i++) {
 
  299    if (debug_) std::cerr << 
"DEBUG IN FitInit : Number of peaks found is " << 
spec->
GetNPeaks() << std::endl;
 
  307          if (debug_) std::cerr << 
"DEBUG IN FitInit : Peak position number " << i << 
" = " << 
InitializationPeak[i] << std::endl;
 
  311       if (debug_) std::cerr << 
"DEBUG IN FitInit : Initializing Parameters" << std::endl;
 
  316       if (debug_) std::cerr << 
"DEBUG IN FitInit : Fitting" << std::endl;
 
  319       if (debug_) std::cerr << 
"DEBUG IN FitInit : Fitting done" << std::endl;
 
  321       if (debug_)  std::cerr << 
"DEBUG IN FitInit : Writing fit output in InitializationFitResults array" << std::endl;
 
  327    if (debug_)  std::cerr << 
"DEBUG IN FitInit : Ending FitInit" << std::endl;
 
  345    std::vector<double> GaussianFitResultsTemp;
 
  346    std::vector<double> GaussianFitResultsErrorTemp;
 
  348    if (debug_) std::cerr << 
"Entering FitSpectrum method" << std::endl;
 
  349    if (debug_) std::cerr << 
"Setting Parameters" << std::endl;
 
  368    if (debug_) std::cerr << 
"Setting Normalization factors" << std::endl;
 
  376       std::cerr << 
"Fitting" << std::endl;
 
  378       std::cerr << 
"FitEnded" << std::endl;
 
  385    GaussianFitResultsTemp.clear();
 
  386    GaussianFitResultsErrorTemp.clear();
 
  410    if (debug_) std::cerr << 
"FitSpectrum ended" << std::endl;
 
  428    double factor_ = par[0];
 
  467          std::cout << 
" Normalization factor " << i << 
" : " << 
GaussianFitResults[i] << std::endl;
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void xpos
 
Set up and run the calibration of siliciums.
 
void AddPeak(double Energy_, double Intensity_)
 
void SetHistRange(double xmin, double xmax)
 
double FunctionToFit(double *x, double *par)
 
double GetGaussianFitParError(int)
 
void FitSpectrum(bool debug_=false)
 
double InitializationFitResults[2]
Array that contain the results of the initialization fit.
 
~KVAlphaCalibration()
Default destructor.
 
std::vector< double > GaussianFitResults
Array that contains results of the final fit.
 
double SigmaOfTSpectrum
Width of the peaks that TSpectrum will search, chosen by user.
 
TF1 * GaussianFit
function that will fit the peaks
 
std::vector< double > IntensityOfPeak
array of peaks amlitude. Set by user
 
double GetGaussianFitParameter(int)
 
std::vector< double > InitializationPeak
 
TH1 * Histo
histogram that contains the data to fit. Set by user
 
void DrawResult(bool WhatToDraw=true)
 
double GetInitializationFitParameter(int)
 
TF1 * InitializationFit
function that will do the initial fit
 
std::vector< double > MeanOfPeak
array peaks energy. Set by user
 
double ThresholdOfTSpectrum
Lowest peak that the TSpectrum has to search for. It is the ratio of the highest peak that the TSpect...
 
void FitAll(bool debug_=false)
This function calls the FitInit and FitSpectrum function.
 
TSpectrum * spec
the method that will search for peaks
 
std::vector< double > GaussianFitResultsError
Array that contains the error of the results of the final fit.
 
void SetParameters(double SigmaOfTSpectrum_=1., double SigmaOfGaussian_=1., double ThresholdOfTSpectrum_=0.5, double IsOriginAtZero_=false)
 
KVAlphaCalibration(int NumberOfPeak_)
 
int NumberOfPeak
Number of Peak present in the histogram. Chose by user.
 
double SigmaOfGaussian
Width of the peak that the model will fit chosen by user. It is possible that it has to be different ...
 
TGraph * factorGraph
Graph where the initial fit is done.
 
void SetHisto(TH1 *h)
Set the histogram that contains the data.
 
TGraph * FitInit(bool debug_=false)
 
virtual void SetMarkerStyle(Style_t mstyle=1)
 
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
 
virtual Double_t GetParameter(const TString &name) const
 
virtual Double_t GetParError(Int_t ipar) const
 
virtual void SetNpx(Int_t npx=100)
 
void Draw(Option_t *option="") override
 
virtual void SetParameter(const TString &name, Double_t value)
 
virtual void FixParameter(Int_t ipar, Double_t value)
 
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
 
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Axis_t xmin=0, Axis_t xmax=0)
 
void Draw(Option_t *chopt="") override
 
virtual Double_t GetBinCenter(Int_t bin) const
 
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
 
void Draw(Option_t *option="") override
 
virtual Int_t GetMaximumBin() const
 
virtual Int_t GetMinimumBin() const
 
virtual Int_t Search(const TH1 *hist, Double_t sigma=2, Option_t *option="", Double_t threshold=0.05)
 
Double_t * GetPositionX() const
 
RooArgSet S(Args_t &&... args)
 
double min(double x, double y)
 
double max(double x, double y)
 
Double_t Power(Double_t x, Double_t y)
 
Double_t Sqrt(Double_t x)