diff --git a/sbncode/CAFMaker/CAFMakerParams.h b/sbncode/CAFMaker/CAFMakerParams.h index b520aa5c9..b058d2250 100644 --- a/sbncode/CAFMaker/CAFMakerParams.h +++ b/sbncode/CAFMaker/CAFMakerParams.h @@ -269,6 +269,12 @@ namespace caf "crtpmt" // this variable exists in icaruscode, pretty sure it does not yet exist in sbnd }; + Atom TPCPMTBarycenterMatchLabel { + Name("TPCPMTBarycenterMatchLabel"), + Comment("Label of Slice-OpFlash matching via barycenters."), + "" //Empty by default, configured in icaruscode cafmaker_defs + }; + Atom OpFlashLabel { Name("OpFlashLabel"), Comment("Label of PMT flash."), diff --git a/sbncode/CAFMaker/CAFMaker_module.cc b/sbncode/CAFMaker/CAFMaker_module.cc index e7704b2c7..e9452232c 100644 --- a/sbncode/CAFMaker/CAFMaker_module.cc +++ b/sbncode/CAFMaker/CAFMaker_module.cc @@ -441,6 +441,9 @@ void CAFMaker::FixPMTReferenceTimes(StandardRecord &rec, double PMT_reference_ti s.fmatch.time += PMT_reference_time; s.fmatch_a.time += PMT_reference_time; s.fmatch_b.time += PMT_reference_time; + + s.barycenterFM.flashTime +=PMT_reference_time; + s.barycenterFM.flashFirstHit +=PMT_reference_time; } // TODO: fix more? @@ -1479,6 +1482,12 @@ void CAFMaker::produce(art::Event& evt) noexcept { FindManyPStrict(fmPFPart, evt, fParams.FlashMatchLabel() + slice_tag_suff); + art::FindOneP foTPCPMTBarycenterMatch = + FindOnePStrict(sliceList, evt, + fParams.TPCPMTBarycenterMatchLabel() + slice_tag_suff); + const sbn::TPCPMTBarycenterMatch *barycenterMatch + = foTPCPMTBarycenterMatch.isValid()? foTPCPMTBarycenterMatch.at(0).get(): nullptr; + art::FindManyP fmPFPMeta = FindManyPStrict(fmPFPart, evt, fParams.PFParticleLabel() + slice_tag_suff); @@ -1670,6 +1679,7 @@ void CAFMaker::produce(art::Event& evt) noexcept { FillSliceVertex(vertex, recslc); FillSliceCRUMBS(slcCRUMBS, recslc); FillSliceBarycenter(slcHits, slcSpacePoints, recslc); + FillTPCPMTBarycenterMatch(barycenterMatch, recslc); // select slice if (!SelectSlice(recslc, fParams.CutClearCosmic())) continue; diff --git a/sbncode/CAFMaker/FillReco.cxx b/sbncode/CAFMaker/FillReco.cxx index 4c86f8a7a..dfdfd365c 100644 --- a/sbncode/CAFMaker/FillReco.cxx +++ b/sbncode/CAFMaker/FillReco.cxx @@ -851,6 +851,35 @@ namespace caf srhit.spacepoint.pfpID = particle.Self(); srhit.spacepoint.ID = spacepoint.ID(); } + + + void FillTPCPMTBarycenterMatch(const sbn::TPCPMTBarycenterMatch *matchInfo, + caf::SRSlice& slice) + { + slice.barycenterFM.setDefault(); + + if ( matchInfo != nullptr ) { + slice.barycenterFM.chargeTotal = matchInfo->chargeTotal; + slice.barycenterFM.chargeCenterXLocal = matchInfo->chargeCenterXLocal; + slice.barycenterFM.chargeCenter = SRVector3D (matchInfo->chargeCenter.x(), matchInfo->chargeCenter.y(), matchInfo->chargeCenter.z()); + slice.barycenterFM.chargeWidth = SRVector3D (matchInfo->chargeWidth.x(), matchInfo->chargeWidth.y(), matchInfo->chargeWidth.z()); + slice.barycenterFM.flashFirstHit = matchInfo->flashFirstHit; + slice.barycenterFM.flashTime = matchInfo->flashTime; + slice.barycenterFM.flashPEs = matchInfo->flashPEs; + slice.barycenterFM.flashCenter = SRVector3D (matchInfo->flashCenter.x(), matchInfo->flashCenter.y(), matchInfo->flashCenter.z()); + slice.barycenterFM.flashWidth = SRVector3D (matchInfo->flashWidth.x(), matchInfo->flashWidth.y(), matchInfo->flashWidth.z()); + slice.barycenterFM.deltaT = matchInfo->deltaT; + slice.barycenterFM.deltaY = matchInfo->deltaY; + slice.barycenterFM.deltaZ = matchInfo->deltaZ; + slice.barycenterFM.radius = matchInfo->radius; + slice.barycenterFM.overlapY = matchInfo->overlapY; + slice.barycenterFM.overlapZ = matchInfo->overlapZ; + slice.barycenterFM.deltaZ_Trigger = matchInfo->deltaZ_Trigger; + slice.barycenterFM.deltaY_Trigger = matchInfo->deltaY_Trigger; + slice.barycenterFM.radius_Trigger = matchInfo->radius_Trigger; + } + } + //...................................................................... void SetNuMuCCPrimary(std::vector &recs, diff --git a/sbncode/CAFMaker/FillReco.h b/sbncode/CAFMaker/FillReco.h index 855735fd4..5f432c020 100644 --- a/sbncode/CAFMaker/FillReco.h +++ b/sbncode/CAFMaker/FillReco.h @@ -33,6 +33,7 @@ #include "sbnobj/Common/Reco/ScatterClosestApproach.h" #include "sbnobj/Common/Reco/StoppingChi2Fit.h" #include "sbnobj/Common/Reco/CRUMBSResult.h" +#include "sbnobj/Common/Reco/TPCPMTBarycenterMatch.h" #include "sbnobj/Common/CRT/CRTHit.hh" #include "sbnobj/Common/CRT/CRTTrack.hh" #include "sbnobj/Common/CRT/CRTPMTMatching.hh" @@ -197,6 +198,9 @@ namespace caf caf::SRCRTPMTMatch &srmatch, bool allowEmpty = false); + void FillTPCPMTBarycenterMatch(const sbn::TPCPMTBarycenterMatch *matchInfo, + caf::SRSlice& slice); + template void CopyPropertyIfSet( const std::map& props, const std::string& search, U& value ); }