66 UInt_t nnodes = nodes.size();
79 typedef std::pair<Double_t,Int_t> CutDir_t;
80 typedef std::pair<Int_t,CutDir_t> SelCut_t;
91 std::list<SelCut_t> allsel;
96 for (
UInt_t i=0; i<nnodes-1; i++) {
97 nextNode = nodes[i+1];
102 if (nodes[i]->GetRight() == nextNode) {
105 else if (nodes[i]->GetLeft() == nextNode) {
109 Log() <<
kFATAL <<
"<MakeTheRule> BUG! Should not be here - an end-node before the end!" <<
Endl;
112 allsel.push_back(SelCut_t(sel,CutDir_t(val,dir)));
120 for ( std::list<SelCut_t>::const_iterator it = allsel.begin(); it!=allsel.end(); it++ ) {
122 val = (*it).second.first;
123 dir = (*it).second.second;
128 fSelector.push_back(sel);
129 fCutMin.resize( fSelector.size(),0);
130 fCutMax.resize( fSelector.size(),0);
131 fCutDoMin.resize( fSelector.size(),
kFALSE);
132 fCutDoMax.resize( fSelector.size(),
kFALSE);
136 if ((val<fCutMin[nsel-1]) || firstMin) {
137 fCutMin[nsel-1] = val;
138 fCutDoMin[nsel-1] =
kTRUE;
143 if ((val>fCutMax[nsel-1]) || firstMax) {
144 fCutMax[nsel-1] = val;
145 fCutDoMax[nsel-1] =
kTRUE;
161 for (
UInt_t i=0; i<fSelector.size(); i++) {
162 if (fCutDoMin[i]) rval += 1;
163 if (fCutDoMax[i]) rval += 1;
178 foundIt = (
Int_t(fSelector[ind])==sel);
180 done = (foundIt || (ind==fSelector.size()));
182 if (!foundIt)
return kFALSE;
183 rmin = fCutMin[ind-1];
184 rmax = fCutMax[ind-1];
185 dormin = fCutDoMin[ind-1];
186 dormax = fCutDoMax[ind-1];
MsgLogger & Endl(MsgLogger &ml)
Float_t GetPurity(void) const
RuleCut()
empty constructor
UInt_t GetNcuts() const
get number of cuts
Float_t GetNEvents(void) const
Bool_t GetCutRange(Int_t sel, Double_t &rmin, Double_t &rmax, Bool_t &dormin, Bool_t &dormax) const
get cut range for a given selector
void MakeCuts(const std::vector< const TMVA::Node * > &nodes)
Construct the cuts from the given array of nodes.
Short_t GetSelector() const
virtual ~RuleCut()
destructor
Float_t GetCutValue(void) const