Skip to content
Snippets Groups Projects
Commit d170d29e authored by Christopher Rob Jones's avatar Christopher Rob Jones
Browse files

RichCKResolutionFitter: Minor cleanup

parent 2154ab75
No related branches found
No related tags found
No related merge requests found
......@@ -11,13 +11,6 @@
#pragma once
// STL
#include <array>
#include <cstdint>
#include <string>
#include <utility>
#include <vector>
// ROOT includes
#include <TF1.h>
#include <TH1.h>
......@@ -25,6 +18,13 @@
// LHCb Kernel
#include "Kernel/RichRadiatorType.h"
// STL
#include <array>
#include <cstdint>
#include <string>
#include <utility>
#include <vector>
namespace Rich::Rec {
/** @class CKResolutionFitter RichRecUtils/RichCKResolutionFitter.h
*
......@@ -310,31 +310,31 @@ namespace Rich::Rec {
public:
/// Default Constructor
CKResolutionFitter();
CKResolutionFitter() = default;
/// Constructor with a given set of parameters
CKResolutionFitter( FitParams prms ) : m_params( std::move( prms ) ) {}
public:
/// Perform a fit to the given TH1 histogram
FitResult fit( TH1& hist, const Rich::RadiatorType rad ) const;
[[nodiscard]] FitResult fit( TH1& hist, const Rich::RadiatorType rad ) const;
/// Write access to the fit parameter object
FitParams& params() noexcept { return m_params; }
[[nodiscard]] FitParams& params() noexcept { return m_params; }
/// Read access to the fit parameter object
[[nodiscard]] const FitParams& params() const noexcept { return m_params; }
private:
// Run a given fit type
FitResult fitImp( TH1& hist, const Rich::RadiatorType rad, const std::string& fitType ) const;
[[nodiscard]] FitResult fitImp( TH1& hist, const Rich::RadiatorType rad, const std::string& fitType ) const;
/// Check histogram fit result
[[nodiscard]] bool fitIsOK( const TF1& fFitF, const Rich::RadiatorType rad ) const;
/// check fit status
template <typename RESULT>
inline bool fitIsValid( const RESULT& fitR ) const {
[[nodiscard]] inline bool fitIsValid( const RESULT& fitR ) const {
return ( fitR.Get() ? fitR->IsValid() : false );
}
......
......@@ -22,10 +22,6 @@ using namespace Rich::Rec;
//=============================================================================
CKResolutionFitter::CKResolutionFitter() = default;
//=============================================================================
CKResolutionFitter::FitResult CKResolutionFitter::fit( TH1& hist, const Rich::RadiatorType rad ) const {
// returned object
FitResult fitR;
......@@ -143,9 +139,9 @@ CKResolutionFitter::FitResult CKResolutionFitter::fitImp( TH1&
// std::cout << rad << " Pol " << nPol << " Fit" << std::endl;
const auto fFitFName = "Rad" + std::to_string( rad ) + "fFitF" + std::to_string( nPol );
const auto fFitFType =
( isSkewed ? params().SkewedNormalPolFitFunc( nPol, 0 ) : params().AsymNormalPolFitFunc( nPol, 0 ) );
TF1 fFitF( fFitFName.c_str(), fFitFType.c_str(), fitMin, fitMax, nSigParams + nPol + 1 );
const auto fFitFType = ( isSkewed ? params().SkewedNormalPolFitFunc( nPol, 0 ) //
: params().AsymNormalPolFitFunc( nPol, 0 ) );
TF1 fFitF( fFitFName.c_str(), fFitFType.c_str(), fitMin, fitMax, nSigParams + nPol + 1 );
// set parameters from last fit
// If first iteration, just 3 Gaussian params otherwise number from last full fit
......@@ -211,7 +207,7 @@ CKResolutionFitter::FitResult CKResolutionFitter::fitImp( TH1&
}
runFit();
}
}
} // is asym or skewed fit
// Save end fit result ?
if ( fitOK ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment