-
Notifications
You must be signed in to change notification settings - Fork 632
[PWGJE] pTHat handling, remove HepMCXSections dependency, add R-d… #15284
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -293,7 +293,7 @@ std::tuple<std::vector<int>, std::vector<int>> MatchJetsGeometrically( | |
| } | ||
|
|
||
| template <typename T, typename U> | ||
| void MatchGeo(T const& jetsBasePerCollision, U const& jetsTagPerCollision, std::vector<std::vector<int>>& baseToTagMatchingGeo, std::vector<std::vector<int>>& tagToBaseMatchingGeo, float maxMatchingDistance) | ||
| void MatchGeo(T const& jetsBasePerCollision, U const& jetsTagPerCollision, std::vector<std::vector<int>>& baseToTagMatchingGeo, std::vector<std::vector<int>>& tagToBaseMatchingGeo, float maxMatchingDistance, std::vector<double> const& jetRadiiForMatchingDistance = {}, std::vector<double> const& maxMatchingDistancePerJetR = {}) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you dont need to initialise with empty vectors. Its good to make sure these vectors are always given to the function and no default empty value is taken |
||
| { | ||
| std::vector<double> jetsR; | ||
| for (const auto& jetBase : jetsBasePerCollision) { | ||
|
|
@@ -332,7 +332,14 @@ void MatchGeo(T const& jetsBasePerCollision, U const& jetsTagPerCollision, std:: | |
| jetsTagEta.emplace_back(jetTag.eta()); | ||
| jetsTagGlobalIndex.emplace_back(jetTag.globalIndex()); | ||
| } | ||
| std::tie(baseToTagMatchingGeoIndex, tagToBaseMatchingGeoIndex) = MatchJetsGeometrically(jetsBasePhi, jetsBaseEta, jetsTagPhi, jetsTagEta, maxMatchingDistance); // change max distnace to a function call | ||
| float effectiveMatchingDistance = maxMatchingDistance; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here take the first one in the list so we can get rid of maxMatchingDistance as variable. So do
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it will break if an empty list is given at runtime but i think thats good. or where you do the LOGP fatal you can also check that the lists are not empty |
||
| for (std::size_t i = 0; i < jetRadiiForMatchingDistance.size() && i < maxMatchingDistancePerJetR.size(); i++) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here i would only check one of i < jetRadiiForMatchingDistance.size() or i < maxMatchingDistancePerJetR.size() since we constrain them to be the same
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this whole addition could be moved to line 314, after these : Because that way then you evaluate it once per jetR and you dont have to do the evaluation each time per jet |
||
| if (std::round(jetRadiiForMatchingDistance[i] * 100.0) == std::round(jetR)) { | ||
| effectiveMatchingDistance = maxMatchingDistancePerJetR[i]; | ||
| break; | ||
| } | ||
| } | ||
| std::tie(baseToTagMatchingGeoIndex, tagToBaseMatchingGeoIndex) = MatchJetsGeometrically(jetsBasePhi, jetsBaseEta, jetsTagPhi, jetsTagEta, effectiveMatchingDistance); | ||
| int jetBaseIndex = 0; | ||
| int jetTagIndex = 0; | ||
| for (const auto& jetBase : jetsBasePerCollision) { | ||
|
|
@@ -564,11 +571,11 @@ void MatchPt(T const& jetsBasePerCollision, U const& jetsTagPerCollision, std::v | |
|
|
||
| // function that calls all the Match functions | ||
| template <bool jetsBaseIsMc, bool jetsTagIsMc, typename T, typename U, typename V, typename M, typename N, typename O, typename P, typename R> | ||
| void doAllMatching(T const& jetsBasePerCollision, U const& jetsTagPerCollision, std::vector<std::vector<int>>& baseToTagMatchingGeo, std::vector<std::vector<int>>& baseToTagMatchingPt, std::vector<std::vector<int>>& baseToTagMatchingHF, std::vector<std::vector<int>>& tagToBaseMatchingGeo, std::vector<std::vector<int>>& tagToBaseMatchingPt, std::vector<std::vector<int>>& tagToBaseMatchingHF, V const& candidatesBase, M const& tracksBase, N const& clustersBase, O const& candidatesTag, P const& tracksTag, R const& clustersTag, bool doMatchingGeo, bool doMatchingHf, bool doMatchingPt, float maxMatchingDistance, float minPtFraction) | ||
| void doAllMatching(T const& jetsBasePerCollision, U const& jetsTagPerCollision, std::vector<std::vector<int>>& baseToTagMatchingGeo, std::vector<std::vector<int>>& baseToTagMatchingPt, std::vector<std::vector<int>>& baseToTagMatchingHF, std::vector<std::vector<int>>& tagToBaseMatchingGeo, std::vector<std::vector<int>>& tagToBaseMatchingPt, std::vector<std::vector<int>>& tagToBaseMatchingHF, V const& candidatesBase, M const& tracksBase, N const& clustersBase, O const& candidatesTag, P const& tracksTag, R const& clustersTag, bool doMatchingGeo, bool doMatchingHf, bool doMatchingPt, float maxMatchingDistance, float minPtFraction, std::vector<double> const& jetRadiiForMatchingDistance = {}, std::vector<double> const& maxMatchingDistancePerJetR = {}) | ||
| { | ||
| // geometric matching | ||
| if (doMatchingGeo) { | ||
| MatchGeo(jetsBasePerCollision, jetsTagPerCollision, baseToTagMatchingGeo, tagToBaseMatchingGeo, maxMatchingDistance); | ||
| MatchGeo(jetsBasePerCollision, jetsTagPerCollision, baseToTagMatchingGeo, tagToBaseMatchingGeo, maxMatchingDistance, jetRadiiForMatchingDistance, maxMatchingDistancePerJetR); | ||
| } | ||
| // pt matching | ||
| if (doMatchingPt) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,8 @@ struct JetMatchingDuplicates { | |
| o2::framework::Configurable<bool> doMatchingPt{"doMatchingPt", true, "Enable pt matching"}; | ||
| o2::framework::Configurable<bool> doMatchingHf{"doMatchingHf", false, "Enable HF matching"}; | ||
| o2::framework::Configurable<float> maxMatchingDistance{"maxMatchingDistance", 0.24f, "Max matching distance"}; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this variable everywhere |
||
| o2::framework::Configurable<std::vector<double>> jetRadiiForMatchingDistance{"jetRadiiForMatchingDistance", {}, "Jet R values for per-R matching distance override, e.g. {0.2, 0.4, 0.6}"}; | ||
| o2::framework::Configurable<std::vector<double>> maxMatchingDistancePerJetR{"maxMatchingDistancePerJetR", {}, "Max matching distance for each R in jetRadiiForMatchingDistance, e.g. {0.12, 0.24, 0.36}"}; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. have you checked up in previous analysis notes that these are the correct default values? Please also find the appropriate ones for R=0.3 and R=0.5 and add them too |
||
| o2::framework::Configurable<float> minPtFraction{"minPtFraction", 0.5f, "Minimum pt fraction for pt matching"}; | ||
|
|
||
| o2::framework::Produces<JetsBasetoTagMatchingTable> jetsBasetoTagMatchingTable; | ||
|
|
@@ -49,6 +51,9 @@ struct JetMatchingDuplicates { | |
|
|
||
| void init(o2::framework::InitContext const&) | ||
| { | ||
| if (jetRadiiForMatchingDistance->size() != maxMatchingDistancePerJetR->size()) { | ||
| LOGP(fatal, "jetRadiiForMatchingDistance and maxMatchingDistancePerJetR must have the same number of entries"); | ||
| } | ||
| } | ||
|
|
||
| void processJets(o2::aod::JetCollisions const& collisions, | ||
|
|
@@ -72,7 +77,7 @@ struct JetMatchingDuplicates { | |
| const auto jetsBasePerColl = jetsBase.sliceBy(baseJetsPerCollision, collision.globalIndex()); | ||
| const auto jetsTagPerColl = jetsTag.sliceBy(tagJetsPerCollision, collision.globalIndex()); | ||
| // initialise template parameters as false since even if they are Mc we are not matching between detector and particle level | ||
| jetmatchingutilities::doAllMatching<false, false>(jetsBasePerColl, jetsTagPerColl, jetsBasetoTagMatchingGeo, jetsBasetoTagMatchingPt, jetsBasetoTagMatchingHF, jetsTagtoBaseMatchingGeo, jetsTagtoBaseMatchingPt, jetsTagtoBaseMatchingHF, candidates, tracks, tracks, candidates, tracks, tracks, doMatchingGeo, doMatchingHf, doMatchingPt, maxMatchingDistance, minPtFraction); | ||
| jetmatchingutilities::doAllMatching<false, false>(jetsBasePerColl, jetsTagPerColl, jetsBasetoTagMatchingGeo, jetsBasetoTagMatchingPt, jetsBasetoTagMatchingHF, jetsTagtoBaseMatchingGeo, jetsTagtoBaseMatchingPt, jetsTagtoBaseMatchingHF, candidates, tracks, tracks, candidates, tracks, tracks, doMatchingGeo, doMatchingHf, doMatchingPt, maxMatchingDistance, minPtFraction, jetRadiiForMatchingDistance, maxMatchingDistancePerJetR); | ||
| } | ||
|
|
||
| for (auto i = 0; i < jetsBase.size(); ++i) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the variable float maxMatchingDistance,