Skip to content
Merged
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
6 changes: 6 additions & 0 deletions sbncode/CAFMaker/CAFMakerParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,12 @@ namespace caf
"crtpmt" // this variable exists in icaruscode, pretty sure it does not yet exist in sbnd
};

Atom<string> TPCPMTBarycenterMatchLabel {
Name("TPCPMTBarycenterMatchLabel"),
Comment("Label of Slice-OpFlash matching via barycenters."),
"" //Empty by default, configured in icaruscode cafmaker_defs
};

Atom<string> OpFlashLabel {
Name("OpFlashLabel"),
Comment("Label of PMT flash."),
Expand Down
10 changes: 10 additions & 0 deletions sbncode/CAFMaker/CAFMaker_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -1479,6 +1482,12 @@ void CAFMaker::produce(art::Event& evt) noexcept {
FindManyPStrict<sbn::SimpleFlashMatch>(fmPFPart, evt,
fParams.FlashMatchLabel() + slice_tag_suff);

art::FindOneP<sbn::TPCPMTBarycenterMatch> foTPCPMTBarycenterMatch =
FindOnePStrict<sbn::TPCPMTBarycenterMatch>(sliceList, evt,
fParams.TPCPMTBarycenterMatchLabel() + slice_tag_suff);
const sbn::TPCPMTBarycenterMatch *barycenterMatch
= foTPCPMTBarycenterMatch.isValid()? foTPCPMTBarycenterMatch.at(0).get(): nullptr;

art::FindManyP<larpandoraobj::PFParticleMetadata> fmPFPMeta =
FindManyPStrict<larpandoraobj::PFParticleMetadata>(fmPFPart, evt,
fParams.PFParticleLabel() + slice_tag_suff);
Expand Down Expand Up @@ -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;
Expand Down
29 changes: 29 additions & 0 deletions sbncode/CAFMaker/FillReco.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<caf::StandardRecord> &recs,
Expand Down
4 changes: 4 additions & 0 deletions sbncode/CAFMaker/FillReco.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -197,6 +198,9 @@ namespace caf
caf::SRCRTPMTMatch &srmatch,
bool allowEmpty = false);

void FillTPCPMTBarycenterMatch(const sbn::TPCPMTBarycenterMatch *matchInfo,
caf::SRSlice& slice);

template<class T, class U>
void CopyPropertyIfSet( const std::map<std::string, T>& props, const std::string& search, U& value );
}
Expand Down