54 fVariableArrangement(0),
67 const std::vector<Float_t>& tg,
75 fVariableArrangement(0),
78 fBoostWeight(boostweight),
88 const std::vector<Float_t>& tg,
89 const std::vector<Float_t>& vi,
97 fVariableArrangement(0),
100 fBoostWeight(boostweight),
117 fVariableArrangement(0),
120 fBoostWeight(boostweight),
133 fSpectators(evdyn->size()-nvar),
134 fVariableArrangement(0),
149 fValues(event.fValues),
150 fValuesDynamic(event.fValuesDynamic),
151 fTargets(event.fTargets),
152 fSpectators(event.fSpectators),
153 fVariableArrangement(event.fVariableArrangement),
154 fClass(event.fClass),
155 fWeight(event.fWeight),
156 fBoostWeight(event.fBoostWeight),
157 fDynamic(event.fDynamic),
162 UInt_t nvar =
event.GetNVariables();
164 std::vector<Float_t*>::iterator itDyn=
event.fValuesDynamic->begin(), itDynEnd=
event.fValuesDynamic->end();
165 for (; itDyn!=itDynEnd && idx<nvar; ++itDyn){
171 for (; itDyn!=itDynEnd; ++itDyn){
196 if(!
m)fVariableArrangement.clear();
197 else fVariableArrangement = *
m;
214 for (; itDyn!=itDynEnd && idx<nvar; ++itDyn){
216 fValues.push_back( value );
220 for (; itDyn!=itDynEnd; ++itDyn){
222 fSpectators.push_back( value );
227 fValuesDynamic = NULL;
240 if (fVariableArrangement.size()==0) {
241 retval = fDynamic ? ( *((fValuesDynamic)->at(ivar)) ) : fValues.at(ivar);
244 UInt_t mapIdx = fVariableArrangement[ivar];
248 retval = *((fValuesDynamic)->at(mapIdx));
252 retval = ( mapIdx<fValues.size() ) ? fValues[mapIdx] : fSpectators[mapIdx-fValues.size()];
264 if (fDynamic)
return *(fValuesDynamic->at(GetNVariables()+ivar));
265 else return fSpectators.at(ivar);
273 if (fVariableArrangement.size()==0) {
277 for (std::vector<Float_t*>::const_iterator it = fValuesDynamic->begin(), itEnd=fValuesDynamic->end()-GetNSpectators();
280 fValues.push_back( val );
287 for (
UInt_t i=0; i< fVariableArrangement.size(); i++){
288 mapIdx = fVariableArrangement[i];
289 fValues.push_back(*((fValuesDynamic)->at(mapIdx)));
295 fValuesRearranged.clear();
296 for (
UInt_t i=0; i< fVariableArrangement.size(); i++){
297 mapIdx = fVariableArrangement[i];
298 fValuesRearranged.push_back(fValues.at(mapIdx));
300 return fValuesRearranged;
313 if (fVariableArrangement.size()==0)
return fValues.size();
314 else return fVariableArrangement.size();
322 return fTargets.size();
333 if (fVariableArrangement.size()==0)
return fSpectators.size();
334 else return fValues.size()-fVariableArrangement.size();
343 if ((fDynamic ?( (*fValuesDynamic).size() ) : fValues.size())<=ivar)
344 (fDynamic ?( (*fValuesDynamic).resize(ivar+1) ) : fValues.resize(ivar+1));
346 (fDynamic ?( *(*fValuesDynamic)[ivar] ) : fValues[ivar])=val;
354 o << *
this << std::endl;
362 if (fTargets.size() <= itgt) fTargets.resize( itgt+1 );
363 fTargets.at(itgt) = value;
371 if (fSpectators.size() <= ivar) fSpectators.resize( ivar+1 );
372 fSpectators.at(ivar) = value;
384 return (fgIgnoreNegWeightsInTraining && fgIsTraining && fWeight < 0) ? 0. : fWeight*fBoostWeight;
403 fgIgnoreNegWeightsInTraining=
b;
411 os <<
"Variables [" <<
event.fValues.size() <<
"]:";
412 for (
UInt_t ivar=0; ivar<
event.fValues.size(); ++ivar)
413 os <<
" " << std::setw(10) <<
event.GetValue(ivar);
414 os <<
", targets [" <<
event.fTargets.size() <<
"]:";
415 for (
UInt_t ivar=0; ivar<
event.fTargets.size(); ++ivar)
416 os <<
" " << std::setw(10) <<
event.GetTarget(ivar);
417 os <<
", spectators ["<<
event.fSpectators.size() <<
"]:";
418 for (
UInt_t ivar=0; ivar<
event.fSpectators.size(); ++ivar)
419 os <<
" " << std::setw(10) <<
event.GetSpectator(ivar);
420 os <<
", weight: " <<
event.GetWeight();
421 os <<
", class: " <<
event.GetClass();
std::vector< Float_t > fValues
static Bool_t fgIsTraining
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
the event values
std::vector< Float_t > fSpectators
UInt_t GetNSpectators() const
accessor to the number of spectators
~Event()
Event destructor.
std::vector< Float_t * > * fValuesDynamic
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
Mother of all ROOT objects.
std::ostream & operator<<(std::ostream &os, const BinaryTree &tree)