54 fDataSetManager(
NULL),
57 fNeedsRebuilding(
kTRUE ),
62 fNormalization(
"NONE" ),
64 fTrainingSumSignalWeights(-1),
65 fTrainingSumBackgrWeights(-1),
66 fTestingSumSignalWeights (-1),
67 fTestingSumBackgrWeights (-1),
71 fTargetsForMulticlass(0),
84 if (fClasses[i])
delete fClasses[i];
87 if (fTargetsForMulticlass)
delete fTargetsForMulticlass;
96 if(fDataSet) {
delete fDataSet; fDataSet=
nullptr; }
104 fLogger->SetMinType(t);
115 fClasses.push_back(
new ClassInfo(className) );
116 fClasses.back()->SetNumber(fClasses.size()-1);
120 Log() << kHEADER <<
Form(
"[%s] : ",fName.Data()) <<
"Added class \"" << className <<
"\""<<
Endl;
122 Log() << kDEBUG <<
"\t with internal class number " << fClasses.back()->GetNumber() <<
Endl;
125 if (className ==
"Signal") fSignalClass = fClasses.size()-1;
127 return fClasses.back();
134 for (std::vector<ClassInfo*>::iterator it = fClasses.begin(); it < fClasses.end(); ++it) {
135 if ((*it)->GetName() ==
name)
return (*it);
145 return fClasses.at(
cls);
157 Log() << kINFO <<
Form(
"Dataset[%s] : ",fName.Data()) <<
"Class index : " <<
cls <<
" name : " << GetClassInfo(
cls)->GetName() <<
Endl;
165 return (
ev->GetClass() == fSignalClass);
172 if( !fTargetsForMulticlass ) fTargetsForMulticlass =
new std::vector<Float_t>( GetNClasses() );
174 fTargetsForMulticlass->assign( GetNClasses(), 0.0 );
175 fTargetsForMulticlass->at(
ev->GetClass() ) = 1.0;
176 return fTargetsForMulticlass;
185 for (std::vector<ClassInfo*>::iterator it = fClasses.begin(); it < fClasses.end(); ++it) {
195 ClassInfo* ptr = GetClassInfo(className);
215 fNeedsRebuilding =
kTRUE;
216 return fVariables.back();
224 fNeedsRebuilding =
kTRUE;
225 return fVariables.back();
237 fVariables.reserve(fVariables.size() +
size);
238 for (
int i = 0; i <
size; ++i) {
243 fVariables.back().SetBit(kIsArrayVariable);
245 fVariables.back().SetInternalName(
newVarName);
257 Error(
"TMVA::DataSetInfo::AddVariablesArray",
"'%c' variable type is not supported",
varType);
261 fNeedsRebuilding =
kTRUE;
281 fNeedsRebuilding =
kTRUE;
282 return fTargets.back();
290 fNeedsRebuilding =
kTRUE;
291 return fTargets.back();
308 fNeedsRebuilding =
kTRUE;
309 return fSpectators.back();
317 fNeedsRebuilding =
kTRUE;
318 return fSpectators.back();
327 if (var == GetVariableInfo(
ivar).GetInternalName())
return ivar;
330 Log() << kINFO <<
Form(
"Dataset[%s] : ",fName.Data()) << GetVariableInfo(
ivar).GetInternalName() <<
Endl;
332 Log() << kFATAL <<
Form(
"Dataset[%s] : ",fName.Data()) <<
"<FindVarIndex> Variable \'" << var <<
"\' not found." <<
Endl;
344 if (className !=
"") {
350 if (fClasses.empty()) {
351 Log() << kWARNING <<
Form(
"Dataset[%s] : ",fName.Data()) <<
"No classes registered yet, cannot specify weight expression!" <<
Endl;
353 for (std::vector<ClassInfo*>::iterator it = fClasses.begin(); it < fClasses.end(); ++it) {
354 (*it)->SetWeight(
expr );
363 GetClassInfo(className)->SetCorrelationMatrix(
matrix);
371 if (className ==
"") {
372 for (std::vector<ClassInfo*>::iterator it = fClasses.begin(); it < fClasses.end(); ++it) {
373 (*it)->SetCut( cut );
387 if (className ==
"") {
388 for (std::vector<ClassInfo*>::iterator it = fClasses.begin(); it < fClasses.end(); ++it) {
390 (*it)->SetCut(
oldCut+cut );
395 ci->SetCut(
ci->GetCut()+cut );
404 std::vector<TString>
vNames;
405 std::vector<TMVA::VariableInfo>::const_iterator
viIt = GetVariableInfos().
begin();
406 for(;
viIt != GetVariableInfos().
end(); ++
viIt)
vNames.push_back( (*viIt).GetInternalName() );
419 <<
"Correlation matrix (" << className <<
"):" <<
Endl;
431 const UInt_t nvar = GetNVariables();
481 Log() << kDEBUG <<
Form(
"Dataset[%s] : ",fName.Data()) <<
"Created correlation matrix as 2D histogram: " << h2->
GetName() <<
Endl;
491 if (fDataSet==0 || fNeedsRebuilding) {
492 if (fNeedsRebuilding) Log() << kINFO <<
"Rebuilding Dataset " << fName <<
Endl;
496 if( !fDataSetManager )
497 Log() << kFATAL <<
Form(
"Dataset[%s] : ",fName.Data()) <<
"DataSetManager has not been set in DataSetInfo (GetDataSet() )." <<
Endl;
498 fDataSet = fDataSetManager->CreateDataSet(GetName());
500 fNeedsRebuilding =
kFALSE;
510 return fSpectators.size();
512 for(std::vector<VariableInfo>::const_iterator
spit=fSpectators.
begin();
spit!=fSpectators.
end(); ++
spit) {
513 if(
spit->GetVarType()!=
'C')
nsp++;
523 for (
UInt_t cl = 0; cl < GetNClasses(); cl++) {
535 for (
UInt_t i = 0; i < GetNVariables(); i++) {
547 for (
UInt_t i = 0; i < GetNTargets(); i++) {
557 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;
558 return fTrainingSumSignalWeights;
564 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;
565 return fTrainingSumBackgrWeights;
571 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;
572 return fTestingSumSignalWeights ;
578 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;
579 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)