///////////////////////////////////////////////////////////////////////
//
// All seeded methods derive from this
//
// Author: Phil G Jones
// Author: Matt Mottram < m.mottram@qmul.ac.uk> -- contact person
//
// REVISION HISTORY:
// - 26/04/2011 : P G Jones - New file
// - 2014-08-01 : M Mottram - Moved SetSeed calls from daughter
// classes to SeededMethod.
// - 2014-09-23 : M Mottram - Added UpdateSeed method.
// - 2014-11-22 : M Mottram - Fixed bug where seed was not set.
// - 2015-03-23 : M Mottram - Account for FitResults with no vertex
//
// Adds seed functionality.
//
///////////////////////////////////////////////////////////////////////
#ifndef __RAT_Method_SeededMethod_
#define __RAT_Method_SeededMethod_
#include
namespace RAT
{
namespace DS
{
class FitResult;
}
namespace Methods
{
//Note virtual inheritance.
class SeededMethod : public virtual Method
{
public:
// Constructor
SeededMethod() {}
// Empty virtual destructor
virtual ~SeededMethod() {}
// Set the seed to the default, must be implemented by daughter classes
//
// These methods MUST ensure that any parameters that are set have fixed=true and valid=false
virtual void DefaultSeed() = 0;
// Set the seed to the given value.
//
// May be called multiple times, will overwrite any parameters
// that are NOT fixed parameters in the seed, or any parameters
// that ARE fixed parameters in the current fSeedResult
virtual void SetSeed( const DS::FitResult& seed );
// Get the seed, required if we want to apply a modification
//
const DS::FitResult& GetSeed() const { return fSeedResult; };
// Copy the seedResult to the fitResult
//
// Forces all parameters to be set as fixed in the FitVertex
// These may then be overridden by the daughter methods
void CopySeedToResult( );
// Set the seed to the given value and copy it to the fitResult
//
// Useful for e.g. MetaOptimisers, which need to update
// the seed being used by a given method.
inline void UpdateSeed( const DS::FitResult& seed );
protected:
DS::FitResult fSeedResult; // FitResult of the seed
};
inline void
SeededMethod::UpdateSeed( const DS::FitResult& seed )
{
SetSeed( seed );
CopySeedToResult();
}
} //::Method
} //::RAT
#endif