UF-HH / bbbbAnalysis

1 stars 6 forks source link

Merge histograms option generates an error when using the histogrammer #28

Closed danielguerrero closed 4 years ago

danielguerrero commented 4 years ago

The message appears on the first quoted selection ( e.g. Btag3_VBFcateg_CR_110_Histogram):

terminate called after throwing an instance of 'std::runtime_error' what(): Bin corresponding to selection Btag3_VBFcateg_CR_110_Histogram not found in the cut histogram

The suspect is in here: https://github.com/UF-HH/bbbbAnalysis/blob/master/src/AnalysisHelper.cc#L159

l-cadamuro commented 4 years ago

Update : this happens because the merge function was not updated to handle the histogram cut flow. The merged sample is created here: https://github.com/UF-HH/bbbbAnalysis/blob/master/src/AnalysisHelper.cc#L1532 but the structure of the cut flow histogram is only created upon reading the file. (at creation it is empty: https://github.com/UF-HH/bbbbAnalysis/blob/master/src/Sample.cc#L31 and it is initialised here: https://github.com/UF-HH/bbbbAnalysis/blob/master/src/Sample.cc#L116 ) but this second step cannot happen in the merge, because no tree is attached to the file.

I will try to make the cut histogram block independent so that it can be called there.

l-cadamuro commented 4 years ago

Fixed by modifying the AnalysisHelper and Sample classes to handle the histogram initialisation and the cut flow histograms upon merging. Tested locally and in the analysis by @danielguerrero, it gives the expected results.