Skip to content

Conversation

@carriganm95
Copy link

This PR adds the ability to use tools to normalize the shower dEdx and energy using the TPC, YZ, and drift sqlite normalization tools.

For MC only the TPC and YZ normalization tools are used. Additionally, because the maps change based on run and the MC does not have valid run numbers to look up the maps in the sqlite database the run must be hard coded in the fcl files. Based on the run set in the fcl file a run from the correct Run era will be used to obtain the correct maps from the database. In the future overlays should fix the need for these hard coded values.

This PR also depends on a PR to larpandora which adds functions to the energy/dedx tools to run the normalizations.

gputnam and others added 30 commits May 16, 2025 11:11
…forms

keep PMT waveforms in stage and add fcl to drop them later
…tage0dropPMT-metadata

Enable Metadata Injection for Production
leoaliaga and others added 27 commits October 10, 2025 18:35
…_CRTData_prod

This PR re-introduces CRTData in Stage0.
…d added TriggerTimestamp variable to DAQTree.
…Hit_CRTDataAnalysis

Fix issue where CRT HitTree in calibration tuples did not store run number.
…pdate-tpccal-tags

Update TPC calibration to tag including 2D-based Run2+4 calibrations.
…etsim-run4

Add in option to control YZMap+Electron lifetime DB from fcl.
…run4_tcorr

Update PMT database tags [SBN2025A]
Copilot AI review requested due to automatic review settings January 26, 2026 22:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds shower normalization capabilities using TPC, YZ, and drift SQLite normalization tools to improve energy/dEdx calibration. The implementation includes new per-plane TPC normalization tools, updated calibration constants based on Run 2 stopping muons, and infrastructure for MC support via hardcoded run numbers (pending future overlay improvements).

Changes:

  • New normalization tools (NormalizeTPCPerPlane, NormalizeTPCPerPlaneSQL) with per-plane TPC equalization
  • Updated calibration constants and database tags (TPC_CalibrationTags_Jul2025, TPC_CalibrationTags_Oct2025)
  • HitMerger module extended with ChannelROI associations
  • Wire-Cell configuration updates for shifted YZ map files and configurable parameters
  • Extensive FCL file reorganization (standard/ directory restructured into mc/, data/, overlay/ subdirectories)
  • MC normalization support via hardcoded run numbers (Run 1-4) based on fcl-configured run period
  • Updated CAF maker workflows with geant4weight additions
  • CRT module code formatting improvements

Reviewed changes

Copilot reviewed 90 out of 96 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
ups/product_deps Updated dependency versions (icarus_data v10_06_02, icarusalg v10_06_00_06, sbncode v10_06_00_06)
HitMerger_module.cc Added ChannelROI-to-Hit associations for normalization tool access
wcls-multitpc-sim-drift-simchannel-yzsim-refactored.jsonnet Updated to use shifted YZ map files and external variables for configuration
wcls-multitpc-sim-drift-simchannel-refactored.jsonnet Added overlay_drifter support and configurable drifter selection
sim.jsonnet Externalized DBFileName and DBTag for runtime configuration
detsimmodules_wirecell_ICARUS.fcl Added YZ map configuration, updated gains, and time offsets for 2D deconvolution
normtools_icarus.fcl Updated to per-plane TPC normalization, added MC flag, new calibration constants
calorimetryICARUS.fcl MC gains now match data gains per updated calibration
NormalizeYZSQL_tool.cc Added MC flag for hardcoded run number lookup
NormalizeTPCSQL_tool.cc Added MC flag and debug output
NormalizeTPCPerPlane_tool.cc New HTTP-based per-plane TPC normalization tool
NormalizeTPCPerPlaneSQL_tool.cc New SQL-based per-plane TPC normalization tool
CMakeLists.txt (Calorimetry) Added build targets for new per-plane normalization tools
CRTDataAnalysis_module.cc Code formatting improvements and added fHitRun/fHitSubRun branches
fcl/standard/* Reorganized into mc/, data/, overlay/ subdirectories with new CMakeLists structure
stage1_run2_icarus_MC.fcl Added normalization tool configuration for MC showers with hardcoded run periods
stage1_icarus_defs.fcl Updated hit merger integration, pulse train hits, and normalization tool setup
cafmaker configurations Added geant4weight to systematic weight sequences
calibration_database_*_icarus.fcl New tag sets for Jul2025 and Oct2025 calibrations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


icarus::calo::NormalizeTPCSQL::ScaleInfo icarus::calo::NormalizeTPCSQL::GetScaleInfo(uint64_t run) {

std::cout << "NormalizeTPCSQL Tool -- Getting scale info for run: " << run << std::endl;
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

The std::cout debug statements should be removed or replaced with proper logging using the message facility (mf::LogInfo, mf::LogDebug, etc.). These lines will pollute the output in production runs. If verbose output is needed, it should be controlled by the fVerbose flag and use proper logging facilities.

Copilot uses AI. Check for mistakes.
double icarus::calo::NormalizeTPCSQL::Normalize(double dQdx, const art::Event &e,
const recob::Hit &hit, const geo::Point_t &location, const geo::Vector_t &direction, double t0) {

std::cout << "NormalizeTPCSQL Tool -- MC Flag: " << fMC << " Run: " << e.id().runID().run() << ", Subrun: " << e.id().subRunID().run() << std::endl;
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

The std::cout debug statement should be removed or replaced with proper logging using the message facility. This line will pollute the output in production runs. If verbose output is needed, it should be controlled by the fVerbose flag and use proper logging facilities.

Copilot uses AI. Check for mistakes.
namespace icarus {
namespace calo {

class NormalizeTPC : public INormalizeCharge
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

The class is named "NormalizeTPC" but should be "NormalizeTPCPerPlane" to match the tool_type specified in the fcl file (NormalizeTPCPerPlane) and to differentiate it from the existing NormalizeTPC tool. This naming inconsistency could cause confusion.

Copilot uses AI. Check for mistakes.
void makeRawDigitAssns(const art::Event&, art::Assns<raw::RawDigit, recob::Hit>&, RecobHitToPtrMap&) const;

/**
* @brief Create recob::ChannelROI to recob::Hit associatins
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

The typo "associatins" should be corrected to "associations" in the comment.

Copilot uses AI. Check for mistakes.
Comment on lines +134 to +135
physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools[0].MC: @local::runPeriod
physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools[1].MC: @local::runPeriod
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

Inconsistent configuration: Line 133 sets NormTools for CryoE but line 134 tries to set NormTools[0].MC for CryoW. Line 137 then sets NormTools for CryoW again. This appears to be a copy-paste error where lines 134-135 should reference SBNShowerGausCryoE instead of SBNShowerGausCryoW.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1 @@
#include "cafmakerjob_icarus_detsim2d_systtools_and_fluxwgt_overlay.fcl"
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

The filename has a typo: "iarus" should be "icarus". This should be renamed to "standard_overlay_caf_icarus.fcl" to match the naming convention of other files in this directory.

Copilot uses AI. Check for mistakes.
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.

7 participants