|
98 | 98 | #include "lardataobj/RecoBase/MCSFitResult.h" |
99 | 99 | #include "lardataobj/RecoBase/Cluster.h" |
100 | 100 | #include "lardataobj/AnalysisBase/MVAOutput.h" |
| 101 | +#include "lardataobj/Simulation/SimEnergyDeposit.h" |
101 | 102 |
|
102 | 103 | #include "nusimdata/SimulationBase/MCFlux.h" |
103 | 104 | #include "nusimdata/SimulationBase/MCTruth.h" |
|
121 | 122 | #include "sbnobj/Common/Reco/OpT0FinderResult.h" |
122 | 123 | #include "sbnobj/SBND/CRT/CRTVeto.hh" |
123 | 124 | #include "sbnobj/Common/Reco/CorrectedOpFlashTiming.h" |
| 125 | +#include "sbnobj/Common/Reco/LightCalo.h" |
124 | 126 | #include "sbnobj/SBND/Timing/TimingInfo.hh" |
125 | 127 | #include "sbnobj/SBND/Timing/FrameShiftInfo.hh" |
126 | 128 |
|
@@ -1650,6 +1652,36 @@ void CAFMaker::produce(art::Event& evt) noexcept { |
1650 | 1652 | } // end for fm |
1651 | 1653 | } // end for i (mctruths) |
1652 | 1654 |
|
| 1655 | + // get sim energy deposits if they're there |
| 1656 | + ::art::Handle<std::vector<sim::SimEnergyDeposit>> sed_handle; |
| 1657 | + GetByLabelStrict(evt, fParams.SimEnergyDepositLabel().encode(), sed_handle); |
| 1658 | + |
| 1659 | + if (!isRealData && sed_handle.isValid()){ |
| 1660 | + art::ServiceHandle<cheat::ParticleInventoryService> pi_serv; |
| 1661 | + |
| 1662 | + srtruthbranch.dep.reserve(mctruths.size()); |
| 1663 | + for (size_t n=0; n<mctruths.size();n++){ |
| 1664 | + SRTrueDeposit init; |
| 1665 | + init.electrons = 0; |
| 1666 | + init.photons = 0; |
| 1667 | + init.energy = 0; |
| 1668 | + srtruthbranch.dep.push_back(init); |
| 1669 | + } |
| 1670 | + |
| 1671 | + for (sim::SimEnergyDeposit const& sed: *sed_handle){ |
| 1672 | + const auto trackID = sed.TrackID(); |
| 1673 | + |
| 1674 | + art::Ptr<simb::MCTruth> mctruth = pi_serv->TrackIdToMCTruth_P(trackID); |
| 1675 | + auto it = std::find(mctruths.begin(), mctruths.end(), mctruth); |
| 1676 | + if (it == mctruths.end()) continue; |
| 1677 | + |
| 1678 | + auto idx = std::distance(mctruths.begin(), it); |
| 1679 | + srtruthbranch.dep.at(idx).energy += sed.Energy()*1e-3; // GeV |
| 1680 | + srtruthbranch.dep.at(idx).photons += sed.NumPhotons(); |
| 1681 | + srtruthbranch.dep.at(idx).electrons += sed.NumElectrons(); |
| 1682 | + } |
| 1683 | + } |
| 1684 | + |
1653 | 1685 | // get the number of events generated in the gen stage |
1654 | 1686 | unsigned n_gen_evt = 0; |
1655 | 1687 | for (const art::ProcessConfiguration &process: evt.processHistory()) { |
@@ -2072,6 +2104,10 @@ void CAFMaker::produce(art::Event& evt) noexcept { |
2072 | 2104 | if (fmCorrectedOpFlash.isValid()) |
2073 | 2105 | slcCorrectedOpFlash = fmCorrectedOpFlash.at(0); |
2074 | 2106 |
|
| 2107 | + art::FindOneP<sbn::LightCalo> foLightCalo = |
| 2108 | + FindOnePStrict<sbn::LightCalo>(sliceList,evt, |
| 2109 | + fParams.LightCaloLabel() + slice_tag_suff); |
| 2110 | + const sbn::LightCalo *slcLightCalo = foLightCalo.isValid()? foLightCalo.at(0).get() : nullptr; |
2075 | 2111 |
|
2076 | 2112 | art::FindOneP<lcvn::Result> foCVNResult = |
2077 | 2113 | FindOnePStrict<lcvn::Result>(sliceList, evt, |
@@ -2334,6 +2370,7 @@ void CAFMaker::produce(art::Event& evt) noexcept { |
2334 | 2370 | FillSliceCRUMBS(slcCRUMBS, recslc); |
2335 | 2371 | FillSliceOpT0Finder(slcOpT0, recslc); |
2336 | 2372 | FillSliceBarycenter(slcHits, slcSpacePoints, recslc); |
| 2373 | + FillSliceLightCalo(slcLightCalo, recslc); |
2337 | 2374 | FillTPCPMTBarycenterMatch(barycenterMatch, recslc); |
2338 | 2375 | FillCorrectedOpFlashTiming(slcCorrectedOpFlash, recslc); |
2339 | 2376 | FillCVNScores(cvnResult, recslc); |
|
0 commit comments