53 fVariableArrangement(0),
66 const std::vector<Float_t>& tg,
74 fVariableArrangement(0),
77 fBoostWeight(boostweight),
87 const std::vector<Float_t>& tg,
88 const std::vector<Float_t>& vi,
96 fVariableArrangement(0),
99 fBoostWeight(boostweight),
116 fVariableArrangement(0),
119 fBoostWeight(boostweight),
132 fSpectators(evdyn->
size()-nvar),
133 fVariableArrangement(0),
148 fValues(event.fValues),
149 fValuesDynamic(event.fValuesDynamic),
150 fTargets(event.fTargets),
151 fSpectators(event.fSpectators),
152 fVariableArrangement(event.fVariableArrangement),
154 fWeight(event.fWeight),
155 fBoostWeight(event.fBoostWeight),
156 fDynamic(event.fDynamic),
161 UInt_t nvar =
event.GetNVariables();
163 std::vector<Float_t*>::iterator itDyn=
event.fValuesDynamic->begin(), itDynEnd=
event.fValuesDynamic->end();
164 for (; itDyn!=itDynEnd && idx<nvar; ++itDyn){
170 for (; itDyn!=itDynEnd; ++itDyn){
195 if(!
m)fVariableArrangement.clear();
196 else fVariableArrangement = *
m;
213 for (; itDyn!=itDynEnd && idx<nvar; ++itDyn){
215 fValues.push_back(
value );
219 for (; itDyn!=itDynEnd; ++itDyn){
221 fSpectators.push_back(
value );
226 fValuesDynamic = NULL;
239 if (fVariableArrangement.size()==0) {
240 retval = fDynamic ? ( *((fValuesDynamic)->at(ivar)) ) : fValues.at(ivar);
243 UInt_t mapIdx = fVariableArrangement[ivar];
247 retval = *((fValuesDynamic)->at(mapIdx));
251 retval = ( mapIdx<fValues.size() ) ? fValues[mapIdx] : fSpectators[mapIdx-fValues.size()];
264 if (fSpectatorTypes[ivar] ==
'F')
265 return *(fValuesDynamic->at(GetNVariables()+ivar));
266 else if (fSpectatorTypes[ivar] ==
'I')
267 return *(
reinterpret_cast<int *
>(fValuesDynamic->at(GetNVariables() + ivar)));
269 throw std::runtime_error(
"Spectator variable has an invalid type ");
272 return fSpectators.at(ivar);
280 if (fVariableArrangement.size()==0) {
284 for (std::vector<Float_t*>::const_iterator it = fValuesDynamic->begin(), itEnd=fValuesDynamic->end()-GetNSpectators();
287 fValues.push_back( val );
294 for (
UInt_t i=0; i< fVariableArrangement.size(); i++){
295 mapIdx = fVariableArrangement[i];
296 fValues.push_back(*((fValuesDynamic)->at(mapIdx)));
302 fValuesRearranged.clear();
303 for (
UInt_t i=0; i< fVariableArrangement.size(); i++){
304 mapIdx = fVariableArrangement[i];
305 fValuesRearranged.push_back(fValues.at(mapIdx));
307 return fValuesRearranged;
320 if (fVariableArrangement.size()==0)
return fValues.size();
321 else return fVariableArrangement.size();
329 return fTargets.size();
340 if (fVariableArrangement.size()==0)
return fSpectators.size();
341 else return fValues.size()-fVariableArrangement.size();
350 if ((fDynamic ?( (*fValuesDynamic).size() ) : fValues.size())<=ivar)
351 (fDynamic ?( (*fValuesDynamic).resize(ivar+1) ) : fValues.resize(ivar+1));
353 (fDynamic ?( *(*fValuesDynamic)[ivar] ) : fValues[ivar])=val;
361 o << *
this << std::endl;
369 if (fTargets.size() <= itgt) fTargets.resize( itgt+1 );
370 fTargets.at(itgt) =
value;
378 if (fSpectators.size() <= ivar) fSpectators.resize( ivar+1 );
379 fSpectators.at(ivar) =
value;
391 return (fgIgnoreNegWeightsInTraining && fgIsTraining && fWeight < 0) ? 0. : fWeight*fBoostWeight;
410 fgIgnoreNegWeightsInTraining=
b;
418 os <<
"Variables [" <<
event.fValues.size() <<
"]:";
419 for (
UInt_t ivar=0; ivar<
event.fValues.size(); ++ivar)
420 os <<
" " << std::setw(10) <<
event.GetValue(ivar);
421 os <<
", targets [" <<
event.fTargets.size() <<
"]:";
422 for (
UInt_t ivar=0; ivar<
event.fTargets.size(); ++ivar)
423 os <<
" " << std::setw(10) <<
event.GetTarget(ivar);
424 os <<
", spectators ["<<
event.fSpectators.size() <<
"]:";
425 for (
UInt_t ivar=0; ivar<
event.fSpectators.size(); ++ivar)
426 os <<
" " << std::setw(10) <<
event.GetSpectator(ivar);
427 os <<
", weight: " <<
event.GetWeight();
428 os <<
", class: " <<
event.GetClass();
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
std::vector< Float_t > fValues
the event values ; mutable, to be able to copy the dynamic values in there
static Bool_t fgIsTraining
Double_t fWeight
event weight (product of global and individual weights)
Float_t GetValue(UInt_t ivar) const
return value of i'th variable
void SetTarget(UInt_t itgt, Float_t value)
set the target value (dimension itgt) to value
std::vector< Float_t > fTargets
target values for regression
Double_t fBoostWeight
internal weight to be set by boosting algorithm
Bool_t fDynamic
is set when the dynamic values are taken
std::vector< Float_t > fSpectators
"visiting" variables not used in MVAs ; mutable, to be able to copy the dynamic values in there
UInt_t GetNSpectators() const
accessor to the number of spectators
~Event()
Event destructor.
std::vector< Float_t * > * fValuesDynamic
! the event values
UInt_t GetNVariables() const
accessor to the number of variables
void CopyVarValues(const Event &other)
copies only the variable values
UInt_t GetNTargets() const
accessor to the number of targets
static Bool_t fgIgnoreNegWeightsInTraining
Double_t GetWeight() const
return the event weight - depending on whether the flag IgnoreNegWeightsInTraining is or not.
void SetVal(UInt_t ivar, Float_t val)
set variable ivar to val
static void SetIsTraining(Bool_t)
when this static function is called, it sets the flag whether events with negative event weight shoul...
void SetVariableArrangement(std::vector< UInt_t > *const m) const
set the variable arrangement
Float_t GetSpectator(UInt_t ivar) const
return spectator content
void SetSpectator(UInt_t ivar, Float_t value)
set spectator value (dimension ivar) to value
std::vector< Float_t > & GetValues()
static void SetIgnoreNegWeightsInTraining(Bool_t)
when this static function is called, it sets the flag whether events with negative event weight shoul...
void Print(std::ostream &o) const
print method
UInt_t fClass
class number
Mother of all ROOT objects.
std::ostream & operator<<(std::ostream &os, const BinaryTree &tree)