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