-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Additional functions for hadronic recoil quantities #273
base: nmssm_devs
Are you sure you want to change the base?
Additional functions for hadronic recoil quantities #273
Conversation
Producers have been added to the config via this pull request: KIT-CMS/TauAnalysis-CROWN#50. |
src/hadrecoil.cxx
Outdated
// add up the negative pt vectors of all selected jets | ||
auto mht = ROOT::Math::PtEtaPhiMVector(0., 0., 0., 0.); | ||
for (const int &jet_index : jet_collection) { | ||
auto jet_pt_vec = dynamic_cast<ROOT::Math::PtEtaPhiMVector>(ROOT::Math::PtEtaPhiEVector(jet_pt.at(jet_index), jet_eta.at(jet_index), 0., jet_pt.at(jet_index))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use pt, eta, phi and Mass of the jets, this information is available in NanoAOD
src/hadrecoil.cxx
Outdated
// add up the magnitudes of the pt of all selected jets | ||
float ht = 0; | ||
for (const int &jet_index : jet_collection) { | ||
ht += jet_pt.at(jet_index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to see thisa implemented as a a basefunction in a more generic way
src/hadrecoil.cxx
Outdated
auto mht = ROOT::Math::PtEtaPhiMVector(0., 0., 0., 0.); | ||
for (const int &jet_index : jet_collection) { | ||
auto jet_pt_vec = dynamic_cast<ROOT::Math::PtEtaPhiMVector>(ROOT::Math::PtEtaPhiEVector(jet_pt.at(jet_index), jet_eta.at(jet_index), 0., jet_pt.at(jet_index))); | ||
mht -= jet_pt_vec; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above, implement as a basefunction (maybe the negative sum as well as the positive)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one remark to use RVec::Construct rest looks good!
include/basefunctions.hxx
Outdated
inline ROOT::RDF::RNode BuildP4Collection(ROOT::RDF::RNode df, | ||
const std::string &outputname, | ||
const std::string &pts, | ||
const std::string &etas, | ||
const std::string &phis, | ||
const std::string &masses, | ||
const std::string &collection_index) { | ||
auto build_collection_p4 = [](const ROOT::RVec<float> &pts, | ||
const ROOT::RVec<float> &etas, | ||
const ROOT::RVec<float> &phis, | ||
const ROOT::RVec<float> &masses, | ||
const ROOT::RVec<int> &collection_index) { | ||
auto p4s = ROOT::RVec<ROOT::Math::PtEtaPhiMVector>(); | ||
for (int i = 0; i < collection_index.size(); ++i) { | ||
auto p4 = ROOT::Math::PtEtaPhiMVector(pts.at(i), etas.at(i), phis.at(i), masses.at(i)); | ||
p4s.push_back(p4); | ||
} | ||
return p4s; | ||
}; | ||
return df.Define(outputname, build_collection_p4, {pts, etas, phis, masses, collection_index}); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is https://root.cern/doc/master/group__vecops.html#ga84ffef84f7829e9d904cd92a57a0cd9a to further shorten this code and eliminate the for-loop
@harrypuuter I added your suggestions, the compiled binary runs on a DY sample without errors. I still have to check if the functions' outputs are reasonable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, I approve and you just merge it ones the results are validated
Thanks for all the checks @harrypuuter ! As it is now this PR would only be merged to my nmssm_devs branch. I guess we could merge it directly into the main branch, since nothing directly related to the NMSSM analysis is involved in the code changes. |
yes, i would merge this directly to main as well |
This pull request introduces functions to calculate quantities, which are related to the hadronic recoil in an event.
hadrecoil::scalar_ht
takes a jet pt column and a column with indices of selected jets as input. The output is the scalar sum of the magnitude of the transverse momentum of the selected jets.hadrecoil::vectorial_mht
takes a jet pt column, a jet phi column and a column with indices of selected jets as input. The output is the negative vectorial sum of the transverse momentum vectors of the selected jets.TODOs: