|
97 | 97 | #include "lardataobj/RecoBase/MCSFitResult.h" |
98 | 98 | #include "lardataobj/RecoBase/Cluster.h" |
99 | 99 | #include "lardataobj/AnalysisBase/MVAOutput.h" |
| 100 | +#include "lardataobj/Simulation/SimEnergyDeposit.h" |
100 | 101 |
|
101 | 102 | #include "nusimdata/SimulationBase/MCFlux.h" |
102 | 103 | #include "nusimdata/SimulationBase/MCTruth.h" |
|
119 | 120 | #include "sbnobj/Common/Reco/CRUMBSResult.h" |
120 | 121 | #include "sbnobj/Common/Reco/OpT0FinderResult.h" |
121 | 122 | #include "sbnobj/Common/Reco/CorrectedOpFlashTiming.h" |
| 123 | +#include "sbnobj/Common/Reco/LightCalo.h" |
122 | 124 | #include "sbnobj/SBND/Timing/TimingInfo.hh" |
123 | 125 | #include "sbnobj/SBND/Timing/FrameShiftInfo.hh" |
124 | 126 |
|
@@ -1422,6 +1424,15 @@ void CAFMaker::produce(art::Event& evt) noexcept { |
1422 | 1424 | art::fill_ptr_vector(simchannels, simchannel_handle); |
1423 | 1425 | } |
1424 | 1426 |
|
| 1427 | + // get sim energy deposits if they're there |
| 1428 | + ::art::Handle<std::vector<sim::SimEnergyDeposit>> sed_handle; |
| 1429 | + GetByLabelStrict(evt, fParams.SimEnergyDepositLabel().encode(), sed_handle); |
| 1430 | + |
| 1431 | + std::vector<art::Ptr<sim::SimEnergyDeposit>> seds; |
| 1432 | + if (sed_handle.isValid()){ |
| 1433 | + art::fill_ptr_vector(seds, sed_handle); |
| 1434 | + } |
| 1435 | + |
1425 | 1436 | art::Handle<std::vector<simb::MCFlux>> mcflux_handle; |
1426 | 1437 | GetByLabelStrict(evt, std::string("generator"), mcflux_handle); |
1427 | 1438 |
|
@@ -1614,6 +1625,34 @@ void CAFMaker::produce(art::Event& evt) noexcept { |
1614 | 1625 | } // end for fm |
1615 | 1626 | } // end for i (mctruths) |
1616 | 1627 |
|
| 1628 | + |
| 1629 | + if (!isRealData && sed_handle.isValid()){ |
| 1630 | + art::ServiceHandle<cheat::ParticleInventoryService> pi_serv; |
| 1631 | + |
| 1632 | + srtruthbranch.dep.reserve(mctruths.size()); |
| 1633 | + for (size_t n=0; n<mctruths.size();n++){ |
| 1634 | + SRTrueDeposit init; |
| 1635 | + init.electrons = 0; |
| 1636 | + init.photons = 0; |
| 1637 | + init.energy = 0; |
| 1638 | + srtruthbranch.dep.push_back(init); |
| 1639 | + } |
| 1640 | + |
| 1641 | + for (size_t n_dep=0; n_dep < seds.size(); n_dep++){ |
| 1642 | + auto sed = seds[n_dep]; |
| 1643 | + const auto trackID = sed->TrackID(); |
| 1644 | + |
| 1645 | + art::Ptr<simb::MCTruth> mctruth = pi_serv->TrackIdToMCTruth_P(trackID); |
| 1646 | + auto it = std::find(mctruths.begin(), mctruths.end(), mctruth); |
| 1647 | + if (it == mctruths.end()) continue; |
| 1648 | + |
| 1649 | + auto idx = std::distance(mctruths.begin(), it); |
| 1650 | + srtruthbranch.dep.at(idx).energy += sed->Energy()*1e-3; // GeV |
| 1651 | + srtruthbranch.dep.at(idx).photons += sed->NumPhotons(); |
| 1652 | + srtruthbranch.dep.at(idx).electrons += sed->NumElectrons(); |
| 1653 | + } |
| 1654 | + } |
| 1655 | + |
1617 | 1656 | // get the number of events generated in the gen stage |
1618 | 1657 | unsigned n_gen_evt = 0; |
1619 | 1658 | for (const art::ProcessConfiguration &process: evt.processHistory()) { |
@@ -1995,6 +2034,13 @@ void CAFMaker::produce(art::Event& evt) noexcept { |
1995 | 2034 | if (fmCorrectedOpFlash.isValid()) |
1996 | 2035 | slcCorrectedOpFlash = fmCorrectedOpFlash.at(0); |
1997 | 2036 |
|
| 2037 | + art::FindOneP<sbn::LightCalo> foLightCalo = |
| 2038 | + FindOnePStrict<sbn::LightCalo>(sliceList,evt, |
| 2039 | + fParams.LightCaloLabel() + slice_tag_suff); |
| 2040 | + const sbn::LightCalo *slcLightCalo = nullptr; |
| 2041 | + if (foLightCalo.isValid()) { |
| 2042 | + slcLightCalo = foLightCalo.at(0).get(); |
| 2043 | + } |
1998 | 2044 |
|
1999 | 2045 | art::FindOneP<lcvn::Result> foCVNResult = |
2000 | 2046 | FindOnePStrict<lcvn::Result>(sliceList, evt, |
@@ -2250,6 +2296,7 @@ void CAFMaker::produce(art::Event& evt) noexcept { |
2250 | 2296 | FillSliceCRUMBS(slcCRUMBS, recslc); |
2251 | 2297 | FillSliceOpT0Finder(slcOpT0, recslc); |
2252 | 2298 | FillSliceBarycenter(slcHits, slcSpacePoints, recslc); |
| 2299 | + FillSliceLightCalo(slcLightCalo, recslc); |
2253 | 2300 | FillTPCPMTBarycenterMatch(barycenterMatch, recslc); |
2254 | 2301 | FillCorrectedOpFlashTiming(slcCorrectedOpFlash, recslc); |
2255 | 2302 | FillCVNScores(cvnResult, recslc); |
|
0 commit comments