65 const std::vector< const Node * >& nodes )
70 , fCoefficient ( 0.0 )
72 , fImportanceRef ( 1.0 )
73 , fRuleEnsemble ( re )
147 doneLoop = (found || (i==nvars));
173 if (mindist<0) useCutValue=
kFALSE;
176 if (useCutValue) rval = ( (!(d<0)) && (d<mindist) );
177 else rval = (!(d<0));
213 while ((equal) && (in<nvars)) {
231 smin = ( rms>0 ? (vminA-vminB)/rms : 0 );
233 smax = ( rms>0 ? (vmaxA-vmaxB)/rms : 0 );
234 sumdc2 += smin*smin + smax*smax;
240 if (!useCutValue) sumdc2 = (equal ? 0.0:-1.0);
241 else sumdc2 = (equal ?
sqrt(sumdc2) : -1.0);
304 if (nvars<1) os <<
" *** WARNING - <EMPTY RULE> ***" << std::endl;
311 os <<
" Support = " <<
Form(
"%1.4f",
fSupport) << std::endl;
312 os <<
" S/(S+B) = " <<
Form(
"%1.4f",
fSSB) << std::endl;
314 for (
UInt_t i=0; i<nvars; i++) {
320 os <<
Form(
"* Cut %2d",i+1) <<
" : " << std::flush;
322 else os <<
" " << std::flush;
325 else os <<
" " << std::flush;
336 if (nvars<1)
Log() << kWARNING <<
"BUG TRAP: EMPTY RULE!!!" <<
Endl;
341 if (title)
Log() << kINFO << title;
345 for (
UInt_t i=0; i<nvars; i++) {
347 Log() << kINFO <<
" ";
352 Log() << kINFO <<
Form(
"Cut %2d",i+1) <<
" : ";
354 else Log() << kINFO <<
" ";
357 else Log() << kINFO <<
" ";
367 Int_t dp = os.precision();
370 << std::setprecision(10)
380 os <<
"N(cuts): " << nvars << std::endl;
381 for (
UInt_t i=0; i<nvars; i++) {
382 os <<
"Cut " << i <<
" : " << std::flush;
384 << std::setprecision(10)
391 os << std::setprecision(dp);
411 for (
UInt_t i=0; i<nvars; i++) {
429 if (nodeName !=
"Rule")
Log() << kFATAL <<
"<ReadFromXML> Unexpected node name: " << nodeName <<
Endl;
469 if (i != nvars)
Log() << kFATAL <<
"<ReadFromXML> Mismatch in number of cuts: " << i <<
" != " << nvars <<
Endl;
489 istr >> dummy >> nvars;
497 for (
UInt_t i=0; i<nvars; i++) {
498 istr >> dummy >> idum;
500 istr >> sel >> cutmin >> cutmax >> bA >> bB;
Rule()
the simple constructor
std::string GetName(const std::string &scope_name)
void SetCoefficient(Double_t v)
const TString & GetVarName(Int_t i) const
returns the name of a rule
MsgLogger & Endl(MsgLogger &ml)
void SetCutMax(Int_t i, Double_t v)
Double_t GetSigma() const
Double_t GetImportanceRef() const
void PrintLogger(const char *title=0) const
print function
Bool_t operator==(const Rule &other) const
comparison operator ==
Bool_t ContainsVariable(UInt_t iv) const
check if variable in node
bool equal(double d1, double d2, double stol=10000)
const RuleEnsemble * GetRuleEnsemble() const
Double_t GetPurity() const
const RuleCut * GetRuleCut() const
Double_t GetCutMin(Int_t is) const
const TString & GetInputLabel(Int_t i) const
Implementation of a rule.
void PrintRaw(std::ostream &os) const
extensive print function used to print info for the weight file
void SetCutMin(Int_t i, Double_t v)
Char_t GetCutDoMin(Int_t is) const
void * AddXMLTo(void *parent) const
void SetSigma(Double_t v)
void SetCutDoMin(Int_t i, Bool_t v)
void SetMinType(EMsgType minType)
void SetSelector(Int_t i, UInt_t s)
Char_t GetCutDoMax(Int_t is) const
Double_t RuleDist(const Rule &other, Bool_t useCutValue) const
Returns:
const MethodBase * GetMethodBase() const
A class describing a 'rule cut'.
void ReadFromXML(void *wghtnode)
read rule from XML
Double_t GetCoefficient() const
std::ostream & operator<<(std::ostream &os, const BinaryTree &tree)
char * Form(const char *fmt,...)
void ReadRaw(std::istream &os)
read function (format is the same as written by PrintRaw)
const RuleFit * GetRuleFit() const
void Copy(const Rule &other)
copy function
void SetImportanceRef(Double_t v)
void SetSupport(Double_t v)
void SetNorm(Double_t norm)
void SetCutDoMax(Int_t i, Bool_t v)
static RooMathCoreReg dummy
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
ostringstream derivative to redirect and format output
const MethodBase * GetMethodBase() const
Get a pointer to the original MethodRuleFit.
void Print(std::ostream &os) const
print function
UInt_t GetSelector(Int_t is) const
Double_t GetRMS(Int_t ivar) const
Bool_t operator<(const Rule &other) const
comparison operator <
Double_t GetImportance() const
void SetMsgType(EMsgType t)
Double_t GetCutMax(Int_t is) const
MsgLogger & Log() const
message logger
virtual ~Rule()
destructor
void SetRuleEnsemble(const RuleEnsemble *re)
Double_t GetCutNeve() const
Double_t GetSSBNeve() const
Double_t GetSupport() const
const RuleEnsemble * fRuleEnsemble
Bool_t Equal(const Rule &other, Bool_t useCutValue, Double_t maxdist) const
Compare two rules.