Skip to content

Commit afb8350

Browse files
authored
Merge pull request #536 from SBNSoftware/feature/fp_CRTT0TagginginCafs
This PR introduces CRT Tagging usage into cafs for analyzers
2 parents fa6a3cd + e0e6d1c commit afb8350

4 files changed

Lines changed: 43 additions & 5 deletions

File tree

sbncode/CAFMaker/CAFMakerParams.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,12 @@ namespace caf
278278
"pandoraTrackCRTHit"
279279
};
280280

281+
Atom<string> CRTHitMatchInfoLabel {
282+
Name("CRTHitMatchInfoLabel"),
283+
Comment("Base label of additional information on track to CRT hit matching producer."),
284+
"CRTT0Tagging"
285+
};
286+
281287
Atom<string> CRTTrackMatchLabel {
282288
Name("CRTTrackMatchLabel"),
283289
Comment("Base label of track to CRT track matching producer."),

sbncode/CAFMaker/CAFMaker_module.cc

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
#include "nusimdata/SimulationBase/MCNeutrino.h"
102102
#include "nusimdata/SimulationBase/GTruth.h"
103103

104+
#include "sbnobj/Common/CRT/CRTHitT0TaggingInfo.hh"
104105
#include "sbnobj/Common/EventGen/MeVPrtl/MeVPrtlTruth.h"
105106
#include "sbnobj/Common/Reco/RangeP.h"
106107
#include "sbnobj/Common/SBNEventWeight/EventWeightMap.h"
@@ -1926,9 +1927,14 @@ void CAFMaker::produce(art::Event& evt) noexcept {
19261927

19271928
// NOTE: The sbn::crt::CRTHit is associated to the T0. It's a bit awkward to
19281929
// access that here, so we do it per-track (see code where fmCRTHitMatch is accessed below)
1930+
19291931
art::FindManyP<anab::T0> fmCRTHitMatch =
19301932
FindManyPStrict<anab::T0>(slcTracks, evt,
1931-
fParams.CRTHitMatchLabel() + slice_tag_suff);
1933+
fParams.CRTHitMatchLabel());
1934+
1935+
art::FindManyP<sbn::crt::CRTHitT0TaggingInfo> fmCRTHitMatchInfo =
1936+
FindManyPStrict<sbn::crt::CRTHitT0TaggingInfo>(slcTracks, evt,
1937+
fParams.CRTHitMatchInfoLabel());
19321938

19331939
// TODO: also save the sbn::crt::CRTTrack in the matching so that CAFMaker has access to it
19341940
art::FindManyP<anab::T0> fmCRTTrackMatch =
@@ -2167,14 +2173,19 @@ void CAFMaker::produce(art::Event& evt) noexcept {
21672173
fParams.TrackHitFillRRStartCut(), fParams.TrackHitFillRREndCut(),
21682174
dprop, trk);
21692175
}
2176+
21702177
if (fmCRTHitMatch.isValid() && fDet == kICARUS) {
21712178
art::FindManyP<sbn::crt::CRTHit> CRTT02Hit = FindManyPStrict<sbn::crt::CRTHit>
2172-
(fmCRTHitMatch.at(iPart), evt, fParams.CRTHitMatchLabel() + slice_tag_suff);
2179+
(fmCRTHitMatch.at(iPart), evt, fParams.CRTHitMatchLabel());
21732180

21742181
std::vector<art::Ptr<sbn::crt::CRTHit>> crthitmatch;
2175-
if (CRTT02Hit.isValid() && CRTT02Hit.size() == 1) crthitmatch = CRTT02Hit.at(0);
2176-
2177-
FillTrackCRTHit(fmCRTHitMatch.at(iPart), crthitmatch, fParams.CRTUseTS0(), CRT_T0_reference_time, CRT_T1_reference_time, trk);
2182+
std::vector<art::Ptr<sbn::crt::CRTHitT0TaggingInfo>> crthittagginginfo;
2183+
if(CRTT02Hit.isValid() && CRTT02Hit.size() == 1){
2184+
crthitmatch = CRTT02Hit.at(0);
2185+
crthittagginginfo = fmCRTHitMatchInfo.at(iPart);
2186+
}
2187+
2188+
FillTrackCRTHit(fmCRTHitMatch.at(iPart), crthitmatch, crthittagginginfo, fParams.CRTUseTS0(), CRT_T0_reference_time, CRT_T1_reference_time, trk);
21782189
}
21792190
// NOTE: SEE TODO AT fmCRTTrackMatch
21802191
if (fmCRTTrackMatch.isValid() && fDet == kICARUS) {

sbncode/CAFMaker/FillReco.cxx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,18 +546,37 @@ namespace caf
546546

547547
//......................................................................
548548

549+
549550
void FillTrackCRTHit(const std::vector<art::Ptr<anab::T0>> &t0match,
550551
const std::vector<art::Ptr<sbn::crt::CRTHit>> &hitmatch,
552+
const std::vector<art::Ptr<sbn::crt::CRTHitT0TaggingInfo>> &hitmatchinfo,
551553
bool use_ts0,
552554
int64_t CRT_T0_reference_time, // ns, signed
553555
double CRT_T1_reference_time, // us
554556
caf::SRTrack &srtrack,
555557
bool allowEmpty)
556558
{
559+
// Francesco Poppi: In the current implementation, hitmatch and hitmatchinfo are
560+
// vectors of pointers, but currently they are vector of size 1.
561+
// The reason behind the current implementation is that we only store the
562+
// best CRT candidate in the selection, eventually, we can store a vector
563+
// of "good" candidates and fill additional infos for all of them.
564+
// This is a TODO.
557565
if (t0match.size()) {
558566
assert(t0match.size() == 1);
559567
srtrack.crthit.distance = t0match[0]->fTriggerConfidence;
568+
srtrack.crthit.region = t0match[0]->fID;
569+
srtrack.crthit.sys = t0match[0]->fTriggerBits;
570+
if(hitmatchinfo.size() == 1){
571+
srtrack.crthit.deltaX = hitmatchinfo[0]->DeltaX;
572+
srtrack.crthit.deltaY = hitmatchinfo[0]->DeltaY;
573+
srtrack.crthit.deltaZ = hitmatchinfo[0]->DeltaZ;
574+
srtrack.crthit.crossX = hitmatchinfo[0]->CrossX;
575+
srtrack.crthit.crossY = hitmatchinfo[0]->CrossY;
576+
srtrack.crthit.crossZ = hitmatchinfo[0]->CrossZ;
577+
}
560578
srtrack.crthit.hit.time = t0match[0]->fTime / 1e3; /* ns -> us */
579+
srtrack.crthit.hit.plane = t0match[0]->fID;
561580
}
562581
if (hitmatch.size()) {
563582
FillCRTHit(*hitmatch[0], use_ts0, CRT_T0_reference_time, CRT_T1_reference_time, srtrack.crthit.hit, allowEmpty);

sbncode/CAFMaker/FillReco.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "sbnobj/SBND/CRT/CRTSpacePoint.hh"
4141
#include "sbnobj/SBND/CRT/CRTTrack.hh"
4242
#include "sbnobj/Common/CRT/CRTPMTMatching.hh"
43+
#include "sbnobj/Common/CRT/CRTHitT0TaggingInfo.hh"
4344
#include "nusimdata/SimulationBase/MCParticle.h"
4445
#include "nusimdata/SimulationBase/MCTruth.h"
4546

@@ -132,6 +133,7 @@ namespace caf
132133

133134
void FillTrackCRTHit(const std::vector<art::Ptr<anab::T0>> &t0match,
134135
const std::vector<art::Ptr<sbn::crt::CRTHit>> &hitmatch,
136+
const std::vector<art::Ptr<sbn::crt::CRTHitT0TaggingInfo>> &hitmatchinfo,
135137
bool use_ts0,
136138
int64_t CRT_T0_reference_time, // ns, signed
137139
double CRT_T1_reference_time, // us

0 commit comments

Comments
 (0)