Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

ROOT multivariate reweighting

  1. Jul 15, 2015 #1

    ChrisVer

    User Avatar
    Gold Member

    Suppose I have a programme. In there I have the creation of histograms:

    signal:
    histo_s_Pt
    histo_s_v1
    histo_s_v2
    background:
    histo_b_Pt,
    histo_b_v1
    histo_b_v2

    iteration to fill signal/bckg from events j.

    So at this point I'm having the 6 above histograms filled. Now if I wanted to compare the variables v1,v2 between signal/background with the reweight of the momenta Pt s or b, I have to make a new histogram that will contain the weights :

    histo_weight = Divide( signal Pt , background Pt).

    My problem is that this can happen only at the end of the program, and then I cannot call these weights back in order to reweight the histos of variables v1, v2 .

    I was told I can save the histo_weight in some root file and then recall it. However I am not sure that this can work.
    Suppose I save it in a TFile weight.root
    How can I open the weight.root in the first place? since it again is saved in the end.

    Any ideas?
     
  2. jcsd
  3. Jul 15, 2015 #2
    What language are you working in that you can't just allocate an array?
     
  4. Jul 15, 2015 #3

    ChrisVer

    User Avatar
    Gold Member

    C++ I guess... what do you mean by that?
     
  5. Jul 15, 2015 #4

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    You don't have the weights at the time you fill the histograms, obviously. Run your program to get the weights, store them, then run it again to fill the other histograms using the stored file. Or combine both in a single program with two loops, the first for the weights the second for the other histograms. There is no way to avoid that.

    If running over the dataset takes too much time, you can make a smaller TTree only with those three variables.

    @Dr. Courtney: He is running over some dataset, generating both pT, v1 and v2. To properly fill the v1 and v2 histograms, he needs the full information of pT, which is not available at that time.
     
  6. Jul 15, 2015 #5

    ChrisVer

    User Avatar
    Gold Member

    So you suggest:
    1. Run it once without using the weights, just to generate the weight histograms.
    2. Save those histograms in a root file (let's call it "weight.root").
    3. Go back into the program and open and recall the histogram from weight.root and use its info
    4. Rerun the program
    ?

    your second solution might be easy in a simple program, but mine is not that simple. The signal and background are taken from two totally different regions in the main body (here I simplified the problem), and it's almost impossible to make that. It would be easier if they were in the same region since yes, I could work the Pt's first individually and use them in a second iteration.
     
  7. Jul 15, 2015 #6

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    Sure.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: ROOT multivariate reweighting
  1. Cubic Root (Replies: 3)

  2. Root Finding (Replies: 5)

  3. Root programming (Replies: 3)

  4. Root programming (Replies: 3)

Loading...