#ifndef ROOT_TMVA_Event
#define ROOT_TMVA_Event
#include <iosfwd>
#include <vector>
#ifndef ROOT_Rtypes
#include "Rtypes.h"
#endif
#ifndef ROOT_TMVA_Types
#include "TMVA/Types.h"
#endif
class TCut;
namespace TMVA {
class Event;
std::ostream& operator<<( std::ostream& os, const Event& event );
class Event {
friend std::ostream& operator<<( std::ostream& os, const Event& event );
public:
Event();
Event( const Event& );
explicit Event( const std::vector<Float_t>& values,
const std::vector<Float_t>& targetValues,
const std::vector<Float_t>& spectatorValues,
UInt_t theClass = 0, Double_t weight = 1.0, Double_t boostweight = 1.0 );
explicit Event( const std::vector<Float_t>& values,
const std::vector<Float_t>& targetValues,
UInt_t theClass = 0, Double_t weight = 1.0, Double_t boostweight = 1.0 );
explicit Event( const std::vector<Float_t>&,
UInt_t theClass, Double_t weight = 1.0, Double_t boostweight = 1.0 );
explicit Event( const std::vector<Float_t*>*&, UInt_t nvar );
~Event();
Bool_t IsDynamic() const {return fDynamic; }
Double_t GetWeight() const;
Double_t GetOriginalWeight() const { return fWeight; }
Double_t GetBoostWeight() const { return TMath::Max(Double_t(0.0001),fBoostWeight); }
UInt_t GetClass() const { return fClass; }
UInt_t GetNVariables() const;
UInt_t GetNTargets() const;
UInt_t GetNSpectators() const;
Float_t GetValue( UInt_t ivar) const;
std::vector<Float_t>& GetValues()
{
return const_cast<std::vector<Float_t>&>( static_cast<const Event&>(*this).GetValues() );
}
const std::vector<Float_t>& GetValues() const;
Float_t GetTarget( UInt_t itgt ) const { return fTargets.at(itgt); }
std::vector<Float_t>& GetTargets() { return fTargets; }
const std::vector<Float_t>& GetTargets() const { return fTargets; }
Float_t GetSpectator( UInt_t ivar) const;
std::vector<Float_t>& GetSpectators() { return fSpectators; }
const std::vector<Float_t>& GetSpectators() const { return fSpectators; }
void SetWeight ( Double_t w ) { fWeight=w; }
void SetBoostWeight ( Double_t w ) const { fDoNotBoost ? fDoNotBoost = kFALSE : fBoostWeight=w; }
void ScaleBoostWeight ( Double_t s ) const { fDoNotBoost ? fDoNotBoost = kFALSE : fBoostWeight *= s; }
void SetClass ( UInt_t t ) { fClass=t; }
void SetVal ( UInt_t ivar, Float_t val );
void SetTarget ( UInt_t itgt, Float_t value );
void SetSpectator ( UInt_t ivar, Float_t value );
void SetVariableArrangement( std::vector<UInt_t>* const m ) const;
void SetDoNotBoost () const { fDoNotBoost = kTRUE; }
static void ClearDynamicVariables() {}
void CopyVarValues( const Event& other );
void Print ( std::ostream & o ) const;
static void SetIsTraining(Bool_t);
static void SetIgnoreNegWeightsInTraining(Bool_t);
private:
static Bool_t fgIsTraining;
static Bool_t fgIgnoreNegWeightsInTraining;
mutable std::vector<Float_t> fValues;
mutable std::vector<Float_t> fValuesRearranged;
mutable std::vector<Float_t*>* fValuesDynamic;
std::vector<Float_t> fTargets;
mutable std::vector<Float_t> fSpectators;
mutable std::vector<UInt_t>* fVariableArrangement;
UInt_t fClass;
Double_t fWeight;
mutable Double_t fBoostWeight;
Bool_t fDynamic;
mutable Bool_t fDoNotBoost;
};
}
#endif