Improve SimpleCut comparison #140
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Major change:
Before
SimpleCutcomparison (==operator) was done in the following way: if their names and lists of variables coincide theSimpleCuts are assumed to be equal. And the logic of theSimpleCutimplemented in the function object (lambda function) was not compared. It lead to a bug when using AnalysisTreeQA package: because of false equality ofCutsthe histograms supposed to be built with different cuts were built with the same - that one which was declared first.Now this issue is partially addressed in the following way:
each
SimpleCutcreated asEqualsCutorRangeCuthas a hash generated from concatenation of its name, list of variables and numbers to be cutted. If twoSimpleCuts have different hashes they are assumed non-equal. However if theSimpleCutis initialized with lambda function, its unique hash cannot be evaluated, therefore any pair ofSimpleCuts initialized with lambdas are assumed not equal (unless they are in the same memory place). From the considerations expressed above (about AnalysisTreeQA package) it is less critical to identify cuts false non-equal than false-equal.Minor changes:
HelperFunctions.hppSimpleCut, covering issues discussed aboveAnalysisTree::Chain