Skip to content
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

feat: Change Jet and FatJet Vector behaviour to be compatible with other lepton classes #1166

Merged
merged 5 commits into from
Aug 24, 2024

Conversation

green-cabbage
Copy link
Contributor

changing Jet and FatJet's base vector class from vector.PtEtaPhiMLorentzVector to candidate.PtEtaPhiMCandidate with introduction of charge property to match operations with lepton classes (ie Muon and Electron)

@lgray lgray changed the title Change Jet and FatJet Vector behaviour to be compatible with other lepton classes feat: Change Jet and FatJet Vector behaviour to be compatible with other lepton classes Aug 19, 2024
@@ -506,6 +506,10 @@ class Jet(vector.PtEtaPhiMLorentzVector, base.NanoCollection, base.Systematic):
TIGHTLEPVETO = 2
"jetId bit position"

@property
def charge(self):
return 0.0 * self.pt
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you try using ak.zeros_like(self.pt), it will read less data. There are a few other places in the file that could use this optimization as well, please fix them.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the dtype matter btw? Is there a reason it's 0.0 * self.pt to return a float specifically. If yes, it should be set in zeros_like as well.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zeros_like respects the dtype of the input.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made the relevant changes to the nanoaod.py. I notice that 0.0 * self.pt code is also present in delphs.py. Is there I way I could add delphs.py to this pull request? If not, I can always just make a new pull request

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok NVM, the pull request automatically does it for you once you commit to the same branch

@ikrommyd
Copy link
Collaborator

ikrommyd commented Aug 19, 2024

@green-cabbage please also replace the other 0.0 * self.pt in the Delphes schema while you're at it:

return 0.0 * self.pt
while you're at it.

green-cabbage and others added 5 commits August 23, 2024 17:18
…MLorentzVector to candidate.PtEtaPhiMCandidate with introduction of charge property to match operations with lepton classes (ie Muon and Electron)
…ggested by Lindsey

This impacts Jet, FatJet and Photon class
@lgray lgray merged commit 4de0159 into CoffeaTeam:master Aug 24, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants