Dear All,
I’m having problem storing a vector as TLorentzVector in a tree, bellow what I have been trying:
std::vector Muons_truth;
…
p->tree->Branch(“Muons_truth”, &p->Muons_truth);
…
xAOD::TruthParticleContainer all_Muons = truthHandler()->getMuons();
xAOD::TruthParticleContainer Muons = truthHandler()->applyMuonSelection (all_Muons);
p->Muons_truth.clear();
for(auto Mu : Muons)
{
Double_t p_x = Mu->auxdata(“px”);
Double_t p_y = Mu->auxdata(“py”);
Double_t p_z = Mu->auxdata(“pz”);
Double_t e = Mu->auxdata(“e”);
TLorentzVector comb(p_x , p_y, p_z, e);
p->Muons_truth.push_back(comb);
}
So the code is run successfully, however, all other branches appear in the ntuple except the Muons_truth.
I tried other thing which gives me something but not the one I wont here it’s:
instead of initiating “std::vector Muons_truth;” I just did "TLorentzVector Muons_truth; ". Hence,
for(auto Mu : Muons)
{
Double_t p_x = Mu->auxdata(“px”);
Double_t p_y = Mu->auxdata(“py”);
Double_t p_z = Mu->auxdata(“pz”);
Double_t e = Mu->auxdata(“e”);
p->Muons_truth..SetPxPyPzE(p_x,p_y,p_z,e);
}
So this created another tree inside the ntuple and fill it with these variables px, py, pz, and e. I would like to get a single branch in my ntuple that has just Muons_truth. Any help would be much appreciated. Thanks.
Cheers,
abdualazem.