91 fLogger->SetSource(
"DataLoader");
100 std::vector<TMVA::VariableTransformBase*>::iterator trfIt =
fDefaultTrfs.begin();
101 for (;trfIt !=
fDefaultTrfs.end(); ++trfIt)
delete (*trfIt);
130 if (dsi!=0)
return *dsi;
150 if (trafoDefinition.
Contains(
"(")) {
154 Ssiz_t parLen = trafoDefinition.
Index(
")", parStart )-parStart+1;
156 trName = trafoDefinition(0,parStart);
157 trOptions = trafoDefinition(parStart,parLen);
158 trOptions.
Remove(parLen-1,1);
162 trName = trafoDefinition;
166 if (trName ==
"VT") {
171 Log() << kFATAL <<
" VT transformation must be passed a floating threshold value" <<
Endl;
176 threshold = trOptions.
Atof();
179 return transformedLoader;
183 Log() << kFATAL <<
"Incorrect transformation string provided, please check" <<
Endl;
185 Log() << kINFO <<
"No transformation applied, returning original loader" <<
Endl;
208 for (
UInt_t ivar=0; ivar<vars.size(); ivar++) {
209 TString vname = vars[ivar].GetExpression();
213 for (
UInt_t itgt=0; itgt<tgts.size(); itgt++) {
214 TString vname = tgts[itgt].GetExpression();
218 for (
UInt_t ispc=0; ispc<spec.size(); ispc++) {
219 TString vname = spec[ispc].GetExpression();
220 assignTree->
Branch( vname, &
fATreeEvent[vars.size()+tgts.size()+ispc], vname +
"/F" );
278 const std::vector<Double_t>& event,
Double_t weight )
343 Log() << kFATAL <<
"<AddTree> cannot interpret tree type: \"" << treetype
344 <<
"\" should be \"Training\" or \"Test\" or \"Training and Testing\"" <<
Endl;
346 AddTree( tree, className, weight, cut,
tt );
355 Log() << kFATAL <<
"Tree does not exist (empty pointer)." <<
Endl;
363 Log() << kINFO<<
"Add Tree " << tree->GetName() <<
" of type " << className
364 <<
" with " << tree->GetEntries() <<
" events" <<
Endl;
365 DataInput().AddTree( tree, className, weight, cut,
tt );
373 AddTree( signal,
"Signal", weight,
TCut(
""), treetype );
382 TTree* signalTree =
new TTree(
"TreeS",
"Tree (S)" );
385 Log() << kINFO <<
"Create TTree objects from ASCII input files ... \n- Signal file : \""
389 AddTree( signalTree,
"Signal", weight,
TCut(
""), treetype );
396 AddTree( signal,
"Signal", weight,
TCut(
""), treetype );
404 AddTree( signal,
"Background", weight,
TCut(
""), treetype );
413 TTree* bkgTree =
new TTree(
"TreeB",
"Tree (B)" );
416 Log() << kINFO <<
"Create TTree objects from ASCII input files ... \n- Background file : \""
420 AddTree( bkgTree,
"Background", weight,
TCut(
""), treetype );
427 AddTree( signal,
"Background", weight,
TCut(
""), treetype );
434 AddTree( tree,
"Signal", weight );
441 AddTree( tree,
"Background", weight );
467 DataInput().AddTree( datFileS,
"Signal", signalWeight );
468 DataInput().AddTree( datFileB,
"Background", backgroundWeight );
543 for (std::vector<TString>::iterator it=theVariables->begin();
611 NsigTrain, NbkgTrain, NsigTest, NbkgTest, otherOpt.
Data()).Data() );
624 DefaultDataSetInfo().SetSplitOptions(
TString::Format(
"nTrain_Signal=%i:nTrain_Background=%i:nTest_Signal=%i:nTest_Background=%i:SplitMode=Random:EqualTrainSample:!V",
625 Ntrain, Ntrain, Ntest, Ntest).Data() );
650 AddCut( sigcut,
"Signal" );
651 AddCut( bkgcut,
"Background" );
703 for( std::vector<TreeInfo>::const_iterator treeinfo=
src->DataInput().Sbegin();treeinfo!=
src->DataInput().Send();++treeinfo)
705 des->
AddSignalTree( (*treeinfo).GetTree(), (*treeinfo).GetWeight(),(*treeinfo).GetTreeType());
708 for( std::vector<TreeInfo>::const_iterator treeinfo=
src->DataInput().Bbegin();treeinfo!=
src->DataInput().Bend();++treeinfo)
710 des->
AddBackgroundTree( (*treeinfo).GetTree(), (*treeinfo).GetWeight(),(*treeinfo).GetTreeType());
721 "CorrelationMatrix"+className,
"Correlation Matrix ("+className+
")");
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 char Point_t Rectangle_t src
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< Double_t > TMatrixD
A specialized string object used for TTree selections.
Service class for 2-D histogram classes.
Class that contains all the information of a class.
Configurable(const TString &theOption="")
constructor
MsgLogger * fLogger
! message logger
virtual void RecombineKFoldDataSet(DataSetInfo &dsi, Types::ETreeType tt=Types::kTraining)
virtual void MakeKFoldDataSet(DataSetInfo &dsi)=0
virtual void PrepareFoldDataSet(DataSetInfo &dsi, UInt_t foldNumber, Types::ETreeType tt)
Set training and test set vectors of dataset described by dsi.
DataInputHandler * fDataInputHandler
->
TTree * CreateEventAssignTrees(const TString &name)
create the data assignment tree (for event-wise data assignment by user)
void AddVariablesArray(const TString &expression, int size, char type='F', Double_t min=0, Double_t max=0)
user inserts discriminating array of variables in data set info in case input tree provides an array ...
Float_t fATreeWeight
weight of the event
std::vector< TTree * > fTrainAssignTree
for each class: tmp tree if user wants to assign the events directly
void SetBackgroundTree(TTree *background, Double_t weight=1.0)
void AddSignalTree(TTree *signal, Double_t weight=1.0, Types::ETreeType treetype=Types::kMaxTreeType)
number of signal events (used to compute significance)
DataSetInfo & AddDataSet(DataSetInfo &)
void AddSpectator(const TString &expression, const TString &title="", const TString &unit="", Double_t min=0, Double_t max=0)
user inserts target in data set info
void SetInputTreesFromEventAssignTrees()
assign event-wise local trees to data set
void AddTrainingEvent(const TString &className, const std::vector< Double_t > &event, Double_t weight)
add signal training event
std::vector< TMVA::VariableTransformBase * > fDefaultTrfs
list of transformations on default DataSet
DataAssignType fDataAssignType
flags for data assigning
void SetTree(TTree *tree, const TString &className, Double_t weight)
deprecated
void AddSignalTestEvent(const std::vector< Double_t > &event, Double_t weight=1.0)
add signal testing event
std::vector< Float_t > fATreeEvent
event variables
DataSetInfo & DefaultDataSetInfo()
default creation
void AddBackgroundTestEvent(const std::vector< Double_t > &event, Double_t weight=1.0)
add signal training event
DataSetManager * fDataSetManager
DataLoader * MakeCopy(TString name)
Copy method use in VI and CV.
void SetSignalWeightExpression(const TString &variable)
void MakeKFoldDataSet(CvSplit &s)
Function required to split the training and testing datasets into a number of folds.
void SetWeightExpression(const TString &variable, const TString &className="")
void AddBackgroundTrainingEvent(const std::vector< Double_t > &event, Double_t weight=1.0)
add signal training event
void RecombineKFoldDataSet(CvSplit &s, Types::ETreeType tt=Types::kTraining)
Recombines the dataset.
DataLoader * VarTransform(TString trafoDefinition)
Transforms the variables and return a new DataLoader with the transformed variables.
void SetBackgroundWeightExpression(const TString &variable)
void AddCut(const TString &cut, const TString &className="")
void AddEvent(const TString &className, Types::ETreeType tt, const std::vector< Double_t > &event, Double_t weight)
add event vector event : the order of values is: variables + targets + spectators
DataLoader(TString thedlName="default")
void PrepareTrainingAndTestTree(const TCut &cut, const TString &splitOpt)
prepare the training and test trees -> same cuts for signal and background
DataInputHandler & DataInput()
void AddBackgroundTree(TTree *background, Double_t weight=1.0, Types::ETreeType treetype=Types::kMaxTreeType)
number of signal events (used to compute significance)
DataSetInfo & GetDataSetInfo()
void AddTarget(const TString &expression, const TString &title="", const TString &unit="", Double_t min=0, Double_t max=0)
user inserts target in data set info
TH2 * GetCorrelationMatrix(const TString &className)
returns the correlation matrix of datasets
Bool_t UserAssignEvents(UInt_t clIndex)
void AddSignalTrainingEvent(const std::vector< Double_t > &event, Double_t weight=1.0)
add signal training event
Bool_t fVerbose
verbose mode
void AddTestEvent(const TString &className, const std::vector< Double_t > &event, Double_t weight)
add signal test event
void SetSignalTree(TTree *signal, Double_t weight=1.0)
TString fTransformations
List of transformations to test.
void SetInputTrees(const TString &signalFileName, const TString &backgroundFileName, Double_t signalWeight=1.0, Double_t backgroundWeight=1.0)
void AddTree(TTree *tree, const TString &className, Double_t weight=1.0, const TCut &cut="", Types::ETreeType tt=Types::kMaxTreeType)
void SetInputVariables(std::vector< TString > *theVariables)
deprecated
Int_t fATreeType
type of event (=classIndex)
std::vector< TTree * > fTestAssignTree
for each class: tmp tree if user wants to assign the events directly
Types::EAnalysisType fAnalysisType
the training type
void SetCut(const TString &cut, const TString &className="")
void AddVariable(const TString &expression, const TString &title, const TString &unit, char type='F', Double_t min=0, Double_t max=0)
user inserts discriminating variable in data set info
void PrepareFoldDataSet(CvSplit &s, UInt_t foldNumber, Types::ETreeType tt=Types::kTraining)
Function for assigning the correct folds to the testing or training set.
Class that contains all the data information.
Class that contains all the data information.
@ kMaxTreeType
also used as temporary storage for trees not yet assigned for testing;training...
virtual void SetName(const char *name)
Set the name of the TNamed.
void ToLower()
Change string to lower-case.
Double_t Atof() const
Return floating-point value contained in string.
Bool_t IsFloat() const
Returns kTRUE if string contains a floating point or integer number.
const char * Data() const
TString & Remove(Ssiz_t pos)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
A TTree represents a columnar dataset.
virtual void SetDirectory(TDirectory *dir)
Change the tree's directory.
TBranch * Branch(const char *name, T *obj, Int_t bufsize=32000, Int_t splitlevel=99)
Add a new branch, and infer the data type from the type of obj being passed.
virtual Long64_t ReadFile(const char *filename, const char *branchDescriptor="", char delimiter=' ')
Create or simply read branches from filename.
void DataLoaderCopy(TMVA::DataLoader *des, TMVA::DataLoader *src)
MsgLogger & Endl(MsgLogger &ml)