diff --git a/CMakeLists.txt b/CMakeLists.txt index 0720a9ddb..d6932da42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ cmake_minimum_required(VERSION 3.20 FATAL_ERROR) find_package(cetmodules 3.20.00 REQUIRED) -project(sbncode VERSION 10.14.00 LANGUAGES CXX) +project(sbncode VERSION 10.14.02 LANGUAGES CXX) message(STATUS "\n\n ========================== ${PROJECT_NAME} ==========================") diff --git a/sbncode/CAFMaker/CAFMakerParams.h b/sbncode/CAFMaker/CAFMakerParams.h index 0250e740f..7bc433426 100644 --- a/sbncode/CAFMaker/CAFMakerParams.h +++ b/sbncode/CAFMaker/CAFMakerParams.h @@ -483,6 +483,12 @@ namespace caf "simdrift" }; + Atom SimEnergyDepositLabel { + Name("SimEnergyDepositLabel"), + Comment("Label of input sim::SimEnergyDeposit objects."), + art::InputTag("ionandscint", "priorSCE","G4") + }; + Atom FillTrueParticles { Name("FillTrueParticles"), Comment("Whether to fill the rec.true_particles branch. The information on true particles" @@ -634,6 +640,12 @@ namespace caf Comment("Label of CVN scores."), "cvn" }; + + Atom LightCaloLabel { + Name("LightCaloLabel"), + Comment("Label of light calorimetry producer"), + "lightcalo" + }; }; } diff --git a/sbncode/CAFMaker/CAFMaker_module.cc b/sbncode/CAFMaker/CAFMaker_module.cc index 9f2c01590..5e91fccaf 100644 --- a/sbncode/CAFMaker/CAFMaker_module.cc +++ b/sbncode/CAFMaker/CAFMaker_module.cc @@ -97,6 +97,7 @@ #include "lardataobj/RecoBase/MCSFitResult.h" #include "lardataobj/RecoBase/Cluster.h" #include "lardataobj/AnalysisBase/MVAOutput.h" +#include "lardataobj/Simulation/SimEnergyDeposit.h" #include "nusimdata/SimulationBase/MCFlux.h" #include "nusimdata/SimulationBase/MCTruth.h" @@ -120,6 +121,7 @@ #include "sbnobj/Common/Reco/OpT0FinderResult.h" #include "sbnobj/SBND/CRT/CRTVeto.hh" #include "sbnobj/Common/Reco/CorrectedOpFlashTiming.h" +#include "sbnobj/Common/Reco/LightCalo.h" #include "sbnobj/SBND/Timing/TimingInfo.hh" #include "sbnobj/SBND/Timing/FrameShiftInfo.hh" @@ -1443,6 +1445,15 @@ void CAFMaker::produce(art::Event& evt) noexcept { art::fill_ptr_vector(simchannels, simchannel_handle); } + // get sim energy deposits if they're there + ::art::Handle> sed_handle; + GetByLabelStrict(evt, fParams.SimEnergyDepositLabel().encode(), sed_handle); + + std::vector> seds; + if (sed_handle.isValid()){ + art::fill_ptr_vector(seds, sed_handle); + } + art::Handle> mcflux_handle; GetByLabelStrict(evt, std::string("generator"), mcflux_handle); @@ -1637,6 +1648,34 @@ void CAFMaker::produce(art::Event& evt) noexcept { } // end for fm } // end for i (mctruths) + + if (!isRealData && sed_handle.isValid()){ + art::ServiceHandle pi_serv; + + srtruthbranch.dep.reserve(mctruths.size()); + for (size_t n=0; nTrackID(); + + art::Ptr mctruth = pi_serv->TrackIdToMCTruth_P(trackID); + auto it = std::find(mctruths.begin(), mctruths.end(), mctruth); + if (it == mctruths.end()) continue; + + auto idx = std::distance(mctruths.begin(), it); + srtruthbranch.dep.at(idx).energy += sed->Energy()*1e-3; // GeV + srtruthbranch.dep.at(idx).photons += sed->NumPhotons(); + srtruthbranch.dep.at(idx).electrons += sed->NumElectrons(); + } + } + // get the number of events generated in the gen stage unsigned n_gen_evt = 0; for (const art::ProcessConfiguration &process: evt.processHistory()) { @@ -2049,6 +2088,13 @@ void CAFMaker::produce(art::Event& evt) noexcept { if (fmCorrectedOpFlash.isValid()) slcCorrectedOpFlash = fmCorrectedOpFlash.at(0); + art::FindOneP foLightCalo = + FindOnePStrict(sliceList,evt, + fParams.LightCaloLabel() + slice_tag_suff); + const sbn::LightCalo *slcLightCalo = nullptr; + if (foLightCalo.isValid()) { + slcLightCalo = foLightCalo.at(0).get(); + } art::FindOneP foCVNResult = FindOnePStrict(sliceList, evt, @@ -2308,6 +2354,7 @@ void CAFMaker::produce(art::Event& evt) noexcept { FillSliceCRUMBS(slcCRUMBS, recslc); FillSliceOpT0Finder(slcOpT0, recslc); FillSliceBarycenter(slcHits, slcSpacePoints, recslc); + FillSliceLightCalo(slcLightCalo, recslc); FillTPCPMTBarycenterMatch(barycenterMatch, recslc); FillCorrectedOpFlashTiming(slcCorrectedOpFlash, recslc); FillCVNScores(cvnResult, recslc); diff --git a/sbncode/CAFMaker/CMakeLists.txt b/sbncode/CAFMaker/CMakeLists.txt index 5dd4f2a8f..b5a9b342b 100644 --- a/sbncode/CAFMaker/CMakeLists.txt +++ b/sbncode/CAFMaker/CMakeLists.txt @@ -25,6 +25,7 @@ art_make_library( LIBRARY_NAME sbncode_CAFMaker caf_RecoUtils lardataobj::AnalysisBase lardataobj::RecoBase + lardataobj::Simulation larrecodnn::CVN_func larcorealg::Geometry larcore::Geometry_Geometry_service diff --git a/sbncode/CAFMaker/FillReco.cxx b/sbncode/CAFMaker/FillReco.cxx index 46396a2c1..2bb279b87 100644 --- a/sbncode/CAFMaker/FillReco.cxx +++ b/sbncode/CAFMaker/FillReco.cxx @@ -693,6 +693,17 @@ namespace caf } } + void FillSliceLightCalo(const sbn::LightCalo *lightcalo, + caf::SRSlice &slice) + { + if (lightcalo != nullptr) { + slice.lightcalo.charge = lightcalo->charge; + slice.lightcalo.light = lightcalo->light; + slice.lightcalo.energy = lightcalo->energy; + slice.lightcalo.bestplane = lightcalo->bestplane; + } + } + void FillSliceBarycenter(const std::vector> &inputHits, const std::vector> &inputPoints, caf::SRSlice &slice) diff --git a/sbncode/CAFMaker/FillReco.h b/sbncode/CAFMaker/FillReco.h index 46704181a..6401aa01d 100644 --- a/sbncode/CAFMaker/FillReco.h +++ b/sbncode/CAFMaker/FillReco.h @@ -48,7 +48,7 @@ #include "sbnobj/Common/PMT/Data/PMTBeamSignal.hh" #include "sbnobj/SBND/Timing/TimingInfo.hh" #include "sbnobj/SBND/Timing/FrameShiftInfo.hh" - +#include "sbnobj/Common/Reco/LightCalo.h" #include "nusimdata/SimulationBase/MCParticle.h" #include "nusimdata/SimulationBase/MCTruth.h" @@ -110,6 +110,9 @@ namespace caf void FillSliceOpT0Finder(const std::vector> &opt0_v, caf::SRSlice &slice); + void FillSliceLightCalo(const sbn::LightCalo *lightcalo, + caf::SRSlice& slice); + void FillSliceBarycenter(const std::vector> &inputHits, const std::vector> &inputPoints, caf::SRSlice &slice); diff --git a/ups/product_deps b/ups/product_deps index 755bb2211..2ff8b27d9 100644 --- a/ups/product_deps +++ b/ups/product_deps @@ -254,8 +254,8 @@ libdir fq_dir lib product version qual flags genie_xsec v3_06_00 - larcv2 v2_2_6 - -larsoft v10_14_00 - -sbnalg v10_14_00 - +larsoft v10_14_02 - +sbnalg v10_14_02 - sbndaq_artdaq_core v1_10_06 - sbndata v01_08 - systematicstools v01_04_04 -