I am using TMVA
methods for classification. Particularly, the Rectangular Cuts
method is used. And I want to get cuts’ values after training:
factory->BookMethod( dataloader, TMVA::Types::kKNN, "kNN", "nkNN=40");
TMVA::MethodBase* methodCutsBase = factory->BookMethod( dataloader, TMVA::Types::kCuts, "Cuts", "FitMethod=GA:EffMethod=EffSel");
TMVA::MethodCuts* methodCuts = dynamic_cast<TMVA::MethodCuts*(methodCutsBase);
//Train methods
factory->TrainAllMethods();
//Get cuts from Cuts method
std::vector<Double_t> minCuts, maxCuts;
//and here I get segmentation violation
Double_t trueEffS = methodCuts->GetCuts( 0.5, minCuts, maxCuts );
But I get the segmentation violation error after trying to call MethodCuts
methods. Note that it seems that casting is successful. It had been checked by:
if (TMVA::MethodCuts* methodCuts = dynamic_cast<TMVA::MethodCuts*(methodCutsBase) ) { /*print smth*/ }
And also I can call MethodBase
methods. For example,
std::cout << methodCuts->GetMethodName() << "\n";
prints Cuts
.
How to fix it? Why so?
Full code here: TMVAClassification.C (2.5 KB)