Hi again
So, I modified a bit my code - Now, what it does is this
1- In advance, I have saved in TBranches all the “raw” values for each TH1 object, along with its weight- Now, specifically for my needs and based on the “MVA_MLP_TT” histo, I need to have at least 10 entries per bin , and then it saves a files (TT_axis.root) which contains the template histo and the TAxis out of it. (Class RebinTTbar)
2-Then, it loops in all TH1-objects and uses the TTree info for each object (input is filein.root) and in parallel opens the TT_axis.root - Now, I make a new TH1 which inherits the binning from the TT_axis , and fill the entries from the TTree for each object matching the same naming of course.
So, while making the custom binning of the template based on the TH1 “MVA_MLP_TT” , (step 1) everything looks ok , as I get the desired >=10 / bin
Filling the new histo 1 content 66.2317 low edge 0
Filling the new histo 2 content 6018.75 low edge 0.15
Filling the new histo 3 content 3290.37 low edge 0.3
Filling the new histo 4 content 525.483 low edge 0.45
Filling the new histo 5 content 201.606 low edge 0.6
Filling the new histo 6 content 107.718 low edge 0.75
Filling the new histo 7 content 87.3386 low edge 0.9
Filling the new histo 8 content 72.0543 low edge 1.05
Filling the new histo 9 content 31.2963 low edge 1.2
Filling the new histo 10 content 10.1895 low edge 1.35
so, each bin with at least 10 entries.
My problem is while trying to fill the TH1 for the objects in the file,(step 2) since even for the very exact TH1 “MVA_MLP_TT” , now looks like it fill different number of entries per bin… Remember, that in step 1, I just open the filein.root, make the binning and save a TAxis ; step2 is to fill a TH1 using the TAxis combined with the TTree “raw” entries for each TH1 object.
So, that means, that even for the very same “MVA_MLP_TT” since step2 uses the TAxis , I should get the very exact binning info as in step1. So, comparing in step2 what it reads from the TAxis
From the histo_binned in ReBinTree class 66.2317 BinLowEdge 0 #Bin 1 BinWidth 0.15 Integral 10411
From the histo_binned in ReBinTree class 6018.75 BinLowEdge 0.15 #Bin 2 BinWidth 0.15 Integral 10411
From the histo_binned in ReBinTree class 3290.37 BinLowEdge 0.3 #Bin 3 BinWidth 0.15 Integral 10411
From the histo_binned in ReBinTree class 525.483 BinLowEdge 0.45 #Bin 4 BinWidth 0.15 Integral 10411
From the histo_binned in ReBinTree class 201.606 BinLowEdge 0.6 #Bin 5 BinWidth 0.15 Integral 10411
From the histo_binned in ReBinTree class 107.718 BinLowEdge 0.75 #Bin 6 BinWidth 0.15 Integral 10411
From the histo_binned in ReBinTree class 87.3386 BinLowEdge 0.9 #Bin 7 BinWidth 0.15 Integral 10411
From the histo_binned in ReBinTree class 72.0543 BinLowEdge 1.05 #Bin 8 BinWidth 0.15 Integral 10411
From the histo_binned in ReBinTree class 31.2963 BinLowEdge 1.2 #Bin 9 BinWidth 0.15 Integral 10411
From the histo_binned in ReBinTree class 10.1895 BinLowEdge 1.35 #Bin 10 BinWidth 0.15 Integral 10411
with what it now gives
The binned histogram is MVA_MLP_TT 1 9477.62 0 axis_min 0 axis_max 1.5 Integral 10416.5
The binned histogram is MVA_MLP_TT 2 625.198 0.15 axis_min 0 axis_max 1.5 Integral 10416.5
The binned histogram is MVA_MLP_TT 3 186.322 0.3 axis_min 0 axis_max 1.5 Integral 10416.5
The binned histogram is MVA_MLP_TT 4 107.718 0.45 axis_min 0 axis_max 1.5 Integral 10416.5
The binned histogram is MVA_MLP_TT 5 15.2842 0.6 axis_min 0 axis_max 1.5 Integral 10416.5
The binned histogram is MVA_MLP_TT 6 3.63911 0.75 axis_min 0 axis_max 1.5 Integral 10416.5
The binned histogram is MVA_MLP_TT 7 0 0.9 axis_min 0 axis_max 1.5 Integral 10416.5
The binned histogram is MVA_MLP_TT 8 0 1.05 axis_min 0 axis_max 1.5 Integral 10416.5
The binned histogram is MVA_MLP_TT 9 0.727821 1.2 axis_min 0 axis_max 1.5 Integral 10416.5
The binned histogram is MVA_MLP_TT 10 0 1.35 axis_min 0 axis_max 1.5 Integral 10416.5
something is wrong… The bin width is correct, but the entries per bin are completely wrong and the Integral as well for the very same MVA_MLP_TT TH1…
I attach the code to reproduce all these -
Thanks in advance!
Alex
ReBin2a.C (9.25 KB)
filein.root (180 KB)