68 #if __cplusplus > 199711L 76 #if __cplusplus > 199711L 80 if(! fgTools.compare_exchange_strong(expected,tmp)) {
87 return fgTools?*(fgTools): *(fgTools =
new Tools());
93 #if __cplusplus > 199711L 94 if (fgTools != 0) {
delete fgTools.load(); fgTools=0; }
96 if (fgTools != 0) {
delete fgTools; fgTools=0; }
104 fRegexp(
"$&|!%^&()'<>?= "),
124 return 2*(x -
xmin)/(xmax - xmin) - 1.0;
141 Log() << kFATAL <<
"<GetSeparation> signal and background" 142 <<
" histograms have different number of bins: " 152 Log() << kFATAL <<
"<GetSeparation> signal and background" 153 <<
" histograms have different or invalid dimensions:" <<
Endl;
161 if (nS > 0 && nB > 0) {
162 for (
Int_t bin=0; bin<nstep; bin++) {
166 if (s + b > 0) separation += (s -
b)*(s - b)/(s +
b);
168 separation *= (0.5*intBin);
171 Log() << kWARNING <<
"<GetSeparation> histograms with zero entries: " 172 << nS <<
" : " << nB <<
" cannot compute separation" 192 Log() << kFATAL <<
"<GetSeparation> Mismatch in PDF limits: " 199 for (
Int_t bin=0; bin<nstep; bin++) {
204 if (s + b > 0) separation += (s -
b)*(s - b)/(s +
b);
206 separation *= (0.5*intBin);
221 Log() << kFATAL <<
"<Tools::ComputeStat> value vector is zero pointer" <<
Endl;
223 if ( events.size() != valVec->size() )
224 Log() << kWARNING <<
"<Tools::ComputeStat> event and value vector have different lengths " 225 << events.size() <<
"!=" << valVec->size() <<
Endl;
241 xmin_ = *std::min( valVec->begin(), valVec->end() );
242 xmax_ = *std::max( valVec->begin(), valVec->end() );
245 for (
Int_t ievt=0; ievt<entries; ievt++) {
250 wgtVecS[nEventsS] = events[ievt]->GetWeight();
251 varVecS[nEventsS++] = theVar;
254 wgtVecB[nEventsB] = events[ievt]->GetWeight();
255 varVecB[nEventsB++] = theVar;
258 if (theVar > xmax) xmax = theVar;
259 if (theVar < xmin) xmin = theVar;
297 d->
Mult( (*si), (*symMat) ); (*d) *= (*s);
302 for (i=0; i<
n; i++) {
303 for (j=0; j<
n; j++) {
305 (i == j && (*d)(i,i) < 0)) {
307 Log() << kWARNING <<
"<GetSQRootMatrix> error in matrix diagonalization; printed S and B" <<
Endl;
313 for (i=0; i<
n; i++)
for (j=0; j<
n; j++)
if (j != i) (*d)(i,j) = 0;
319 sqrtMat->
Mult( (*s), (*d) );
339 if (covMat == 0)
return 0;
343 Log() << kFATAL <<
"<GetCorrelationMatrix> input matrix not quadratic" <<
Endl;
347 for (
Int_t ivar=0; ivar<nvar; ivar++) {
348 for (
Int_t jvar=0; jvar<nvar; jvar++) {
350 Double_t d = (*covMat)(ivar, ivar)*(*covMat)(jvar, jvar);
351 if (d > 1
E-20) (*corrMat)(ivar, jvar) = (*covMat)(ivar, jvar)/
TMath::Sqrt(d);
353 Log() <<
"<GetCorrelationMatrix> zero variances for variables " 354 <<
"(" << ivar <<
", " << jvar <<
")" <<
Endl;
355 (*corrMat)(ivar, jvar) = 0;
359 <<
" Element corr("<<ivar<<
","<<ivar<<
")=" << (*corrMat)(ivar,jvar)
361 <<
" cov("<<ivar<<
","<<ivar<<
")=" <<(*covMat)(ivar, ivar)
362 <<
" cov("<<jvar<<
","<<jvar<<
")=" <<(*covMat)(jvar, jvar)
367 else (*corrMat)(ivar, ivar) = 1.0;
384 TH1* hist =
new TH1F( name, name, nbins, xmin, xmax );
386 theTree->Project( name, theVarName, cut );
396 if (!theHist)
return 0;
402 if (w > 0) theHist->
Scale( norm/w );
416 while (formatString.First(sep)==0) formatString.Remove(0,1);
418 while (formatString.Length()>0) {
419 if (formatString.First(sep) == -1) {
425 Ssiz_t posSep = formatString.First(sep);
427 formatString.Remove(0,posSep+1);
429 while (formatString.First(sep)==0) formatString.Remove(0,1);
455 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;
501 Double_t dev = 0.5*(ys - yh)/(ys + yh);
503 Log() << kFATAL <<
"<CheckSplines> Spline failed sanity criterion; " 504 <<
" relative deviation from histogram: " << dev
505 <<
" in (bin, value): (" << ibin <<
", " << x <<
")" <<
Endl;
519 if (a.size() != b.size()) {
522 vector<Double_t>
result(a.size());
532 for (
UInt_t i=0; i<v.size();i++) v[i]*=f;
540 for (
UInt_t i=0; i<v.size();i++) v[i]*=f;
553 UInt_t sizeofarray=
v[0].size();
554 for (
UInt_t i=0; i<sizeofarray; i++) {
555 for (
UInt_t j=sizeofarray-1; j>i; j--) {
556 if (
v[0][j-1] >
v[0][j]) {
557 for (
UInt_t k=0; k< nArrays; k++) {
558 temp =
v[k][j-1];
v[k][j-1] =
v[k][j];
v[k][j] = temp;
561 TString temps = (*vs)[j-1]; (*vs)[j-1] = (*vs)[j]; (*vs)[j] = temps;
580 UInt_t sizeofarray=
v[0].size();
581 for (
UInt_t i=0; i<sizeofarray; i++) {
582 for (
UInt_t j=sizeofarray-1; j>i; j--) {
583 if (
v[0][j-1] <
v[0][j]) {
584 for (
UInt_t k=0; k< nArrays; k++) {
585 temp =
v[k][j-1];
v[k][j-1] =
v[k][j];
v[k][j] = temp;
588 TString temps = (*vs)[j-1]; (*vs)[j-1] = (*vs)[j]; (*vs)[j] = temps;
603 if (hi == 0)
return -1;
613 for (
Int_t x = 1;
x <= maxBinX;
x++) {
614 for (
Int_t y = 1;
y <= maxBinY;
y++) {
618 if (p_x > 0. && p_y > 0. && p_xy > 0.){
619 mutualInfo += p_xy*
TMath::Log(p_xy / (p_x * p_y));
634 if (hi == 0.)
return -1;
672 Log() << kFATAL <<
"<TransposeHist> cannot transpose non-quadratic histogram" <<
Endl;
675 TH2F *transposedHisto =
new TH2F( h );
687 stats_new[0] = stats_old[0];
688 stats_new[1] = stats_old[1];
689 stats_new[2] = stats_old[4];
690 stats_new[3] = stats_old[5];
691 stats_new[4] = stats_old[2];
692 stats_new[5] = stats_old[3];
693 stats_new[6] = stats_old[6];
694 transposedHisto->
PutStats(stats_new);
696 return transposedHisto;
708 s.ReplaceAll(
" ",
"");
709 if (s.Contains(
"silent") && !s.Contains(
"silent=f")) {
710 if (!s.Contains(
"!silent") || s.Contains(
"silent=t")) isSilent =
kTRUE;
725 s.ReplaceAll(
" ",
"");
727 for (std::vector<TString>::iterator it = v.begin(); it != v.end(); it++) {
728 if ((*it ==
"v" || *it ==
"verbose") && !it->Contains(
"!")) isVerbose =
kTRUE;
739 vector< vector<Double_t> > vtemp;
750 vector<vector<Double_t> > vtemp;
761 if (v.empty())
return -1;
764 for (
UInt_t i=0; i<v.size(); i++){
778 if (v.empty())
return -1;
781 for (
UInt_t i=0; i<v.size(); i++){
815 snew.ReplaceAll(
"::", r );
816 snew.ReplaceAll(
"$",
"_S_" );
817 snew.ReplaceAll(
"&",
"_A_" );
818 snew.ReplaceAll(
"%",
"_MOD_" );
819 snew.ReplaceAll(
"|",
"_O_" );
820 snew.ReplaceAll(
"*",
"_T_" );
821 snew.ReplaceAll(
"/",
"_D_" );
822 snew.ReplaceAll(
"+",
"_P_" );
823 snew.ReplaceAll(
"-",
"_M_" );
824 snew.ReplaceAll(
" ",
"_" );
825 snew.ReplaceAll(
"[",
"_" );
826 snew.ReplaceAll(
"]",
"_" );
827 snew.ReplaceAll(
"=",
"_E_" );
828 snew.ReplaceAll(
">",
"_GT_" );
829 snew.ReplaceAll(
"<",
"_LT_" );
830 snew.ReplaceAll(
"(",
"_" );
831 snew.ReplaceAll(
")",
"_" );
841 static const TString gClr_none =
"" ;
842 static const TString gClr_white =
"\033[1;37m";
843 static const TString gClr_black =
"\033[30m";
844 static const TString gClr_blue =
"\033[34m";
845 static const TString gClr_red =
"\033[1;31m" ;
846 static const TString gClr_yellow =
"\033[1;33m";
847 static const TString gClr_darkred =
"\033[31m";
848 static const TString gClr_darkgreen =
"\033[32m";
849 static const TString gClr_darkyellow =
"\033[33m";
851 static const TString gClr_bold =
"\033[1m" ;
852 static const TString gClr_black_b =
"\033[30m" ;
853 static const TString gClr_lblue_b =
"\033[1;34m" ;
854 static const TString gClr_cyan_b =
"\033[0;36m" ;
855 static const TString gClr_lgreen_b =
"\033[1;32m";
857 static const TString gClr_blue_bg =
"\033[44m";
858 static const TString gClr_red_bg =
"\033[1;41m";
859 static const TString gClr_whiteonblue =
"\033[1;44m";
860 static const TString gClr_whiteongreen =
"\033[1;42m";
861 static const TString gClr_grey_bg =
"\033[47m";
863 static const TString gClr_reset =
"\033[0m";
865 if (!
gConfig().UseColor())
return gClr_none;
867 if (c ==
"white" )
return gClr_white;
868 if (c ==
"blue" )
return gClr_blue;
869 if (c ==
"black" )
return gClr_black;
870 if (c ==
"lightblue")
return gClr_cyan_b;
871 if (c ==
"yellow")
return gClr_yellow;
872 if (c ==
"red" )
return gClr_red;
873 if (c ==
"dred" )
return gClr_darkred;
874 if (c ==
"dgreen")
return gClr_darkgreen;
875 if (c ==
"lgreenb")
return gClr_lgreen_b;
876 if (c ==
"dyellow")
return gClr_darkyellow;
878 if (c ==
"bold")
return gClr_bold;
879 if (c ==
"bblack")
return gClr_black_b;
881 if (c ==
"blue_bgd")
return gClr_blue_bg;
882 if (c ==
"red_bgd" )
return gClr_red_bg;
884 if (c ==
"white_on_blue" )
return gClr_whiteonblue;
885 if (c ==
"white_on_green")
return gClr_whiteongreen;
887 if (c ==
"reset")
return gClr_reset;
889 std::cout <<
"Unknown color " << c << std::endl;
904 if ((
UInt_t)values.size() != nvar) {
905 logger << kFATAL <<
"<FormattedOutput> fatal error with dimensions: " 906 << values.size() <<
" OR " <<
" != " << nvar <<
Endl;
911 std::vector<UInt_t> vLengths;
920 UInt_t clen = maxL + maxV + 3;
923 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
927 logger << setw(maxL) << titleVars <<
":";
928 logger << setw(maxV+1) << titleValues <<
":";
930 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
934 for (
UInt_t irow=0; irow<nvar; irow++) {
935 logger << setw(maxL) << V[irow] <<
":";
936 logger << setw(maxV+1) <<
Form( format.Data(), values[irow] );
941 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
953 logger << kFATAL <<
"<FormattedOutput> fatal error with dimensions: " 960 std::vector<UInt_t> vLengths;
961 for (
UInt_t ivar=0; ivar<nvar; ivar++) {
968 for (
UInt_t icol=0; icol<nvar; icol++) clen += vLengths[icol]+1;
971 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
975 logger << setw(maxL+1) <<
" ";
976 for (
UInt_t icol=0; icol<nvar; icol++) logger << setw(vLengths[icol]+1) << V[icol];
980 for (
UInt_t irow=0; irow<nvar; irow++) {
981 logger << setw(maxL) << V[irow] <<
":";
982 for (
UInt_t icol=0; icol<nvar; icol++) {
983 logger << setw(vLengths[icol]+1) <<
Form(
"%+1.3f", M(irow,icol) );
989 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
997 const std::vector<TString>& vert,
const std::vector<TString>& horiz,
1001 UInt_t nvvar = vert.size();
1002 UInt_t nhvar = horiz.size();
1007 std::vector<UInt_t> vLengths;
1008 for (
UInt_t ivar=0; ivar<nvvar; ivar++) {
1016 std::vector<UInt_t> hLengths;
1017 for (
UInt_t ivar=0; ivar<nhvar; ivar++) {
1019 maxLh =
TMath::Max( hLengths.back(), maxLh );
1023 for (
UInt_t icol=0; icol<nhvar; icol++) clen += hLengths[icol]+1;
1026 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
1030 logger << setw(maxL+1) <<
" ";
1031 for (
UInt_t icol=0; icol<nhvar; icol++) logger << setw(hLengths[icol]+1) << horiz[icol];
1035 for (
UInt_t irow=0; irow<nvvar; irow++) {
1036 logger << setw(maxL) << vert[irow] <<
":";
1037 for (
UInt_t icol=0; icol<nhvar; icol++) {
1038 logger << setw(hLengths[icol]+1) <<
Form(
"%+1.3f", M(irow,icol) );
1044 for (
UInt_t i=0; i<clen; i++) logger <<
"-";
1053 return ( unit ==
"" ? title : ( title +
" [" + unit +
"]" ) );
1061 TString retval = ( normalised ?
"(1/N) " :
"" );
1071 os << val <<
" :: ";
1073 for (
int i=0; i<4; i++) {
1074 Int_t ic = *((
char*)c+i)-
'\0';
1092 for (
int i=0; i<4; i++) {
1094 *((
char*)ap+i) =
'\0'+c[i];
1115 if (!
HasAttr(node, attrname)) {
1117 Log() << kFATAL <<
"Trying to read non-existing attribute '" << attrname <<
"' from xml node '" << nodename <<
"'" <<
Endl;
1128 if( node == 0 )
return;
1137 if( !isRootNode && parent == 0 )
return 0;
1144 if( node == 0 )
return kFALSE;
1164 if (childname != 0) {
1176 if (childname != 0) {
1212 std::vector<TString> splitV;
1214 splitOpt.ReplaceAll(
"\n",
" ");
1216 while (splitOpt.Length()>0) {
1217 if ( !splitOpt.Contains(separator) ) {
1218 splitV.push_back(splitOpt);
1222 TString toSave = splitOpt(0,splitOpt.First(separator));
1223 splitV.push_back(toSave);
1224 splitOpt = splitOpt(splitOpt.First(separator),splitOpt.Length());
1236 std::stringstream s;
1238 return TString(s.str().c_str());
1246 std::stringstream s;
1247 s <<
Form(
"%5.8e", d );
1248 return TString(s.str().c_str());
1259 std::stringstream s;
1262 s <<
Form(
"%5.15e ", (*mat)[row][col] );
1282 for (
int i=0;i<vec->
GetNoElements();++i) (*vec)[i] = mat[0][i];
1289 if (strcmp(
xmlengine().GetNodeName(node),name)!=0){
1290 Log() << kWARNING <<
"Possible Error: Name of matrix in weight file" 1291 <<
" does not match name of matrix passed as argument!" <<
Endl;
1295 ReadAttr( node,
"Columns", ncols );
1297 Log() << kWARNING <<
"Possible Error: Dimension of matrix in weight file" 1298 <<
" does not match dimension of matrix passed as argument!" <<
Endl;
1302 std::stringstream s(content);
1303 for (
Int_t row = 0; row<nrows; row++) {
1304 for (
Int_t col = 0; col<ncols; col++) {
1305 s >> (*mat)[row][col];
1315 std::cout << std::endl;
1316 std::cout <<
Color(
"bold") <<
"TMVA -- Toolkit for Multivariate Data Analysis" <<
Color(
"reset") << std::endl;
1318 std::cout <<
" " <<
"Copyright (C) 2005-2010 CERN, MPI-K Heidelberg, Us of Bonn and Victoria" << std::endl;
1319 std::cout <<
" " <<
"Home page: http://tmva.sf.net" << std::endl;
1320 std::cout <<
" " <<
"Citation info: http://tmva.sf.net/citeTMVA.html" << std::endl;
1321 std::cout <<
" " <<
"License: http://tmva.sf.net/LICENSE" << std::endl << std::endl;
1338 static const char *
const months[] = {
"Jan",
"Feb",
"Mar",
"Apr",
"May",
1339 "Jun",
"Jul",
"Aug",
"Sep",
"Oct",
1342 Int_t iday = idatqq%100;
1343 Int_t imonth = (idatqq/100)%100;
1344 Int_t iyear = (idatqq/10000);
1345 TString versionDate =
Form(
"%s %d, %4d",months[imonth-1],iday,iyear);
1348 logger <<
"You are running ROOT Version: " <<
gROOT->GetVersion() <<
", " << versionDate <<
Endl;
1360 logger <<
Color(
"white") <<
"TMVA -- Toolkit for Multivariate Analysis" <<
Color(
"reset") <<
Endl;
1361 logger <<
"Copyright (C) 2005-2006 CERN, LAPP & MPI-K Heidelberg and Victoria U." <<
Endl;
1362 logger <<
"Home page http://tmva.sourceforge.net" <<
Endl;
1363 logger <<
"All rights reserved, please read http://tmva.sf.net/license.txt" << Endl <<
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;
1375 logger <<
"\\/__/ /:/ / \\::::/__/ /:/ / " <<
Endl;
1376 logger <<
" /:/ / ~~~~ /:/ / " <<
Endl;
1377 logger <<
" \\/__/ \\/__/ " << Endl <<
Endl;
1382 logger <<
"_|_|_|_|_| _| _| _| _| _|_| " <<
Endl;
1383 logger <<
" _| _|_| _|_| _| _| _| _| " <<
Endl;
1384 logger <<
" _| _| _| _| _| _| _|_|_|_| " <<
Endl;
1385 logger <<
" _| _| _| _| _| _| _| " <<
Endl;
1386 logger <<
" _| _| _| _| _| _| " << Endl <<
Endl;
1391 logger <<
"_/_/_/_/_/ _/ _/ _/ _/ _/_/ " <<
Endl;
1392 logger <<
" _/ _/_/ _/_/ _/ _/ _/ _/ " <<
Endl;
1393 logger <<
" _/ _/ _/ _/ _/ _/ _/_/_/_/ " <<
Endl;
1394 logger <<
" _/ _/ _/ _/ _/ _/ _/ " <<
Endl;
1395 logger <<
"_/ _/ _/ _/ _/ _/ " << Endl <<
Endl;
1400 logger <<
"_/_/_/_/_/ _| _| _| _| _|_| " <<
Endl;
1401 logger <<
" _/ _|_| _|_| _| _| _| _| " <<
Endl;
1402 logger <<
" _/ _| _| _| _| _| _|_|_|_| " <<
Endl;
1403 logger <<
" _/ _| _| _| _| _| _| " <<
Endl;
1404 logger <<
"_/ _| _| _| _| _| " << Endl <<
Endl;
1408 logger <<
" _____ __ ____ ___ " <<
Endl;
1409 logger <<
"|_ _| \\/ \\ \\ / /_\\ " <<
Endl;
1410 logger <<
" | | | |\\/| |\\ V / _ \\ " <<
Endl;
1411 logger <<
" |_| |_| |_| \\_/_/ \\_\\" << Endl <<
Endl;
1415 logger <<
" _____ __ ____ ___ " <<
Endl;
1416 logger <<
"|_ _| \\/ \\ \\ / / \\ " <<
Endl;
1417 logger <<
" | | | |\\/| |\\ \\ / / _ \\ " <<
Endl;
1418 logger <<
" | | | | | | \\ V / ___ \\ " <<
Endl;
1419 logger <<
" |_| |_| |_| \\_/_/ \\_\\ " << Endl <<
Endl;
1423 logger << kINFO <<
"" <<
Color(
"red")
1424 <<
"_______________________________________" <<
Color(
"reset") <<
Endl;
1425 logger << kINFO <<
"" <<
Color(
"blue")
1428 <<
"|\\ /|| \\ // /\\\\\\\\\\\\\\\\\\\\\\\\ \\ \\ \\ " <<
Color(
"reset") <<
Endl;
1429 logger << kINFO <<
""<<
Color(
"blue")
1432 <<
"| \\/ || \\// /--\\\\\\\\\\\\\\\\\\\\\\\\ \\ \\ \\" <<
Color(
"reset") <<
Endl;
1436 logger << kINFO <<
"" 1437 <<
"_______________________________________" <<
Endl;
1438 logger << kINFO <<
" // " 1439 <<
"|\\ /|| \\ // /\\\\\\\\\\\\\\\\\\\\\\\\ \\ \\ \\ " <<
Endl;
1440 logger << kINFO <<
"// " 1441 <<
"| \\/ || \\// /--\\\\\\\\\\\\\\\\\\\\\\\\ \\ \\ \\" <<
Endl;
1445 logger << kFATAL <<
"unknown message type: " << msgType <<
Endl;
1457 logger <<
"A. Hoecker, P. Speckmayer, J. Stelzer, J. Therhaag, E. von Toerne, H. Voss" <<
Endl;
1458 logger <<
"\"TMVA - Toolkit for Multivariate Data Analysis\" PoS ACAT:040,2007. e-Print: physics/0703039" <<
Endl;
1462 logger <<
"@Article{TMVA2007," <<
Endl;
1463 logger <<
" author = \"Hoecker, Andreas and Speckmayer, Peter and Stelzer, Joerg " <<
Endl;
1464 logger <<
" and Therhaag, Jan and von Toerne, Eckhard and Voss, Helge\"," <<
Endl;
1465 logger <<
" title = \"{TMVA: Toolkit for multivariate data analysis}\"," <<
Endl;
1466 logger <<
" journal = \"PoS\"," <<
Endl;
1467 logger <<
" volume = \"ACAT\"," <<
Endl;
1468 logger <<
" year = \"2007\"," <<
Endl;
1469 logger <<
" pages = \"040\"," <<
Endl;
1470 logger <<
" eprint = \"physics/0703039\"," <<
Endl;
1471 logger <<
" archivePrefix = \"arXiv\"," <<
Endl;
1472 logger <<
" SLACcitation = \"%%CITATION = PHYSICS/0703039;%%\"" <<
Endl;
1473 logger <<
"}" <<
Endl;
1477 logger <<
"%\\cite{TMVA2007}" <<
Endl;
1478 logger <<
"\\bibitem{TMVA2007}" <<
Endl;
1479 logger <<
" A.~Hoecker, P.~Speckmayer, J.~Stelzer, J.~Therhaag, E.~von Toerne, H.~Voss" <<
Endl;
1480 logger <<
" %``TMVA: Toolkit for multivariate data analysis,''" <<
Endl;
1481 logger <<
" PoS A {\\bf CAT} (2007) 040" <<
Endl;
1482 logger <<
" [arXiv:physics/0703039]." <<
Endl;
1483 logger <<
" %%CITATION = POSCI,ACAT,040;%%" <<
Endl;
1491 <<
"For citation information, please visit: http://tmva.sf.net/citeTMVA.html" 1505 std::vector<TMatrixDSym*>*
1508 std::vector<Event*> eventVector;
1509 for (std::vector<const Event*>::const_iterator it = events.begin(), itEnd = events.end(); it != itEnd; ++it)
1511 eventVector.push_back (
new Event(*(*it)));
1514 for (std::vector<Event*>::const_iterator it = eventVector.begin(), itEnd = eventVector.end(); it != itEnd; ++it)
1524 std::vector<TMatrixDSym*>*
1527 if (events.empty()) {
1528 Log() << kWARNING <<
" Asked to calculate a covariance matrix for an empty event vectors.. sorry cannot do that -> return NULL"<<
Endl;
1532 UInt_t nvars=0, ntgts=0, nspcts=0;
1536 nvars =events.at(0)->GetNVariables ();
1537 ntgts =events.at(0)->GetNTargets ();
1538 nspcts=events.at(0)->GetNSpectators();
1543 Int_t matNum = maxCls;
1544 if (maxCls > 1 ) matNum++;
1546 std::vector<TVectorD*>* vec =
new std::vector<TVectorD*>(matNum);
1547 std::vector<TMatrixD*>* mat2 =
new std::vector<TMatrixD*>(matNum);
1548 std::vector<Double_t> count(matNum);
1549 count.assign(matNum,0);
1555 for (cls = 0; cls < matNum ; cls++) {
1556 vec->at(cls) =
new TVectorD(nvars);
1557 mat2->at(cls) =
new TMatrixD(nvars,nvars);
1561 for (ivar=0; ivar<nvars; ivar++) {
1563 for (jvar=0; jvar<nvars; jvar++) {
1564 (*m)(ivar, jvar) = 0;
1570 for (
UInt_t i=0; i<events.size(); i++) {
1573 const Event * ev = events[i];
1577 std::vector<Float_t> input;
1578 std::vector<Char_t> mask;
1580 if (transformBase) {
1581 transformBase->
GetInput (ev, input, mask);
1583 for (ivar=0; ivar<nvars; ++ivar) {
1584 input.push_back (ev->
GetValue(ivar));
1589 v = vec->at(matNum-1);
1590 m = mat2->at(matNum-1);
1592 count.at(matNum-1)+=weight;
1593 for (ivar=0; ivar<nvars; ivar++) {
1596 (*v)(ivar) += xi*weight;
1597 (*m)(ivar, ivar) += (xi*xi*weight);
1599 for (jvar=ivar+1; jvar<nvars; jvar++) {
1601 (*m)(ivar, jvar) += (xi*xj*weight);
1602 (*m)(jvar, ivar) = (*m)(ivar, jvar);
1607 count.at(cls)+=weight;
1610 for (ivar=0; ivar<nvars; ivar++) {
1612 (*v)(ivar) += xi*weight;
1613 (*m)(ivar, ivar) += (xi*xi*weight);
1615 for (jvar=ivar+1; jvar<nvars; jvar++) {
1617 (*m)(ivar, jvar) += (xi*xj*weight);
1618 (*m)(jvar, ivar) = (*m)(ivar, jvar);
1624 std::vector<TMatrixDSym*>* mat =
new std::vector<TMatrixDSym*>(matNum);
1625 for (cls = 0; cls < matNum; cls++) {
1632 for (ivar=0; ivar<nvars; ivar++) {
1633 for (jvar=0; jvar<nvars; jvar++) {
1634 (*(mat->at(cls)))(ivar, jvar) = (*m)(ivar, jvar)/n - (*v)(ivar)*(*v)(jvar)/(n*n);
1652 template <
typename Iterator,
typename WeightIterator>
1660 while ( first != last )
1672 ::Error(
"TMVA::Tools::Mean",
"sum of weights <= 0 ?! that's a bit too much of negative event weights :) ");
1678 while ( first != last )
1684 sum += (*w) * (*first);
1691 ::Error(
"TMVA::Tools::Mean",
"sum of weights <= 0 ?! that's a bit too much of negative event weights :) ");
1701 template <
typename T>
1716 template <
typename Iterator,
typename WeightIterator>
1727 while ( first != last ) {
1730 sum2 += adouble*adouble;
1737 while ( first != last ) {
1739 sum += adouble * (*w);
1740 sum2 += adouble*adouble * (*w);
1757 template <
typename T>
1780 for (
Int_t ibinEnd=1, ibin=cumulativeDist->
GetNbinsX(); ibin >=ibinEnd ; ibin--){
1782 if (val>0) inverseSum += val;
1784 inverseSum = 1/inverseSum;
1786 for (
Int_t ibinEnd=1, ibin=cumulativeDist->
GetNbinsX(); ibin >=ibinEnd ; ibin--){
1788 if (val>0) partialSum += val;
1791 return cumulativeDist;
1798 if (val ==
nullptr) {
1800 Log() << kFATAL <<
"Trying to read non-existing attribute '" << attrname <<
"' from xml node '" << nodename <<
"'" 1810 if (val ==
nullptr) {
1812 Log() << kFATAL <<
"Trying to read non-existing attribute '" << attrname <<
"' from xml node '" << nodename <<
"'" 1822 if (val ==
nullptr) {
1824 Log() << kFATAL <<
"Trying to read non-existing attribute '" << attrname <<
"' from xml node '" << nodename <<
"'"
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
PDF wrapper for histograms; uses user-defined spline interpolation.
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
ostringstream derivative to redirect and format output
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)