From e0afaa22e8a1a65300d00ab786ecbdba2061a3d2 Mon Sep 17 00:00:00 2001 From: Gray Putnam Date: Wed, 30 Jul 2025 21:17:48 -0500 Subject: [PATCH 1/8] Update calibrations for 2D+DNN signal processing for Run 2. --- ...calibration_database_GlobalTags_icarus.fcl | 2 +- ...alibration_database_TPC_TagSets_icarus.fcl | 11 ++ icaruscode/TPC/Calorimetry/CMakeLists.txt | 2 + .../NormalizeTPCPerPlaneSQL_tool.cc | 121 ++++++++++++++ .../Calorimetry/NormalizeTPCPerPlane_tool.cc | 158 ++++++++++++++++++ .../TPC/Calorimetry/normtools_icarus.fcl | 12 +- 6 files changed, 299 insertions(+), 7 deletions(-) create mode 100644 icaruscode/TPC/Calorimetry/NormalizeTPCPerPlaneSQL_tool.cc create mode 100644 icaruscode/TPC/Calorimetry/NormalizeTPCPerPlane_tool.cc diff --git a/fcl/configurations/calibration_database_GlobalTags_icarus.fcl b/fcl/configurations/calibration_database_GlobalTags_icarus.fcl index 5d080878d..03f5d89a5 100644 --- a/fcl/configurations/calibration_database_GlobalTags_icarus.fcl +++ b/fcl/configurations/calibration_database_GlobalTags_icarus.fcl @@ -5,7 +5,7 @@ BEGIN_PROLOG ICARUS_Calibration_GlobalTags: { - @table::TPC_CalibrationTags_Jan2025 + @table::TPC_CalibrationTags_Jul2025 @table::PMT_CalibrationTags_Run3_Feb2025 @table::CRT_CalibrationTags_Oct2023 } diff --git a/fcl/configurations/calibration_database_TPC_TagSets_icarus.fcl b/fcl/configurations/calibration_database_TPC_TagSets_icarus.fcl index 828e8d8a3..99d15c020 100644 --- a/fcl/configurations/calibration_database_TPC_TagSets_icarus.fcl +++ b/fcl/configurations/calibration_database_TPC_TagSets_icarus.fcl @@ -37,4 +37,15 @@ TPC_CalibrationTags_Jan2025: { } +## TPC_CalibrationTags_Jul2024 +# Update to 2D deconv tags. Change TPC equalization to be per-plane +TPC_CalibrationTags_Jul2025: { + + tpc_channelstatus_data: "v3r4" + tpc_elifetime_data: "v3r0" + tpc_dqdxcalibration_allplanes_data: "v1r0" + tpc_yz_correction_allplanes_data: "v2r0" + +} + END_PROLOG diff --git a/icaruscode/TPC/Calorimetry/CMakeLists.txt b/icaruscode/TPC/Calorimetry/CMakeLists.txt index a3b1709c5..45b214a16 100644 --- a/icaruscode/TPC/Calorimetry/CMakeLists.txt +++ b/icaruscode/TPC/Calorimetry/CMakeLists.txt @@ -47,6 +47,8 @@ cet_build_plugin(NormalizeDriftSQLite art::tool LIBRARIES ${TOOL_LIBRARIES}) cet_build_plugin(NormalizeDrift art::tool LIBRARIES ${TOOL_LIBRARIES}) cet_build_plugin(NormalizeTPCSQL art::tool LIBRARIES ${TOOL_LIBRARIES}) cet_build_plugin(NormalizeTPC art::tool LIBRARIES ${TOOL_LIBRARIES}) +cet_build_plugin(NormalizeTPCPerPlaneSQL art::tool LIBRARIES ${TOOL_LIBRARIES}) +cet_build_plugin(NormalizeTPCPerPlane art::tool LIBRARIES ${TOOL_LIBRARIES}) cet_build_plugin(NormalizeTPCLocal art::tool LIBRARIES ${TOOL_LIBRARIES}) cet_build_plugin(NormalizeWire art::tool LIBRARIES ${TOOL_LIBRARIES}) cet_build_plugin(NormalizeYZSQL art::tool LIBRARIES ${TOOL_LIBRARIES}) diff --git a/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlaneSQL_tool.cc b/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlaneSQL_tool.cc new file mode 100644 index 000000000..6ed734b13 --- /dev/null +++ b/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlaneSQL_tool.cc @@ -0,0 +1,121 @@ +// Framework Includes +#include "art/Framework/Core/EDProducer.h" +#include "art/Framework/Principal/Event.h" +#include "art/Framework/Principal/Handle.h" +#include "art/Framework/Services/Registry/ServiceHandle.h" +#include "art/Persistency/Common/PtrMaker.h" +#include "art/Utilities/ToolMacros.h" +#include "cetlib/cpu_timer.h" +#include "fhiclcpp/ParameterSet.h" +#include "messagefacility/MessageLogger/MessageLogger.h" + +#include "larevt/CalibrationDBI/Providers/DBFolder.h" + +// Tool include +#include "larreco/Calorimetry/INormalizeCharge.h" + +// Services +#include "lardata/DetectorInfoServices/DetectorClocksService.h" + +// Lab helpers +#include "wda.h" + +// C++ +#include + +namespace icarus { + namespace calo { + +class NormalizeTPCPerPlaneSQL : public INormalizeCharge +{ +public: + NormalizeTPCPerPlaneSQL(fhicl::ParameterSet const &pset); + + void configure(const fhicl::ParameterSet& pset) override; + double Normalize(double dQdx, const art::Event &e, const recob::Hit &h, const geo::Point_t &location, const geo::Vector_t &direction, double t0) override; + +private: + // Configuration + std::string fDBFileName; + std::string fDBTag; + bool fVerbose; + + lariov::DBFolder fDB; + + // Class to hold data from DB + class ScaleInfo { + public: + std::map scale; + }; + + // Helpers + ScaleInfo GetScaleInfo(uint64_t run); + + // Cache run requests + std::map fScaleInfos; +}; + +DEFINE_ART_CLASS_TOOL(NormalizeTPCPerPlaneSQL) + + } // end namespace calo +} // end namespace icarus + + +icarus::calo::NormalizeTPCPerPlaneSQL::NormalizeTPCPerPlaneSQL(fhicl::ParameterSet const &pset): + fDBFileName(pset.get("DBFileName")), + fDBTag(pset.get("DBTag")), + fVerbose(pset.get("Verbose", false)), + fDB(fDBFileName, "", "", fDBTag, true, false) {} + +void icarus::calo::NormalizeTPCPerPlaneSQL::configure(const fhicl::ParameterSet& pset) {} + +icarus::calo::NormalizeTPCPerPlaneSQL::ScaleInfo icarus::calo::NormalizeTPCPerPlaneSQL::GetScaleInfo(uint64_t run) { + // check the cache + if (fScaleInfos.count(run)) { + return fScaleInfos.at(run); + } + + // Look up the run + // + // Translate the run into a fake "timestamp" + fDB.UpdateData((run+1000000000)*1000000000); + + // Collect the run info + ScaleInfo thisscale; + + // Iterate over the rows + for (unsigned ch = 0; ch < 12; ch++) { + double scale; + fDB.GetNamedChannelData(ch, "scale", scale); + + thisscale.scale[ch] = scale; + } + // Set the cache + fScaleInfos[run] = thisscale; + + return thisscale; +} + +double icarus::calo::NormalizeTPCPerPlaneSQL::Normalize(double dQdx, const art::Event &e, + const recob::Hit &hit, const geo::Point_t &location, const geo::Vector_t &direction, double t0) { + // Get the info + ScaleInfo i = GetScaleInfo(e.id().runID().run()); + + // Lookup the TPC, cryo + unsigned tpc = hit.WireID().TPC; + unsigned cryo = hit.WireID().Cryostat; + unsigned plane = hit.WireID().Plane; + + // Get the TPC-Plane index + unsigned itpc_plane = 2*cryo + tpc/2 + plane*4; + + double scale = 1; + + // TODO: what to do if no scale is found? throw an exception?? + if (i.scale.count(itpc_plane)) scale = i.scale.at(itpc_plane); + + if (fVerbose) std::cout << "NormalizeTPCPerPlaneSQL Tool -- Data at Cryo: " << cryo << " TPC: " << tpc << " Plane: " << plane << " itpc_plane: " << itpc_plane << " scale: " << scale << std::endl; + + return dQdx * scale; +} + diff --git a/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlane_tool.cc b/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlane_tool.cc new file mode 100644 index 000000000..6e61f7a6f --- /dev/null +++ b/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlane_tool.cc @@ -0,0 +1,158 @@ +// Framework Includes +#include "art/Framework/Core/EDProducer.h" +#include "art/Framework/Principal/Event.h" +#include "art/Framework/Principal/Handle.h" +#include "art/Framework/Services/Registry/ServiceHandle.h" +#include "art/Persistency/Common/PtrMaker.h" +#include "art/Utilities/ToolMacros.h" +#include "cetlib/cpu_timer.h" +#include "fhiclcpp/ParameterSet.h" +#include "messagefacility/MessageLogger/MessageLogger.h" + +// Tool include +#include "larreco/Calorimetry/INormalizeCharge.h" + +// Services +#include "lardata/DetectorInfoServices/DetectorClocksService.h" + +// Lab helpers +#include "wda.h" + +// C++ +#include + +namespace icarus { + namespace calo { + +class NormalizeTPC : public INormalizeCharge +{ +public: + NormalizeTPC(fhicl::ParameterSet const &pset); + + void configure(const fhicl::ParameterSet& pset) override; + double Normalize(double dQdx, const art::Event &e, const recob::Hit &h, const geo::Point_t &location, const geo::Vector_t &direction, double t0) override; + +private: + // Configuration + int fTimeout; + std::string fURL; + bool fVerbose; + + // Class to hold data from DB + class ScaleInfo { + public: + std::map scale; + }; + + // Helpers + ScaleInfo GetScaleInfo(uint64_t run); + std::string URL(uint64_t run); + + // Cache run requests + std::map fScaleInfos; +}; + +DEFINE_ART_CLASS_TOOL(NormalizeTPC) + + } // end namespace calo +} // end namespace icarus + + +icarus::calo::NormalizeTPC::NormalizeTPC(fhicl::ParameterSet const &pset) { + this->configure(pset); +} + +void icarus::calo::NormalizeTPC::configure(const fhicl::ParameterSet& pset) { + fURL = pset.get("URL"); + fTimeout = pset.get("Timeout"); + fVerbose = pset.get("Verbose", false); +} + +std::string icarus::calo::NormalizeTPC::URL(uint64_t run) { + return fURL + std::to_string(run); +} + +icarus::calo::NormalizeTPC::ScaleInfo icarus::calo::NormalizeTPC::GetScaleInfo(uint64_t run) { + // check the cache + if (fScaleInfos.count(run)) { + return fScaleInfos.at(run); + } + + // Otherwise, look it up + int error = 0; + std::string url = URL(run); + + if (fVerbose) std::cout << "NormalizeTPC Tool -- New Scale info, requesting data from url:\n" << url << std::endl; + + Dataset d = getDataWithTimeout(url.c_str(), "", fTimeout, &error); + if (error) { + throw cet::exception("NormalizeTPC") << "Calibration Database access failed. URL: (" << url << ") Error Code: " << error; + } + + if (fVerbose) std::cout << "NormalizeTPC Tool -- Received HTTP response:\n" << getHTTPmessage(d) << std::endl; + + if (getHTTPstatus(d) != 200) { + throw cet::exception("NormalizeTPC") + << "Calibration Database access failed. URL: (" << url + << "). HTTP error status: " << getHTTPstatus(d) << ". HTTP error message: " << getHTTPmessage(d); + } + + // Collect the run info + ScaleInfo thisscale; + + // Number of rows + int n_tuple = getNtuples(d); + if (n_tuple < 0) { + throw cet::exception("NormalizeTPC") << "Calibration Database access failed. URL: (" << url << ") Bad Tuple Number: " << n_tuple; + } + + // Iterate over the rows + // The first 4 are metadata + for (unsigned row = 4; row < (unsigned)n_tuple; row++) { + Tuple tup = getTuple(d, row); + + int err = 0; + // Get the itpc number + int ch = getLongValue(tup, 0, &err); + if (error) { + throw cet::exception("NormalizeTPC") << "Calibration Database access failed. URL: (" << url << ") Failed on tuple access, row: " << row << ", col 0. Error Code: " << error; + } + + // and the scale + double scale = getDoubleValue(tup, 3, &err); + if (error) { + throw cet::exception("NormalizeTPC") << "Calibration Database access failed. URL: (" << url << ") Failed on tuple access, row: " << row << ", col 1. Error Code: " << error; + } + + thisscale.scale[ch] = scale; + } + + // Set the cache + fScaleInfos[run] = thisscale; + + return thisscale; +} + +double icarus::calo::NormalizeTPC::Normalize(double dQdx, const art::Event &e, + const recob::Hit &hit, const geo::Point_t &location, const geo::Vector_t &direction, double t0) { + // Get the info + ScaleInfo i = GetScaleInfo(e.id().runID().run()); + + // Lookup the TPC, cryo + unsigned tpc = hit.WireID().TPC; + unsigned cryo = hit.WireID().Cryostat; + unsigned plane = hit.WireID().Plane; + + // Get the TPC-Plane index + unsigned itpc_plane = 2*cryo + tpc/2 + plane*4; + + double scale = 1; + + // TODO: what to do if no scale is found? throw an exception?? + if (i.scale.count(itpc_plane)) scale = i.scale.at(itpc_plane); + + if (fVerbose) std::cout << "NormalizeTPCPerPlaneSQL Tool -- Data at Cryo: " << cryo << " TPC: " << tpc << " Plane: " << plane << " itpc_plane: " << itpc_plane << " scale: " << scale << std::endl; + + return dQdx * scale; +} + diff --git a/icaruscode/TPC/Calorimetry/normtools_icarus.fcl b/icaruscode/TPC/Calorimetry/normtools_icarus.fcl index 2a69eb647..5443186cf 100644 --- a/icaruscode/TPC/Calorimetry/normtools_icarus.fcl +++ b/icaruscode/TPC/Calorimetry/normtools_icarus.fcl @@ -24,9 +24,9 @@ yznorm: { } tpcgain: { - tool_type: NormalizeTPC + tool_type: NormalizeTPCPerPlane Timeout: 200 - URL: "https://dbdata0vm.fnal.gov:9443/icarus_con_prod/app/data?f=tpc_dqdxcalibration_data&t=" + URL: "https://dbdata0vm.fnal.gov:9443/icarus_con_prod/app/data?f=tpc_dqdxcalibration_allplanes_data&t=" Verbose: false } @@ -38,9 +38,9 @@ driftnorm_sql: { } tpcgain_sql: { - tool_type: NormalizeTPCSQL - DBFileName: tpc_dqdxcalibration_data - DBTag: @local::ICARUS_Calibration_GlobalTags.tpc_dqdxcalibration_data + tool_type: NormalizeTPCPerPlaneSQL + DBFileName: tpc_dqdxcalibration_allplanes_data + DBTag: @local::ICARUS_Calibration_GlobalTags.tpc_dqdxcalibration_allplanes_data Verbose: false } @@ -59,7 +59,7 @@ yznorm_sql: { } #icarus_calonormtools: [@local::driftnorm, @local::yznorm, @local::tpcgain] - icarus_calonormtools: [@local::driftnorm_sql, @local::yznorm_sql, @local::tpcgain_sql] +icarus_calonormtools: [@local::driftnorm_sql, @local::yznorm_sql, @local::tpcgain_sql] # Gain with angular dep. recombination. Measurement from: https://arxiv.org/pdf/2407.12969 # Assume equal on planes -- this is __wrong__ -- will need to be fixed when they are calibrated From 13b53a7aaa3d9c571e1855cf7f8bb1a69218dfd0 Mon Sep 17 00:00:00 2001 From: Michael Carrigan Date: Thu, 4 Dec 2025 13:25:39 -0600 Subject: [PATCH 2/8] first commit --- .../Stage1/data/stage1_run2_shwcal_icarus.fcl | 44 +++++ .../mc/stage1_run2_shwcal_mc_icarus.fcl | 171 ++++++++++++++++++ .../Calorimetry/NormalizeDriftSQLite_tool.cc | 3 + .../NormalizeTPCPerPlaneSQL_tool.cc | 32 +++- .../TPC/Calorimetry/NormalizeYZSQL_tool.cc | 30 ++- .../TPC/Calorimetry/normtools_icarus.fcl | 12 +- 6 files changed, 286 insertions(+), 6 deletions(-) create mode 100644 fcl/reco/Stage1/data/stage1_run2_shwcal_icarus.fcl create mode 100644 fcl/reco/Stage1/mc/stage1_run2_shwcal_mc_icarus.fcl diff --git a/fcl/reco/Stage1/data/stage1_run2_shwcal_icarus.fcl b/fcl/reco/Stage1/data/stage1_run2_shwcal_icarus.fcl new file mode 100644 index 000000000..f9cb9d46d --- /dev/null +++ b/fcl/reco/Stage1/data/stage1_run2_shwcal_icarus.fcl @@ -0,0 +1,44 @@ +#include "stage1_run2_icarus.fcl" + +message: @local::icarus_message_services_prod + +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].CalorimetryAlg: @local::icarus_calorimetryalgdata +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].NormTools: @local::icarus_calonormtools +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].CalorimetryAlg: @local::icarus_calorimetryalgdata +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].NormTools: @local::icarus_calonormtools + +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].CalorimetryAlg: @local::icarus_calorimetryalgdata +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].NormTools: @local::icarus_calonormtools +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].CalorimetryAlg: @local::icarus_calorimetryalgdata +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].NormTools: @local::icarus_calonormtools + +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[3].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[3].NormTools: @local::icarus_calonormtools +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools: @local::icarus_calonormtools + +services.message.destinations : +{ + STDCOUT: + { + type: "cout" #tells the message service to output this destination to cout + threshold: "ERROR" #tells the message service that this destination applies to WARNING and higher level messages + categories: + { + Cluster3DICARUS: + { + limit: -1 + reportEvery: 1 + } + SimDriftElectrons: + { + limit: 0 + } + } + } +} + diff --git a/fcl/reco/Stage1/mc/stage1_run2_shwcal_mc_icarus.fcl b/fcl/reco/Stage1/mc/stage1_run2_shwcal_mc_icarus.fcl new file mode 100644 index 000000000..df281da09 --- /dev/null +++ b/fcl/reco/Stage1/mc/stage1_run2_shwcal_mc_icarus.fcl @@ -0,0 +1,171 @@ +#include "mchitmodules.fcl" +#include "mctrutht0matching.fcl" +#include "mcreco.fcl" +#include "backtrackerservice.fcl" +#include "particleinventoryservice.fcl" +#include "stage1_icarus_driver_common.fcl" + +process_name: MCstage1p2 + +# Disabled Space-Charge service for calorimetry +services.SpaceChargeService: { + EnableCalEfieldSCE: false + EnableCalSpatialSCE: false + EnableCorrSCE: false + EnableSimEfieldSCE: false + EnableSimSpatialSCE: false + InputFilename: "SCEoffsets/SCEoffsets_ICARUS_E500_voxelTH3.root" + RepresentationType: "Voxelized_TH3" + service_provider: "SpaceChargeServiceICARUS" +} + +services.BackTrackerService: @local::standard_backtrackerservice +# In the 2D-detsim, SimChannel objects are made by the WireCell +# drift simulation (daq), not LArG4 (largeant). Thus, we need +# to overwrite the truth matching labels in the calibration ntuple maker +services.BackTrackerService.BackTracker.SimChannelModuleLabel: "merge" +services.ParticleInventoryService: @local::standard_particleinventoryservice + +## Add the MC module to the list of producers +physics.producers: { + @table::icarus_stage1_producers + + #mcophit: @local::ICARUSMCOpHit + mcopflashTPC0: @local::ICARUSMCOpFlashTPC0 + mcopflashTPC1: @local::ICARUSMCOpFlashTPC1 + mcopflashTPC2: @local::ICARUSMCOpFlashTPC2 + mcopflashTPC3: @local::ICARUSMCOpFlashTPC3 + + cheatopflashTPC0: @local::ICARUSCheatOpFlashTPC0 + cheatopflashTPC1: @local::ICARUSCheatOpFlashTPC1 + cheatopflashTPC2: @local::ICARUSCheatOpFlashTPC2 + cheatopflashTPC3: @local::ICARUSCheatOpFlashTPC3 + + ### mc producers + mcreco: @local::standard_mcreco + mchitfinder: @local::standard_mchitfinder + mcassociationsGausCryoE: @local::standard_mcparticlehitmatching + mcassociationsGausCryoW: @local::standard_mcparticlehitmatching +} + +physics.reco: [ + @sequence::icarus_reco_Gauss2D_CryoE , + @sequence::icarus_reco_Gauss2D_CryoW , + @sequence::icarus_reco_fm, + @sequence::icarus_tpcpmtbarycentermatch, + @sequence::icarus_crttrack, + @sequence::icarus_crtt0tagging, + caloskimCalorimetryCryoE, caloskimCalorimetryCryoW, + mcassociationsGausCryoE, mcassociationsGausCryoW, + mcreco + ] + +physics.outana: [ @sequence::icarus_analysis_modules ] +physics.trigger_paths: [ reco ] +physics.end_paths: [ outana, stream1 ] +outputs.out1.fileName: "%ifb_%tc-%p.root" +outputs.out1.dataTier: "reconstructed" +outputs.out1.outputCommands: [ + "keep *_*_*_*", + "drop *_caloskimCalorimetryCryoE_*_*", + "drop *_caloskimCalorimetryCryoW_*_*" +] + +source: +{ + maxEvents: 10 # Number of events to create +} + +#Redefine TPCPMTBarycenterMatch producers with MC parameters +physics.producers.tpcpmtbarycentermatchCryoE: @local::mc_tpcpmtbarycentermatchproducer_east +physics.producers.tpcpmtbarycentermatchCryoW: @local::mc_tpcpmtbarycentermatchproducer_west + +# Turn on truth-info for track skimmer +physics.analyzers.caloskimE.G4producer: "largeant" +physics.analyzers.caloskimE.SimChannelproducer: "merge" +physics.analyzers.caloskimE.RawDigitproducers: ["MCDecodeTPCROI:PHYSCRATEDATATPCEW", "MCDecodeTPCROI:PHYSCRATEDATATPCEE"] +physics.analyzers.caloskimE.SelectEvents: [reco] + +physics.analyzers.caloskimW.G4producer: "largeant" +physics.analyzers.caloskimW.SimChannelproducer: "merge" +physics.analyzers.caloskimW.RawDigitproducers: ["MCDecodeTPCROI:PHYSCRATEDATATPCWW", "MCDecodeTPCROI:PHYSCRATEDATATPCWE"] +physics.analyzers.caloskimW.SelectEvents: [reco] + +physics.producers.mcassociationsGausCryoE.HitParticleAssociations.HitModuleLabelVec: ["cluster3DCryoE"] +physics.producers.mcassociationsGausCryoW.HitParticleAssociations.HitModuleLabelVec: ["cluster3DCryoW"] + +# Remove missing products in MC +physics.analyzers.simpleLightAna.TriggerLabel: "" +physics.analyzers.simpleLightAna.RWMLabel: "" +physics.analyzers.simpleLightAna.OpDetWaveformLabels: ["opdaq"] + +# Configure mcreco to read SEDLite instead of SED and MCParticleLite in addition to MCParticle +physics.producers.mcreco.G4ModName: @erase +physics.producers.mcreco.SimChannelLabel: "filtersed" +physics.producers.mcreco.MCParticleLabel: "largeant" +physics.producers.mcreco.UseSimEnergyDepositLite: true +physics.producers.mcreco.UseSimEnergyDeposit: false +physics.producers.mcreco.IncludeDroppedParticles: true #this is now true with larsoft v09_89 and newer +physics.producers.mcreco.MCParticleDroppedLabel: "largeant:droppedMCParticles" +physics.producers.mcreco.MCRecoPart.SavePathPDGList: [13,-13,211,-211,111,311,310,130,321,-321,2212,2112,2224,2214,2114,1114,3122,1000010020,1000010030,1000020030,1000020040] +physics.producers.mcreco.MCRecoPart.TrackIDOffsets: [0,10000000,20000000] #Account for track ID offsets in labeling primaries + +message: @local::icarus_message_services_prod + +#icarus_calonormtoolsTest: [@local::driftnorm_sql, @local::yznorm_sql, @local::tpcgain_sql] +#icarus_calonormtoolsMC: [@local::tpcgain_sql] + +runPeriod: 2 + +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].CalorimetryAlg: @local::icarus_calorimetryalgmc +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].NormTools: @local::icarus_calonormtoolsMC +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].NormTools[0].MC: @local::runPeriod +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].NormTools[1].MC: @local::runPeriod +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].CalorimetryAlg: @local::icarus_calorimetryalgmc +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].NormTools: @local::icarus_calonormtoolsMC +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].NormTools[0].MC: @local::runPeriod +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].NormTools[1].MC: @local::runPeriod + +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].CalorimetryAlg: @local::icarus_calorimetryalgmc +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].NormTools: @local::icarus_calonormtoolsMC +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].NormTools[0].MC: @local::runPeriod +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].NormTools[1].MC: @local::runPeriod +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].CalorimetryAlg: @local::icarus_calorimetryalgmc +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].NormTools: @local::icarus_calonormtoolsMC +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].NormTools[0].MC: @local::runPeriod +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].NormTools[1].MC: @local::runPeriod + +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[3].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[3].NormTools: @local::icarus_calonormtoolsMC +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools[0].MC: @local::runPeriod +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools[1].MC: @local::runPeriod +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools: @local::icarus_calonormtoolsMC +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools[0].MC: @local::runPeriod +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools[1].MC: @local::runPeriod + +services.message.destinations : +{ + STDCOUT: + { + type: "cout" #tells the message service to output this destination to cout + threshold: "ERROR" #tells the message service that this destination applies to WARNING and higher level messages + categories: + { + Cluster3DICARUS: + { + limit: -1 + reportEvery: 1 + } + SimDriftElectrons: + { + limit: 0 + } + } + } +} + diff --git a/icaruscode/TPC/Calorimetry/NormalizeDriftSQLite_tool.cc b/icaruscode/TPC/Calorimetry/NormalizeDriftSQLite_tool.cc index 36466aabd..6b1e53820 100644 --- a/icaruscode/TPC/Calorimetry/NormalizeDriftSQLite_tool.cc +++ b/icaruscode/TPC/Calorimetry/NormalizeDriftSQLite_tool.cc @@ -142,8 +142,11 @@ double icarus::calo::NormalizeDriftSQLite::Normalize(double dQdx, const art::Eve // Get the hit time double thit = fClockData->TPCTick2TrigTime(hit.PeakTime()) - t0; + //std::cout << "TPC Tick2TrigTime: " << fClockData->TPCTick2TrigTime(hit.PeakTime()) << ", t0: " << t0 << ", hit: " << hit.PeakTime() << std::endl; + if (fVerbose) std::cout << "NormalizeDriftSQLite Tool -- Norm factor: " << exp(thit / thiselifetime) << " at TPC: " << tpc << " Cryo: " << cryo << " Time: " << thit << " Track T0: " << t0 << std::endl; + //std::cout << "dQdx before: " << dQdx << ", dQdx after: " << dQdx*exp(thit / thiselifetime) << ", thit: " << thit << ", lifetime: " << thiselifetime << std::endl; // Scale if (thiselifetime > 0) { dQdx = dQdx*exp(thit / thiselifetime); diff --git a/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlaneSQL_tool.cc b/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlaneSQL_tool.cc index 6ed734b13..50a2aa0ae 100644 --- a/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlaneSQL_tool.cc +++ b/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlaneSQL_tool.cc @@ -39,6 +39,7 @@ class NormalizeTPCPerPlaneSQL : public INormalizeCharge std::string fDBFileName; std::string fDBTag; bool fVerbose; + int fMC; lariov::DBFolder fDB; @@ -65,11 +66,15 @@ icarus::calo::NormalizeTPCPerPlaneSQL::NormalizeTPCPerPlaneSQL(fhicl::ParameterS fDBFileName(pset.get("DBFileName")), fDBTag(pset.get("DBTag")), fVerbose(pset.get("Verbose", false)), + fMC(pset.get("MC")), fDB(fDBFileName, "", "", fDBTag, true, false) {} void icarus::calo::NormalizeTPCPerPlaneSQL::configure(const fhicl::ParameterSet& pset) {} icarus::calo::NormalizeTPCPerPlaneSQL::ScaleInfo icarus::calo::NormalizeTPCPerPlaneSQL::GetScaleInfo(uint64_t run) { + + //std::cout << "NormalizeTPCSQL Tool -- Getting scale info for run: " << run << std::endl; + // check the cache if (fScaleInfos.count(run)) { return fScaleInfos.at(run); @@ -98,8 +103,33 @@ icarus::calo::NormalizeTPCPerPlaneSQL::ScaleInfo icarus::calo::NormalizeTPCPerPl double icarus::calo::NormalizeTPCPerPlaneSQL::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; + // Get the info - ScaleInfo i = GetScaleInfo(e.id().runID().run()); + uint64_t runID = -1; + switch (fMC) { + case 1: + runID = 8460; + break; + case 2: + runID = 9301; + break; + case 3: + runID = 11806; + break; + case 4: + runID = 12960; + break; + case 5: + runID = 5; + break; + default: + runID = e.id().runID().run(); + break; + } + + ScaleInfo const& i = GetScaleInfo(runID); // Lookup the TPC, cryo unsigned tpc = hit.WireID().TPC; diff --git a/icaruscode/TPC/Calorimetry/NormalizeYZSQL_tool.cc b/icaruscode/TPC/Calorimetry/NormalizeYZSQL_tool.cc index 9868bd627..70a16137f 100644 --- a/icaruscode/TPC/Calorimetry/NormalizeYZSQL_tool.cc +++ b/icaruscode/TPC/Calorimetry/NormalizeYZSQL_tool.cc @@ -39,6 +39,7 @@ class NormalizeYZSQL : public INormalizeCharge std::string fDBFileName; std::string fDBTag; bool fVerbose; + int fMC; lariov::DBFolder fDB; @@ -155,12 +156,15 @@ icarus::calo::NormalizeYZSQL::NormalizeYZSQL(fhicl::ParameterSet const &pset): fDBFileName(pset.get("DBFileName")), fDBTag(pset.get("DBTag")), fVerbose(pset.get("Verbose", false)), + fMC(pset.get("MC")), fDB(fDBFileName, "", "", fDBTag, true, false) {} void icarus::calo::NormalizeYZSQL::configure(const fhicl::ParameterSet& pset) {} const icarus::calo::NormalizeYZSQL::ScaleInfo& icarus::calo::NormalizeYZSQL::GetScaleInfo(uint64_t run) { + //std::cout << "NormalizeYZSQL Tool -- Getting scale info for run: " << run << std::endl; + // check the cache if (fScaleInfos.count(run)) { return fScaleInfos.at(run); @@ -230,8 +234,32 @@ const icarus::calo::NormalizeYZSQL::ScaleInfo& icarus::calo::NormalizeYZSQL::Get double icarus::calo::NormalizeYZSQL::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 << "NormalizeYZSQL Tool -- MC Flag: " << fMC << " Run: " << e.id().runID().run() << ", Subrun: " << e.id().subRunID().run() << std::endl; + // Get the info - ScaleInfo const& i = GetScaleInfo(e.id().runID().run()); + uint64_t runID = -1; + switch (fMC) { + case 1: + runID = 8460; + break; + case 2: + runID = 9301; + break; + case 3: + runID = 11806; + break; + case 4: + runID = 12960; + break; + case 5: + runID = 5; + break; + default: + runID = e.id().runID().run(); + break; + } + + ScaleInfo const& i = GetScaleInfo(runID); // plane int plane = hit.WireID().Plane; diff --git a/icaruscode/TPC/Calorimetry/normtools_icarus.fcl b/icaruscode/TPC/Calorimetry/normtools_icarus.fcl index 5443186cf..5edccb9ba 100644 --- a/icaruscode/TPC/Calorimetry/normtools_icarus.fcl +++ b/icaruscode/TPC/Calorimetry/normtools_icarus.fcl @@ -34,7 +34,7 @@ driftnorm_sql: { tool_type: NormalizeDriftSQLite DBFileName: tpc_elifetime_data DBTag: @local::ICARUS_Calibration_GlobalTags.tpc_elifetime_data - Verbose: false + Verbose: true } tpcgain_sql: { @@ -42,6 +42,7 @@ tpcgain_sql: { DBFileName: tpc_dqdxcalibration_allplanes_data DBTag: @local::ICARUS_Calibration_GlobalTags.tpc_dqdxcalibration_allplanes_data Verbose: false + MC: -1 } tpcgain_local: { @@ -56,13 +57,16 @@ yznorm_sql: { DBFileName: tpc_yz_correction_allplanes_data DBTag: @local::ICARUS_Calibration_GlobalTags.tpc_yz_correction_allplanes_data Verbose: false + MC: -1 } #icarus_calonormtools: [@local::driftnorm, @local::yznorm, @local::tpcgain] icarus_calonormtools: [@local::driftnorm_sql, @local::yznorm_sql, @local::tpcgain_sql] +icarus_calonormtoolsMC: [@local::yznorm_sql, @local::tpcgain_sql] -# Gain with angular dep. recombination. Measurement from: https://arxiv.org/pdf/2407.12969 -# Assume equal on planes -- this is __wrong__ -- will need to be fixed when they are calibrated -icarus_data_calconst: [0.0133333, 0.0133333, 0.0133333] +# +# GP 8/4/25 -- Update gain to re-measurement with Run 2 stopping muons and +# fixed recombination. +icarus_data_calconst: [0.016751, 0.012755, 0.012513] END_PROLOG From f1ffe765473177bd4cb79526f6c378630f733570 Mon Sep 17 00:00:00 2001 From: Michael Carrigan Date: Wed, 14 Jan 2026 10:30:53 -0600 Subject: [PATCH 3/8] committing working branch version with MC run numbers --- .../Stage1/data/stage1_run2_shwcal_icarus.fcl | 50 +++++++------------ .../TPC/Calorimetry/NormalizeTPCSQL_tool.cc | 32 +++++++++++- 2 files changed, 48 insertions(+), 34 deletions(-) diff --git a/fcl/reco/Stage1/data/stage1_run2_shwcal_icarus.fcl b/fcl/reco/Stage1/data/stage1_run2_shwcal_icarus.fcl index f9cb9d46d..7f8b6a3a5 100644 --- a/fcl/reco/Stage1/data/stage1_run2_shwcal_icarus.fcl +++ b/fcl/reco/Stage1/data/stage1_run2_shwcal_icarus.fcl @@ -1,44 +1,28 @@ +# This includes running larcv as part of stage 1 processing + #include "stage1_run2_icarus.fcl" -message: @local::icarus_message_services_prod +physics.outana: [ @sequence::icarus_analysis_larcv_modules ] +physics.end_paths: [ outana, stream1 ] + +applyNorm: true physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].CalorimetryAlg: @local::icarus_calorimetryalgdata -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].ApplyCorrectionsInNorm: @local::applyNorm physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].NormTools: @local::icarus_calonormtools -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].CalorimetryAlg: @local::icarus_calorimetryalgdata -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].ApplyCorrectionsInNorm: true -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].NormTools: @local::icarus_calonormtools +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].CalorimetryAlg: @local::icarus_calorimetryalgdata +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].ApplyCorrectionsInNorm: @local::applyNorm +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].NormTools: @local::icarus_calonormtools physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].CalorimetryAlg: @local::icarus_calorimetryalgdata -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].ApplyCorrectionsInNorm: @local::applyNorm physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].NormTools: @local::icarus_calonormtools -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].CalorimetryAlg: @local::icarus_calorimetryalgdata -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].ApplyCorrectionsInNorm: true -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].NormTools: @local::icarus_calonormtools +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].CalorimetryAlg: @local::icarus_calorimetryalgdata +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].ApplyCorrectionsInNorm: @local::applyNorm +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].NormTools: @local::icarus_calonormtools -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[3].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[3].ApplyCorrectionsInNorm: @local::applyNorm physics.producers.SBNShowerGausCryoE.ShowerFinderTools[3].NormTools: @local::icarus_calonormtools -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].ApplyCorrectionsInNorm: true -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools: @local::icarus_calonormtools - -services.message.destinations : -{ - STDCOUT: - { - type: "cout" #tells the message service to output this destination to cout - threshold: "ERROR" #tells the message service that this destination applies to WARNING and higher level messages - categories: - { - Cluster3DICARUS: - { - limit: -1 - reportEvery: 1 - } - SimDriftElectrons: - { - limit: 0 - } - } - } -} +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].ApplyCorrectionsInNorm: @local::applyNorm +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools: @local::icarus_calonormtools diff --git a/icaruscode/TPC/Calorimetry/NormalizeTPCSQL_tool.cc b/icaruscode/TPC/Calorimetry/NormalizeTPCSQL_tool.cc index 8189bbb45..c529f3259 100644 --- a/icaruscode/TPC/Calorimetry/NormalizeTPCSQL_tool.cc +++ b/icaruscode/TPC/Calorimetry/NormalizeTPCSQL_tool.cc @@ -39,6 +39,7 @@ class NormalizeTPCSQL : public INormalizeCharge std::string fDBFileName; std::string fDBTag; bool fVerbose; + int fMC; lariov::DBFolder fDB; @@ -65,11 +66,15 @@ icarus::calo::NormalizeTPCSQL::NormalizeTPCSQL(fhicl::ParameterSet const &pset): fDBFileName(pset.get("DBFileName")), fDBTag(pset.get("DBTag")), fVerbose(pset.get("Verbose", false)), + fMC(pset.get("MC")), fDB(fDBFileName, "", "", fDBTag, true, false) {} void icarus::calo::NormalizeTPCSQL::configure(const fhicl::ParameterSet& pset) {} icarus::calo::NormalizeTPCSQL::ScaleInfo icarus::calo::NormalizeTPCSQL::GetScaleInfo(uint64_t run) { + + std::cout << "NormalizeTPCSQL Tool -- Getting scale info for run: " << run << std::endl; + // check the cache if (fScaleInfos.count(run)) { return fScaleInfos.at(run); @@ -98,8 +103,33 @@ icarus::calo::NormalizeTPCSQL::ScaleInfo icarus::calo::NormalizeTPCSQL::GetScale 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; + // Get the info - ScaleInfo i = GetScaleInfo(e.id().runID().run()); + uint64_t runID = -1; + switch (fMC) { + case 1: + runID = 1; + break; + case 2: + runID = 9400; + break; + case 3: + runID = 3; + break; + case 4: + runID = 4; + break; + case 5: + runID = 5; + break; + default: + runID = e.id().runID().run(); + break; + } + + ScaleInfo const& i = GetScaleInfo(runID); // Lookup the TPC, cryo unsigned tpc = hit.WireID().TPC; From e8cc2fa45ca9235ec6671ed404469e3cf3420324 Mon Sep 17 00:00:00 2001 From: Michael Carrigan Date: Thu, 22 Jan 2026 11:30:51 -0600 Subject: [PATCH 4/8] cleaned up code --- fcl/reco/Definitions/stage1_icarus_defs.fcl | 24 ++++++++++++++ fcl/reco/Stage1/mc/stage1_run2_icarus_MC.fcl | 33 +++++++++++++++++++ .../Calorimetry/NormalizeDriftSQLite_tool.cc | 3 -- .../NormalizeTPCPerPlaneSQL_tool.cc | 7 ---- .../TPC/Calorimetry/NormalizeYZSQL_tool.cc | 7 ---- .../TPC/Calorimetry/normtools_icarus.fcl | 3 +- 6 files changed, 58 insertions(+), 19 deletions(-) diff --git a/fcl/reco/Definitions/stage1_icarus_defs.fcl b/fcl/reco/Definitions/stage1_icarus_defs.fcl index 22b46744c..95dd92faf 100644 --- a/fcl/reco/Definitions/stage1_icarus_defs.fcl +++ b/fcl/reco/Definitions/stage1_icarus_defs.fcl @@ -364,4 +364,28 @@ icarus_stage1_producers.SBNShowerGausCryoW.UseAllParticles: icarus_stage1_producers.SBNShowerGausCryoE.PFParticleLabel: "pandoraGausCryoE" icarus_stage1_producers.SBNShowerGausCryoE.UseAllParticles: true +applyNorm: true + +icarus_stage1_producers.SBNShowerGausCryoE.ShowerFinderTools[7].CalorimetryAlg: @local::icarus_calorimetryalgdata +icarus_stage1_producers.SBNShowerGausCryoE.ShowerFinderTools[7].ApplyCorrectionsInNorm: @local::applyNorm +icarus_stage1_producers.SBNShowerGausCryoE.ShowerFinderTools[7].NormTools: @local::icarus_calonormtools +icarus_stage1_producers.SBNShowerGausCryoW.ShowerFinderTools[7].CalorimetryAlg: @local::icarus_calorimetryalgdata +icarus_stage1_producers.SBNShowerGausCryoW.ShowerFinderTools[7].ApplyCorrectionsInNorm: @local::applyNorm +icarus_stage1_producers.SBNShowerGausCryoW.ShowerFinderTools[7].NormTools: @local::icarus_calonormtools + +icarus_stage1_producers.SBNShowerGausCryoE.ShowerFinderTools[5].CalorimetryAlg: @local::icarus_calorimetryalgdata +icarus_stage1_producers.SBNShowerGausCryoE.ShowerFinderTools[5].ApplyCorrectionsInNorm: @local::applyNorm +icarus_stage1_producers.SBNShowerGausCryoE.ShowerFinderTools[5].NormTools: @local::icarus_calonormtools +icarus_stage1_producers.SBNShowerGausCryoW.ShowerFinderTools[5].CalorimetryAlg: @local::icarus_calorimetryalgdata +icarus_stage1_producers.SBNShowerGausCryoW.ShowerFinderTools[5].ApplyCorrectionsInNorm: @local::applyNorm +icarus_stage1_producers.SBNShowerGausCryoW.ShowerFinderTools[5].NormTools: @local::icarus_calonormtools + +icarus_stage1_producers.SBNShowerGausCryoE.ShowerFinderTools[3].ApplyCorrectionsInNorm: @local::applyNorm +icarus_stage1_producers.SBNShowerGausCryoE.ShowerFinderTools[3].NormTools: @local::icarus_calonormtools +icarus_stage1_producers.SBNShowerGausCryoW.ShowerFinderTools[3].ApplyCorrectionsInNorm: @local::applyNorm +icarus_stage1_producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools: @local::icarus_calonormtools + +# Set supera input fcl files +icarus_stage1_analyzers.superaMC.supera_params: "supera_icarus_MC_all_cryo_PMT_CRT_v10.fcl" + END_PROLOG diff --git a/fcl/reco/Stage1/mc/stage1_run2_icarus_MC.fcl b/fcl/reco/Stage1/mc/stage1_run2_icarus_MC.fcl index 0009c0806..ae35e3c85 100644 --- a/fcl/reco/Stage1/mc/stage1_run2_icarus_MC.fcl +++ b/fcl/reco/Stage1/mc/stage1_run2_icarus_MC.fcl @@ -105,6 +105,39 @@ physics.producers.mcreco.MCParticleDroppedLabel: "largeant:droppedMCParticles" physics.producers.mcreco.MCRecoPart.SavePathPDGList: [13,-13,211,-211,111,311,310,130,321,-321,2212,2112,2224,2214,2114,1114,3122,1000010020,1000010030,1000020030,1000020040] physics.producers.mcreco.MCRecoPart.TrackIDOffsets: [0,10000000,20000000] #Account for track ID offsets in labeling primaries +runPeriod: 2 + +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].CalorimetryAlg: @local::icarus_calorimetryalgmc +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].NormTools: @local::icarus_calonormtoolsMC +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].NormTools[0].MC: @local::runPeriod +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].NormTools[1].MC: @local::runPeriod +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].CalorimetryAlg: @local::icarus_calorimetryalgmc +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].NormTools: @local::icarus_calonormtoolsMC +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].NormTools[0].MC: @local::runPeriod +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].NormTools[1].MC: @local::runPeriod + +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].CalorimetryAlg: @local::icarus_calorimetryalgmc +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].NormTools: @local::icarus_calonormtoolsMC +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].NormTools[0].MC: @local::runPeriod +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].NormTools[1].MC: @local::runPeriod +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].CalorimetryAlg: @local::icarus_calorimetryalgmc +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].NormTools: @local::icarus_calonormtoolsMC +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].NormTools[0].MC: @local::runPeriod +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].NormTools[1].MC: @local::runPeriod + +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[3].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[3].NormTools: @local::icarus_calonormtoolsMC +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools[0].MC: @local::runPeriod +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools[1].MC: @local::runPeriod +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].ApplyCorrectionsInNorm: true +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools: @local::icarus_calonormtoolsMC +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools[0].MC: @local::runPeriod +physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools[1].MC: @local::runPeriod + services.message.destinations : { STDCOUT: diff --git a/icaruscode/TPC/Calorimetry/NormalizeDriftSQLite_tool.cc b/icaruscode/TPC/Calorimetry/NormalizeDriftSQLite_tool.cc index 6b1e53820..36466aabd 100644 --- a/icaruscode/TPC/Calorimetry/NormalizeDriftSQLite_tool.cc +++ b/icaruscode/TPC/Calorimetry/NormalizeDriftSQLite_tool.cc @@ -142,11 +142,8 @@ double icarus::calo::NormalizeDriftSQLite::Normalize(double dQdx, const art::Eve // Get the hit time double thit = fClockData->TPCTick2TrigTime(hit.PeakTime()) - t0; - //std::cout << "TPC Tick2TrigTime: " << fClockData->TPCTick2TrigTime(hit.PeakTime()) << ", t0: " << t0 << ", hit: " << hit.PeakTime() << std::endl; - if (fVerbose) std::cout << "NormalizeDriftSQLite Tool -- Norm factor: " << exp(thit / thiselifetime) << " at TPC: " << tpc << " Cryo: " << cryo << " Time: " << thit << " Track T0: " << t0 << std::endl; - //std::cout << "dQdx before: " << dQdx << ", dQdx after: " << dQdx*exp(thit / thiselifetime) << ", thit: " << thit << ", lifetime: " << thiselifetime << std::endl; // Scale if (thiselifetime > 0) { dQdx = dQdx*exp(thit / thiselifetime); diff --git a/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlaneSQL_tool.cc b/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlaneSQL_tool.cc index 50a2aa0ae..b43879b98 100644 --- a/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlaneSQL_tool.cc +++ b/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlaneSQL_tool.cc @@ -73,8 +73,6 @@ void icarus::calo::NormalizeTPCPerPlaneSQL::configure(const fhicl::ParameterSet& icarus::calo::NormalizeTPCPerPlaneSQL::ScaleInfo icarus::calo::NormalizeTPCPerPlaneSQL::GetScaleInfo(uint64_t run) { - //std::cout << "NormalizeTPCSQL Tool -- Getting scale info for run: " << run << std::endl; - // check the cache if (fScaleInfos.count(run)) { return fScaleInfos.at(run); @@ -104,8 +102,6 @@ icarus::calo::NormalizeTPCPerPlaneSQL::ScaleInfo icarus::calo::NormalizeTPCPerPl double icarus::calo::NormalizeTPCPerPlaneSQL::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; - // Get the info uint64_t runID = -1; switch (fMC) { @@ -121,9 +117,6 @@ double icarus::calo::NormalizeTPCPerPlaneSQL::Normalize(double dQdx, const art:: case 4: runID = 12960; break; - case 5: - runID = 5; - break; default: runID = e.id().runID().run(); break; diff --git a/icaruscode/TPC/Calorimetry/NormalizeYZSQL_tool.cc b/icaruscode/TPC/Calorimetry/NormalizeYZSQL_tool.cc index 70a16137f..4b9567ad3 100644 --- a/icaruscode/TPC/Calorimetry/NormalizeYZSQL_tool.cc +++ b/icaruscode/TPC/Calorimetry/NormalizeYZSQL_tool.cc @@ -163,8 +163,6 @@ void icarus::calo::NormalizeYZSQL::configure(const fhicl::ParameterSet& pset) {} const icarus::calo::NormalizeYZSQL::ScaleInfo& icarus::calo::NormalizeYZSQL::GetScaleInfo(uint64_t run) { - //std::cout << "NormalizeYZSQL Tool -- Getting scale info for run: " << run << std::endl; - // check the cache if (fScaleInfos.count(run)) { return fScaleInfos.at(run); @@ -234,8 +232,6 @@ const icarus::calo::NormalizeYZSQL::ScaleInfo& icarus::calo::NormalizeYZSQL::Get double icarus::calo::NormalizeYZSQL::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 << "NormalizeYZSQL Tool -- MC Flag: " << fMC << " Run: " << e.id().runID().run() << ", Subrun: " << e.id().subRunID().run() << std::endl; - // Get the info uint64_t runID = -1; switch (fMC) { @@ -251,9 +247,6 @@ double icarus::calo::NormalizeYZSQL::Normalize(double dQdx, const art::Event &e, case 4: runID = 12960; break; - case 5: - runID = 5; - break; default: runID = e.id().runID().run(); break; diff --git a/icaruscode/TPC/Calorimetry/normtools_icarus.fcl b/icaruscode/TPC/Calorimetry/normtools_icarus.fcl index 5edccb9ba..48f2ea92d 100644 --- a/icaruscode/TPC/Calorimetry/normtools_icarus.fcl +++ b/icaruscode/TPC/Calorimetry/normtools_icarus.fcl @@ -34,7 +34,7 @@ driftnorm_sql: { tool_type: NormalizeDriftSQLite DBFileName: tpc_elifetime_data DBTag: @local::ICARUS_Calibration_GlobalTags.tpc_elifetime_data - Verbose: true + Verbose: false } tpcgain_sql: { @@ -60,7 +60,6 @@ yznorm_sql: { MC: -1 } -#icarus_calonormtools: [@local::driftnorm, @local::yznorm, @local::tpcgain] icarus_calonormtools: [@local::driftnorm_sql, @local::yznorm_sql, @local::tpcgain_sql] icarus_calonormtoolsMC: [@local::yznorm_sql, @local::tpcgain_sql] From fa4e3e92bde6f762875ad6795c5ca3c0f1f256fd Mon Sep 17 00:00:00 2001 From: Michael Carrigan Date: Thu, 4 Dec 2025 13:25:39 -0600 Subject: [PATCH 5/8] first commit --- icaruscode/TPC/Calorimetry/NormalizeDriftSQLite_tool.cc | 3 +++ icaruscode/TPC/Calorimetry/NormalizeTPCPerPlaneSQL_tool.cc | 3 +++ icaruscode/TPC/Calorimetry/NormalizeYZSQL_tool.cc | 7 +++++++ icaruscode/TPC/Calorimetry/normtools_icarus.fcl | 2 +- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/icaruscode/TPC/Calorimetry/NormalizeDriftSQLite_tool.cc b/icaruscode/TPC/Calorimetry/NormalizeDriftSQLite_tool.cc index 36466aabd..6b1e53820 100644 --- a/icaruscode/TPC/Calorimetry/NormalizeDriftSQLite_tool.cc +++ b/icaruscode/TPC/Calorimetry/NormalizeDriftSQLite_tool.cc @@ -142,8 +142,11 @@ double icarus::calo::NormalizeDriftSQLite::Normalize(double dQdx, const art::Eve // Get the hit time double thit = fClockData->TPCTick2TrigTime(hit.PeakTime()) - t0; + //std::cout << "TPC Tick2TrigTime: " << fClockData->TPCTick2TrigTime(hit.PeakTime()) << ", t0: " << t0 << ", hit: " << hit.PeakTime() << std::endl; + if (fVerbose) std::cout << "NormalizeDriftSQLite Tool -- Norm factor: " << exp(thit / thiselifetime) << " at TPC: " << tpc << " Cryo: " << cryo << " Time: " << thit << " Track T0: " << t0 << std::endl; + //std::cout << "dQdx before: " << dQdx << ", dQdx after: " << dQdx*exp(thit / thiselifetime) << ", thit: " << thit << ", lifetime: " << thiselifetime << std::endl; // Scale if (thiselifetime > 0) { dQdx = dQdx*exp(thit / thiselifetime); diff --git a/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlaneSQL_tool.cc b/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlaneSQL_tool.cc index b43879b98..e612530a3 100644 --- a/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlaneSQL_tool.cc +++ b/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlaneSQL_tool.cc @@ -117,6 +117,9 @@ double icarus::calo::NormalizeTPCPerPlaneSQL::Normalize(double dQdx, const art:: case 4: runID = 12960; break; + case 5: + runID = 14079; + break; default: runID = e.id().runID().run(); break; diff --git a/icaruscode/TPC/Calorimetry/NormalizeYZSQL_tool.cc b/icaruscode/TPC/Calorimetry/NormalizeYZSQL_tool.cc index 4b9567ad3..d3ea1fddd 100644 --- a/icaruscode/TPC/Calorimetry/NormalizeYZSQL_tool.cc +++ b/icaruscode/TPC/Calorimetry/NormalizeYZSQL_tool.cc @@ -163,6 +163,8 @@ void icarus::calo::NormalizeYZSQL::configure(const fhicl::ParameterSet& pset) {} const icarus::calo::NormalizeYZSQL::ScaleInfo& icarus::calo::NormalizeYZSQL::GetScaleInfo(uint64_t run) { + //std::cout << "NormalizeYZSQL Tool -- Getting scale info for run: " << run << std::endl; + // check the cache if (fScaleInfos.count(run)) { return fScaleInfos.at(run); @@ -232,6 +234,8 @@ const icarus::calo::NormalizeYZSQL::ScaleInfo& icarus::calo::NormalizeYZSQL::Get double icarus::calo::NormalizeYZSQL::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 << "NormalizeYZSQL Tool -- MC Flag: " << fMC << " Run: " << e.id().runID().run() << ", Subrun: " << e.id().subRunID().run() << std::endl; + // Get the info uint64_t runID = -1; switch (fMC) { @@ -247,6 +251,9 @@ double icarus::calo::NormalizeYZSQL::Normalize(double dQdx, const art::Event &e, case 4: runID = 12960; break; + case 5: + runID = 14079; + break; default: runID = e.id().runID().run(); break; diff --git a/icaruscode/TPC/Calorimetry/normtools_icarus.fcl b/icaruscode/TPC/Calorimetry/normtools_icarus.fcl index 48f2ea92d..b64ea9ba8 100644 --- a/icaruscode/TPC/Calorimetry/normtools_icarus.fcl +++ b/icaruscode/TPC/Calorimetry/normtools_icarus.fcl @@ -34,7 +34,7 @@ driftnorm_sql: { tool_type: NormalizeDriftSQLite DBFileName: tpc_elifetime_data DBTag: @local::ICARUS_Calibration_GlobalTags.tpc_elifetime_data - Verbose: false + Verbose: true } tpcgain_sql: { From be4ca97b0a63eb6bfd316104566730dc849f5b44 Mon Sep 17 00:00:00 2001 From: Michael Carrigan Date: Thu, 22 Jan 2026 11:30:51 -0600 Subject: [PATCH 6/8] cleaned up code --- icaruscode/TPC/Calorimetry/NormalizeDriftSQLite_tool.cc | 3 --- icaruscode/TPC/Calorimetry/NormalizeYZSQL_tool.cc | 4 ---- icaruscode/TPC/Calorimetry/normtools_icarus.fcl | 2 +- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/icaruscode/TPC/Calorimetry/NormalizeDriftSQLite_tool.cc b/icaruscode/TPC/Calorimetry/NormalizeDriftSQLite_tool.cc index 6b1e53820..36466aabd 100644 --- a/icaruscode/TPC/Calorimetry/NormalizeDriftSQLite_tool.cc +++ b/icaruscode/TPC/Calorimetry/NormalizeDriftSQLite_tool.cc @@ -142,11 +142,8 @@ double icarus::calo::NormalizeDriftSQLite::Normalize(double dQdx, const art::Eve // Get the hit time double thit = fClockData->TPCTick2TrigTime(hit.PeakTime()) - t0; - //std::cout << "TPC Tick2TrigTime: " << fClockData->TPCTick2TrigTime(hit.PeakTime()) << ", t0: " << t0 << ", hit: " << hit.PeakTime() << std::endl; - if (fVerbose) std::cout << "NormalizeDriftSQLite Tool -- Norm factor: " << exp(thit / thiselifetime) << " at TPC: " << tpc << " Cryo: " << cryo << " Time: " << thit << " Track T0: " << t0 << std::endl; - //std::cout << "dQdx before: " << dQdx << ", dQdx after: " << dQdx*exp(thit / thiselifetime) << ", thit: " << thit << ", lifetime: " << thiselifetime << std::endl; // Scale if (thiselifetime > 0) { dQdx = dQdx*exp(thit / thiselifetime); diff --git a/icaruscode/TPC/Calorimetry/NormalizeYZSQL_tool.cc b/icaruscode/TPC/Calorimetry/NormalizeYZSQL_tool.cc index d3ea1fddd..3c5327a80 100644 --- a/icaruscode/TPC/Calorimetry/NormalizeYZSQL_tool.cc +++ b/icaruscode/TPC/Calorimetry/NormalizeYZSQL_tool.cc @@ -163,8 +163,6 @@ void icarus::calo::NormalizeYZSQL::configure(const fhicl::ParameterSet& pset) {} const icarus::calo::NormalizeYZSQL::ScaleInfo& icarus::calo::NormalizeYZSQL::GetScaleInfo(uint64_t run) { - //std::cout << "NormalizeYZSQL Tool -- Getting scale info for run: " << run << std::endl; - // check the cache if (fScaleInfos.count(run)) { return fScaleInfos.at(run); @@ -234,8 +232,6 @@ const icarus::calo::NormalizeYZSQL::ScaleInfo& icarus::calo::NormalizeYZSQL::Get double icarus::calo::NormalizeYZSQL::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 << "NormalizeYZSQL Tool -- MC Flag: " << fMC << " Run: " << e.id().runID().run() << ", Subrun: " << e.id().subRunID().run() << std::endl; - // Get the info uint64_t runID = -1; switch (fMC) { diff --git a/icaruscode/TPC/Calorimetry/normtools_icarus.fcl b/icaruscode/TPC/Calorimetry/normtools_icarus.fcl index b64ea9ba8..48f2ea92d 100644 --- a/icaruscode/TPC/Calorimetry/normtools_icarus.fcl +++ b/icaruscode/TPC/Calorimetry/normtools_icarus.fcl @@ -34,7 +34,7 @@ driftnorm_sql: { tool_type: NormalizeDriftSQLite DBFileName: tpc_elifetime_data DBTag: @local::ICARUS_Calibration_GlobalTags.tpc_elifetime_data - Verbose: true + Verbose: false } tpcgain_sql: { From 0c14fd4ad238e318ca27a1bc010d97d7ef1320bc Mon Sep 17 00:00:00 2001 From: Michael Carrigan Date: Thu, 22 Jan 2026 16:12:00 -0600 Subject: [PATCH 7/8] remove custom fcl files, update mc runs in NormalizeTPCSQL --- .../Stage1/data/stage1_run2_shwcal_icarus.fcl | 28 --- .../mc/stage1_run2_shwcal_mc_icarus.fcl | 171 ------------------ .../TPC/Calorimetry/NormalizeTPCSQL_tool.cc | 11 +- 3 files changed, 4 insertions(+), 206 deletions(-) delete mode 100644 fcl/reco/Stage1/data/stage1_run2_shwcal_icarus.fcl delete mode 100644 fcl/reco/Stage1/mc/stage1_run2_shwcal_mc_icarus.fcl diff --git a/fcl/reco/Stage1/data/stage1_run2_shwcal_icarus.fcl b/fcl/reco/Stage1/data/stage1_run2_shwcal_icarus.fcl deleted file mode 100644 index 7f8b6a3a5..000000000 --- a/fcl/reco/Stage1/data/stage1_run2_shwcal_icarus.fcl +++ /dev/null @@ -1,28 +0,0 @@ -# This includes running larcv as part of stage 1 processing - -#include "stage1_run2_icarus.fcl" - -physics.outana: [ @sequence::icarus_analysis_larcv_modules ] -physics.end_paths: [ outana, stream1 ] - -applyNorm: true - -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].CalorimetryAlg: @local::icarus_calorimetryalgdata -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].ApplyCorrectionsInNorm: @local::applyNorm -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].NormTools: @local::icarus_calonormtools -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].CalorimetryAlg: @local::icarus_calorimetryalgdata -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].ApplyCorrectionsInNorm: @local::applyNorm -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].NormTools: @local::icarus_calonormtools - -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].CalorimetryAlg: @local::icarus_calorimetryalgdata -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].ApplyCorrectionsInNorm: @local::applyNorm -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].NormTools: @local::icarus_calonormtools -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].CalorimetryAlg: @local::icarus_calorimetryalgdata -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].ApplyCorrectionsInNorm: @local::applyNorm -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].NormTools: @local::icarus_calonormtools - -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[3].ApplyCorrectionsInNorm: @local::applyNorm -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[3].NormTools: @local::icarus_calonormtools -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].ApplyCorrectionsInNorm: @local::applyNorm -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools: @local::icarus_calonormtools - diff --git a/fcl/reco/Stage1/mc/stage1_run2_shwcal_mc_icarus.fcl b/fcl/reco/Stage1/mc/stage1_run2_shwcal_mc_icarus.fcl deleted file mode 100644 index df281da09..000000000 --- a/fcl/reco/Stage1/mc/stage1_run2_shwcal_mc_icarus.fcl +++ /dev/null @@ -1,171 +0,0 @@ -#include "mchitmodules.fcl" -#include "mctrutht0matching.fcl" -#include "mcreco.fcl" -#include "backtrackerservice.fcl" -#include "particleinventoryservice.fcl" -#include "stage1_icarus_driver_common.fcl" - -process_name: MCstage1p2 - -# Disabled Space-Charge service for calorimetry -services.SpaceChargeService: { - EnableCalEfieldSCE: false - EnableCalSpatialSCE: false - EnableCorrSCE: false - EnableSimEfieldSCE: false - EnableSimSpatialSCE: false - InputFilename: "SCEoffsets/SCEoffsets_ICARUS_E500_voxelTH3.root" - RepresentationType: "Voxelized_TH3" - service_provider: "SpaceChargeServiceICARUS" -} - -services.BackTrackerService: @local::standard_backtrackerservice -# In the 2D-detsim, SimChannel objects are made by the WireCell -# drift simulation (daq), not LArG4 (largeant). Thus, we need -# to overwrite the truth matching labels in the calibration ntuple maker -services.BackTrackerService.BackTracker.SimChannelModuleLabel: "merge" -services.ParticleInventoryService: @local::standard_particleinventoryservice - -## Add the MC module to the list of producers -physics.producers: { - @table::icarus_stage1_producers - - #mcophit: @local::ICARUSMCOpHit - mcopflashTPC0: @local::ICARUSMCOpFlashTPC0 - mcopflashTPC1: @local::ICARUSMCOpFlashTPC1 - mcopflashTPC2: @local::ICARUSMCOpFlashTPC2 - mcopflashTPC3: @local::ICARUSMCOpFlashTPC3 - - cheatopflashTPC0: @local::ICARUSCheatOpFlashTPC0 - cheatopflashTPC1: @local::ICARUSCheatOpFlashTPC1 - cheatopflashTPC2: @local::ICARUSCheatOpFlashTPC2 - cheatopflashTPC3: @local::ICARUSCheatOpFlashTPC3 - - ### mc producers - mcreco: @local::standard_mcreco - mchitfinder: @local::standard_mchitfinder - mcassociationsGausCryoE: @local::standard_mcparticlehitmatching - mcassociationsGausCryoW: @local::standard_mcparticlehitmatching -} - -physics.reco: [ - @sequence::icarus_reco_Gauss2D_CryoE , - @sequence::icarus_reco_Gauss2D_CryoW , - @sequence::icarus_reco_fm, - @sequence::icarus_tpcpmtbarycentermatch, - @sequence::icarus_crttrack, - @sequence::icarus_crtt0tagging, - caloskimCalorimetryCryoE, caloskimCalorimetryCryoW, - mcassociationsGausCryoE, mcassociationsGausCryoW, - mcreco - ] - -physics.outana: [ @sequence::icarus_analysis_modules ] -physics.trigger_paths: [ reco ] -physics.end_paths: [ outana, stream1 ] -outputs.out1.fileName: "%ifb_%tc-%p.root" -outputs.out1.dataTier: "reconstructed" -outputs.out1.outputCommands: [ - "keep *_*_*_*", - "drop *_caloskimCalorimetryCryoE_*_*", - "drop *_caloskimCalorimetryCryoW_*_*" -] - -source: -{ - maxEvents: 10 # Number of events to create -} - -#Redefine TPCPMTBarycenterMatch producers with MC parameters -physics.producers.tpcpmtbarycentermatchCryoE: @local::mc_tpcpmtbarycentermatchproducer_east -physics.producers.tpcpmtbarycentermatchCryoW: @local::mc_tpcpmtbarycentermatchproducer_west - -# Turn on truth-info for track skimmer -physics.analyzers.caloskimE.G4producer: "largeant" -physics.analyzers.caloskimE.SimChannelproducer: "merge" -physics.analyzers.caloskimE.RawDigitproducers: ["MCDecodeTPCROI:PHYSCRATEDATATPCEW", "MCDecodeTPCROI:PHYSCRATEDATATPCEE"] -physics.analyzers.caloskimE.SelectEvents: [reco] - -physics.analyzers.caloskimW.G4producer: "largeant" -physics.analyzers.caloskimW.SimChannelproducer: "merge" -physics.analyzers.caloskimW.RawDigitproducers: ["MCDecodeTPCROI:PHYSCRATEDATATPCWW", "MCDecodeTPCROI:PHYSCRATEDATATPCWE"] -physics.analyzers.caloskimW.SelectEvents: [reco] - -physics.producers.mcassociationsGausCryoE.HitParticleAssociations.HitModuleLabelVec: ["cluster3DCryoE"] -physics.producers.mcassociationsGausCryoW.HitParticleAssociations.HitModuleLabelVec: ["cluster3DCryoW"] - -# Remove missing products in MC -physics.analyzers.simpleLightAna.TriggerLabel: "" -physics.analyzers.simpleLightAna.RWMLabel: "" -physics.analyzers.simpleLightAna.OpDetWaveformLabels: ["opdaq"] - -# Configure mcreco to read SEDLite instead of SED and MCParticleLite in addition to MCParticle -physics.producers.mcreco.G4ModName: @erase -physics.producers.mcreco.SimChannelLabel: "filtersed" -physics.producers.mcreco.MCParticleLabel: "largeant" -physics.producers.mcreco.UseSimEnergyDepositLite: true -physics.producers.mcreco.UseSimEnergyDeposit: false -physics.producers.mcreco.IncludeDroppedParticles: true #this is now true with larsoft v09_89 and newer -physics.producers.mcreco.MCParticleDroppedLabel: "largeant:droppedMCParticles" -physics.producers.mcreco.MCRecoPart.SavePathPDGList: [13,-13,211,-211,111,311,310,130,321,-321,2212,2112,2224,2214,2114,1114,3122,1000010020,1000010030,1000020030,1000020040] -physics.producers.mcreco.MCRecoPart.TrackIDOffsets: [0,10000000,20000000] #Account for track ID offsets in labeling primaries - -message: @local::icarus_message_services_prod - -#icarus_calonormtoolsTest: [@local::driftnorm_sql, @local::yznorm_sql, @local::tpcgain_sql] -#icarus_calonormtoolsMC: [@local::tpcgain_sql] - -runPeriod: 2 - -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].CalorimetryAlg: @local::icarus_calorimetryalgmc -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].ApplyCorrectionsInNorm: true -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].NormTools: @local::icarus_calonormtoolsMC -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].NormTools[0].MC: @local::runPeriod -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[7].NormTools[1].MC: @local::runPeriod -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].CalorimetryAlg: @local::icarus_calorimetryalgmc -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].ApplyCorrectionsInNorm: true -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].NormTools: @local::icarus_calonormtoolsMC -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].NormTools[0].MC: @local::runPeriod -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[7].NormTools[1].MC: @local::runPeriod - -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].CalorimetryAlg: @local::icarus_calorimetryalgmc -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].ApplyCorrectionsInNorm: true -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].NormTools: @local::icarus_calonormtoolsMC -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].NormTools[0].MC: @local::runPeriod -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[5].NormTools[1].MC: @local::runPeriod -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].CalorimetryAlg: @local::icarus_calorimetryalgmc -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].ApplyCorrectionsInNorm: true -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].NormTools: @local::icarus_calonormtoolsMC -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].NormTools[0].MC: @local::runPeriod -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].NormTools[1].MC: @local::runPeriod - -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[3].ApplyCorrectionsInNorm: true -physics.producers.SBNShowerGausCryoE.ShowerFinderTools[3].NormTools: @local::icarus_calonormtoolsMC -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools[0].MC: @local::runPeriod -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools[1].MC: @local::runPeriod -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].ApplyCorrectionsInNorm: true -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools: @local::icarus_calonormtoolsMC -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools[0].MC: @local::runPeriod -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools[1].MC: @local::runPeriod - -services.message.destinations : -{ - STDCOUT: - { - type: "cout" #tells the message service to output this destination to cout - threshold: "ERROR" #tells the message service that this destination applies to WARNING and higher level messages - categories: - { - Cluster3DICARUS: - { - limit: -1 - reportEvery: 1 - } - SimDriftElectrons: - { - limit: 0 - } - } - } -} - diff --git a/icaruscode/TPC/Calorimetry/NormalizeTPCSQL_tool.cc b/icaruscode/TPC/Calorimetry/NormalizeTPCSQL_tool.cc index c529f3259..276ce44b8 100644 --- a/icaruscode/TPC/Calorimetry/NormalizeTPCSQL_tool.cc +++ b/icaruscode/TPC/Calorimetry/NormalizeTPCSQL_tool.cc @@ -110,19 +110,16 @@ double icarus::calo::NormalizeTPCSQL::Normalize(double dQdx, const art::Event &e uint64_t runID = -1; switch (fMC) { case 1: - runID = 1; + runID = 8460; break; case 2: - runID = 9400; + runID = 9301; break; case 3: - runID = 3; + runID = 11806; break; case 4: - runID = 4; - break; - case 5: - runID = 5; + runID = 12960; break; default: runID = e.id().runID().run(); From b2f940fb4c36b90fc3e5c4660a87c9e80f62c3e6 Mon Sep 17 00:00:00 2001 From: Michael Carrigan Date: Thu, 26 Feb 2026 10:20:17 -0600 Subject: [PATCH 8/8] cleanup print statements, NormalizeTPCPerPlane class name change NormalizeTPC->NormalizeTPCPerPlane --- fcl/reco/Stage1/mc/stage1_run2_icarus_MC.fcl | 4 +-- .../Calorimetry/NormalizeTPCPerPlane_tool.cc | 30 +++++++++---------- .../TPC/Calorimetry/NormalizeTPCSQL_tool.cc | 4 --- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/fcl/reco/Stage1/mc/stage1_run2_icarus_MC.fcl b/fcl/reco/Stage1/mc/stage1_run2_icarus_MC.fcl index ae35e3c85..a1c2ce7ff 100644 --- a/fcl/reco/Stage1/mc/stage1_run2_icarus_MC.fcl +++ b/fcl/reco/Stage1/mc/stage1_run2_icarus_MC.fcl @@ -131,8 +131,8 @@ physics.producers.SBNShowerGausCryoW.ShowerFinderTools[5].NormTools[1].MC: physics.producers.SBNShowerGausCryoE.ShowerFinderTools[3].ApplyCorrectionsInNorm: true physics.producers.SBNShowerGausCryoE.ShowerFinderTools[3].NormTools: @local::icarus_calonormtoolsMC -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools[0].MC: @local::runPeriod -physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools[1].MC: @local::runPeriod +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[3].NormTools[0].MC: @local::runPeriod +physics.producers.SBNShowerGausCryoE.ShowerFinderTools[3].NormTools[1].MC: @local::runPeriod physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].ApplyCorrectionsInNorm: true physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools: @local::icarus_calonormtoolsMC physics.producers.SBNShowerGausCryoW.ShowerFinderTools[3].NormTools[0].MC: @local::runPeriod diff --git a/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlane_tool.cc b/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlane_tool.cc index 6e61f7a6f..08b0c0ec4 100644 --- a/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlane_tool.cc +++ b/icaruscode/TPC/Calorimetry/NormalizeTPCPerPlane_tool.cc @@ -24,10 +24,10 @@ namespace icarus { namespace calo { -class NormalizeTPC : public INormalizeCharge +class NormalizeTPCPerPlane : public INormalizeCharge { public: - NormalizeTPC(fhicl::ParameterSet const &pset); + NormalizeTPCPerPlane(fhicl::ParameterSet const &pset); void configure(const fhicl::ParameterSet& pset) override; double Normalize(double dQdx, const art::Event &e, const recob::Hit &h, const geo::Point_t &location, const geo::Vector_t &direction, double t0) override; @@ -52,27 +52,27 @@ class NormalizeTPC : public INormalizeCharge std::map fScaleInfos; }; -DEFINE_ART_CLASS_TOOL(NormalizeTPC) +DEFINE_ART_CLASS_TOOL(NormalizeTPCPerPlane) } // end namespace calo } // end namespace icarus -icarus::calo::NormalizeTPC::NormalizeTPC(fhicl::ParameterSet const &pset) { +icarus::calo::NormalizeTPCPerPlane::NormalizeTPCPerPlane(fhicl::ParameterSet const &pset) { this->configure(pset); } -void icarus::calo::NormalizeTPC::configure(const fhicl::ParameterSet& pset) { +void icarus::calo::NormalizeTPCPerPlane::configure(const fhicl::ParameterSet& pset) { fURL = pset.get("URL"); fTimeout = pset.get("Timeout"); fVerbose = pset.get("Verbose", false); } -std::string icarus::calo::NormalizeTPC::URL(uint64_t run) { +std::string icarus::calo::NormalizeTPCPerPlane::URL(uint64_t run) { return fURL + std::to_string(run); } -icarus::calo::NormalizeTPC::ScaleInfo icarus::calo::NormalizeTPC::GetScaleInfo(uint64_t run) { +icarus::calo::NormalizeTPCPerPlane::ScaleInfo icarus::calo::NormalizeTPCPerPlane::GetScaleInfo(uint64_t run) { // check the cache if (fScaleInfos.count(run)) { return fScaleInfos.at(run); @@ -82,17 +82,17 @@ icarus::calo::NormalizeTPC::ScaleInfo icarus::calo::NormalizeTPC::GetScaleInfo(u int error = 0; std::string url = URL(run); - if (fVerbose) std::cout << "NormalizeTPC Tool -- New Scale info, requesting data from url:\n" << url << std::endl; + if (fVerbose) std::cout << "NormalizeTPCPerPlane Tool -- New Scale info, requesting data from url:\n" << url << std::endl; Dataset d = getDataWithTimeout(url.c_str(), "", fTimeout, &error); if (error) { - throw cet::exception("NormalizeTPC") << "Calibration Database access failed. URL: (" << url << ") Error Code: " << error; + throw cet::exception("NormalizeTPCPerPlane") << "Calibration Database access failed. URL: (" << url << ") Error Code: " << error; } - if (fVerbose) std::cout << "NormalizeTPC Tool -- Received HTTP response:\n" << getHTTPmessage(d) << std::endl; + if (fVerbose) std::cout << "NormalizeTPCPerPlane Tool -- Received HTTP response:\n" << getHTTPmessage(d) << std::endl; if (getHTTPstatus(d) != 200) { - throw cet::exception("NormalizeTPC") + throw cet::exception("NormalizeTPCPerPlane") << "Calibration Database access failed. URL: (" << url << "). HTTP error status: " << getHTTPstatus(d) << ". HTTP error message: " << getHTTPmessage(d); } @@ -103,7 +103,7 @@ icarus::calo::NormalizeTPC::ScaleInfo icarus::calo::NormalizeTPC::GetScaleInfo(u // Number of rows int n_tuple = getNtuples(d); if (n_tuple < 0) { - throw cet::exception("NormalizeTPC") << "Calibration Database access failed. URL: (" << url << ") Bad Tuple Number: " << n_tuple; + throw cet::exception("NormalizeTPCPerPlane") << "Calibration Database access failed. URL: (" << url << ") Bad Tuple Number: " << n_tuple; } // Iterate over the rows @@ -115,13 +115,13 @@ icarus::calo::NormalizeTPC::ScaleInfo icarus::calo::NormalizeTPC::GetScaleInfo(u // Get the itpc number int ch = getLongValue(tup, 0, &err); if (error) { - throw cet::exception("NormalizeTPC") << "Calibration Database access failed. URL: (" << url << ") Failed on tuple access, row: " << row << ", col 0. Error Code: " << error; + throw cet::exception("NormalizeTPCPerPlane") << "Calibration Database access failed. URL: (" << url << ") Failed on tuple access, row: " << row << ", col 0. Error Code: " << error; } // and the scale double scale = getDoubleValue(tup, 3, &err); if (error) { - throw cet::exception("NormalizeTPC") << "Calibration Database access failed. URL: (" << url << ") Failed on tuple access, row: " << row << ", col 1. Error Code: " << error; + throw cet::exception("NormalizeTPCPerPlane") << "Calibration Database access failed. URL: (" << url << ") Failed on tuple access, row: " << row << ", col 1. Error Code: " << error; } thisscale.scale[ch] = scale; @@ -133,7 +133,7 @@ icarus::calo::NormalizeTPC::ScaleInfo icarus::calo::NormalizeTPC::GetScaleInfo(u return thisscale; } -double icarus::calo::NormalizeTPC::Normalize(double dQdx, const art::Event &e, +double icarus::calo::NormalizeTPCPerPlane::Normalize(double dQdx, const art::Event &e, const recob::Hit &hit, const geo::Point_t &location, const geo::Vector_t &direction, double t0) { // Get the info ScaleInfo i = GetScaleInfo(e.id().runID().run()); diff --git a/icaruscode/TPC/Calorimetry/NormalizeTPCSQL_tool.cc b/icaruscode/TPC/Calorimetry/NormalizeTPCSQL_tool.cc index 276ce44b8..7a6a50051 100644 --- a/icaruscode/TPC/Calorimetry/NormalizeTPCSQL_tool.cc +++ b/icaruscode/TPC/Calorimetry/NormalizeTPCSQL_tool.cc @@ -73,8 +73,6 @@ void icarus::calo::NormalizeTPCSQL::configure(const fhicl::ParameterSet& pset) { icarus::calo::NormalizeTPCSQL::ScaleInfo icarus::calo::NormalizeTPCSQL::GetScaleInfo(uint64_t run) { - std::cout << "NormalizeTPCSQL Tool -- Getting scale info for run: " << run << std::endl; - // check the cache if (fScaleInfos.count(run)) { return fScaleInfos.at(run); @@ -104,8 +102,6 @@ icarus::calo::NormalizeTPCSQL::ScaleInfo icarus::calo::NormalizeTPCSQL::GetScale 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; - // Get the info uint64_t runID = -1; switch (fMC) {