-
Notifications
You must be signed in to change notification settings - Fork 17
LHE MadGraph reweighting implementation into DelphesPythia8_EDM4HEP. #148
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
base: main
Are you sure you want to change the base?
Conversation
There seem to be some merge conflicts, could you try and resolve them? |
And could you rephrase your opening post into release notes and other text so that the release notes look more like what we have in https://github.com/key4hep/k4SimDelphes/blob/main/doc/ReleaseNotes.md Thanks! |
Hi both, thanks for the comments. I've tried to resolve the conflicts (apologies, my original repo is by now slightly outdated). Hope this worked. I'll change the release notes now to be in-line with previous iterations. |
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.
The actual changes look sensible to me. There are a few unnecessary format / whitespace changes (that I assume pre-commit
will also complain). Could you remove those and also keep the naming convention for member variables?
Hi - opening post should now be of the correct format to be included in the release notes. Thanks for the pointer :) |
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.
Does the LHE weights branch also carry the names for the different weights? If yes, we should try to also preserve those into the metadata of the EDM4hep file that we produce.
That would require reading in the weight names from the LHE files and then probably storing them internally in the DelphesEDM4hepConverter
to retrieve them on the first event, and put them into a the metadata podio::Frame with the correct key. The key would be edm4hep::labels::EventWeightsNames
(defined in <edm4hep/Constants.h>
.
Hi both, apologies for the delay in getting back to this. At the moment Delphes stores the weight ID as an integer, so it's not much more instructive than just storing the vector of weights. We could perhaps change this implementation to also check for strings and then store these? |
Can we get the weight names from the LHE event somehow before it goes through Delphes via Pythia? Maybe it would then be possible to match weight ids and names again. Otherwise we would have to find some way to get the weight names through. I think otherwise interpreting these weights down the line will become very hard. |
Hi, apologies for the delayed response - I just got back from a short holiday. I have an implementation working that reads the weights using a new function in |
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.
Very nice. This is in principle pretty much the solution, I had in mind. I am wondering whether we need to re-open the LHE file again to get to the weight names, or whether we would be able to re-use some of the Pythia8 functionality.
If I read the documentation correctly, it should be possible to obtain it via
const auto& weightNames = m_pythia->info.weightNameVector();
I think that it should be possible to call that after m_pythia->init()
and I would assume (or hope) that this also works for weights read from LHEF files. That would make it possible to remove the std::vector<std::string> getWeightNames(const std::string&)
free function again and we would not have to bother with maintaining the reading of the LHEF files since Pythia already does everything for us.
const auto& weightNames = inputReader.getWeightNames(); | ||
if (!weightNames.empty()) { | ||
std::cout << "Writing LHEF weight ID vector of strings with size " << weightNames.size() << std::endl; | ||
frame.putParameter<std::vector<std::string>>(edm4hep::labels::EventWeightsNames, weightNames); |
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.
frame.putParameter<std::vector<std::string>>(edm4hep::labels::EventWeightsNames, weightNames); | |
frame.putParameter(edm4hep::labels::EventWeightsNames, weightNames); |
It's not strictly necessary in this case to explicitly spell out which template function you want to call as the compiler will figure it out from the arguments in any case.
BEGINRELEASENOTES
lhefWeights
event-weights vector read from MadGraph reweighted LHE files, stored in output root file in_EventHeader_weights
forDelphesPythia8_EDM4HEP
executable.ENDRELEASENOTES