-
Notifications
You must be signed in to change notification settings - Fork 680
[PWGLF] fixed all O2 linter warnings and added eventcorrection histograms #17498
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
Merged
+28
−13
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -9,7 +9,7 @@ | |||||
| // granted to it by virtue of its status as an Intergovernmental Organization | ||||||
| // or submit itself to any jurisdiction. | ||||||
|
|
||||||
| /// \file deltaanalysis.cxx | ||||||
| /// \file deltaAnalysis.cxx | ||||||
| /// \brief Delta(1232) resonance analysis via proton-pion invariant mass reconstruction with advance PID and background rejection cuts also add efficiency correction and acceptance correction | ||||||
| /// \author Durgesh Bhatt <durgesh.bhatt@cern.ch> | ||||||
|
|
||||||
|
|
@@ -60,9 +60,10 @@ using namespace o2::constants::physics; | |||||
|
|
||||||
| namespace | ||||||
| { | ||||||
| constexpr float massProton = o2::constants::physics::MassProton; | ||||||
| constexpr float massPion = o2::constants::physics::MassPionCharged; | ||||||
| constexpr float minAbsCharge = 1e-3f; | ||||||
| constexpr float MassProton = o2::constants::physics::MassProton; | ||||||
| constexpr float MassPion = o2::constants::physics::MassPionCharged; | ||||||
| constexpr float MinAbsCharge = 1e-3f; | ||||||
| const std::array<float, 2> kProtonPionMasses{MassProton, MassPion}; | ||||||
|
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. The
Suggested change
|
||||||
| } // namespace | ||||||
| namespace delta_analysis | ||||||
| { | ||||||
|
|
@@ -449,7 +450,13 @@ struct DeltaAnalysis { | |||||
| if (doprocessEventFactor) { | ||||||
| histos.add("EventFactor/hRecoEvents", "Reconstructed INEL>0 events (Nrec)", kTH1F, {centAxis}); | ||||||
| histos.add("EventFactor/hEventsGenAll", "Generated events passing truth |Zvtx| + truth INEL>0 cuts", kTH1F, {centAxis}); | ||||||
| histos.add("EventFactor/hEventsGenAccepted", "Generated events with >=1 accepted reconstructed collision", kTH1F, {centAxis}); | ||||||
| histos.add("EventFactor/hEventsGenAccepted", "Generated events with >=1 accepted reconstructed collision (truth centrality)", kTH1F, {centAxis}); | ||||||
| // NEW: same "generated with >=1 accepted reconstructed collision" population as | ||||||
| // hEventsGenAccepted, but filled with the RECONSTRUCTED centrality of that accepted | ||||||
| // collision instead of the truth centrality. This puts it on the same axis as | ||||||
| // hRecoEvents so that event_splitting = hEventsGenAcceptedReco / hRecoEvents compares | ||||||
| // like with like. hEventsGenAccepted (truth-binned) stays as-is for event_loss. | ||||||
| histos.add("EventFactor/hEventsGenAcceptedReco", "Generated events with >=1 accepted reconstructed collision (reconstructed centrality)", kTH1F, {centAxis}); | ||||||
| histos.add("EventFactor/hNRecoCollisionsPerMcCollision", "Number of reconstructed collisions per generated collision", kTH1F, {{21, -0.5f, 20.5f}}); | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -545,7 +552,7 @@ struct DeltaAnalysis { | |||||
| if (!pdgParticle) { | ||||||
| return false; | ||||||
| } | ||||||
| return std::abs(pdgParticle->Charge()) > minAbsCharge; | ||||||
| return std::abs(pdgParticle->Charge()) > MinAbsCharge; | ||||||
| } | ||||||
|
|
||||||
| // Truth-level analogue of isRecoInelGt0() above - at least one charged primary within | ||||||
|
|
@@ -1029,7 +1036,7 @@ struct DeltaAnalysis { | |||||
| const std::array<std::array<float, 3>, 2> rotMomenta = { | ||||||
| std::array<float, 3>{pxProton, pyProton, pzProton}, | ||||||
| std::array<float, 3>{pxPionRot, pyPionRot, pzPion}}; | ||||||
| const float rotMass = RecoDecay::m(rotMomenta, std::array{massProton, massPion}); | ||||||
| const float rotMass = RecoDecay::m(rotMomenta, kProtonPionMasses); | ||||||
| const float rotPt = RecoDecay::pt(std::array{pxProton + pxPionRot, pyProton + pyPionRot}); | ||||||
| const float rotY = RecoDecay::y( | ||||||
| std::array{pxProton + pxPionRot, pyProton + pyPionRot, pzProton + pzPion}, rotMass); | ||||||
|
|
@@ -1155,7 +1162,7 @@ struct DeltaAnalysis { | |||||
| const std::array<std::array<float, 3>, 2> bothMomenta = { | ||||||
| std::array<float, 3>{pxPr, pyPr, pzPr}, | ||||||
| std::array<float, 3>{pxPi, pyPi, pzPi}}; | ||||||
| const float pairMass = RecoDecay::m(bothMomenta, std::array{massProton, massPion}); | ||||||
| const float pairMass = RecoDecay::m(bothMomenta, kProtonPionMasses); | ||||||
| const float pairPt = RecoDecay::pt(std::array{pxPr + pxPi, pyPr + pyPi}); | ||||||
| const float pairY = RecoDecay::y(std::array{pxPr + pxPi, pyPr + pyPi, pzPr + pzPi}, pairMass); | ||||||
|
|
||||||
|
|
@@ -1414,7 +1421,7 @@ struct DeltaAnalysis { | |||||
| const std::array<std::array<float, 3>, 2> momentaReco = { | ||||||
| std::array<float, 3>{t0.px(), t0.py(), t0.pz()}, | ||||||
| std::array<float, 3>{t1.px(), t1.py(), t1.pz()}}; | ||||||
| const float pairMassReco = RecoDecay::m(momentaReco, std::array{massProton, massPion}); | ||||||
| const float pairMassReco = RecoDecay::m(momentaReco, kProtonPionMasses); | ||||||
| const float pairPtReco = RecoDecay::pt(std::array{t0.px() + t1.px(), t0.py() + t1.py()}); | ||||||
| const float pairYReco = RecoDecay::y(std::array{t0.px() + t1.px(), t0.py() + t1.py(), t0.pz() + t1.pz()}, pairMassReco); | ||||||
| if (pairYReco >= trackCuts.cfgMinY && pairYReco <= trackCuts.cfgMaxY) { | ||||||
|
|
@@ -1456,7 +1463,7 @@ struct DeltaAnalysis { | |||||
| const std::array<std::array<float, 3>, 2> momenta = { | ||||||
| std::array<float, 3>{t0.px(), t0.py(), t0.pz()}, | ||||||
| std::array<float, 3>{t1.px(), t1.py(), t1.pz()}}; | ||||||
| const float pairMass = RecoDecay::m(momenta, std::array{massProton, massPion}); | ||||||
| const float pairMass = RecoDecay::m(momenta, kProtonPionMasses); | ||||||
| const float pairPt = RecoDecay::pt(std::array{t0.px() + t1.px(), t0.py() + t1.py()}); | ||||||
| const float pairY = RecoDecay::y(std::array{t0.px() + t1.px(), t0.py() + t1.py(), t0.pz() + t1.pz()}, pairMass); | ||||||
| if (pairY < trackCuts.cfgMinY || pairY > trackCuts.cfgMaxY) { | ||||||
|
|
@@ -1595,7 +1602,7 @@ struct DeltaAnalysis { | |||||
| { | ||||||
| // ── Loop A: reconstructed collisions ────────────────────────────────────────────────── | ||||||
| std::unordered_map<int64_t, int> nRecoCollisionsPerMc; | ||||||
| std::unordered_set<int64_t> acceptedMcCollisionIds; | ||||||
| std::unordered_map<int64_t, float> acceptedMcCollisionRecoCent; | ||||||
| for (auto const& collision : collisions) { | ||||||
| if (collision.has_mcCollision()) { | ||||||
| ++nRecoCollisionsPerMc[collision.mcCollisionId()]; | ||||||
|
|
@@ -1606,7 +1613,10 @@ struct DeltaAnalysis { | |||||
| const float centrality = getCentrality(collision); | ||||||
| histos.fill(HIST("EventFactor/hRecoEvents"), centrality); | ||||||
| if (collision.has_mcCollision()) { | ||||||
| acceptedMcCollisionIds.insert(collision.mcCollisionId()); | ||||||
| // emplace() keeps the FIRST accepted collision's centrality if a generated collision | ||||||
| // has more than one accepted reconstructed collision (splitting), matching the | ||||||
| // "first accepted" convention already used in processMCGen() above. | ||||||
| acceptedMcCollisionRecoCent.emplace(collision.mcCollisionId(), centrality); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -1636,11 +1646,16 @@ struct DeltaAnalysis { | |||||
| histos.fill(HIST("CutFlow/EventFactor/hEventAcceptedCutFlow"), 3.f); // Has associated reconstructed collision | ||||||
| } | ||||||
|
|
||||||
| const bool hasAcceptedReco = acceptedMcCollisionIds.contains(mcCollision.globalIndex()); | ||||||
| const auto itCent = acceptedMcCollisionRecoCent.find(mcCollision.globalIndex()); | ||||||
| const bool hasAcceptedReco = (itCent != acceptedMcCollisionRecoCent.end()); | ||||||
|
Comment on lines
-1639
to
+1650
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 looks like a regression. |
||||||
| if (hasAcceptedReco) { | ||||||
| histos.fill(HIST("CutFlow/EventFactor/hEventAcceptedCutFlow"), 4.f); // Associated reco collision passes event selection | ||||||
| histos.fill(HIST("CutFlow/EventFactor/hEventAcceptedCutFlow"), 5.f); // Final EventAccepted | ||||||
| // Truth-binned: denominator for event_loss = hEventsGenAccepted / hEventsGenAll (unchanged). | ||||||
| histos.fill(HIST("EventFactor/hEventsGenAccepted"), truthCentrality); | ||||||
| // NEW - reco-binned: numerator for event_splitting = hEventsGenAcceptedReco / hRecoEvents, | ||||||
| // now on the same (reconstructed) centrality axis as hRecoEvents. | ||||||
| histos.fill(HIST("EventFactor/hEventsGenAcceptedReco"), itCent->second); | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
Oops, something went wrong.
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.
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.
The constants defined here are not needed. You can use the existing ones directly.