Home | News | Documentation | Download

Fatal error TMVA signalweight

Hello root family,

I’m trying to classify some data with TMVA methods, for this I’m following the TMVAtutorialClassification https://root.cern.ch/doc/v610/TMVAClassification_8C.html.

My code after the factory and before cuts: (the code is very similar to the example )


  //global event weights per tree
  Double_t signalWeight = 1.0;
  Double_t backgroundWeight = 1.0;
  dataloader->AddSignalTree    ( signalTree,     signalWeight ); //  TTree *signalTree     = (TTree*)input->Get("Tree;2/Pesosig");
  // para el problema: se prueba dejarlo en la señal, ya que en el peso esta con fatal error
  dataloader->AddBackgroundTree( background, backgroundWeight );
  dataloader->SetSignalWeightExpression("Pesosig");    // This is the problem!!!!!!!!!!!!!!!
  dataloader->SetBackgroundWeightExpression("Pesobac");  //name of the background weight

When I used my code, in the compilation part, root show me the next error

I check that my signal weight is not empty or 0,

and is different to the background weight (but not in dimensions they have the same number of entries), if you recommend me a solution I will very happy.

Thanks for your time

Hello @Manuel_Torres,

it’s nothing about dimensions, contrary to what the error message suggests.
I see that almost all values printed are not a number (nan), so something goes wrong with the training.

I invite @moneta - maybe he knows what’s wrong.

It could be that you have to upload the exact code you are running, as well as the training data if possible, and give us the exact ROOT version. (Does it work with the latest version?)
If you want to do this already now, @moneta will have an easier time finding the problem.

@StephanH thanks,

This is my code (sorry if some comments are in spanish)

tmva1.cpp (15.5 KB)

my version of Root is 6.20/04

In this part “If you want to do this already now, @moneta will have an easier time finding the problem.” is better to chat directly with moneta ?

And if you need the training data, maybe I could pass this in private chat

Thanks for your answers

No, he’s just more experienced with TMVA. The @name generates a notification, so just wait for him to see this thread.


Looking at the error message , it looks like some of the variable gets a RMS as NaN. This can happen if in some events the variables are NaN. You should check the input data and avoid these events.
You can also add a cut in the variables, like TCut mycut = "!TMath::IsNaN(P_P)"; and pass it in the
DataLoader::PrepareTrainingAndTestTree function



Thank you moneta,

I will check my input data, if I continue with problems I’ll write again in this forum.