Skip to content

[PWGJE] IR implementation in JE MC collision tables - #19079

Open
mhwang285 wants to merge 6 commits into
AliceO2Group:masterfrom
mhwang285:hadr-rate
Open

mhwang285 wants to merge 6 commits into
AliceO2Group:masterfrom
mhwang285:hadr-rate

Conversation

@mhwang285

Copy link
Copy Markdown
Contributor

Implements some improvements/additions relating to IR.

  • Decouples the hadronic rate in JCollisions from centrality/multiplicity/cross-section. includeHadronicRate = true now always includes the IR in JCollisions, regardless of which processCollisions* variant is used.
  • Adds a new IR column to the JMcCollisions table and fills it; it should also properly account for MCGEN datasets that don't have a BC table
  • Adds an independent getHadronicRate function in the JE derived data producers (regular and embedded) that updates the hadronic rate when includeHadronicRate is on and the run number has changed (i.e. it doesn't query the CCDB every BC, but at every run number change)
  • Implements autodetection of the IR estimator if requested. The autodetection currently uses T0VTX for pp and OO, and ZNC hadronic for all other systems.
  • IR "source" has been renamed to estimator for clarity.

@mhwang285
mhwang285 force-pushed the hadr-rate branch 2 times, most recently from 7576216 to ca097f4 Compare December 3, 2026 09:39
@github-actions github-actions Bot changed the title IR implementation in JE MC collision tables [PWGJE] IR implementation in JE MC collision tables Dec 4, 2026
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

O2 linter results: ❌ 0 errors, ⚠️ 159 warnings, 🔕 0 disabled

@mhwang285
mhwang285 marked this pull request as ready for review December 4, 2026 09:39
@alibuild

alibuild commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for 1c4ae63 at 2026-12-04 17:02:

## sw/BUILD/O2Physics-code-check-latest/log
--
========== List of issues found ==========
++ echo 'To reproduce the results below locally, run: '\''aliBuild build O2Physics-code-check -e ALIBUILD_BASE_HASH=upstream/master'\''.'
To reproduce the results below locally, run: 'aliBuild build O2Physics-code-check -e ALIBUILD_BASE_HASH=upstream/master'.
++ echo 'To apply all automatic fixes, add the '\''-e O2PHYSICS_CHECKER_FIX=1'\'' option.'
To apply all automatic fixes, add the '-e O2PHYSICS_CHECKER_FIX=1' option.
++ echo 'See the documentation for more details at: <https://aliceo2group.github.io/analysis-framework/docs/tools/#running-with-o2physics-code-check>.'
See the documentation for more details at: <https://aliceo2group.github.io/analysis-framework/docs/tools/#running-with-o2physics-code-check>.
++ echo 'Found 4 errors and 24 warnings.'
Found 4 errors and 24 warnings.
++ [[ 4 -gt 0 ]]
++ cat /sw/BUILD/10458e4e209986c41415c980032693fd58ef560b/O2Physics-code-check/errors.txt
PWGJE/TableProducer/derivedDataProducerEmbedding.cxx:251:28: error: the parameter 'bc' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param,-warnings-as-errors]
PWGJE/TableProducer/derivedDataProducerEmbedding.cxx:260:48: error: no header providing "o2::common::core::CollisionSystemType" is directly included [misc-include-cleaner,-warnings-as-errors]
PWGJE/TableProducer/derivedDataProducer.cxx:229:28: error: the parameter 'bc' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param,-warnings-as-errors]
PWGJE/TableProducer/derivedDataProducer.cxx:238:48: error: no header providing "o2::common::core::CollisionSystemType" is directly included [misc-include-cleaner,-warnings-as-errors]
++ [[ 24 -gt 0 ]]
++ cat /sw/BUILD/10458e4e209986c41415c980032693fd58ef560b/O2Physics-code-check/warnings.txt
PWGJE/DataModel/JetReducedData.h:314:32: warning: do not use 'else' after 'return' [readability-else-after-return]
PWGJE/DataModel/JetReducedData.h:420:180: warning: do not use 'else' after 'return' [readability-else-after-return]
PWGJE/DataModel/JetReducedData.h:422:199: warning: do not use 'else' after 'return' [readability-else-after-return]
PWGJE/DataModel/JetReducedData.h:424:201: warning: do not use 'else' after 'return' [readability-else-after-return]
PWGJE/TableProducer/derivedDataProducerEmbedding.cxx:92:8: warning: constructor does not initialize these fields: ccdb, lut, pdgDatabase, autodetectHadronicRateEstimator, runNumber, hadronicRate, withCollisionAssociator [cppcoreguidelines-pro-type-member-init]
PWGJE/TableProducer/derivedDataProducerEmbedding.cxx:259:11: warning: use auto when initializing with a template cast to avoid duplicating the type name [modernize-use-auto]
PWGJE/TableProducer/derivedDataProducerEmbedding.cxx:679:15: warning: variable 'sigmaDCAXYZ2' is not initialized [cppcoreguidelines-init-variables]
PWGJE/TableProducer/derivedDataProducerEmbedding.cxx:704:17: warning: variable 'sigmaDCAXYZ2' is not initialized [cppcoreguidelines-init-variables]
PWGJE/TableProducer/derivedDataProducerEmbedding.cxx:796:17: warning: variable 'sigmaDCAXYZ2' is not initialized [cppcoreguidelines-init-variables]
PWGJE/TableProducer/derivedDataProducerEmbedding.cxx:817:17: warning: variable 'sigmaDCAXYZ' is not initialized [cppcoreguidelines-init-variables]
PWGJE/TableProducer/derivedDataProducerEmbedding.cxx:893:5: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGJE/TableProducer/derivedDataProducer.cxx:78:8: warning: constructor does not initialize these fields: ccdb, lut, pdgDatabase, autodetectHadronicRateEstimator, runNumber, hadronicRate, withCollisionAssociator [cppcoreguidelines-pro-type-member-init]
PWGJE/TableProducer/derivedDataProducer.cxx:237:11: warning: use auto when initializing with a template cast to avoid duplicating the type name [modernize-use-auto]
PWGJE/TableProducer/derivedDataProducer.cxx:615:11: warning: variable 'sigmaDCAXYZ2' is not initialized [cppcoreguidelines-init-variables]
PWGJE/TableProducer/derivedDataProducer.cxx:643:17: warning: variable 'sigmaDCAXYZ2' is not initialized [cppcoreguidelines-init-variables]
PWGJE/TableProducer/derivedDataProducer.cxx:664:17: warning: variable 'sigmaDCAXYZ' is not initialized [cppcoreguidelines-init-variables]
PWGJE/TableProducer/derivedDataProducer.cxx:788:5: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGJE/TableProducer/derivedDataProducer.cxx:1146:9: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGJE/TableProducer/derivedDataProducer.cxx:1200:9: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGJE/TableProducer/derivedDataProducer.cxx:1255:9: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGJE/TableProducer/derivedDataWriter.cxx:56:8: warning: constructor does not initialize these fields: precisionPositionMask, precisionMomentumMask [cppcoreguidelines-pro-type-member-init]
PWGJE/TableProducer/derivedDataWriter.cxx:805:11: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGJE/TableProducer/derivedDataWriter.cxx:1025:9: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGJE/TableProducer/derivedDataWriter.cxx:1060:9: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
++ [[ 4 -gt 0 ]]
++ exit 1
--

Full log here.

TRandom3 trackingEfficiencyRandomNumber;

template <soa::is_iterator BC>
float getHadronicRate(BC bc)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

so this seems safe but could it also just be done in the init? I guess for any dataset we run over we would only need to establish the collision type once?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ideally yes but I couldn't find any way to get the run number out of the metadata directly; it needs to be done on a BC. So it has to be in a processing function somehow because the init won't have access to any tables

hadronicRate = rateFetcher.fetch(ccdb.service, bc.timestamp(), runNumber, config.irSource) * 0.001;
}
}
hadronicRate = getHadronicRate(bc);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why not use the bcHadronicRateMapping here instead of the getHadronicRate function?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So currently (as in the current master), processMcCollisions* strictly requires processBunchCrossings on as well, since it fills the RCT and selection mappings that processMcCollisions* use, and workflows that run over MC collisions will already have processBunchCrossings = true. But processCollisions* don't use these mappings, so workflows that don't specifically need the JBCs table could previously have processBunchCrossings off with no effect. If we tried to use the hadronic rate mapping here, then processBunchCrossings would become a strict dependency for processCollisions*, and I wanted to avoid creating a new dependency if it could be avoided and minimize the changes needed to existing workflows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants