Using TMVA::MethodBase::GetRarity() instead of TMVA::Reader::GetRarity()


After an unsuccessful attempt at using FDA to simulate a multiclass Fisher response (the coefficients came out as NaN), I settled on using a one versus rest scheme to expand TMVA’s Fisher binary classification. After generating weight files with CreateMVAPdfs enabled, what I would like to do now is use evaluate the rarity function using the signal PDF as opposed to the background PDF. TMVA::Reader::GetRarity() only has this available for background PDF, but with TMVA::MethodBase::GetRarity() the option I want is there. Looking at source code for classes such as TMVA::Reader I see that if I compiled code as opposed to running a macro I could be able to use something like
TMVA::MethodFisher * PengWAISHPol = dynamic_cast<TMVA::MethodFisher *>(readerPeng.FindMVA("WAISHPol"));
like I do in line 156 of the attached macro,

evaluateResponsesNew.C (17.4 KB)

However, I see from the comments on TMVA::Reader::FindCutsMVA() and in this thread that CINT doesn’t work with dynamic_cast. Is there something like TH2::Class()->DynamicCast() like mentioned in the above thread that I can use?

Which ROOT version are you using ? CINT is not existing anymore in ROOT version 6, so those old comments are not valid anymore.
dynamic_cast is a valid C++ keyword and works without any problem with Cling (the successor of CINT).
Please let me know if you have other issues ,

Thank you, Lorenzo.

I am indeed using ROOT 6 (6.18/00). Then I will try running the macro and see if it works.