* *
**********************************************************************************/
#include <string>
#include "TMVA/Event.h"
#include "TMVA/Tools.h"
#include "TObjString.h"
#include "Riostream.h"
#include "TTree.h"
#include "TString.h"
#include <stdexcept>
ClassImp(TMVA::Event)
TMVA::Event::Event(TTree* tree, Int_t ievt, std::vector<TString>* fInputVars)
{
for (UInt_t ivar=0; ivar<fInputVars->size(); ivar++)
fVar.push_back(TMVA::Tools::GetValue( tree, ievt, (*fInputVars)[ivar] ));
if (tree->GetBranchStatus("weight"))
fWeight = Double_t(TMVA::Tools::GetValue( tree, ievt, "weight"));
else
fWeight = 1.;
if (fWeight > 10) cout << "Weight in TMVA::Event " << fWeight <<endl;
fType = Int_t(TMVA::Tools::GetValue( tree, ievt, "type" ));
}
const Double_t& TMVA::Event::GetData(Int_t i) const
{
if (i<0 || i>(Int_t)fVar.size()) {
cout<<"--- TMVA::Event::Data(Int i ... ERROR! i="<<i<<" out of range \n";
exit(1);
}
else return fVar[i];
}
void TMVA::Event::Print(ostream& os) const
{
os << "Event with " << this->GetEventSize() << " variables and weight " << this->GetWeight()<<endl;
for (int i=0; i<this->GetEventSize(); i++){
os << this->GetData(i) << " ";
}
}
TMVA::Event* TMVA::Event::Read(ifstream& is)
{
std::string tmp;
Double_t dtmp;
Int_t nvar;
is >> tmp >> tmp >> nvar >> tmp >> tmp >> tmp >> dtmp;
this->SetWeight(dtmp);
for (int i=0; i<nvar; i++){
is >> dtmp; this->Insert(dtmp);
}
return this;
}
ostream& TMVA::operator<<(ostream& os, const TMVA::Event& event){
event.Print(os);
return os;
}
ostream& TMVA::operator<<(ostream& os, const TMVA::Event* event){
if (event!=NULL)event->Print(os);
else os << "There is no TMVA::Event to print. Pointer == NULL";
return os;
}
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.