10 void TMVA::variablesMultiClass(TString dataset, TString fin , TString dirName , TString title,
 
   11                                Bool_t , Bool_t useTMVAStyle )
 
   13    TString outfname = dirName;
 
   14    TString tmp = dirName;
 
   15    tmp.ReplaceAll(
"InputVariables_",
"");
 
   16    outfname.ToLower(); outfname.ReplaceAll( 
"input", 
""  );
 
   19    TMVAGlob::Initialize( useTMVAStyle );
 
   22    TString htitle = title; 
 
   23    htitle.ReplaceAll(
"variables ",
"variable");
 
   24    htitle.ReplaceAll(
"and target(s)",
"");
 
   25    htitle.ReplaceAll(
"(training sample)",
"");
 
   28    TFile* file = TMVAGlob::OpenFile( fin );
 
   30    TDirectory* dir = (TDirectory*)file->GetDirectory(dataset.Data())->Get( dirName );
 
   32       cout << 
"No information about " << title << 
" available in directory " << dirName << 
" of file " << fin << endl;
 
   38    Int_t noPlots = TMVAGlob::GetNumberOfInputVariables( dir );
 
   48       xPad = 1; yPad = 1; width = 550; height = 0.90*width; 
break;
 
   50       xPad = 2; yPad = 1; width = 600; height = 0.50*width; 
break;
 
   52       xPad = 3; yPad = 1; width = 900; height = 0.4*width; 
break;
 
   54       xPad = 2; yPad = 2; width = 600; height = width; 
break;
 
   56       xPad = 3; yPad = 2; width = 800; height = 0.55*width; 
break;
 
   59    Int_t noPadPerCanv = xPad * yPad ;
 
   62    Int_t countCanvas = 0;
 
   67    Bool_t   createNewFig = kFALSE;
 
   68    TIter next(dir->GetListOfKeys());
 
   70    std::vector<TString> varnames(TMVAGlob::GetInputVariableNames(dir));
 
   71    std::vector<TString> classnames(TMVAGlob::GetClassNames(dir));
 
   74    std::vector<TString>::iterator variter = varnames.begin();
 
   75    std::vector<TString>::iterator classiter = classnames.begin();
 
   93    variter = varnames.begin();
 
   94    for(; variter!=varnames.end(); ++variter){
 
   97       if (countPad%noPadPerCanv==0) {
 
   99          canv = 
new TCanvas( Form(
"canvas%d", countCanvas), title,
 
  100                              countCanvas*50+50, countCanvas*20, width, height );
 
  101          canv->Divide(xPad,yPad);
 
  104       TPad* cPad = (TPad*)canv->cd(countPad++%noPadPerCanv+1);
 
  105       classiter = classnames.begin();
 
  108       for(; classiter!=classnames.end(); ++classiter){
 
  110          TString hname(*variter + 
"__" + *classiter + 
"_" + tmp);
 
  111          TH1 *hist = (TH1*)dir->Get(hname);
 
  114             cout << 
"ERROR!!! couldn't find " << *variter << 
" histogram for class " << *classiter << endl;
 
  123       TMVAGlob::SetMultiClassStyle( &hists ); 
 
  125       ((TH1*)hists.First())->SetTitle( TString( htitle ) + 
": " + *variter );
 
  127       TMVAGlob::SetFrameStyle( ((TH1*)hists.First()), 1.2 );
 
  130       Float_t histmax = -1;
 
  131       for(Int_t i=0; i<hists.GetEntriesFast(); ++i){
 
  132          TMVAGlob::NormalizeHist((TH1*)hists[i] );
 
  133          if(((TH1*)hists[i])->GetMaximum() > histmax)
 
  134             histmax = ((TH1*)hists[i])->GetMaximum();
 
  139       if (countPad == 1) sc = 1.3;
 
  140       ((TH1*)hists.First())->SetMaximum( histmax*sc );
 
  142       ((TH1*)hists.First())->Draw( 
"hist" );
 
  143       cPad->SetLeftMargin( 0.17 );
 
  144       ((TH1*)hists.First())->GetYaxis()->SetTitleOffset( 1.70 );
 
  146       for(Int_t i=1; i<hists.GetEntriesFast(); ++i){
 
  148          ((TH1*)hists[i])->Draw(
"histsame");
 
  149          TString ytit = TString(
"(1/N) ") + ((TH1*)hists[i])->GetYaxis()->GetTitle();
 
  150          ((TH1*)hists[i])->GetYaxis()->SetTitle( ytit ); 
 
  156          TLegend *legend= 
new TLegend( cPad->GetLeftMargin(), 
 
  157                                        1-cPad->GetTopMargin()-.15, 
 
  158                                        cPad->GetLeftMargin()+.4, 
 
  159                                        1-cPad->GetTopMargin() );
 
  160          legend->SetFillStyle(1);
 
  162          classiter = classnames.begin();
 
  164          for(Int_t i=0; i<hists.GetEntriesFast(); ++i, ++classiter){
 
  165             legend->AddEntry(((TH1*)hists[i]),*classiter,
"F");
 
  168          legend->SetBorderSize(1);
 
  169          legend->SetMargin( 0.3 );
 
  170          legend->Draw(
"same");
 
  174       ((TH1*)hists.First())->Draw(
"sameaxis");
 
  178       Int_t    nbin = ((TH1*)hists.First())->GetNbinsX();
 
  179       Double_t dxu  = ((TH1*)hists.First())->GetBinWidth(0);
 
  180       Double_t dxo  = ((TH1*)hists.First())->GetBinWidth(nbin+1);
 
  183       classiter = classnames.begin();
 
  184       for(Int_t i=0; i<hists.GetEntriesFast(); ++i, ++classiter){
 
  185          if(((TH1*)hists[i])->GetBinContent(0)!=0 || ((TH1*)hists[i])->GetBinContent(nbin+1)!=0){
 
  186             uoflow += *classiter;
 
  187             uoflow += Form( 
" U/O-flow:  %.1f / %.1f %%", 
 
  188                             ((TH1*)hists[i])->GetBinContent(0)*dxu*100, ((TH1*)hists[i])->GetBinContent(nbin+1)*dxo*100);
 
  192       TText* t = 
new TText( 0.98, 0.14, uoflow );
 
  194       t->SetTextSize( 0.040 );
 
  195       t->SetTextAngle( 90 );
 
  200       if (countPad%noPadPerCanv==0) {
 
  201          TString fname = dataset+Form( 
"/plots/%s_c%i", outfname.Data(), countCanvas );
 
  202          TMVAGlob::plot_logo();
 
  203          TMVAGlob::imgconv( canv, fname );
 
  204          createNewFig = kFALSE;
 
  207          createNewFig = kTRUE;
 
  212       TString fname = dataset+Form( 
"/plots/%s_c%i", outfname.Data(), countCanvas );
 
  213       TMVAGlob::plot_logo();
 
  214       TMVAGlob::imgconv( canv, fname );
 
  215       createNewFig = kFALSE;