Dear all,
I have a vector in which I saved the variables that I have to plot.
vector<TString> PlotVars;
PlotVars.push_back("ungroomed_PuppiAK8_jet_pt");
As I am reading this variable from a tree so I get it like
float ungroomed_PuppiAK8_jet_pt;
mytree->SetBranchStatus("ungroomed_PuppiAK8_jet_pt",1);
mytree->SetBranchAddress("ungroomed_PuppiAK8_jet_pt",&ungroomed_PuppiAK8_jet_pt);
float LHEWeight[1164];
mytree->SetBranchStatus("LHEWeight",1);
mytree->SetBranchAddress("LHEWeight",LHEWeight);
When I am trying to fill it in histogram inside event loop like
for (int i =0; i<mytree->GetEntries(); i++)
{
mytree->GetEntry(i)
hist->Fill(PlotVars[0], (LHEWeight[j+446]/LHEWeight[0]))
}
As PlotVars[0] is of type TString so I used .Data()
to convert it to const char *
like
for (int i =0; i<mytree->GetEntries(); i++)
{
mytree->GetEntry(i)
hhist->Fill(PlotVars[0].Data() , (LHEWeight[j+446]/LHEWeight[0]))
}
But, in both cases just saves the string ungroomed_PuppiAK8_jet_pt
in the histogram, not its value from the tree.
Please let me know how I can do this.
Thanks,
Ram
ROOT Version: 6.08/05
Platform: lxplus
Compiler: Not Provided