HI,
Sorry to bother with this simple task, but how can I sum and take the invariant mass of a pair of four vectors?. I have written the following script to read information of a tree and store it in a two four vectors:
void tut(){
TFile file("output.root");
TTreeReader reader("cutted", &file);
TTreeReaderValue<float> MET_etx(reader, "MET_etx");
TTreeReaderArray<double> TauE(reader, "TauE");
TTreeReaderArray<double> TauPt(reader, "TauPt");
TTreeReaderArray<double> TauEta(reader, "TauEta");
TTreeReaderArray<double> TauPhi(reader, "TauPhi");
while( reader.Next()) {
//std::cout << *MET_etx << std::endl;
TLorentzVector *p1 = new TLorentzVector();
p1->SetPtEtaPhiE(TauPt[0],TauEta[0],TauPhi[0],TauE[0]);
TLorentzVector *p2 = new TLorentzVector();
p2->SetPtEtaPhiE(TauPt[1],TauEta[1],TauPhi[1],TauE[1]);
//std::vector<double> sum = {0,1,2,3};
std::cout << "Mass: " << (p1+p2).M() << std::endl;
}
}
So, what I am doing wrong here?
Best,
Caio.