Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)

find_package(cetmodules 3.20.00 REQUIRED)
project(sbncode VERSION 10.14.02 LANGUAGES CXX)
project(sbncode VERSION 10.14.02.01 LANGUAGES CXX)

message(STATUS "\n\n ========================== ${PROJECT_NAME} ==========================")

Expand Down
12 changes: 12 additions & 0 deletions sbncode/CAFMaker/CAFMakerParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,12 @@ namespace caf
"simdrift"
};

Atom<art::InputTag> SimEnergyDepositLabel {
Name("SimEnergyDepositLabel"),
Comment("Label of input sim::SimEnergyDeposit objects."),
art::InputTag("ionandscint", "priorSCE","G4")
Copy link
Member

Choose a reason for hiding this comment

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

What's the motivation for explicitly naming the process name as "G4"? Are we expecting scenarios where multiple fcl processes have created SimEnergyDeposits? Definitely not asking for a change here as this is nice and fcl flexible. Just interested in why this came up!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, no particular reason. I think I had paralleled the syntax for the trigger emulation in the same file!

};

Atom<bool> FillTrueParticles {
Name("FillTrueParticles"),
Comment("Whether to fill the rec.true_particles branch. The information on true particles"
Expand Down Expand Up @@ -634,6 +640,12 @@ namespace caf
Comment("Label of CVN scores."),
"cvn"
};

Atom<string> LightCaloLabel {
Name("LightCaloLabel"),
Comment("Label of light calorimetry producer"),
"lightcalo"
};

};
}
Expand Down
47 changes: 47 additions & 0 deletions sbncode/CAFMaker/CAFMaker_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"

Expand Down Expand Up @@ -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<std::vector<sim::SimEnergyDeposit>> sed_handle;
GetByLabelStrict(evt, fParams.SimEnergyDepositLabel().encode(), sed_handle);

std::vector<art::Ptr<sim::SimEnergyDeposit>> seds;
if (sed_handle.isValid()){
art::fill_ptr_vector(seds, sed_handle);
}

art::Handle<std::vector<simb::MCFlux>> mcflux_handle;
GetByLabelStrict(evt, std::string("generator"), mcflux_handle);

Expand Down Expand Up @@ -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<cheat::ParticleInventoryService> pi_serv;

srtruthbranch.dep.reserve(mctruths.size());
for (size_t n=0; n<mctruths.size();n++){
SRTrueDeposit init;
Copy link
Member

Choose a reason for hiding this comment

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

Is the name SRTrueDeposit a little confusing when the object is actually going to store the sum of all relevant deposits? I wonder whether we want to call it something like SRTotalTrueDeposition or something catchier you can think of? Maybe this isn't a problem 🤔 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could go either way about it, not sure that I feel very strongly as long as you think it's documented well in the corresponding header. It may be confusing if one expects it to be exactly what's in SimEnergyDeposits, but I think what the branch is actually accessible with (which is rec.mc.dep.energy, etc., is not too bad?

init.electrons = 0;
init.photons = 0;
init.energy = 0;
srtruthbranch.dep.push_back(init);
}

for (size_t n_dep=0; n_dep < seds.size(); n_dep++){
auto sed = seds[n_dep];
const auto trackID = sed->TrackID();

art::Ptr<simb::MCTruth> 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()) {
Expand Down Expand Up @@ -2049,6 +2088,13 @@ void CAFMaker::produce(art::Event& evt) noexcept {
if (fmCorrectedOpFlash.isValid())
slcCorrectedOpFlash = fmCorrectedOpFlash.at(0);

art::FindOneP<sbn::LightCalo> foLightCalo =
FindOnePStrict<sbn::LightCalo>(sliceList,evt,
fParams.LightCaloLabel() + slice_tag_suff);
const sbn::LightCalo *slcLightCalo = nullptr;
if (foLightCalo.isValid()) {
slcLightCalo = foLightCalo.at(0).get();
}

art::FindOneP<lcvn::Result> foCVNResult =
FindOnePStrict<lcvn::Result>(sliceList, evt,
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions sbncode/CAFMaker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions sbncode/CAFMaker/FillReco.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<art::Ptr<recob::Hit>> &inputHits,
const std::vector<art::Ptr<recob::SpacePoint>> &inputPoints,
caf::SRSlice &slice)
Expand Down
5 changes: 4 additions & 1 deletion sbncode/CAFMaker/FillReco.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -110,6 +110,9 @@ namespace caf
void FillSliceOpT0Finder(const std::vector<art::Ptr<sbn::OpT0Finder>> &opt0_v,
caf::SRSlice &slice);

void FillSliceLightCalo(const sbn::LightCalo *lightcalo,
caf::SRSlice& slice);

void FillSliceBarycenter(const std::vector<art::Ptr<recob::Hit>> &inputHits,
const std::vector<art::Ptr<recob::SpacePoint>> &inputPoints,
caf::SRSlice &slice);
Expand Down
2 changes: 1 addition & 1 deletion ups/product_deps
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ libdir fq_dir lib
product version qual flags <table_format=2>
genie_xsec v3_06_00 -
larcv2 v2_2_6 -
larsoft v10_14_02 -
larsoft v10_14_02_01 -
sbnalg v10_14_02 -
sbndaq_artdaq_core v1_10_06 -
sbndata v01_08 -
Expand Down