Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New histogram collection: VectorizedHistCollection #173

Merged
merged 30 commits into from
Aug 6, 2019

Conversation

kreczko
Copy link
Member

@kreczko kreczko commented Jul 18, 2019

Fixes #39, #171

Introduces VectorizedHistCollection that adds two things w.r.t. BaseHistCollection:

  • access multiple histograms at once
  • fill multiple histograms at once

Accessing collection[pileup] with pileup = [1, 12, 1, 50] will automatically return the histograms for the correct pileup bins (not values). This part is generalized through the VectorizedBinProxy.

Filling histograms can be done with either scalar, numpy.ndarray or awkward.JaggedArray.

VectorizedHistCollection also introduces some experimental functionality, e.g. execute_before_write.
The execute_before_write parameter can be used to schedule function calls before the collection is written to disk. E.g. this could replace the EfficiencyCollection's _calculateEfficiencies call (i.e. a step towards the generalization of histogram collections). This part is generalized through the VectorizedHistProxy.

Example

import awkward
from cmsl1t.collections import VectorizedHistCollection

puBins = list(range(0, 50, 10)) + [999]
collection = VectorizedHistCollection(innerBins=puBins, innerLabel='pu')
collection.add('test', bins=[35, 90, 120])

pileup = [1, 12, 1, 50]
jet_et = awkward.fromiter([
        [60, 50, 40, 30, 20],
        [32, 23],
        [56, 34, 31],
        [],
    ])

collection[pileup]['test'].fill(jet_et)

Further work needed

  • documentation
  • more tests & benchmarks (> 2 dimensions, scalar values)
  • allowing for different histogram proxies: e.g. special fill for efficiencies

@kreczko kreczko requested a review from benkrikler July 18, 2019 14:22
@kreczko kreczko changed the base branch from master to dev July 18, 2019 14:22
@lgtm-com
Copy link

lgtm-com bot commented Jul 18, 2019

This pull request fixes 1 alert when merging e643ec9 into ead9128 - view on LGTM.com

fixed alerts:

  • 1 for Unreachable code

@lgtm-com
Copy link

lgtm-com bot commented Jul 18, 2019

This pull request fixes 1 alert when merging 114f53c into ead9128 - view on LGTM.com

fixed alerts:

  • 1 for Unreachable code

@lgtm-com
Copy link

lgtm-com bot commented Jul 18, 2019

This pull request fixes 1 alert when merging 09178f4 into ead9128 - view on LGTM.com

fixed alerts:

  • 1 for Unreachable code

@lgtm-com
Copy link

lgtm-com bot commented Jul 19, 2019

This pull request fixes 1 alert when merging 51d44d3 into ead9128 - view on LGTM.com

fixed alerts:

  • 1 for Unreachable code

Copy link
Contributor

@benkrikler benkrikler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of questions and comments for you Luke, hopefully as you wanted!

cmsl1t/analyzers/jetMet_analyzer.py Show resolved Hide resolved
cmsl1t/collections/base.py Show resolved Hide resolved
cmsl1t/__init__.py Outdated Show resolved Hide resolved
cmsl1t/collections/vectorized.py Outdated Show resolved Hide resolved
cmsl1t/collections/vectorized.py Outdated Show resolved Hide resolved
cmsl1t/collections/vectorized.py Outdated Show resolved Hide resolved
cmsl1t/collections/vectorized.py Outdated Show resolved Hide resolved
cmsl1t/collections/vectorized.py Outdated Show resolved Hide resolved
cmsl1t/collections/vectorized.py Outdated Show resolved Hide resolved
test/collections/test_vectorized.py Outdated Show resolved Hide resolved
@kreczko
Copy link
Member Author

kreczko commented Aug 2, 2019

ok, @benkrikler, that should be that for now. I am addressing the jetMet_analyzer in a separate branch

@lgtm-com
Copy link

lgtm-com bot commented Aug 2, 2019

This pull request fixes 1 alert when merging cb28ed4 into ead9128 - view on LGTM.com

fixed alerts:

  • 1 for Unreachable code

@kreczko kreczko merged commit 691dde2 into cms-l1t-offline:dev Aug 6, 2019
@kreczko kreczko deleted the kreczko-issue-171 branch August 6, 2019 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants