How Can I Implement ROOT Multivariate Reweighting in a Program?

In summary: Or you could combine both steps in a single program with two loops, the first for the weights and the second for the other histograms. It depends on how complicated your program is and how much time it takes to run over the dataset.
  • #1
ChrisVer
Gold Member
3,378
464
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?
 
Technology news on Phys.org
  • #2
What language are you working in that you can't just allocate an array?
 
  • #3
Dr. Courtney said:
What language are you working in that you can't just allocate an array?

C++ I guess... what do you mean by that?
 
  • #4
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.
 
  • Like
Likes ChrisVer
  • #5
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.
 
  • #6
ChrisVer said:
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
Sure.
 
  • Like
Likes ChrisVer

Related to How Can I Implement ROOT Multivariate Reweighting in a Program?

1. What is ROOT multivariate reweighting?

ROOT multivariate reweighting is a technique used in particle physics to adjust the weights of simulated events in order to match the distribution of real data. This allows for a more accurate comparison between simulated and real data, and can help identify subtle differences that may be indicative of new physics.

2. How does ROOT multivariate reweighting work?

The technique uses a set of variables, known as observables, to characterize the simulated and real data. These observables are then used to create a multidimensional distribution, which is compared between the two data sets. The weights of the simulated events are then adjusted to match the distribution of the real data, resulting in a more accurate representation of the real data.

3. What is the purpose of using ROOT multivariate reweighting?

The main purpose of using ROOT multivariate reweighting is to improve the accuracy of simulated data and reduce any discrepancies between simulated and real data. This can help researchers identify potential sources of new physics and gain a better understanding of the underlying physical processes.

4. What are the advantages of using ROOT multivariate reweighting?

One of the main advantages of using this technique is that it allows for a more accurate comparison between simulated and real data, which can lead to a better understanding of the physics being studied. Additionally, it can help reduce the amount of simulated data needed, which can save time and resources.

5. Are there any limitations to using ROOT multivariate reweighting?

While ROOT multivariate reweighting is a powerful technique, it does have some limitations. It relies on the assumption that the simulated data accurately represents the real data, which may not always be the case. Additionally, it can be computationally intensive and requires a thorough understanding of the underlying physics being studied.

Similar threads

  • Programming and Computer Science
Replies
2
Views
3K
  • Programming and Computer Science
Replies
7
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Programming and Computer Science
Replies
9
Views
2K
  • Programming and Computer Science
Replies
1
Views
11K
  • Programming and Computer Science
Replies
4
Views
3K
  • Introductory Physics Homework Help
Replies
10
Views
2K
  • Programming and Computer Science
Replies
5
Views
2K
  • Programming and Computer Science
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
Back
Top