Home | News | Documentation | Download

Method to change the input variable range in a root file

Dear people,
I wish to change the range of values in x axis of an input variable . For example if you can see the image the range is from -40 to 40 . I wish to zoom in the range and plot from -1 to 1 . Should i modify the root file itself or how to change the range of the particular variable when adding it to the training list.Is there a possibility to modify the following line from the TMVACLASSIFIACTION.C file so that i can see the truncated range when i see the input variable list after training?
“dataloader->AddVariable( “DeltaZ”, “DELTAZ”, “Probability”, ‘F’ );”

Screenshot from 2021-04-15 15-15-54

@moneta @moneta2 kindly help me with this

Hi @rithishbarath ,
you can use TAxis::SetRangeUser method to set the x axis range. You have to call it on the histogram, something like histogram->GetXaxis()->SetRangeUser(...).


1 Like

I have not understood if your problem is a plotting one or it is in defining the range of the input variable to be used for classification. In the first case you can do what Enrico suggest, or just plot yourself the variables from the input tree in histograms as you wish.
In the second case you need to apply a variable selection cut. This you can do, for example in TMVAClassification, by modifying line 271 and 272.
In your case , if the variable is called 'DELTAZ` you do:

TCut mycuts = "DELTAZ > -40 && DELTAZ < 40";
TCut mycutb = "DELTAZ > -40 && DELTAZ < 40";



Where should i enter this piece of code in the TMVACLASSIFICATION.C file so that my histogram changes @eguiraud or send me a example file to execute the same.

Thanks @moneta

You can search our tutorials, e.g. this TMVA tutorial uses SetRangeUser.