Coder Social home page Coder Social logo

rebsmear's Introduction

Rebalance and smear

Flexible implementation of the rebalance and smear method in python + RooFit.

Example

from rebalance import Jet, RebalanceWSFactory

# Event with two arbitrary reco-level jets
jets = [
    Jet(pt=100, eta=1.3, phi=0.),
    Jet(pt=100, eta=1.3, phi=2.8),
]

# Factory creates RooWorkspace for us
# default workspace has dummy assumptions for priors, resolution functions
# -> Simple extension possible via inheritance!
rbwsfac = RebalanceWSFactory(jets)
rbwsfac.build()
ws = rbwsfac.get_ws()

# Ready to minize the negative log likelihood!
m = r.RooMinimizer(ws.function("nll"))
m.migrad()

rebsmear's People

Contributors

alpakpinar avatar andreasalbert avatar

Watchers

James Cloos avatar  avatar

Forkers

alpakpinar

rebsmear's Issues

Possibly wrong HTmiss calculation

Hey @AndreasAlbert , while deriving HTmiss distribution from data using a different coffea-based processor, I realized the HTmiss values calculated by that processor are not consistent with the ones that are calculated by rebsmear code. I believe the issue is that the "Jet phi" values read by rebsmear are different. I'll explain what I saw below.

I ran over the first event of our input for rebsmear, using both frameworks. From the input root file, I get the following jet pt and phi:
Screen Shot 2021-01-28 at 8 53 19 PM

First running with coffea-based processor, I print out the pt, phi and resulting HTmiss values:
image

They are all consistent with the input file, the resulting HTmiss is wildly different from what rebsmear calculates though, its around 30 GeV, while rebsmear calculates 762 GeV for the same event.

To check rebsmear code, I looked at the output workspace, and you can see the pt of the leading jet is consistent, but phi is completely different somehow:

image

This is true for all jets in the event, and hence HTmiss ends up being very different. I don't yet know how exactly this happens but I'll keep investigating.

RooHistPdf check

Hey @AndreasAlbert , starting from the code snippet you posted earlier, I developed a small test script here:

https://github.com/alpakpinar/rebsmear/blob/2021-01-27_rootest/rootest.py

Here, I follow the workflow of the main code: Define a derived variable, re-evaluate it as a RooRealVar and feed it into RooDataHist and RooHistPdf. You can see what the code outputs at the bottom of the script.

I'm not sure if that's how the minimization software acquires the values for each iteration, so the comparison might not be entirely valid. But I see that the values returned from the pdf seem consistent. I'm also attaching a plot of the PDF for reference. I believe getValV() returns the un-normalized (but bin-width divided) values, seems consistent with the docs in 1.

Let me know what you think, thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.