I’m having a problem with a macro that I’m writing, which is adapted from the Decay.C-style macros that are automatically generated from DecayTree->MakeClass(“Decay”). I’ve attached it here, and I’ll try to explain what I want it to do.
1 - I create and fill 48 histograms of various cuts to a variable;
2 - I call Sumw2() for each histogram;
3 - I declare vectors pertaining to values that I want to calculate using these histograms;
4 - I fill one of the vectors with the integral of the 48 histograms (number of events in the histogram range);
5 - I fit some of the histograms with a pol1 function, then integrate this function over a certain range immediately below the histogram range and save the value (number of estimated events in this lower range);
6 - For some of the histograms I calculate the number of estimated events by multiplying the number of events in the histogram range by the ratio (estimated events)/(events in histogram range) of a previous histogram, which has more events and therefore more statistics. I do this for histograms that have a low number of events;
7 - Print the value of the calculated estimated events in the lower range for each of the histograms.
I’m having problems with step 4 onwards. Step 4 is on lines 281-283, and for some reason it gives me a segmentation violation every time I try to run the macro on ROOT. Step 5 is on lines 289-396, and when I comment the lines for step 4 and try to run the macro again, ROOT gives me the following error:
Error: Non-static-const variable in array dimension Decay.C:136:
(cint allows this only in interactive command and special form macro which
is special extension. It is not allowed in source code. Please ignore
I’ve never had this error before. As I understand it, the way I’ve written Step 5 in my macro is acceptable only when I use ROOT interactively, but not in a macro. Does this mean that I can adapt it in such a way that it does work as a macro?
I can calculate the variables I’m interested in manually, fitting each histogram one by one and integrating the pol1 functions myself, but that takes literally hours and is very inefficient. Any help in making this macro work would be much appreciated.
B_Mass_Distribution_BDT-PID_Cut.C (14.8 KB)