Skip to content

Commit 1332c72

Browse files
committed
Merge branch 'release/v10_10_03'
2 parents 1039dbc + 2cf2d1f commit 1332c72

9 files changed

Lines changed: 284 additions & 60 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
1717

1818
find_package(cetmodules 3.20.00 REQUIRED)
19-
project(sbncode VERSION 10.10.02 LANGUAGES CXX)
19+
project(sbncode VERSION 10.10.03 LANGUAGES CXX)
2020

2121
message(STATUS "\n\n ========================== ${PROJECT_NAME} ==========================")
2222

sbncode/CAFMaker/CAFMakerParams.h

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace caf
1616
template<class T> using Atom = fhicl::Atom<T>;
1717
template<class T> using Sequence = fhicl::Sequence<T>;
1818
template<class T> using Table = fhicl::Table<T>;
19+
template<class T> using OptionalTable = fhicl::OptionalTable<T>;
1920
using Comment = fhicl::Comment;
2021
using Name = fhicl::Name;
2122
using string = std::string;
@@ -362,6 +363,12 @@ namespace caf
362363
"" //Empty by default, configured in icaruscode cafmaker_defs
363364
};
364365

366+
Atom<string> CorrectedOpFlashLabel {
367+
Name("CorrectedOpFlashLabel"),
368+
Comment("Label of CorrectedOpFlash containing tpc-corrected flash time."),
369+
""
370+
};
371+
365372
Atom<art::InputTag> NuGraphSliceHitLabel {
366373
Name("NuGraphSliceHitLabel"),
367374
Comment("Label of NuGraph slice hit map."),
@@ -470,6 +477,92 @@ namespace caf
470477
25.
471478
};
472479

480+
struct PFOCharLabels_t {
481+
Atom<string> EndFractionName {
482+
Name("EndFractionName"),
483+
Comment("Provide the tool name for the EndFraction BDT variable."),
484+
"LArThreeDChargeFeatureTool_EndFraction"
485+
};
486+
487+
Atom<string> FractionalSpreadName {
488+
Name("FractionalSpreadName"),
489+
Comment("Provide the tool name for the FractionalSpread BDT variable."),
490+
"LArThreeDChargeFeatureTool_FractionalSpread"
491+
};
492+
493+
Atom<string> DiffStraightLineMeanName {
494+
Name("DiffStraightLineMeanName"),
495+
Comment("Provide the tool name for the DiffStraightLineMean BDT variable."),
496+
"LArThreeDLinearFitFeatureTool_DiffStraightLineMean"
497+
};
498+
499+
Atom<string> LengthName {
500+
Name("LengthName"),
501+
Comment("Provide the tool name for the Length BDT variable."),
502+
"LArThreeDLinearFitFeatureTool_Length"
503+
};
504+
505+
Atom<string> MaxFitGapLengthName {
506+
Name("MaxFitGapLengthName"),
507+
Comment("Provide the tool name for the MaxFitGapLength BDT variable."),
508+
"LArThreeDLinearFitFeatureTool_MaxFitGapLength"
509+
};
510+
511+
Atom<string> SlidingLinearFitRMSName {
512+
Name("SlidingLinearFitRMSName"),
513+
Comment("Provide the tool name for the SlidingLinearFitRMS BDT variable."),
514+
"LArThreeDLinearFitFeatureTool_SlidingLinearFitRMS"
515+
};
516+
517+
Atom<string> AngleDiffName {
518+
Name("AngleDiffName"),
519+
Comment("Provide the tool name for the AngleDiff BDT variable."),
520+
"LArThreeDOpeningAngleFeatureTool_AngleDiff"
521+
};
522+
523+
Atom<string> SecondaryPCARatioName {
524+
Name("SecondaryPCARatioName"),
525+
Comment("Provide the tool name for the SecondaryPCARatio BDT variable."),
526+
"LArThreeDPCAFeatureTool_SecondaryPCARatio"
527+
};
528+
529+
Atom<string> TertiaryPCARatioName {
530+
Name("TertiaryPCARatioName"),
531+
Comment("Provide the tool name for the TertiaryPCARatio BDT variable."),
532+
"LArThreeDPCAFeatureTool_TertiaryPCARatio"
533+
};
534+
535+
Atom<string> VertexDistanceName {
536+
Name("VertexDistanceName"),
537+
Comment("Provide the tool name for the VertexDistance BDT variable."),
538+
"LArThreeDVertexDistanceFeatureTool_VertexDistance"
539+
};
540+
541+
Atom<string> HaloTotalRatioName {
542+
Name("HaloTotalRatioName"),
543+
Comment("Provide the tool name for the HaloTotalRatio BDT variable."),
544+
"LArConeChargeFeatureTool_HaloTotalRatio"
545+
};
546+
547+
Atom<string> ConcentrationName {
548+
Name("ConcentrationName"),
549+
Comment("Provide the tool name for the Concentration BDT variable."),
550+
"LArConeChargeFeatureTool_Concentration"
551+
552+
};
553+
554+
Atom<string> ConicalnessName {
555+
Name("ConicalnessName"),
556+
Comment("Provide the tool name for the Conicalness BDT variable."),
557+
"LArConeChargeFeatureTool_Conicalness"
558+
};
559+
};
560+
561+
OptionalTable<PFOCharLabels_t> PFOCharLabels {
562+
Name("PFOCharLabels"),
563+
Comment("Provide tool names for the Pandora track/shower discrimination BDT variables.")
564+
};
565+
473566
Atom<bool> ReferencePMTFromTriggerToBeam {
474567
Name("ReferencePMTFromTriggerToBeam"),
475568
Comment("Whether to switch the reference time of PMT reco from 'trigger' to 'beam spill' time."),

sbncode/CAFMaker/CAFMaker_module.cc

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,11 @@
118118
#include "sbnobj/Common/Trigger/ExtraTriggerInfo.h"
119119
#include "sbnobj/Common/Reco/CRUMBSResult.h"
120120
#include "sbnobj/Common/Reco/OpT0FinderResult.h"
121+
#include "sbnobj/Common/Reco/CorrectedOpFlashTiming.h"
121122
#include "sbnobj/SBND/Timing/TimingInfo.hh"
122123
#include "sbnobj/SBND/Timing/FrameShiftInfo.hh"
123124

125+
124126
// GENIE
125127
#include "Framework/EventGen/EventRecord.h"
126128
#include "Framework/Ntuple/NtpMCEventRecord.h"
@@ -1899,6 +1901,15 @@ void CAFMaker::produce(art::Event& evt) noexcept {
18991901
const sbn::TPCPMTBarycenterMatch *barycenterMatch
19001902
= foTPCPMTBarycenterMatch.isValid()? foTPCPMTBarycenterMatch.at(0).get(): nullptr;
19011903

1904+
1905+
art::FindManyP<sbn::CorrectedOpFlashTiming> fmCorrectedOpFlash =
1906+
FindManyPStrict<sbn::CorrectedOpFlashTiming>(sliceList, evt,
1907+
fParams.CorrectedOpFlashLabel() + slice_tag_suff);
1908+
std::vector<art::Ptr<sbn::CorrectedOpFlashTiming>> slcCorrectedOpFlash;
1909+
if (fmCorrectedOpFlash.isValid())
1910+
slcCorrectedOpFlash = fmCorrectedOpFlash.at(0);
1911+
1912+
19021913
art::FindOneP<lcvn::Result> foCVNResult =
19031914
FindOnePStrict<lcvn::Result>(sliceList, evt,
19041915
fParams.CVNLabel() + slice_tag_suff);
@@ -2154,6 +2165,7 @@ void CAFMaker::produce(art::Event& evt) noexcept {
21542165
FillSliceOpT0Finder(slcOpT0, recslc);
21552166
FillSliceBarycenter(slcHits, slcSpacePoints, recslc);
21562167
FillTPCPMTBarycenterMatch(barycenterMatch, recslc);
2168+
FillCorrectedOpFlashTiming(slcCorrectedOpFlash, recslc);
21572169
FillCVNScores(cvnResult, recslc);
21582170

21592171
// select slice
@@ -2253,7 +2265,24 @@ void CAFMaker::produce(art::Event& evt) noexcept {
22532265
}
22542266

22552267
const larpandoraobj::PFParticleMetadata *pfpMeta = (fmPFPMeta.at(iPart).empty()) ? NULL : fmPFPMeta.at(iPart).at(0).get();
2256-
FillPFPVars(thisParticle, primary, pfpMeta, thisPFPT0, pfp);
2268+
caf::CAFMakerParams::PFOCharLabels_t const& pfoCharParams
2269+
= fParams.PFOCharLabels().value_or(caf::CAFMakerParams::PFOCharLabels_t{});
2270+
const caf::PFOCharLabelsStruct pfoCharLabels {
2271+
pfoCharParams.EndFractionName(),
2272+
pfoCharParams.FractionalSpreadName(),
2273+
pfoCharParams.DiffStraightLineMeanName(),
2274+
pfoCharParams.LengthName(),
2275+
pfoCharParams.MaxFitGapLengthName(),
2276+
pfoCharParams.SlidingLinearFitRMSName(),
2277+
pfoCharParams.AngleDiffName(),
2278+
pfoCharParams.SecondaryPCARatioName(),
2279+
pfoCharParams.TertiaryPCARatioName(),
2280+
pfoCharParams.VertexDistanceName(),
2281+
pfoCharParams.HaloTotalRatioName(),
2282+
pfoCharParams.ConcentrationName(),
2283+
pfoCharParams.ConicalnessName()
2284+
};
2285+
FillPFPVars(thisParticle, primary, pfpMeta, thisPFPT0, pfp, pfoCharLabels);
22572286

22582287
if (fmCNNScores.isValid()) {
22592288
const sbn::PFPCNNScore *cnnScores = fmCNNScores.at(iPart).at(0).get();
@@ -2526,6 +2555,7 @@ void CAFMaker::produce(art::Event& evt) noexcept {
25262555
rec.hdr.ismc = !isRealData;
25272556
rec.hdr.det = fDet;
25282557
rec.hdr.fno = fFileNumber;
2558+
25292559
if(fFirstInSubRun)
25302560
{
25312561
rec.hdr.nbnbinfo = fBNBInfo.size();
@@ -2566,13 +2596,13 @@ void CAFMaker::produce(art::Event& evt) noexcept {
25662596
else {
25672597
std::cout << "Did not find this event in the spill info map." << std::endl;
25682598
}
2569-
2599+
25702600
if(fRecTree){
25712601
// Save the standard-record
25722602
StandardRecord* prec = &rec;
2603+
25732604
fRecTree->SetBranchAddress("rec", &prec);
25742605
fRecTree->Fill();
2575-
25762606
if(fFlatTree){
25772607
fFlatRecord->Clear();
25782608
fFlatRecord->Fill(rec);

sbncode/CAFMaker/FillReco.cxx

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,24 @@ namespace caf
295295
}
296296
}
297297

298+
299+
void FillCorrectedOpFlashTiming(const std::vector<art::Ptr<sbn::CorrectedOpFlashTiming>> &slcCorrectedOpFlash,
300+
caf::SRSlice& slice)
301+
{
302+
slice.correctedOpFlash.setDefault();
303+
if ( slcCorrectedOpFlash.empty()==false ) {
304+
const sbn::CorrectedOpFlashTiming &_correctedOpFlash = *slcCorrectedOpFlash[0];
305+
//TODO: use the score of the match to fill the information accordingly
306+
slice.correctedOpFlash.OpFlashT0 = _correctedOpFlash.OpFlashT0;
307+
slice.correctedOpFlash.UpstreamTime_lightonly = _correctedOpFlash.UpstreamTime_lightonly;
308+
slice.correctedOpFlash.UpstreamTime_tpczcorr = _correctedOpFlash.UpstreamTime_tpczcorr;
309+
slice.correctedOpFlash.UpstreamTime_propcorr_tpczcorr = _correctedOpFlash.UpstreamTime_propcorr_tpczcorr;
310+
slice.correctedOpFlash.FMScore = _correctedOpFlash.FMScore;
311+
slice.correctedOpFlash.SliceNuScore = _correctedOpFlash.SliceNuScore;
312+
}
313+
}
314+
315+
298316
std::vector<float> double_to_float_vector(const std::vector<double>& v)
299317
{
300318
std::vector<float> ret;
@@ -1005,6 +1023,7 @@ namespace caf
10051023
const larpandoraobj::PFParticleMetadata *pfpMeta,
10061024
const art::Ptr<anab::T0> t0,
10071025
caf::SRPFP& srpfp,
1026+
const PFOCharLabelsStruct& pfoCharLabels,
10081027
bool allowEmpty)
10091028
{
10101029
srpfp.id = particle.Self();
@@ -1028,19 +1047,19 @@ namespace caf
10281047
// Pfo Characterisation features
10291048
srpfp.pfochar.setDefault();
10301049

1031-
CopyPropertyIfSet(propertiesMap, "LArThreeDChargeFeatureTool_EndFraction", srpfp.pfochar.chgendfrac);
1032-
CopyPropertyIfSet(propertiesMap, "LArThreeDChargeFeatureTool_FractionalSpread", srpfp.pfochar.chgfracspread);
1033-
CopyPropertyIfSet(propertiesMap, "LArThreeDLinearFitFeatureTool_DiffStraightLineMean", srpfp.pfochar.linfitdiff);
1034-
CopyPropertyIfSet(propertiesMap, "LArThreeDLinearFitFeatureTool_Length", srpfp.pfochar.linfitlen);
1035-
CopyPropertyIfSet(propertiesMap, "LArThreeDLinearFitFeatureTool_MaxFitGapLength", srpfp.pfochar.linfitgaplen);
1036-
CopyPropertyIfSet(propertiesMap, "LArThreeDLinearFitFeatureTool_SlidingLinearFitRMS", srpfp.pfochar.linfitrms);
1037-
CopyPropertyIfSet(propertiesMap, "LArThreeDOpeningAngleFeatureTool_AngleDiff", srpfp.pfochar.openanglediff);
1038-
CopyPropertyIfSet(propertiesMap, "LArThreeDPCAFeatureTool_SecondaryPCARatio", srpfp.pfochar.pca2ratio);
1039-
CopyPropertyIfSet(propertiesMap, "LArThreeDPCAFeatureTool_TertiaryPCARatio", srpfp.pfochar.pca3ratio);
1040-
CopyPropertyIfSet(propertiesMap, "LArThreeDVertexDistanceFeatureTool_VertexDistance", srpfp.pfochar.vtxdist);
1041-
CopyPropertyIfSet(propertiesMap, "LArConeChargeFeatureTool_HaloTotalRatio", srpfp.pfochar.halototratio);
1042-
CopyPropertyIfSet(propertiesMap, "LArConeChargeFeatureTool_Concentration", srpfp.pfochar.concentration);
1043-
CopyPropertyIfSet(propertiesMap, "LArConeChargeFeatureTool_Conicalness", srpfp.pfochar.conicalness);
1050+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.EndFractionName, srpfp.pfochar.chgendfrac);
1051+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.FractionalSpreadName, srpfp.pfochar.chgfracspread);
1052+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.DiffStraightLineMeanName, srpfp.pfochar.linfitdiff);
1053+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.LengthName, srpfp.pfochar.linfitlen);
1054+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.MaxFitGapLengthName, srpfp.pfochar.linfitgaplen);
1055+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.SlidingLinearFitRMSName, srpfp.pfochar.linfitrms);
1056+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.AngleDiffName, srpfp.pfochar.openanglediff);
1057+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.SecondaryPCARatioName, srpfp.pfochar.pca2ratio);
1058+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.TertiaryPCARatioName, srpfp.pfochar.pca3ratio);
1059+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.VertexDistanceName, srpfp.pfochar.vtxdist);
1060+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.HaloTotalRatioName, srpfp.pfochar.halototratio);
1061+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.ConcentrationName, srpfp.pfochar.concentration);
1062+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.ConicalnessName, srpfp.pfochar.conicalness);
10441063
}
10451064
if (t0) {
10461065
srpfp.t0 = t0->Time() / 1e3; /* ns -> us */
@@ -1163,6 +1182,8 @@ namespace caf
11631182
slice.barycenterFM.deltaZ_Trigger = matchInfo->deltaZ_Trigger;
11641183
slice.barycenterFM.deltaY_Trigger = matchInfo->deltaY_Trigger;
11651184
slice.barycenterFM.radius_Trigger = matchInfo->radius_Trigger;
1185+
slice.barycenterFM.score = matchInfo->score;
1186+
slice.barycenterFM.chi2 = matchInfo->chi2;
11661187
}
11671188
}
11681189

sbncode/CAFMaker/FillReco.h

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "sbnobj/Common/Reco/CRUMBSResult.h"
3737
#include "sbnobj/Common/Reco/OpT0FinderResult.h"
3838
#include "sbnobj/Common/Reco/TPCPMTBarycenterMatch.h"
39+
#include "sbnobj/Common/Reco/CorrectedOpFlashTiming.h"
3940
#include "sbnobj/Common/CRT/CRTHit.hh"
4041
#include "sbnobj/Common/CRT/CRTTrack.hh"
4142
#include "sbnobj/SBND/CRT/CRTSpacePoint.hh"
@@ -140,12 +141,29 @@ namespace caf
140141
caf::SRHit& srhit,
141142
bool allowEmpty = false);
142143

144+
struct PFOCharLabelsStruct {
145+
std::string EndFractionName;
146+
std::string FractionalSpreadName;
147+
std::string DiffStraightLineMeanName;
148+
std::string LengthName;
149+
std::string MaxFitGapLengthName;
150+
std::string SlidingLinearFitRMSName;
151+
std::string AngleDiffName;
152+
std::string SecondaryPCARatioName;
153+
std::string TertiaryPCARatioName;
154+
std::string VertexDistanceName;
155+
std::string HaloTotalRatioName;
156+
std::string ConcentrationName;
157+
std::string ConicalnessName;
158+
};
159+
143160
void FillPFPVars(const recob::PFParticle &particle,
144161
const recob::PFParticle *primary,
145162
const larpandoraobj::PFParticleMetadata *pfpMeta,
146163
const art::Ptr<anab::T0> t0,
147164
caf::SRPFP& srpfp,
148-
bool allowEmpty= false);
165+
const PFOCharLabelsStruct& pfoCharLabels,
166+
bool allowEmpty = false);
149167

150168
void FillCNNScores(const recob::PFParticle &particle,
151169
const sbn::PFPCNNScore *cnnscore,
@@ -277,6 +295,9 @@ namespace caf
277295
void FillTPCPMTBarycenterMatch(const sbn::TPCPMTBarycenterMatch *matchInfo,
278296
caf::SRSlice& slice);
279297

298+
void FillCorrectedOpFlashTiming(const std::vector<art::Ptr<sbn::CorrectedOpFlashTiming>> &slcCorrectedOpFlash,
299+
caf::SRSlice& slice);
300+
280301
void FillCVNScores(const lcvn::Result *cvnResult,
281302
caf::SRSlice& slice);
282303

sbncode/Calibration/TrackCaloSkimmer.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
#include "sbnobj/Common/Calibration/TrackCaloSkimmerObj.h"
6464
#include "sbnobj/Common/CRT/CRTHitT0TaggingInfo.hh"
6565
#include "sbnobj/Common/CRT/CRTHitT0TaggingTruthInfo.hh"
66+
#include "sbnobj/SBND/CRT/CRTTrack.hh"
67+
#include "sbnobj/SBND/CRT/CRTSpacePoint.hh"
6668

6769
#include "ITCSSelectionTool.h"
6870

@@ -98,9 +100,12 @@ class sbn::TrackCaloSkimmer : public art::EDAnalyzer {
98100
double t0Pandora;
99101
double t0CRTTrack;
100102
double t0CRTHit;
103+
double t0CRTSpacePoint;
101104
bool hasT0Pandora;
102105
bool hasT0CRTTrack;
103106
bool hasT0CRTHit;
107+
bool hasT0CRTSpacePoint;
108+
double crtMatchingScore;
104109
};
105110

106111
// Internal data struct
@@ -178,7 +183,8 @@ class sbn::TrackCaloSkimmer : public art::EDAnalyzer {
178183
const geo::WireReadoutGeom *wireReadout,
179184
const detinfo::DetectorClocksData &dclock,
180185
const cheat::BackTrackerService *bt_serv,
181-
const detinfo::DetectorPropertiesData &dprop);
186+
const detinfo::DetectorPropertiesData &dprop,
187+
const float &xshift);
182188
void FillTrackCRTHitInfo(const std::vector<art::Ptr<sbn::crt::CRTHitT0TaggingInfo>> &tag);
183189

184190
// helpers
@@ -192,6 +198,7 @@ class sbn::TrackCaloSkimmer : public art::EDAnalyzer {
192198
art::InputTag fPFPT0producer;
193199
art::InputTag fCRTTrackT0producer;
194200
art::InputTag fCRTHitT0producer;
201+
art::InputTag fCRTSpacePointT0producer;
195202
art::InputTag fCALOproducer;
196203
art::InputTag fTRKproducer;
197204
art::InputTag fTRKHMproducer;
@@ -216,6 +223,7 @@ class sbn::TrackCaloSkimmer : public art::EDAnalyzer {
216223
double fTopCRTDistanceCutPassing;
217224
double fSideCRTDistanceCutStopping;
218225
double fSideCRTDistanceCutPassing;
226+
bool fAllowShowerLikePFPs;
219227

220228
// tools
221229
std::vector<std::unique_ptr<sbn::ITCSSelectionTool>> fSelectionTools;

0 commit comments

Comments
 (0)