58 fDataSetManager(
NULL),
61 fNeedsRebuilding(
kTRUE ),
66 fNormalization(
"NONE" ),
68 fTrainingSumSignalWeights(-1),
69 fTrainingSumBackgrWeights(-1),
70 fTestingSumSignalWeights (-1),
71 fTestingSumBackgrWeights (-1),
75 fTargetsForMulticlass(0),
88 if (fClasses[i])
delete fClasses[i];
91 if (fTargetsForMulticlass)
delete fTargetsForMulticlass;
100 if(fDataSet) {
delete fDataSet; fDataSet=
nullptr; }
108 fLogger->SetMinType(t);
119 fClasses.push_back(
new ClassInfo(className) );
120 fClasses.back()->SetNumber(fClasses.size()-1);
124 Log() << kHEADER <<
Form(
"[%s] : ",fName.Data()) <<
"Added class \"" << className <<
"\""<<
Endl;
126 Log() << kDEBUG <<
"\t with internal class number " << fClasses.back()->GetNumber() <<
Endl;
129 if (className ==
"Signal") fSignalClass = fClasses.size()-1;
131 return fClasses.back();
138 for (std::vector<ClassInfo*>::iterator it = fClasses.begin(); it < fClasses.end(); ++it) {
139 if ((*it)->GetName() ==
name)
return (*it);
149 return fClasses.at(
cls);
161 Log() << kINFO <<
Form(
"Dataset[%s] : ",fName.Data()) <<
"Class index : " <<
cls <<
" name : " << GetClassInfo(
cls)->GetName() <<
Endl;
169 return (
ev->GetClass() == fSignalClass);
176 if( !fTargetsForMulticlass ) fTargetsForMulticlass =
new std::vector<Float_t>( GetNClasses() );
178 fTargetsForMulticlass->assign( GetNClasses(), 0.0 );
179 fTargetsForMulticlass->at(
ev->GetClass() ) = 1.0;
180 return fTargetsForMulticlass;
189 for (std::vector<ClassInfo*>::iterator it = fClasses.begin(); it < fClasses.end(); ++it) {
199 ClassInfo* ptr = GetClassInfo(className);
219 fNeedsRebuilding =
kTRUE;
220 return fVariables.back();
228 fNeedsRebuilding =
kTRUE;
229 return fVariables.back();
241 fVariables.reserve(fVariables.size() +
size);
242 for (
int i = 0; i <
size; ++i) {
247 fVariables.back().SetBit(kIsArrayVariable);
249 fVariables.back().SetInternalName(
newVarName);
261 Error(
"TMVA::DataSetInfo::AddVariablesArray",
"'%c' variable type is not supported",
varType);
265 fNeedsRebuilding =
kTRUE;
285 fNeedsRebuilding =
kTRUE;
286 return fTargets.back();
294 fNeedsRebuilding =
kTRUE;
295 return fTargets.back();
312 fNeedsRebuilding =
kTRUE;
313 return fSpectators.back();
321 fNeedsRebuilding =
kTRUE;
322 return fSpectators.back();
331 if (var == GetVariableInfo(
ivar).GetInternalName())
return ivar;
334 Log() << kINFO <<
Form(
"Dataset[%s] : ",fName.Data()) << GetVariableInfo(
ivar).GetInternalName() <<
Endl;
336 Log() << kFATAL <<
Form(
"Dataset[%s] : ",fName.Data()) <<
"<FindVarIndex> Variable \'" << var <<
"\' not found." <<
Endl;
348 if (className !=
"") {
354 if (fClasses.empty()) {
355 Log() << kWARNING <<
Form(
"Dataset[%s] : ",fName.Data()) <<
"No classes registered yet, cannot specify weight expression!" <<
Endl;
357 for (std::vector<ClassInfo*>::iterator it = fClasses.begin(); it < fClasses.end(); ++it) {
358 (*it)->SetWeight(
expr );
367 GetClassInfo(className)->SetCorrelationMatrix(
matrix);
375 if (className ==
"") {
376 for (std::vector<ClassInfo*>::iterator it = fClasses.begin(); it < fClasses.end(); ++it) {
377 (*it)->SetCut( cut );
391 if (className ==
"") {
392 for (std::vector<ClassInfo*>::iterator it = fClasses.begin(); it < fClasses.end(); ++it) {
394 (*it)->SetCut(
oldCut+cut );
399 ci->SetCut(
ci->GetCut()+cut );
408 std::vector<TString>
vNames;
409 std::vector<TMVA::VariableInfo>::const_iterator
viIt = GetVariableInfos().
begin();
410 for(;
viIt != GetVariableInfos().
end(); ++
viIt)
vNames.push_back( (*viIt).GetInternalName() );
423 <<
"Correlation matrix (" << className <<
"):" <<
Endl;
435 const UInt_t nvar = GetNVariables();
485 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",fName.Data()) <<
"Created correlation matrix as 2D histogram: " << h2->
GetName() <<
Endl;
495 if (fDataSet==0 || fNeedsRebuilding) {
496 if (fNeedsRebuilding) Log() << kINFO <<
"Rebuilding Dataset " << fName <<
Endl;
500 if( !fDataSetManager )
501 Log() << kFATAL <<
Form(
"Dataset[%s] : ",fName.Data()) <<
"DataSetManager has not been set in DataSetInfo (GetDataSet() )." <<
Endl;
502 fDataSet = fDataSetManager->CreateDataSet(GetName());
504 fNeedsRebuilding =
kFALSE;
514 return fSpectators.size();
516 for(std::vector<VariableInfo>::const_iterator
spit=fSpectators.
begin();
spit!=fSpectators.
end(); ++
spit) {
517 if(
spit->GetVarType()!=
'C')
nsp++;
527 for (
UInt_t cl = 0; cl < GetNClasses(); cl++) {
539 for (
UInt_t i = 0; i < GetNVariables(); i++) {
551 for (
UInt_t i = 0; i < GetNTargets(); i++) {
561 if (fTrainingSumSignalWeights<0) Log() << kFATAL <<
Form(
"Dataset[%s] : ",fName.Data()) <<
" asking for the sum of training signal event weights which is not initialized yet" <<
Endl;
562 return fTrainingSumSignalWeights;
568 if (fTrainingSumBackgrWeights<0) Log() << kFATAL <<
Form(
"Dataset[%s] : ",fName.Data()) <<
" asking for the sum of training backgr event weights which is not initialized yet" <<
Endl;
569 return fTrainingSumBackgrWeights;
575 if (fTestingSumSignalWeights<0) Log() << kFATAL <<
Form(
"Dataset[%s] : ",fName.Data()) <<
" asking for the sum of testing signal event weights which is not initialized yet" <<
Endl;
576 return fTestingSumSignalWeights ;
582 if (fTestingSumBackgrWeights<0) Log() << kFATAL <<
Form(
"Dataset[%s] : ",fName.Data()) <<
" asking for the sum of testing backgr event weights which is not initialized yet" <<
Endl;
583 return fTestingSumBackgrWeights ;
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int)
float Float_t
Float 4 bytes (float)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
TMatrixT< Float_t > TMatrixF
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
const_iterator begin() const
const_iterator end() const
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
virtual void SetBinLabel(Int_t bin, const char *label)
Set label for bin.
A specialized string object used for TTree selections.
virtual void SetLabelOffset(Float_t offset=0.005, Option_t *axis="X")
Set offset between axis and axis' labels.
virtual void LabelsOption(Option_t *option="h", Option_t *axis="X")
Sort bins with labels or set option(s) to draw axis with labels.
void SetNameTitle(const char *name, const char *title) override
Change the name and title of this histogram.
virtual void SetMaximum(Double_t maximum=-1111)
virtual void SetMinimum(Double_t minimum=-1111)
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
2-D histogram with a float per channel (see TH1 documentation)
Service class for 2-D histogram classes.
void SetBinContent(Int_t bin, Double_t content) override
Set bin content.
Double_t GetBinContent(Int_t binx, Int_t biny) const override
Class that contains all the information of a class.
const TMatrixD * GetCorrelationMatrix() const
UInt_t GetNSpectators(bool all=kTRUE) const
VariableInfo & AddVariable(const TString &expression, const TString &title="", const TString &unit="", Double_t min=0, Double_t max=0, char varType='F', Bool_t normalized=kTRUE, void *external=nullptr)
add a variable (can be a complex expression) to the set of variables used in the MV analysis
ClassInfo * AddClass(const TString &className)
const TMatrixD * CorrelationMatrix(const TString &className) const
Int_t GetTargetNameMaxLength() const
virtual ~DataSetInfo()
destructor
Double_t GetTestingSumBackgrWeights()
void SetMsgType(EMsgType t) const
DataSet * GetDataSet() const
returns data set
DataSetInfo(const TString &name="Default")
constructor
TH2 * CreateCorrelationMatrixHist(const TMatrixD *m, const TString &hName, const TString &hTitle) const
std::vector< TString > GetListOfVariables() const
returns list of variables
ClassInfo * GetClassInfo(Int_t clNum) const
Double_t GetTrainingSumSignalWeights()
void PrintClasses() const
Int_t GetClassNameMaxLength() const
Double_t GetTrainingSumBackgrWeights()
VariableInfo & AddTarget(const TString &expression, const TString &title, const TString &unit, Double_t min, Double_t max, Bool_t normalized=kTRUE, void *external=nullptr)
add a variable (can be a complex expression) to the set of variables used in the MV analysis
void PrintCorrelationMatrix(const TString &className)
calculates the correlation matrices for signal and background, prints them to standard output,...
void SetCut(const TCut &cut, const TString &className)
set the cut for the classes
Double_t GetTestingSumSignalWeights()
Int_t FindVarIndex(const TString &) const
find variable by name
Int_t GetVariableNameMaxLength() const
Bool_t IsSignal(const Event *ev) const
VariableInfo & AddSpectator(const TString &expression, const TString &title, const TString &unit, Double_t min, Double_t max, char type='F', Bool_t normalized=kTRUE, void *external=nullptr)
add a spectator (can be a complex expression) to the set of spectator variables used in the MV analys...
void SetWeightExpression(const TString &exp, const TString &className="")
set the weight expressions for the classes if class name is specified, set only for this class if cla...
void AddCut(const TCut &cut, const TString &className)
set the cut for the classes
void AddVariablesArray(const TString &expression, Int_t size, const TString &title="", const TString &unit="", Double_t min=0, Double_t max=0, char type='F', Bool_t normalized=kTRUE, void *external=nullptr)
add an array of variables identified by an expression corresponding to an array entry in the tree
std::vector< Float_t > * GetTargetsForMulticlass(const Event *ev)
void SetCorrelationMatrix(const TString &className, TMatrixD *matrix)
void ClearDataSet() const
Class that contains all the data information.
ostringstream derivative to redirect and format output
Class for type info of MVA input variable.
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
MsgLogger & Endl(MsgLogger &ml)