49 fRankingDiscriminatorName(
"" ),
60 fRankingDiscriminatorName( rankingDiscriminatorName ),
61 fLogger( new
MsgLogger(fContext.Data(), kINFO) )
79 fLogger->SetSource( fContext.Data() );
93 fRanking.push_back( rank );
95 UInt_t sizeofarray=fRanking.size();
96 Rank temp(fRanking[0]);
97 for (
UInt_t i=0; i<sizeofarray; i++) {
98 for (
UInt_t j=sizeofarray-1; j>i; j--) {
99 if (fRanking[j-1] < fRanking[j]) {
100 temp = fRanking[j-1];fRanking[j-1] = fRanking[j]; fRanking[j] = temp;
105 for (
UInt_t i=0; i<fRanking.size(); i++) fRanking[i].SetRank( i+1 );
114 for (std::vector<Rank>::const_iterator ir = fRanking.begin(); ir != fRanking.end(); ++ir )
115 if ((*ir).GetVariable().Length() > maxL) maxL = (*ir).GetVariable().Length();
118 for (
Int_t i=0; i<maxL+15+fRankingDiscriminatorName.Length(); i++) hline +=
"-";
119 Log() << kHEADER <<
"Ranking result (top variable is best ranked)" <<
Endl;
120 Log() << kINFO << hline <<
Endl;
121 Log() << kINFO << std::setiosflags(std::ios::left)
122 << std::setw(5) <<
"Rank : "
123 << std::setw(maxL+0) <<
"Variable "
124 << std::resetiosflags(std::ios::right)
125 <<
" : " << fRankingDiscriminatorName <<
Endl;
126 Log() << kINFO << hline <<
Endl;
127 for (std::vector<Rank>::const_iterator ir = fRanking.begin(); ir != fRanking.end(); ++ir ) {
129 <<
Form(
"%4i : ",(*ir).GetRank() )
130 << std::setw(
TMath::Max(maxL+0,9)) << (*ir).GetVariable().Data()
131 <<
Form(
" : %3.3e", (*ir).GetRankValue() ) <<
Endl;
133 Log() << kINFO << hline <<
Endl;
140 : fVariable( variable ),
141 fRankValue( rankValue ),
158 if (fRankValue < other.
fRankValue)
return true;
167 if (fRankValue > other.
fRankValue)
return true;
char * Form(const char *fmt,...)
ostringstream derivative to redirect and format output
virtual ~Rank()
destructor
Rank(const TString &variable, Double_t rankValue)
constructor
Bool_t operator>(const Rank &other) const
comparison operator >
Bool_t operator<(const Rank &other) const
comparison operator <
Ranking for variables in method (implementation)
virtual void AddRank(const Rank &rank)
Add a new rank take ownership of it.
virtual void Print() const
get maximum length of variable names
void SetContext(const TString &context)
virtual ~Ranking()
destructor
Ranking()
default constructor
MsgLogger & Endl(MsgLogger &ml)
Short_t Max(Short_t a, Short_t b)