67using std::vector, std::setw, std::istream, std::ostream;
76 if(!
fgTools.compare_exchange_strong(expected,tmp)) {
129 if ((S->GetNbinsX() != B->
GetNbinsX()) || (S->GetNbinsX() <= 0)) {
130 Log() << kFATAL <<
"<GetSeparation> signal and background"
131 <<
" histograms have different number of bins: "
137 S->GetXaxis()->GetXmax() <= S->GetXaxis()->GetXmin()) {
140 <<
" " << S->GetXaxis()->GetXmax() <<
" " << S->GetXaxis()->GetXmin() <<
Endl;
141 Log() << kFATAL <<
"<GetSeparation> signal and background"
142 <<
" histograms have different or invalid dimensions:" <<
Endl;
145 Int_t nstep = S->GetNbinsX();
146 Double_t intBin = (S->GetXaxis()->GetXmax() - S->GetXaxis()->GetXmin())/nstep;
147 Double_t nS = S->GetSumOfWeights()*intBin;
150 if (nS > 0 && nB > 0) {
151 for (
Int_t bin=0; bin<nstep; bin++) {
155 if (s +
b > 0) separation += (s -
b)*(s -
b)/(s +
b);
157 separation *= (0.5*intBin);
160 Log() << kWARNING <<
"<GetSeparation> histograms with zero entries: "
161 << nS <<
" : " << nB <<
" cannot compute separation"
181 Log() << kFATAL <<
"<GetSeparation> Mismatch in PDF limits: "
188 for (
Int_t bin=0; bin<nstep; bin++) {
193 if (s +
b > 0) separation += (s -
b)*(s -
b)/(s +
b);
195 separation *= (0.5*intBin);
210 Log() << kFATAL <<
"<Tools::ComputeStat> value vector is zero pointer" <<
Endl;
212 if ( events.size() != valVec->size() )
213 Log() << kWARNING <<
"<Tools::ComputeStat> event and value vector have different lengths "
214 << events.size() <<
"!=" << valVec->size() <<
Endl;
230 xmin_ = *std::min( valVec->begin(), valVec->end() );
231 xmax_ = *std::max( valVec->begin(), valVec->end() );
234 for (
Int_t ievt=0; ievt<entries; ievt++) {
238 if (
Int_t(events[ievt]->GetClass()) == signalClass ){
239 wgtVecS[nEventsS] = events[ievt]->GetWeight();
240 varVecS[nEventsS++] = theVar;
243 wgtVecB[nEventsB] = events[ievt]->GetWeight();
244 varVecB[nEventsB++] = theVar;
277 Log() << kWARNING <<
"<GetSQRootMatrix> matrix not positive definite; printed S and B" <<
Endl;
302 if (covMat == 0)
return 0;
306 Log() << kFATAL <<
"<GetCorrelationMatrix> input matrix not quadratic" <<
Endl;
310 for (
Int_t ivar=0; ivar<nvar; ivar++) {
311 for (
Int_t jvar=0; jvar<nvar; jvar++) {
313 Double_t d = (*covMat)(ivar, ivar)*(*covMat)(jvar, jvar);
315 (*corrMat)(ivar, jvar) = (*covMat)(ivar, jvar)/
TMath::Sqrt(
d);
317 Log() <<
"<GetCorrelationMatrix> zero variances for variables "
318 <<
"(" << ivar <<
", " << jvar <<
")" <<
Endl;
319 (*corrMat)(ivar, jvar) = 0;
323 <<
" Element corr("<<ivar<<
","<<ivar<<
")=" << (*corrMat)(ivar,jvar)
325 <<
" cov("<<ivar<<
","<<ivar<<
")=" <<(*covMat)(ivar, ivar)
326 <<
" cov("<<jvar<<
","<<jvar<<
")=" <<(*covMat)(jvar, jvar)
331 else (*corrMat)(ivar, ivar) = 1.0;
360 if (!theHist)
return 0;
366 if (w > 0) theHist->
Scale( norm/w );
380 while (formatString.
First(sep)==0) formatString.
Remove(0,1);
382 while (formatString.
Length()>0) {
383 if (formatString.
First(sep) == -1) {
391 formatString.
Remove(0,posSep+1);
393 while (formatString.
First(sep)==0) formatString.
Remove(0,1);
419 vector<Int_t>* nodes )
425 if (list->GetSize() < 1) {
426 Log() << kFATAL <<
"<ParseANNOptionString> unrecognized option string: " << theOptions <<
Endl;
430 nodes->push_back( atoi( ((
TObjString*)list->At(0))->GetString() ) );
433 if (list->GetSize() > 1) {
434 for (
Int_t i=1; i<list->GetSize(); i++) {
438 if (s.
Length() > 1) nodes->push_back( nvar + atoi(&s[1]) );
439 else nodes->push_back( nvar );
441 else if ((
a = atoi( s )) > 0) nodes->push_back( atoi(s ) );
443 Log() << kFATAL <<
"<ParseANNOptionString> unrecognized option string: " << theOptions <<
Endl;
465 Double_t dev = 0.5*(ys - yh)/(ys + yh);
467 Log() << kFATAL <<
"<CheckSplines> Spline failed sanity criterion; "
468 <<
" relative deviation from histogram: " << dev
469 <<
" in (bin, value): (" << ibin <<
", " <<
x <<
")" <<
Endl;
483 if (
a.size() !=
b.size()) {
486 vector<Double_t> result(
a.size());
487 for (
UInt_t i=0; i<
a.size();i++) result[i]=
a[i]-
b[i];
496 for (
UInt_t i=0; i<
v.size();i++)
v[i]*=
f;
504 for (
UInt_t i=0; i<
v.size();i++)
v[i]*=
f;
517 UInt_t sizeofarray=
v[0].size();
518 for (
UInt_t i=0; i<sizeofarray; i++) {
519 for (
UInt_t j=sizeofarray-1; j>i; j--) {
520 if (
v[0][j-1] >
v[0][j]) {
521 for (
UInt_t k=0; k< nArrays; k++) {
522 temp =
v[k][j-1];
v[k][j-1] =
v[k][j];
v[k][j] = temp;
525 TString temps = (*vs)[j-1]; (*vs)[j-1] = (*vs)[j]; (*vs)[j] = temps;
544 UInt_t sizeofarray=
v[0].size();
545 for (
UInt_t i=0; i<sizeofarray; i++) {
546 for (
UInt_t j=sizeofarray-1; j>i; j--) {
547 if (
v[0][j-1] <
v[0][j]) {
548 for (
UInt_t k=0; k< nArrays; k++) {
549 temp =
v[k][j-1];
v[k][j-1] =
v[k][j];
v[k][j] = temp;
552 TString temps = (*vs)[j-1]; (*vs)[j-1] = (*vs)[j]; (*vs)[j] = temps;
567 if (
hi == 0)
return -1;
575 Int_t maxBinX =
h.GetNbinsX();
576 Int_t maxBinY =
h.GetNbinsY();
577 for (
Int_t x = 1;
x <= maxBinX;
x++) {
578 for (
Int_t y = 1;
y <= maxBinY;
y++) {
582 if (p_x > 0. && p_y > 0. && p_xy > 0.){
583 mutualInfo += p_xy*
TMath::Log(p_xy / (p_x * p_y));
598 if (
hi == 0.)
return -1;
606 Double_t y_mean =
h.ProjectionY()->GetMean();
607 for (
Int_t ix=1; ix<=
h.GetNbinsX(); ix++) {
608 corrRatio += (
h.Integral(ix,ix,1,
h.GetNbinsY())/
hi)*pow((
GetYMean_binX(
h,ix)-y_mean),2);
610 corrRatio /= pow(
h.ProjectionY()->GetRMS(),2);
619 if (
h.Integral(bin_x,bin_x,1,
h.GetNbinsY()) == 0.) {
return 0;}
621 TH1* py =
h.ProjectionY();
622 for (
Int_t y = 1;
y <=
h.GetNbinsY();
y++){
625 y_bin_mean /=
h.Integral(bin_x,bin_x,1,
h.GetNbinsY());
635 if (
h.GetNbinsX() !=
h.GetNbinsY()) {
636 Log() << kFATAL <<
"<TransposeHist> cannot transpose non-quadratic histogram" <<
Endl;
640 for (
Int_t ix=1; ix <=
h.GetNbinsX(); ix++){
641 for (
Int_t iy=1; iy <=
h.GetNbinsY(); iy++){
650 h.GetStats(stats_old);
651 stats_new[0] = stats_old[0];
652 stats_new[1] = stats_old[1];
653 stats_new[2] = stats_old[4];
654 stats_new[3] = stats_old[5];
655 stats_new[4] = stats_old[2];
656 stats_new[5] = stats_old[3];
657 stats_new[6] = stats_old[6];
658 transposedHisto->
PutStats(stats_new);
660 return transposedHisto;
691 for (std::vector<TString>::iterator it =
v.begin(); it !=
v.end(); ++it) {
692 if ((*it ==
"v" || *it ==
"verbose") && !it->Contains(
"!")) isVerbose =
kTRUE;
703 vector< vector<Double_t> > vtemp;
714 vector<vector<Double_t> > vtemp;
725 if (
v.empty())
return -1;
728 for (
UInt_t i=0; i<
v.size(); i++){
742 if (
v.empty())
return -1;
745 for (
UInt_t i=0; i<
v.size(); i++){
805 static const TString gClr_none =
"" ;
806 static const TString gClr_white =
"\033[1;37m";
807 static const TString gClr_black =
"\033[30m";
808 static const TString gClr_blue =
"\033[34m";
809 static const TString gClr_red =
"\033[1;31m" ;
810 static const TString gClr_yellow =
"\033[1;33m";
811 static const TString gClr_darkred =
"\033[31m";
812 static const TString gClr_darkgreen =
"\033[32m";
813 static const TString gClr_darkyellow =
"\033[33m";
815 static const TString gClr_bold =
"\033[1m" ;
816 static const TString gClr_black_b =
"\033[30m" ;
817 static const TString gClr_lblue_b =
"\033[1;34m" ;
818 static const TString gClr_cyan_b =
"\033[0;36m" ;
819 static const TString gClr_lgreen_b =
"\033[1;32m";
821 static const TString gClr_blue_bg =
"\033[44m";
822 static const TString gClr_red_bg =
"\033[1;41m";
823 static const TString gClr_whiteonblue =
"\033[1;44m";
824 static const TString gClr_whiteongreen =
"\033[1;42m";
825 static const TString gClr_grey_bg =
"\033[47m";
827 static const TString gClr_reset =
"\033[0m";
829 if (!
gConfig().UseColor())
return gClr_none;
831 if (
c ==
"white" )
return gClr_white;
832 if (
c ==
"blue" )
return gClr_blue;
833 if (
c ==
"black" )
return gClr_black;
834 if (
c ==
"lightblue")
return gClr_cyan_b;
835 if (
c ==
"yellow")
return gClr_yellow;
836 if (
c ==
"red" )
return gClr_red;
837 if (
c ==
"dred" )
return gClr_darkred;
838 if (
c ==
"dgreen")
return gClr_darkgreen;
839 if (
c ==
"lgreenb")
return gClr_lgreen_b;
840 if (
c ==
"dyellow")
return gClr_darkyellow;
842 if (
c ==
"bold")
return gClr_bold;
843 if (
c ==
"bblack")
return gClr_black_b;
845 if (
c ==
"blue_bgd")
return gClr_blue_bg;
846 if (
c ==
"red_bgd" )
return gClr_red_bg;
848 if (
c ==
"white_on_blue" )
return gClr_whiteonblue;
849 if (
c ==
"white_on_green")
return gClr_whiteongreen;
851 if (
c ==
"reset")
return gClr_reset;
853 std::cout <<
"Unknown color " <<
c << std::endl;
868 if ((
UInt_t)values.size() != nvar) {
869 logger << kFATAL <<
"<FormattedOutput> fatal error with dimensions: "
870 << values.size() <<
" OR " <<
" != " << nvar <<
Endl;
875 std::vector<UInt_t> vLengths;
884 UInt_t clen = maxL + maxV + 3;
887 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
891 logger << setw(maxL) << titleVars <<
":";
892 logger << setw(maxV+1) << titleValues <<
":";
894 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
898 for (
UInt_t irow=0; irow<nvar; irow++) {
899 logger << setw(maxL) << V[irow] <<
":";
900 logger << setw(maxV+1) <<
Form( format.
Data(), values[irow] );
905 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
916 if ((
UInt_t)M.GetNcols() != nvar || (
UInt_t)M.GetNrows() != nvar) {
917 logger << kFATAL <<
"<FormattedOutput> fatal error with dimensions: "
918 << M.GetNcols() <<
" OR " << M.GetNrows() <<
" != " << nvar <<
" ==> abort" <<
Endl;
924 std::vector<UInt_t> vLengths;
925 for (
UInt_t ivar=0; ivar<nvar; ivar++) {
932 for (
UInt_t icol=0; icol<nvar; icol++) clen += vLengths[icol]+1;
935 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
939 logger << setw(maxL+1) <<
" ";
940 for (
UInt_t icol=0; icol<nvar; icol++) logger << setw(vLengths[icol]+1) << V[icol];
944 for (
UInt_t irow=0; irow<nvar; irow++) {
945 logger << setw(maxL) << V[irow] <<
":";
946 for (
UInt_t icol=0; icol<nvar; icol++) {
947 logger << setw(vLengths[icol]+1) <<
TString::Format(
"%+1.3f", M(irow,icol) );
953 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
961 const std::vector<TString>& vert,
const std::vector<TString>& horiz,
965 UInt_t nvvar = vert.size();
966 UInt_t nhvar = horiz.size();
971 std::vector<UInt_t> vLengths;
972 for (
UInt_t ivar=0; ivar<nvvar; ivar++) {
980 std::vector<UInt_t> hLengths;
981 for (
UInt_t ivar=0; ivar<nhvar; ivar++) {
987 for (
UInt_t icol=0; icol<nhvar; icol++) clen += hLengths[icol]+1;
990 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
994 logger << setw(maxL+1) <<
" ";
995 for (
UInt_t icol=0; icol<nhvar; icol++) logger << setw(hLengths[icol]+1) << horiz[icol];
999 for (
UInt_t irow=0; irow<nvvar; irow++) {
1000 logger << setw(maxL) << vert[irow] <<
":";
1001 for (
UInt_t icol=0; icol<nhvar; icol++) {
1002 logger << setw(hLengths[icol]+1) <<
TString::Format(
"%+1.3f", M(irow,icol) );
1008 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
1017 return ( unit ==
"" ? title : ( title +
" [" + unit +
"]" ) );
1025 TString retval = ( normalised ?
"(1/N) " :
"" );
1035 os << val <<
" :: ";
1037 for (
int i=0; i<4; i++) {
1038 Int_t ic = *((
char*)
c+i)-
'\0';
1056 for (
int i=0; i<4; i++) {
1058 *((
char*)ap+i) =
'\0'+
c[i];
1071 return xmlengine().HasAttr(node, attrname);
1079 if (!
HasAttr(node, attrname)) {
1080 const char * nodename =
xmlengine().GetNodeName(node);
1081 Log() << kFATAL <<
"Trying to read non-existing attribute '" << attrname <<
"' from xml node '" << nodename <<
"'" <<
Endl;
1083 const char* val =
xmlengine().GetAttr(node, attrname);
1101 if( !isRootNode && parent == 0 )
return 0;
1108 if( node == 0 )
return kFALSE;
1117 void* par =
xmlengine().GetParent(child);
1127 void* ch =
xmlengine().GetChild(parent);
1128 if (childname != 0) {
1129 while (ch!=0 && strcmp(
xmlengine().GetNodeName(ch),childname) != 0) ch =
xmlengine().GetNext(ch);
1139 void* ch =
xmlengine().GetNext(prevchild);
1140 if (childname != 0) {
1141 while (ch!=0 && strcmp(
xmlengine().GetNodeName(ch),childname)!=0) ch =
xmlengine().GetNext(ch);
1151 return xmlengine().GetNodeContent(node);
1167 return xmlengine().AddRawLine( node, raw );
1176 std::vector<TString> splitV;
1180 while (splitOpt.
Length()>0) {
1181 if ( !splitOpt.
Contains(separator) ) {
1182 splitV.push_back(splitOpt);
1186 TString toSave = splitOpt(0,splitOpt.
First(separator));
1187 splitV.push_back(toSave);
1188 splitOpt = splitOpt(splitOpt.
First(separator),splitOpt.
Length());
1200 std::stringstream s;
1202 return TString(s.str().c_str());
1210 std::stringstream s;
1212 return TString(s.str().c_str());
1223 std::stringstream s;
1229 xmlengine().AddRawLine( matnode, s.str().c_str() );
1246 for (
int i=0;i<
vec->GetNoElements();++i) (*
vec)[i] = mat[0][i];
1254 Log() << kWARNING <<
"Possible Error: Name of matrix in weight file"
1255 <<
" does not match name of matrix passed as argument!" <<
Endl;
1259 ReadAttr( node,
"Columns", ncols );
1261 Log() << kWARNING <<
"Possible Error: Dimension of matrix in weight file"
1262 <<
" does not match dimension of matrix passed as argument!" <<
Endl;
1265 const char* content =
xmlengine().GetNodeContent(node);
1266 std::stringstream s(content);
1267 for (
Int_t row = 0; row<nrows; row++) {
1268 for (
Int_t col = 0; col<ncols; col++) {
1269 s >> (*mat)[row][col];
1279 std::cout << std::endl;
1280 std::cout <<
Color(
"bold") <<
"TMVA -- Toolkit for Multivariate Data Analysis" <<
Color(
"reset") << std::endl;
1282 std::cout <<
" " <<
"Copyright (C) 2005-2010 CERN, MPI-K Heidelberg, Us of Bonn and Victoria" << std::endl;
1283 std::cout <<
" " <<
"Home page: http://tmva.sf.net" << std::endl;
1284 std::cout <<
" " <<
"Citation info: http://tmva.sf.net/citeTMVA.html" << std::endl;
1285 std::cout <<
" " <<
"License: http://tmva.sf.net/LICENSE" << std::endl << std::endl;
1302 static const char *
const months[] = {
"Jan",
"Feb",
"Mar",
"Apr",
"May",
1303 "Jun",
"Jul",
"Aug",
"Sep",
"Oct",
1306 Int_t iday = idatqq%100;
1307 Int_t imonth = (idatqq/100)%100;
1308 Int_t iyear = (idatqq/10000);
1312 logger <<
"You are running ROOT Version: " <<
gROOT->GetVersion() <<
", " << versionDate <<
Endl;
1324 logger <<
Color(
"white") <<
"TMVA -- Toolkit for Multivariate Analysis" <<
Color(
"reset") <<
Endl;
1325 logger <<
"Copyright (C) 2005-2006 CERN, LAPP & MPI-K Heidelberg and Victoria U." <<
Endl;
1326 logger <<
"Home page https://root.cern/manual/tmva/" <<
Endl;
1330 logger <<
" ___ ___ ___ ___ " <<
Endl;
1331 logger <<
" /\\ \\ /\\__\\ /\\__\\ /\\ \\ " <<
Endl;
1332 logger <<
" \\:\\ \\ /::| | /:/ / /::\\ \\ " <<
Endl;
1333 logger <<
" \\:\\ \\ /:|:| | /:/ / /:/\\:\\ \\ " <<
Endl;
1334 logger <<
" /::\\ \\ /:/|:|__|__ /:/__/ ___ /::\\~\\:\\ \\ " <<
Endl;
1335 logger <<
" /:/\\:\\__\\ /:/ |::::\\__\\ |:| | /\\__\\ /:/\\:\\ \\:\\__\\ " <<
Endl;
1336 logger <<
" /:/ \\/__/ \\/__/~~/:/ / |:| |/:/ / \\/__\\:\\/:/ / " <<
Endl;
1337 logger <<
"/:/ / /:/ / |:|__/:/ / \\::/ / " <<
Endl;
1338 logger <<
"\\/__/ /:/ / \\::::/__/ /:/ / " <<
Endl;
1339 logger <<
" /:/ / ~~~~ /:/ / " <<
Endl;
1340 logger <<
" \\/__/ \\/__/ " <<
Endl <<
Endl;
1345 logger <<
"_|_|_|_|_| _| _| _| _| _|_| " <<
Endl;
1346 logger <<
" _| _|_| _|_| _| _| _| _| " <<
Endl;
1347 logger <<
" _| _| _| _| _| _| _|_|_|_| " <<
Endl;
1348 logger <<
" _| _| _| _| _| _| _| " <<
Endl;
1349 logger <<
" _| _| _| _| _| _| " <<
Endl <<
Endl;
1354 logger <<
"_/_/_/_/_/ _/ _/ _/ _/ _/_/ " <<
Endl;
1355 logger <<
" _/ _/_/ _/_/ _/ _/ _/ _/ " <<
Endl;
1356 logger <<
" _/ _/ _/ _/ _/ _/ _/_/_/_/ " <<
Endl;
1357 logger <<
" _/ _/ _/ _/ _/ _/ _/ " <<
Endl;
1358 logger <<
"_/ _/ _/ _/ _/ _/ " <<
Endl <<
Endl;
1363 logger <<
"_/_/_/_/_/ _| _| _| _| _|_| " <<
Endl;
1364 logger <<
" _/ _|_| _|_| _| _| _| _| " <<
Endl;
1365 logger <<
" _/ _| _| _| _| _| _|_|_|_| " <<
Endl;
1366 logger <<
" _/ _| _| _| _| _| _| " <<
Endl;
1367 logger <<
"_/ _| _| _| _| _| " <<
Endl <<
Endl;
1371 logger <<
" _____ __ ____ ___ " <<
Endl;
1372 logger <<
"|_ _| \\/ \\ \\ / /_\\ " <<
Endl;
1373 logger <<
" | | | |\\/| |\\ V / _ \\ " <<
Endl;
1374 logger <<
" |_| |_| |_| \\_/_/ \\_\\" <<
Endl <<
Endl;
1378 logger <<
" _____ __ ____ ___ " <<
Endl;
1379 logger <<
"|_ _| \\/ \\ \\ / / \\ " <<
Endl;
1380 logger <<
" | | | |\\/| |\\ \\ / / _ \\ " <<
Endl;
1381 logger <<
" | | | | | | \\ V / ___ \\ " <<
Endl;
1382 logger <<
" |_| |_| |_| \\_/_/ \\_\\ " <<
Endl <<
Endl;
1386 logger << kINFO <<
"" <<
Color(
"red")
1387 <<
"_______________________________________" <<
Color(
"reset") <<
Endl;
1388 logger << kINFO <<
"" <<
Color(
"blue")
1391 <<
"|\\ /|| \\ // /\\\\\\\\\\\\\\\\\\\\\\\\ \\ \\ \\ " <<
Color(
"reset") <<
Endl;
1392 logger << kINFO <<
""<<
Color(
"blue")
1395 <<
"| \\/ || \\// /--\\\\\\\\\\\\\\\\\\\\\\\\ \\ \\ \\" <<
Color(
"reset") <<
Endl;
1399 logger << kINFO <<
""
1400 <<
"_______________________________________" <<
Endl;
1401 logger << kINFO <<
" // "
1402 <<
"|\\ /|| \\ // /\\\\\\\\\\\\\\\\\\\\\\\\ \\ \\ \\ " <<
Endl;
1403 logger << kINFO <<
"// "
1404 <<
"| \\/ || \\// /--\\\\\\\\\\\\\\\\\\\\\\\\ \\ \\ \\" <<
Endl;
1408 logger << kFATAL <<
"unknown message type: " << msgType <<
Endl;
1420 logger <<
"A. Hoecker, P. Speckmayer, J. Stelzer, J. Therhaag, E. von Toerne, H. Voss" <<
Endl;
1421 logger <<
"\"TMVA - Toolkit for Multivariate Data Analysis\" PoS ACAT:040,2007. e-Print: physics/0703039" <<
Endl;
1425 logger <<
"@Article{TMVA2007," <<
Endl;
1426 logger <<
" author = \"Hoecker, Andreas and Speckmayer, Peter and Stelzer, Joerg " <<
Endl;
1427 logger <<
" and Therhaag, Jan and von Toerne, Eckhard and Voss, Helge\"," <<
Endl;
1428 logger <<
" title = \"{TMVA: Toolkit for multivariate data analysis}\"," <<
Endl;
1429 logger <<
" journal = \"PoS\"," <<
Endl;
1430 logger <<
" volume = \"ACAT\"," <<
Endl;
1431 logger <<
" year = \"2007\"," <<
Endl;
1432 logger <<
" pages = \"040\"," <<
Endl;
1433 logger <<
" eprint = \"physics/0703039\"," <<
Endl;
1434 logger <<
" archivePrefix = \"arXiv\"," <<
Endl;
1435 logger <<
" SLACcitation = \"%%CITATION = PHYSICS/0703039;%%\"" <<
Endl;
1436 logger <<
"}" <<
Endl;
1440 logger <<
"%\\cite{TMVA2007}" <<
Endl;
1441 logger <<
"\\bibitem{TMVA2007}" <<
Endl;
1442 logger <<
" A.~Hoecker, P.~Speckmayer, J.~Stelzer, J.~Therhaag, E.~von Toerne, H.~Voss" <<
Endl;
1443 logger <<
" %``TMVA: Toolkit for multivariate data analysis,''" <<
Endl;
1444 logger <<
" PoS A {\\bf CAT} (2007) 040" <<
Endl;
1445 logger <<
" [arXiv:physics/0703039]." <<
Endl;
1446 logger <<
" %%CITATION = POSCI,ACAT,040;%%" <<
Endl;
1454 <<
"For citation information, please visit: http://tmva.sf.net/citeTMVA.html"
1463 return !(
h.GetXaxis()->GetXbins()->fN);
1468std::vector<TMatrixDSym*>*
1471 std::vector<Event*> eventVector;
1472 for (std::vector<const Event*>::const_iterator it = events.begin(), itEnd = events.end(); it != itEnd; ++it)
1474 eventVector.push_back (
new Event(*(*it)));
1477 for (std::vector<Event*>::const_iterator it = eventVector.begin(), itEnd = eventVector.end(); it != itEnd; ++it)
1487std::vector<TMatrixDSym*>*
1490 if (events.empty()) {
1491 Log() << kWARNING <<
" Asked to calculate a covariance matrix for an empty event vectors.. sorry cannot do that -> return NULL"<<
Endl;
1495 UInt_t nvars=0, ntgts=0, nspcts=0;
1499 nvars =events.at(0)->GetNVariables ();
1500 ntgts =events.at(0)->GetNTargets ();
1501 nspcts=events.at(0)->GetNSpectators();
1506 Int_t matNum = maxCls;
1507 if (maxCls > 1 ) matNum++;
1509 std::vector<TVectorD*>*
vec =
new std::vector<TVectorD*>(matNum);
1510 std::vector<TMatrixD*>* mat2 =
new std::vector<TMatrixD*>(matNum);
1511 std::vector<Double_t> count(matNum);
1512 count.assign(matNum,0);
1518 for (cls = 0; cls < matNum ; cls++) {
1520 mat2->at(cls) =
new TMatrixD(nvars,nvars);
1524 for (ivar=0; ivar<nvars; ivar++) {
1526 for (jvar=0; jvar<nvars; jvar++) {
1527 (*m)(ivar, jvar) = 0;
1533 for (
UInt_t i=0; i<events.size(); i++) {
1536 const Event * ev = events[i];
1540 std::vector<Float_t> input;
1541 std::vector<Char_t> mask;
1543 if (transformBase) {
1544 transformBase->
GetInput (ev, input, mask);
1546 for (ivar=0; ivar<nvars; ++ivar) {
1547 input.push_back (ev->
GetValue(ivar));
1552 v =
vec->at(matNum-1);
1553 m = mat2->at(matNum-1);
1555 count.at(matNum-1)+=weight;
1556 for (ivar=0; ivar<nvars; ivar++) {
1559 (*v)(ivar) += xi*weight;
1560 (*m)(ivar, ivar) += (xi*xi*weight);
1562 for (jvar=ivar+1; jvar<nvars; jvar++) {
1564 (*m)(ivar, jvar) += (xi*xj*weight);
1565 (*m)(jvar, ivar) = (*
m)(ivar, jvar);
1570 count.at(cls)+=weight;
1573 for (ivar=0; ivar<nvars; ivar++) {
1575 (*v)(ivar) += xi*weight;
1576 (*m)(ivar, ivar) += (xi*xi*weight);
1578 for (jvar=ivar+1; jvar<nvars; jvar++) {
1580 (*m)(ivar, jvar) += (xi*xj*weight);
1581 (*m)(jvar, ivar) = (*
m)(ivar, jvar);
1587 std::vector<TMatrixDSym*>* mat =
new std::vector<TMatrixDSym*>(matNum);
1588 for (cls = 0; cls < matNum; cls++) {
1595 for (ivar=0; ivar<nvars; ivar++) {
1596 for (jvar=0; jvar<nvars; jvar++) {
1597 (*(mat->at(cls)))(ivar, jvar) = (*
m)(ivar, jvar)/
n - (*
v)(ivar)*(*
v)(jvar)/(
n*
n);
1615template <
typename Iterator,
typename WeightIterator>
1622 while ( first != last )
1633 ::Error(
"TMVA::Tools::Mean",
"sum of weights <= 0 ?! that's a bit too much of negative event weights :) ");
1639 while ( first != last )
1645 sum += (*w) * (*first);
1651 ::Error(
"TMVA::Tools::Mean",
"sum of weights <= 0 ?! that's a bit too much of negative event weights :) ");
1661template <
typename T>
1676template <
typename Iterator,
typename WeightIterator>
1687 while ( first != last ) {
1690 sum2 += adouble*adouble;
1697 while ( first != last ) {
1699 sum += adouble * (*w);
1700 sum2 += adouble*adouble * (*w);
1717template <
typename T>
1740 for (
Int_t ibinEnd=1, ibin=cumulativeDist->
GetNbinsX(); ibin >=ibinEnd ; ibin--){
1742 if (val>0) inverseSum += val;
1744 inverseSum = 1/inverseSum;
1746 for (
Int_t ibinEnd=1, ibin=cumulativeDist->
GetNbinsX(); ibin >=ibinEnd ; ibin--){
1748 if (val>0) partialSum += val;
1751 return cumulativeDist;
1757 const char *val =
xmlengine().GetAttr(node, attrname);
1758 if (val ==
nullptr) {
1759 const char *nodename =
xmlengine().GetNodeName(node);
1760 Log() << kFATAL <<
"Trying to read non-existing attribute '" << attrname <<
"' from xml node '" << nodename <<
"'"
1769 const char *val =
xmlengine().GetAttr(node, attrname);
1770 if (val ==
nullptr) {
1771 const char *nodename =
xmlengine().GetNodeName(node);
1772 Log() << kFATAL <<
"Trying to read non-existing attribute '" << attrname <<
"' from xml node '" << nodename <<
"'"
1781 const char *val =
xmlengine().GetAttr(node, attrname);
1782 if (val ==
nullptr) {
1783 const char *nodename =
xmlengine().GetNodeName(node);
1784 Log() << kFATAL <<
"Trying to read non-existing attribute '" << attrname <<
"' from xml node '" << nodename <<
"'"
int Int_t
Signed integer 4 bytes (int).
int Ssiz_t
String size (currently int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
long long Long64_t
Portable signed long integer 8 bytes.
float Float_t
Float 4 bytes (float).
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
TMatrixTSym< Double_t > TMatrixDSym
TMatrixTDiag< Double_t > TMatrixDDiag
TMatrixT< Double_t > TMatrixD
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
TVectorT< Double_t > TVectorD
#define TMVA_RELEASE_DATE
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
Cholesky Decomposition class.
Bool_t Decompose() override
Matrix A is decomposed in component U so that A = U^T * U If the decomposition succeeds,...
1-D histogram with a float per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
virtual Double_t GetSumOfWeights() const
Return the sum of weights across all bins excluding under/overflows.
virtual Int_t GetNbinsX() const
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
virtual Int_t GetSumw2N() const
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
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 Integral(Option_t *option="") const override
Return integral of bin contents.
void PutStats(Double_t *stats) override
Replace current statistics with the values in array stats.
void Add(TObject *obj) override
Float_t GetValue(UInt_t ivar) const
return value of i'th variable
Double_t GetWeight() const
return the event weight - depending on whether the flag IgnoreNegWeightsInTraining is or not.
ostringstream derivative to redirect and format output
PDF wrapper for histograms; uses user-defined spline interpolation.
Double_t GetVal(Double_t x) const
returns value PDF(x)
const TVectorD & GetEigenValues() const
const TMatrixD & GetEigenVectors() const
virtual TMatrixTBase< Element > & Sqrt()
Take square root of all elements.
TMatrixTSym< Element > & Similarity(const TMatrixT< Element > &n)
Calculate B * (*this) * B^T , final matrix will be (nrowsb x nrowsb) This is a similarity transform w...
TMatrixTSym< Element > & Invert(Double_t *det=nullptr)
Invert the matrix and calculate its determinant Notice that the LU decomposition is used instead of B...
TMatrixTBase< Element > & ResizeTo(Int_t nrows, Int_t ncols, Int_t=-1) override
Set size of the matrix to nrows x ncols New dynamic elements are created, the overlapping part of the...
Collectable string class.
Base class for spline implementation containing the Draw/Paint methods.
virtual Double_t Eval(Double_t x) const =0
void ToLower()
Change string to lower-case.
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
Ssiz_t First(char c) const
Find first occurrence of a character c.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
void ToUpper()
Change string to upper case.
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
A TTree represents a columnar dataset.
virtual Long64_t Project(const char *hname, const char *varexp, const char *selection="", Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0)
Make a projection of a tree using selections.
XMLNodePointer_t NewChild(XMLNodePointer_t parent, XMLNsPointer_t ns, const char *name, const char *content=nullptr)
create new child element for parent node
XMLAttrPointer_t NewAttr(XMLNodePointer_t xmlnode, XMLNsPointer_t, const char *name, const char *value)
creates new attribute for xmlnode, namespaces are not supported for attributes
Bool_t AddComment(XMLNodePointer_t parent, const char *comment)
Adds comment line to the node.
MsgLogger & Endl(MsgLogger &ml)
Double_t RMS(Long64_t n, const T *a, const Double_t *w=nullptr)
Returns the Standard Deviation of an array a with length n.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Double_t Log(Double_t x)
Returns the natural logarithm of x.
Double_t Sqrt(Double_t x)
Returns the square root of x.
Double_t Mean(Long64_t n, const T *a, const Double_t *w=nullptr)
Returns the weighted mean of an array a with length n.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
static uint64_t sum(uint64_t i)