31 #ifndef ROOT_TMVA_Event
32 #define ROOT_TMVA_Event
49 std::ostream& operator<<( std::ostream& os,
const Event& event );
51 class Event:
public TObject {
53 friend std::ostream& operator<<( std::ostream& os,
const Event& event );
59 Event(
const Event& );
60 explicit Event(
const std::vector<Float_t>& values,
61 const std::vector<Float_t>& targetValues,
62 const std::vector<Float_t>& spectatorValues,
63 UInt_t theClass = 0, Double_t weight = 1.0, Double_t boostweight = 1.0 );
64 explicit Event(
const std::vector<Float_t>& values,
65 const std::vector<Float_t>& targetValues,
66 UInt_t theClass = 0, Double_t weight = 1.0, Double_t boostweight = 1.0 );
67 explicit Event(
const std::vector<Float_t>&,
68 UInt_t theClass, Double_t weight = 1.0, Double_t boostweight = 1.0 );
69 explicit Event(
const std::vector<Float_t*>*&, UInt_t nvar );
77 Event& operator=(
const Event& ) =
default;
80 Bool_t IsDynamic()
const {
return fDynamic; }
83 Double_t GetWeight()
const;
84 Double_t GetOriginalWeight()
const {
return fWeight; }
85 Double_t GetBoostWeight()
const {
return TMath::Max(Double_t(0.0001),fBoostWeight); }
86 UInt_t GetClass()
const {
return fClass; }
88 UInt_t GetNVariables()
const;
89 UInt_t GetNTargets()
const;
90 UInt_t GetNSpectators()
const;
92 Float_t GetValue( UInt_t ivar)
const;
93 Float_t GetValueFast(UInt_t ivar)
const {
return fDynamic ? *(*fValuesDynamic)[ivar] : fValues[ivar]; }
94 std::vector<Float_t>& GetValues()
98 return const_cast<std::vector<Float_t>&
>(
static_cast<const Event&
>(*this).GetValues() );
100 const std::vector<Float_t>& GetValues()
const;
102 Float_t GetTarget( UInt_t itgt )
const {
return fTargets.at(itgt); }
103 std::vector<Float_t>& GetTargets() {
return fTargets; }
104 const std::vector<Float_t>& GetTargets()
const {
return fTargets; }
106 Float_t GetSpectator( UInt_t ivar)
const;
107 std::vector<Float_t>& GetSpectators() {
return fSpectators; }
108 const std::vector<Float_t>& GetSpectators()
const {
return fSpectators; }
110 void SetWeight ( Double_t w ) { fWeight=w; }
111 void SetBoostWeight ( Double_t w )
const { fDoNotBoost ? fDoNotBoost = kFALSE : fBoostWeight=w; }
112 void ScaleBoostWeight ( Double_t s )
const { fDoNotBoost ? fDoNotBoost = kFALSE : fBoostWeight *= s; }
113 void SetClass ( UInt_t t ) { fClass=t; }
114 void SetVal ( UInt_t ivar, Float_t val );
115 void SetTarget ( UInt_t itgt, Float_t value );
116 void SetSpectator ( UInt_t ivar, Float_t value );
117 void SetVariableArrangement( std::vector<UInt_t>*
const m )
const;
119 void SetDoNotBoost ()
const { fDoNotBoost = kTRUE; }
120 static void ClearDynamicVariables() {}
122 void CopyVarValues(
const Event& other );
123 using TObject::Print;
124 void Print ( std::ostream & o )
const;
126 static void SetIsTraining(Bool_t);
127 static void SetIgnoreNegWeightsInTraining(Bool_t);
131 static Bool_t fgIsTraining;
132 static Bool_t fgIgnoreNegWeightsInTraining;
135 mutable std::vector<Float_t> fValues;
137 mutable std::vector<Float_t> fValuesRearranged;
138 mutable std::vector<Float_t*> *fValuesDynamic;
139 std::vector<Float_t> fTargets;
140 mutable std::vector<Float_t> fSpectators;
141 mutable std::vector<UInt_t> fVariableArrangement;
145 mutable Double_t fBoostWeight;
147 mutable Bool_t fDoNotBoost;