ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided
Hi Everyone !
I have one root file and there I have six different trees. Each tree contains each and individual particle’s four momentum. I want to add all six TLorentz Vectors to get one particle’s mass. Can you please give me a skeleton code of it ?
Thanks in Advance.
TLorentzVector p1, p2;
// Here fill the vectors
const auto this_mass = (p1 + p2).M();
Thank you very much for your reply. Now I have one tree in a root file. There I want calculate mass from the four vector so I use the similar command attached below. But the plot is coming out to be empty. Can you please check it.
TFile* f2= new TFile("/home/souvik/root_work/lfv1.root");
TH1F *hist2 = new TH1F("", " ", 50, 0, 10);
Int_t n_tot2 = (Int_t)t2->GetEntries();
float fMomentum = D0_fvec.M();
for (int i=0;i<n_tot2; i++)
cout<< i << " "<< fMomentum <<endl;
you do not specify what ROOT version you are using: I assume 6.14/06.
In this case, you can simply do:
ROOT::RDataFrame df("dklfv", "/home/souvik/root_work/lfv1.root");
auto massHisto = df.Define("m", "TLorentzVector(D0_P4.data()).M()").Histo1D("m");
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.