33 #ifndef ROOT_TMVA_Config 36 #ifndef ROOT_TMVA_Event 39 #ifndef ROOT_TMVA_Version 45 #ifndef ROOT_TMVA_MsgLogger 73 #if __cplusplus > 199711L 81 #if __cplusplus > 199711L 85 if(! fgTools.compare_exchange_strong(expected,tmp)) {
92 return fgTools?*(fgTools): *(fgTools =
new Tools());
98 #if __cplusplus > 199711L 99 if (fgTools != 0) {
delete fgTools.load(); fgTools=0; }
101 if (fgTools != 0) {
delete fgTools; fgTools=0; }
109 fRegexp(
"$&|!%^&()'<>?= "),
129 return 2*(x -
xmin)/(xmax - xmin) - 1.0;
144 Log() <<
kFATAL <<
"<GetSeparation> signal and background" 145 <<
" histograms have different number of bins: " 155 Log() <<
kFATAL <<
"<GetSeparation> signal and background" 156 <<
" histograms have different or invalid dimensions:" <<
Endl;
164 if (nS > 0 && nB > 0) {
165 for (
Int_t bin=0; bin<nstep; bin++) {
169 if (s + b > 0) separation += 0.5*(s -
b)*(s - b)/(s +
b);
171 separation *= intBin;
174 Log() <<
kWARNING <<
"<GetSeparation> histograms with zero entries: " 175 << nS <<
" : " << nB <<
" cannot compute separation" 193 Log() <<
kFATAL <<
"<GetSeparation> Mismatch in PDF limits: " 200 for (
Int_t bin=0; bin<nstep; bin++) {
205 if (s + b > 0) separation += (s -
b)*(s - b)/(s +
b);
207 separation *= (0.5*intBin);
222 Log() <<
kFATAL <<
"<Tools::ComputeStat> value vector is zero pointer" <<
Endl;
224 if ( events.size() != valVec->size() )
225 Log() <<
kWARNING <<
"<Tools::ComputeStat> event and value vector have different lengths " 226 << events.size() <<
"!=" << valVec->size() <<
Endl;
242 xmin_ = *std::min( valVec->begin(), valVec->end() );
243 xmax_ = *std::max( valVec->begin(), valVec->end() );
246 for (
Int_t ievt=0; ievt<entries; ievt++) {
251 wgtVecS[nEventsS] = events[ievt]->GetWeight();
252 varVecS[nEventsS++] = theVar;
255 wgtVecB[nEventsB] = events[ievt]->GetWeight();
256 varVecB[nEventsB++] = theVar;
259 if (theVar > xmax) xmax = theVar;
260 if (theVar < xmin) xmin = theVar;
298 d->
Mult( (*si), (*symMat) ); (*d) *= (*s);
303 for (i=0; i<
n; i++) {
304 for (j=0; j<
n; j++) {
306 (i == j && (*d)(i,i) < 0)) {
308 Log() <<
kWARNING <<
"<GetSQRootMatrix> error in matrix diagonalization; printed S and B" <<
Endl;
314 for (i=0; i<
n; i++)
for (j=0; j<
n; j++)
if (j != i) (*d)(i,j) = 0;
320 sqrtMat->
Mult( (*s), (*d) );
340 if (covMat == 0)
return 0;
344 Log() <<
kFATAL <<
"<GetCorrelationMatrix> input matrix not quadratic" <<
Endl;
348 for (
Int_t ivar=0; ivar<nvar; ivar++) {
349 for (
Int_t jvar=0; jvar<nvar; jvar++) {
351 Double_t d = (*covMat)(ivar, ivar)*(*covMat)(jvar, jvar);
352 if (d > 1
E-20) (*corrMat)(ivar, jvar) = (*covMat)(ivar, jvar)/
TMath::Sqrt(d);
354 Log() <<
"<GetCorrelationMatrix> zero variances for variables " 355 <<
"(" << ivar <<
", " << jvar <<
")" <<
Endl;
356 (*corrMat)(ivar, jvar) = 0;
360 <<
" Element corr("<<ivar<<
","<<ivar<<
")=" << (*corrMat)(ivar,jvar)
362 <<
" cov("<<ivar<<
","<<ivar<<
")=" <<(*covMat)(ivar, ivar)
363 <<
" cov("<<jvar<<
","<<jvar<<
")=" <<(*covMat)(jvar, jvar)
368 else (*corrMat)(ivar, ivar) = 1.0;
385 TH1* hist =
new TH1F( name, name, nbins, xmin, xmax );
387 theTree->Project( name, theVarName, cut );
397 if (!theHist)
return 0;
403 if (w > 0) theHist->
Scale( norm/w );
417 while (formatString.First(sep)==0) formatString.Remove(0,1);
419 while (formatString.Length()>0) {
420 if (formatString.First(sep) == -1) {
426 Ssiz_t posSep = formatString.First(sep);
428 formatString.Remove(0,posSep+1);
430 while (formatString.First(sep)==0) formatString.Remove(0,1);
441 vector<Int_t>* nodes )
462 Log() <<
kFATAL <<
"<ParseANNOptionString> unrecognized option string: " << theOptions <<
Endl;
466 nodes->push_back( atoi( ((
TObjString*)list->
At(0))->GetString() ) );
474 if (s.Length() > 1) nodes->push_back( nvar + atoi(&s[1]) );
475 else nodes->push_back( nvar );
477 else if ((a = atoi( s )) > 0) nodes->push_back( atoi(s ) );
479 Log() <<
kFATAL <<
"<ParseANNOptionString> unrecognized option string: " << theOptions <<
Endl;
499 Double_t dev = 0.5*(ys - yh)/(ys + yh);
501 Log() <<
kFATAL <<
"<CheckSplines> Spline failed sanity criterion; " 502 <<
" relative deviation from histogram: " << dev
503 <<
" in (bin, value): (" << ibin <<
", " << x <<
")" <<
Endl;
517 if (a.size() != b.size()) {
520 vector<Double_t>
result(a.size());
530 for (
UInt_t i=0; i<v.size();i++) v[i]*=f;
538 for (
UInt_t i=0; i<v.size();i++) v[i]*=f;
551 UInt_t sizeofarray=
v[0].size();
552 for (
UInt_t i=0; i<sizeofarray; i++) {
553 for (
UInt_t j=sizeofarray-1; j>i; j--) {
554 if (
v[0][j-1] >
v[0][j]) {
555 for (
UInt_t k=0; k< nArrays; k++) {
556 temp =
v[k][j-1];
v[k][j-1] =
v[k][j];
v[k][j] = temp;
559 TString temps = (*vs)[j-1]; (*vs)[j-1] = (*vs)[j]; (*vs)[j] = temps;
578 UInt_t sizeofarray=
v[0].size();
579 for (
UInt_t i=0; i<sizeofarray; i++) {
580 for (
UInt_t j=sizeofarray-1; j>i; j--) {
581 if (
v[0][j-1] <
v[0][j]) {
582 for (
UInt_t k=0; k< nArrays; k++) {
583 temp =
v[k][j-1];
v[k][j-1] =
v[k][j];
v[k][j] = temp;
586 TString temps = (*vs)[j-1]; (*vs)[j-1] = (*vs)[j]; (*vs)[j] = temps;
601 if (hi == 0)
return -1;
611 for (
Int_t x = 1;
x <= maxBinX;
x++) {
612 for (
Int_t y = 1;
y <= maxBinY;
y++) {
616 if (p_x > 0. && p_y > 0. && p_xy > 0.){
617 mutualInfo += p_xy*
TMath::Log(p_xy / (p_x * p_y));
632 if (hi == 0.)
return -1;
670 Log() <<
kFATAL <<
"<TransposeHist> cannot transpose non-quadratic histogram" <<
Endl;
673 TH2F *transposedHisto =
new TH2F( h );
685 stats_new[0] = stats_old[0];
686 stats_new[1] = stats_old[1];
687 stats_new[2] = stats_old[4];
688 stats_new[3] = stats_old[5];
689 stats_new[4] = stats_old[2];
690 stats_new[5] = stats_old[3];
691 stats_new[6] = stats_old[6];
692 transposedHisto->
PutStats(stats_new);
694 return transposedHisto;
706 s.ReplaceAll(
" ",
"");
707 if (s.Contains(
"silent") && !s.Contains(
"silent=f")) {
708 if (!s.Contains(
"!silent") || s.Contains(
"silent=t")) isSilent =
kTRUE;
723 s.ReplaceAll(
" ",
"");
725 for (std::vector<TString>::iterator it = v.begin(); it != v.end(); it++) {
726 if ((*it ==
"v" || *it ==
"verbose") && !it->Contains(
"!")) isVerbose =
kTRUE;
737 vector< vector<Double_t> > vtemp;
748 vector<vector<Double_t> > vtemp;
759 if (v.empty())
return -1;
762 for (
UInt_t i=0; i<v.size(); i++){
776 if (v.empty())
return -1;
779 for (
UInt_t i=0; i<v.size(); i++){
813 snew.ReplaceAll(
"::", r );
814 snew.ReplaceAll(
"$",
"_S_" );
815 snew.ReplaceAll(
"&",
"_A_" );
816 snew.ReplaceAll(
"%",
"_MOD_" );
817 snew.ReplaceAll(
"|",
"_O_" );
818 snew.ReplaceAll(
"*",
"_T_" );
819 snew.ReplaceAll(
"/",
"_D_" );
820 snew.ReplaceAll(
"+",
"_P_" );
821 snew.ReplaceAll(
"-",
"_M_" );
822 snew.ReplaceAll(
" ",
"_" );
823 snew.ReplaceAll(
"[",
"_" );
824 snew.ReplaceAll(
"]",
"_" );
825 snew.ReplaceAll(
"=",
"_E_" );
826 snew.ReplaceAll(
">",
"_GT_" );
827 snew.ReplaceAll(
"<",
"_LT_" );
828 snew.ReplaceAll(
"(",
"_" );
829 snew.ReplaceAll(
")",
"_" );
839 static const TString gClr_none =
"" ;
840 static const TString gClr_white =
"\033[1;37m";
841 static const TString gClr_black =
"\033[30m";
842 static const TString gClr_blue =
"\033[34m";
843 static const TString gClr_red =
"\033[1;31m" ;
844 static const TString gClr_yellow =
"\033[1;33m";
845 static const TString gClr_darkred =
"\033[31m";
846 static const TString gClr_darkgreen =
"\033[32m";
847 static const TString gClr_darkyellow =
"\033[33m";
849 static const TString gClr_bold =
"\033[1m" ;
850 static const TString gClr_black_b =
"\033[30m" ;
851 static const TString gClr_lblue_b =
"\033[1;34m" ;
852 static const TString gClr_cyan_b =
"\033[0;36m" ;
853 static const TString gClr_lgreen_b =
"\033[1;32m";
855 static const TString gClr_blue_bg =
"\033[44m";
856 static const TString gClr_red_bg =
"\033[1;41m";
857 static const TString gClr_whiteonblue =
"\033[1;44m";
858 static const TString gClr_whiteongreen =
"\033[1;42m";
859 static const TString gClr_grey_bg =
"\033[47m";
861 static const TString gClr_reset =
"\033[0m";
863 if (!
gConfig().UseColor())
return gClr_none;
865 if (c ==
"white" )
return gClr_white;
866 if (c ==
"blue" )
return gClr_blue;
867 if (c ==
"black" )
return gClr_black;
868 if (c ==
"lightblue")
return gClr_cyan_b;
869 if (c ==
"yellow")
return gClr_yellow;
870 if (c ==
"red" )
return gClr_red;
871 if (c ==
"dred" )
return gClr_darkred;
872 if (c ==
"dgreen")
return gClr_darkgreen;
873 if (c ==
"lgreenb")
return gClr_lgreen_b;
874 if (c ==
"dyellow")
return gClr_darkyellow;
876 if (c ==
"bold")
return gClr_bold;
877 if (c ==
"bblack")
return gClr_black_b;
879 if (c ==
"blue_bgd")
return gClr_blue_bg;
880 if (c ==
"red_bgd" )
return gClr_red_bg;
882 if (c ==
"white_on_blue" )
return gClr_whiteonblue;
883 if (c ==
"white_on_green")
return gClr_whiteongreen;
885 if (c ==
"reset")
return gClr_reset;
887 std::cout <<
"Unknown color " << c << std::endl;
902 if ((
UInt_t)values.size() != nvar) {
903 logger <<
kFATAL <<
"<FormattedOutput> fatal error with dimensions: " 904 << values.size() <<
" OR " <<
" != " << nvar <<
Endl;
909 std::vector<UInt_t> vLengths;
918 UInt_t clen = maxL + maxV + 3;
921 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
925 logger << setw(maxL) << titleVars <<
":";
926 logger << setw(maxV+1) << titleValues <<
":";
928 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
932 for (
UInt_t irow=0; irow<nvar; irow++) {
933 logger << setw(maxL) << V[irow] <<
":";
934 logger << setw(maxV+1) <<
Form( format.Data(), values[irow] );
939 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
951 logger <<
kFATAL <<
"<FormattedOutput> fatal error with dimensions: " 958 std::vector<UInt_t> vLengths;
959 for (
UInt_t ivar=0; ivar<nvar; ivar++) {
966 for (
UInt_t icol=0; icol<nvar; icol++) clen += vLengths[icol]+1;
969 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
973 logger << setw(maxL+1) <<
" ";
974 for (
UInt_t icol=0; icol<nvar; icol++) logger << setw(vLengths[icol]+1) << V[icol];
978 for (
UInt_t irow=0; irow<nvar; irow++) {
979 logger << setw(maxL) << V[irow] <<
":";
980 for (
UInt_t icol=0; icol<nvar; icol++) {
981 logger << setw(vLengths[icol]+1) <<
Form(
"%+1.3f", M(irow,icol) );
987 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
995 const std::vector<TString>& vert,
const std::vector<TString>& horiz,
999 UInt_t nvvar = vert.size();
1000 UInt_t nhvar = horiz.size();
1005 std::vector<UInt_t> vLengths;
1006 for (
UInt_t ivar=0; ivar<nvvar; ivar++) {
1014 std::vector<UInt_t> hLengths;
1015 for (
UInt_t ivar=0; ivar<nhvar; ivar++) {
1017 maxLh =
TMath::Max( hLengths.back(), maxLh );
1021 for (
UInt_t icol=0; icol<nhvar; icol++) clen += hLengths[icol]+1;
1024 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
1028 logger << setw(maxL+1) <<
" ";
1029 for (
UInt_t icol=0; icol<nhvar; icol++) logger << setw(hLengths[icol]+1) << horiz[icol];
1033 for (
UInt_t irow=0; irow<nvvar; irow++) {
1034 logger << setw(maxL) << vert[irow] <<
":";
1035 for (
UInt_t icol=0; icol<nhvar; icol++) {
1036 logger << setw(hLengths[icol]+1) <<
Form(
"%+1.3f", M(irow,icol) );
1042 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
1051 return ( unit ==
"" ? title : ( title +
" [" + unit +
"]" ) );
1059 TString retval = ( normalised ?
"(1/N) " :
"" );
1069 os << val <<
" :: ";
1071 for (
int i=0; i<4; i++) {
1072 Int_t ic = *((
char*)c+i)-
'\0';
1090 for (
int i=0; i<4; i++) {
1092 *((
char*)ap+i) =
'\0'+c[i];
1114 if (!
HasAttr(node, attrname)) {
1116 Log() <<
kFATAL <<
"Trying to read non-existing attribute '" << attrname <<
"' from xml node '" << nodename <<
"'" <<
Endl;
1127 if( node == 0 )
return;
1136 if( !isRootNode && parent == 0 )
return 0;
1143 if( node == 0 )
return kFALSE;
1161 if (childname != 0) {
1173 if (childname != 0) {
1209 std::vector<TString> splitV;
1211 splitOpt.ReplaceAll(
"\n",
" ");
1213 while (splitOpt.Length()>0) {
1214 if ( !splitOpt.Contains(separator) ) {
1215 splitV.push_back(splitOpt);
1219 TString toSave = splitOpt(0,splitOpt.First(separator));
1220 splitV.push_back(toSave);
1221 splitOpt = splitOpt(splitOpt.First(separator),splitOpt.Length());
1233 std::stringstream s;
1235 return TString(s.str().c_str());
1243 std::stringstream s;
1244 s <<
Form(
"%5.8e", d );
1245 return TString(s.str().c_str());
1256 std::stringstream s;
1259 s <<
Form(
"%5.15e ", (*mat)[row][col] );
1279 for (
int i=0;i<vec->
GetNoElements();++i) (*vec)[i] = mat[0][i];
1286 if (strcmp(
xmlengine().GetNodeName(node),name)!=0){
1287 Log() <<
kWARNING <<
"Possible Error: Name of matrix in weight file" 1288 <<
" does not match name of matrix passed as argument!" <<
Endl;
1292 ReadAttr( node,
"Columns", ncols );
1294 Log() <<
kWARNING <<
"Possible Error: Dimension of matrix in weight file" 1295 <<
" does not match dimension of matrix passed as argument!" <<
Endl;
1299 std::stringstream s(content);
1300 for (
Int_t row = 0; row<nrows; row++) {
1301 for (
Int_t col = 0; col<ncols; col++) {
1302 s >> (*mat)[row][col];
1312 std::cout << std::endl;
1313 std::cout <<
Color(
"bold") <<
"TMVA -- Toolkit for Multivariate Data Analysis" <<
Color(
"reset") << std::endl;
1315 std::cout <<
" " <<
"Copyright (C) 2005-2010 CERN, MPI-K Heidelberg, Us of Bonn and Victoria" << std::endl;
1316 std::cout <<
" " <<
"Home page: http://tmva.sf.net" << std::endl;
1317 std::cout <<
" " <<
"Citation info: http://tmva.sf.net/citeTMVA.html" << std::endl;
1318 std::cout <<
" " <<
"License: http://tmva.sf.net/LICENSE" << std::endl << std::endl;
1335 static const char *
const months[] = {
"Jan",
"Feb",
"Mar",
"Apr",
"May",
1336 "Jun",
"Jul",
"Aug",
"Sep",
"Oct",
1339 Int_t iday = idatqq%100;
1340 Int_t imonth = (idatqq/100)%100;
1341 Int_t iyear = (idatqq/10000);
1342 TString versionDate =
Form(
"%s %d, %4d",months[imonth-1],iday,iyear);
1345 logger <<
"You are running ROOT Version: " <<
gROOT->GetVersion() <<
", " << versionDate <<
Endl;
1357 logger <<
Color(
"white") <<
"TMVA -- Toolkit for Multivariate Analysis" <<
Color(
"reset") <<
Endl;
1358 logger <<
"Copyright (C) 2005-2006 CERN, LAPP & MPI-K Heidelberg and Victoria U." <<
Endl;
1359 logger <<
"Home page http://tmva.sourceforge.net" <<
Endl;
1360 logger <<
"All rights reserved, please read http://tmva.sf.net/license.txt" << Endl <<
Endl;
1364 logger <<
" ___ ___ ___ ___ " <<
Endl;
1365 logger <<
" /\\ \\ /\\__\\ /\\__\\ /\\ \\ " <<
Endl;
1366 logger <<
" \\:\\ \\ /::| | /:/ / /::\\ \\ " <<
Endl;
1367 logger <<
" \\:\\ \\ /:|:| | /:/ / /:/\\:\\ \\ " <<
Endl;
1368 logger <<
" /::\\ \\ /:/|:|__|__ /:/__/ ___ /::\\~\\:\\ \\ " <<
Endl;
1369 logger <<
" /:/\\:\\__\\ /:/ |::::\\__\\ |:| | /\\__\\ /:/\\:\\ \\:\\__\\ " <<
Endl;
1370 logger <<
" /:/ \\/__/ \\/__/~~/:/ / |:| |/:/ / \\/__\\:\\/:/ / " <<
Endl;
1371 logger <<
"/:/ / /:/ / |:|__/:/ / \\::/ / " <<
Endl;
1372 logger <<
"\\/__/ /:/ / \\::::/__/ /:/ / " <<
Endl;
1373 logger <<
" /:/ / ~~~~ /:/ / " <<
Endl;
1374 logger <<
" \\/__/ \\/__/ " << Endl <<
Endl;
1379 logger <<
"_|_|_|_|_| _| _| _| _| _|_| " <<
Endl;
1380 logger <<
" _| _|_| _|_| _| _| _| _| " <<
Endl;
1381 logger <<
" _| _| _| _| _| _| _|_|_|_| " <<
Endl;
1382 logger <<
" _| _| _| _| _| _| _| " <<
Endl;
1383 logger <<
" _| _| _| _| _| _| " << Endl <<
Endl;
1388 logger <<
"_/_/_/_/_/ _/ _/ _/ _/ _/_/ " <<
Endl;
1389 logger <<
" _/ _/_/ _/_/ _/ _/ _/ _/ " <<
Endl;
1390 logger <<
" _/ _/ _/ _/ _/ _/ _/_/_/_/ " <<
Endl;
1391 logger <<
" _/ _/ _/ _/ _/ _/ _/ " <<
Endl;
1392 logger <<
"_/ _/ _/ _/ _/ _/ " << Endl <<
Endl;
1397 logger <<
"_/_/_/_/_/ _| _| _| _| _|_| " <<
Endl;
1398 logger <<
" _/ _|_| _|_| _| _| _| _| " <<
Endl;
1399 logger <<
" _/ _| _| _| _| _| _|_|_|_| " <<
Endl;
1400 logger <<
" _/ _| _| _| _| _| _| " <<
Endl;
1401 logger <<
"_/ _| _| _| _| _| " << Endl <<
Endl;
1405 logger <<
" _____ __ ____ ___ " <<
Endl;
1406 logger <<
"|_ _| \\/ \\ \\ / /_\\ " <<
Endl;
1407 logger <<
" | | | |\\/| |\\ V / _ \\ " <<
Endl;
1408 logger <<
" |_| |_| |_| \\_/_/ \\_\\" << Endl <<
Endl;
1412 logger <<
" _____ __ ____ ___ " <<
Endl;
1413 logger <<
"|_ _| \\/ \\ \\ / / \\ " <<
Endl;
1414 logger <<
" | | | |\\/| |\\ \\ / / _ \\ " <<
Endl;
1415 logger <<
" | | | | | | \\ V / ___ \\ " <<
Endl;
1416 logger <<
" |_| |_| |_| \\_/_/ \\_\\ " << Endl <<
Endl;
1421 <<
"_______________________________________" <<
Color(
"reset") <<
Endl;
1425 <<
"|\\ /|| \\ // /\\\\\\\\\\\\\\\\\\\\\\\\ \\ \\ \\ " <<
Color(
"reset") <<
Endl;
1429 <<
"| \\/ || \\// /--\\\\\\\\\\\\\\\\\\\\\\\\ \\ \\ \\" <<
Color(
"reset") <<
Endl;
1433 logger <<
kINFO <<
"" 1434 <<
"_______________________________________" <<
Endl;
1435 logger <<
kINFO <<
" // " 1436 <<
"|\\ /|| \\ // /\\\\\\\\\\\\\\\\\\\\\\\\ \\ \\ \\ " <<
Endl;
1437 logger <<
kINFO <<
"// " 1438 <<
"| \\/ || \\// /--\\\\\\\\\\\\\\\\\\\\\\\\ \\ \\ \\" <<
Endl;
1442 logger <<
kFATAL <<
"unknown message type: " << msgType <<
Endl;
1454 logger <<
"A. Hoecker, P. Speckmayer, J. Stelzer, J. Therhaag, E. von Toerne, H. Voss" <<
Endl;
1455 logger <<
"\"TMVA - Toolkit for Multivariate Data Analysis\" PoS ACAT:040,2007. e-Print: physics/0703039" <<
Endl;
1459 logger <<
"@Article{TMVA2007," <<
Endl;
1460 logger <<
" author = \"Hoecker, Andreas and Speckmayer, Peter and Stelzer, Joerg " <<
Endl;
1461 logger <<
" and Therhaag, Jan and von Toerne, Eckhard and Voss, Helge\"," <<
Endl;
1462 logger <<
" title = \"{TMVA: Toolkit for multivariate data analysis}\"," <<
Endl;
1463 logger <<
" journal = \"PoS\"," <<
Endl;
1464 logger <<
" volume = \"ACAT\"," <<
Endl;
1465 logger <<
" year = \"2007\"," <<
Endl;
1466 logger <<
" pages = \"040\"," <<
Endl;
1467 logger <<
" eprint = \"physics/0703039\"," <<
Endl;
1468 logger <<
" archivePrefix = \"arXiv\"," <<
Endl;
1469 logger <<
" SLACcitation = \"%%CITATION = PHYSICS/0703039;%%\"" <<
Endl;
1470 logger <<
"}" <<
Endl;
1474 logger <<
"%\\cite{TMVA2007}" <<
Endl;
1475 logger <<
"\\bibitem{TMVA2007}" <<
Endl;
1476 logger <<
" A.~Hoecker, P.~Speckmayer, J.~Stelzer, J.~Therhaag, E.~von Toerne, H.~Voss" <<
Endl;
1477 logger <<
" %``TMVA: Toolkit for multivariate data analysis,''" <<
Endl;
1478 logger <<
" PoS A {\\bf CAT} (2007) 040" <<
Endl;
1479 logger <<
" [arXiv:physics/0703039]." <<
Endl;
1480 logger <<
" %%CITATION = POSCI,ACAT,040;%%" <<
Endl;
1488 <<
"For citation information, please visit: http://tmva.sf.net/citeTMVA.html" 1502 std::vector<TMatrixDSym*>*
1505 std::vector<Event*> eventVector;
1506 for (std::vector<const Event*>::const_iterator it = events.begin(), itEnd = events.end(); it != itEnd; ++it)
1508 eventVector.push_back (
new Event(*(*it)));
1511 for (std::vector<Event*>::const_iterator it = eventVector.begin(), itEnd = eventVector.end(); it != itEnd; ++it)
1521 std::vector<TMatrixDSym*>*
1524 if (events.empty()) {
1525 Log() <<
kWARNING <<
" Asked to calculate a covariance matrix for an empty event vectors.. sorry cannot do that -> return NULL"<<
Endl;
1529 UInt_t nvars=0, ntgts=0, nspcts=0;
1533 nvars =events.at(0)->GetNVariables ();
1534 ntgts =events.at(0)->GetNTargets ();
1535 nspcts=events.at(0)->GetNSpectators();
1540 Int_t matNum = maxCls;
1541 if (maxCls > 1 ) matNum++;
1543 std::vector<TVectorD*>* vec =
new std::vector<TVectorD*>(matNum);
1544 std::vector<TMatrixD*>* mat2 =
new std::vector<TMatrixD*>(matNum);
1545 std::vector<Double_t> count(matNum);
1546 count.assign(matNum,0);
1552 for (cls = 0; cls < matNum ; cls++) {
1553 vec->at(cls) =
new TVectorD(nvars);
1554 mat2->at(cls) =
new TMatrixD(nvars,nvars);
1558 for (ivar=0; ivar<nvars; ivar++) {
1560 for (jvar=0; jvar<nvars; jvar++) {
1561 (*m)(ivar, jvar) = 0;
1567 for (
UInt_t i=0; i<events.size(); i++) {
1570 const Event * ev = events[i];
1574 std::vector<Float_t> input;
1575 std::vector<Char_t> mask;
1577 if (transformBase) {
1578 transformBase->
GetInput (ev, input, mask);
1580 for (ivar=0; ivar<nvars; ++ivar) {
1581 input.push_back (ev->
GetValue(ivar));
1586 v = vec->at(matNum-1);
1587 m = mat2->at(matNum-1);
1589 count.at(matNum-1)+=weight;
1590 for (ivar=0; ivar<nvars; ivar++) {
1593 (*v)(ivar) += xi*weight;
1594 (*m)(ivar, ivar) += (xi*xi*weight);
1596 for (jvar=ivar+1; jvar<nvars; jvar++) {
1598 (*m)(ivar, jvar) += (xi*xj*weight);
1599 (*m)(jvar, ivar) = (*m)(ivar, jvar);
1604 count.at(cls)+=weight;
1607 for (ivar=0; ivar<nvars; ivar++) {
1609 (*v)(ivar) += xi*weight;
1610 (*m)(ivar, ivar) += (xi*xi*weight);
1612 for (jvar=ivar+1; jvar<nvars; jvar++) {
1614 (*m)(ivar, jvar) += (xi*xj*weight);
1615 (*m)(jvar, ivar) = (*m)(ivar, jvar);
1621 std::vector<TMatrixDSym*>* mat =
new std::vector<TMatrixDSym*>(matNum);
1622 for (cls = 0; cls < matNum; cls++) {
1629 for (ivar=0; ivar<nvars; ivar++) {
1630 for (jvar=0; jvar<nvars; jvar++) {
1631 (*(mat->at(cls)))(ivar, jvar) = (*m)(ivar, jvar)/n - (*v)(ivar)*(*v)(jvar)/(n*n);
1644 template <
typename Iterator,
typename WeightIterator>
1656 while ( first != last )
1668 ::Error(
"TMVA::Tools::Mean",
"sum of weights <= 0 ?! that's a bit too much of negative event weights :) ");
1674 while ( first != last )
1680 sum += (*w) * (*first);
1687 ::Error(
"TMVA::Tools::Mean",
"sum of weights <= 0 ?! that's a bit too much of negative event weights :) ");
1694 template <
typename T>
1706 template <
typename Iterator,
typename WeightIterator>
1720 while ( first != last ) {
1723 sum2 += adouble*adouble;
1730 while ( first != last ) {
1732 sum += adouble * (*w);
1733 sum2 += adouble*adouble * (*w);
1745 template <
typename T>
1770 for (
Int_t ibinEnd=1, ibin=cumulativeDist->
GetNbinsX(); ibin >=ibinEnd ; ibin--){
1772 if (val>0) inverseSum += val;
1774 inverseSum = 1/inverseSum;
1776 for (
Int_t ibinEnd=1, ibin=cumulativeDist->
GetNbinsX(); ibin >=ibinEnd ; ibin--){
1778 if (val>0) partialSum += val;
1781 return cumulativeDist;
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
static long int sum(long int i)
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
MsgLogger & Endl(MsgLogger &ml)
TMatrixT< Element > & Transpose(const TMatrixT< Element > &source)
Transpose matrix source.
virtual void PutStats(Double_t *stats)
Replace current statistics with the values in array stats.
Collectable string class.
TH1D * ProjectionY(const char *name="_py", Int_t firstxbin=0, Int_t lastxbin=-1, Option_t *option="") const
Project a 2-D histogram into a 1-D histogram along Y.
virtual TH2 * RebinY(Int_t ngroup=2, const char *newname="")
Rebin only the Y axis see Rebin2D.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
THist< 1, float, THistStatContent, THistStatUncertainty > TH1F
Base class for spline implementation containing the Draw/Paint methods //.
virtual Double_t GetSumOfWeights() const
Return the sum of weights excluding under/overflows.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
virtual Double_t GetMean(Int_t axis=1) const
For axis = 1,2 or 3 returns the mean value of the histogram along X,Y or Z axis.
XMLNodePointer_t GetNext(XMLNodePointer_t xmlnode, Bool_t realnode=kTRUE)
return next to xmlnode node if realnode==kTRUE, any special nodes in between will be skipped ...
virtual Double_t Integral(Option_t *option="") const
Return integral of bin contents.
Double_t GetRMS(Int_t axis=1) const
Bool_t AddComment(XMLNodePointer_t parent, const char *comment)
Adds comment line to the node.
static std::string format(double x, double y, int digits, int width)
virtual TMatrixTBase< Element > & ResizeTo(Int_t nrows, Int_t ncols, Int_t=-1)
Set size of the matrix to nrows x ncols New dynamic elements are created, the overlapping part of the...
const char * GetNodeContent(XMLNodePointer_t xmlnode)
get contents (if any) of xml node
Double_t RMS(Long64_t n, const T *a, const Double_t *w=0)
double pow(double, double)
std::vector< std::vector< double > > Data
Double_t GetWeight() const
return the event weight - depending on whether the flag IgnoreNegWeightsInTraining is or not...
void Error(const char *location, const char *msgfmt,...)
TVectorT< Double_t > TVectorD
TMatrixT< Element > & Invert(Double_t *det=0)
Invert the matrix and calculate its determinant.
const char * GetNodeName(XMLNodePointer_t xmlnode)
returns name of xmlnode
TMatrixT< Double_t > TMatrixD
RooArgSet S(const RooAbsArg &v1)
Bool_t AddRawLine(XMLNodePointer_t parent, const char *line)
Add just line into xml file Line should has correct xml syntax that later it can be decoded by xml pa...
Service class for 2-Dim histogram classes.
virtual void GetStats(Double_t *stats) const
Fill the array stats from the contents of this histogram The array stats must be correctly dimensionn...
tomato 2-D histogram with a float per channel (see TH1 documentation)}
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...
Double_t Mean(Long64_t n, const T *a, const Double_t *w=0)
char * Form(const char *fmt,...)
Int_t GetNoElements() const
virtual Double_t Eval(Double_t x) const =0
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
const TMatrixD & GetEigenVectors() const
Float_t GetValue(UInt_t ivar) const
return value of i'th variable
Bool_t HasAttr(XMLNodePointer_t xmlnode, const char *name)
checks if node has attribute of specified name
virtual Int_t GetSumw2N() const
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
virtual TH2 * RebinX(Int_t ngroup=2, const char *newname="")
Rebin only the X axis see Rebin2D.
const char * GetAttr(XMLNodePointer_t xmlnode, const char *name)
returns value of attribute for xmlnode
TMatrixTSym< Double_t > TMatrixDSym
#define TMVA_RELEASE_DATE
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
virtual void Add(TObject *obj)
XMLNodePointer_t GetChild(XMLNodePointer_t xmlnode, Bool_t realnode=kTRUE)
returns first child of xml node
XMLNodePointer_t GetParent(XMLNodePointer_t xmlnode)
returns parent of xmlnode
Short_t Max(Short_t a, Short_t b)
XMLNodePointer_t NewChild(XMLNodePointer_t parent, XMLNsPointer_t ns, const char *name, const char *content=0)
create new child element for parent node
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
TString()
TString default ctor.
float type_of_call hi(const int &, const int &)
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content.
void Mult(const TMatrixT< Element > &a, const TMatrixT< Element > &b)
General matrix multiplication. Create a matrix C such that C = A * B.
virtual Int_t GetNbinsX() const
Double_t Sqrt(Double_t x)
virtual Int_t GetSize() const
THist< 2, float, THistStatContent, THistStatUncertainty > TH2F
double norm(double *x, double *p)
const TArrayD * GetXbins() const
virtual const char * GetTitle() const
Returns title of object.
virtual Int_t GetNbinsY() const
Double_t GetVal(Double_t x) const
returns value PDF(x)