Dear Experts,
I have an RDataFrame which consists of several thousand files. A very few of these files are missing some branches (specifically the BornLeptonsAuxDyn.<>)
and thus the following operation fails:
df = df.Define("bornMass","ComputeBornMass(BornLeptonsAuxDyn.px,BornLeptonsAuxDyn.py,BornLeptonsAuxDyn.pz,BornLeptonsAuxDyn.e,RunNumber)")
(see further down for the defintion of ComputeBornMass()
)
Is there a way to still be able to perform this operation on my RDataFrame although a small fraction of the files do not contain these variables. I.e.: can I somehow say that I only want to process this command if the branches actually exists for the event being processed?
I’m using ROOT version 6.28/04.
Thank you for any help.
best,
Eirik
float ComputeBornMass(VecF_t& px, VecF_t& py, VecF_t& pz, VecF_t& e, Long64_t dsid) {
TLorentzVector p1;
TLorentzVector p2;
if(!((dsid >= 700320 && dsid <= 700328) || (dsid >= 700615 && dsid <= 700623)))return 0;
const auto ninpt = int(px.size());
if(ninpt > 2){
std::cout<<"ERROR \t Number of born leptons is "<<ninpt<<std::endl;
for (int j=0; j < ninpt; ++j) {
std::cout<<"(px,py,pz,e) = ("<<px[j]<<","<<py[j]<<","<<pz[j]<<","<<e[j]<<")"<<std::endl;
}
}
p1.SetPxPyPzE(px[0], py[0], pz[0], e[0]);
p2.SetPxPyPzE(px[1], py[1], pz[1], e[1]);
return (p1 + p2).M();
}