Home | News | Documentation | Download

How to obtain BDT score at specific signal efficiency?

Hi friends,
I am looking for way to output the BDT score that corresponds to a specific signal efficiency. Specifically, I want to know what BDT score corresponds to signal efficiency in steps of 1% changes, like what is the BDT score at 99% signal efficiency, 98% signal efficiency, 97% signal efficiency and so on. Is there a way to do it?
Thanks a lot,
Ka Wa

@swunsch @moneta could you please help here?



I think you just need to call TMath::Quantiles using as input probability p=1-signal_efficiency
on the BDT score vector data that you can obtain from the output ROOT file of the BDT.
If you need I can provide you an example



Hi Lorenzo,
Thanks for your reply! By the “BDT score vector data”, do you refer to the tree inside the root file? An example would be nice. Thank you so much.
Ka Wa


As example you can run the tutorial TMVA/TMVA_Higgs_Classification.C that performs a classification using BDT.

The output file generated by the tutorial is called Higgs_ClassificationOutput.root
Then you can run this code from the output file to get the BDT score from the Test Tree on the signal events

  TFile f("Higgs_ClassificationOutput.root");
  auto t = (TTree*) f.Get("dataset/TestTree");
  int n =  t->Draw("BDT","classID==0");
  // retrieve the data used to fill the BDT score histogram plot
  auto scoreVector = t->GetV1(); 
  // probabilities used for computing the quantiles 
  double p[99];
  for (int i = 0; i < 99; ++i) p[i] = 0.01*double(i+1); 
  double q[99]; 
  TMath::Quantiles(n, 99, scoreVector, q, p, false); 
  for (int i = 0; i< 99; ++i) {
     std::cout << " signal efficiency " << 1.-p[i] << " BDT score " << q[i] << std::endl;