While evaluating the MVA response through TMVA::Reader::AddVariable. I faced the problem of the method AddVariable only accepting Float_t variables (or Int_t), but not Double_t. I can import variables of type double from my nTuple to train an MVA method with the TMVA::DataLoader but cannot through ‘TMVA::Reader::AddVariable’ because of the reason as stated. train.C (2.4 KB)
Along with the MVA response, I am also want to save the probability and rarity distribution. The macro apply.C is used to save their distribution. see apply.C (3.8 KB)
The data coming from a TTree, which I did not create that already has Double_t branches, so to use them, the only way was casting to Float_t.
Kindly please suggest how to cast the Double_t type variables to Float_t type or some other solution which can take Double_t type variables.
You can use an input double from the Tree, but you need to pass a float pointer in Reader::AddVariable. Like in this example (here the input Tree is having an integer and a float is used in AddVariable):
You pass a double pointer in Tree::SetBranchAddress as following: