-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathFillReco.h
More file actions
337 lines (280 loc) · 14.6 KB
/
FillReco.h
File metadata and controls
337 lines (280 loc) · 14.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
#ifndef CAF_FILLRECO_H
#define CAF_FILLRECO_H
#include <array>
#include "art/Framework/Services/Registry/ServiceHandle.h"
#include "larsim/MCCheater/ParticleInventoryService.h"
#include "lardataalg/DetectorInfo/DetectorPropertiesStandard.h"
// LArSoft includes
#include "larcorealg/Geometry/fwd.h"
#include "lardataobj/RecoBase/PFParticle.h"
#include "lardataobj/RecoBase/Shower.h"
#include "lardataobj/RecoBase/Slice.h"
#include "lardataobj/RecoBase/Track.h"
#include "lardataobj/RecoBase/Vertex.h"
#include "lardataobj/RecoBase/Hit.h"
#include "lardataobj/RecoBase/SpacePoint.h"
#include "lardataobj/RecoBase/OpFlash.h"
#include "lardataobj/RecoBase/OpHit.h"
#include "lardataobj/AnalysisBase/Calorimetry.h"
#include "lardataobj/AnalysisBase/MVAOutput.h"
#include "lardataobj/AnalysisBase/ParticleID.h"
#include "lardataobj/AnalysisBase/T0.h"
#include "lardataobj/RecoBase/PFParticleMetadata.h"
#include "lardataobj/RecoBase/MCSFitResult.h"
#include "lardataobj/Simulation/AuxDetSimChannel.h"
#include "larrecodnn/CVN/func/Result.h"
#include "sbnobj/Common/Reco/Stub.h"
#include "sbnobj/Common/Reco/RangeP.h"
#include "sbnobj/Common/Reco/ShowerSelectionVars.h"
#include "sbnobj/Common/Reco/MVAPID.h"
#include "sbnobj/Common/Reco/CNNScore.h"
#include "sbnobj/Common/Reco/ScatterClosestApproach.h"
#include "sbnobj/Common/Reco/StoppingChi2Fit.h"
#include "sbnobj/Common/Reco/CRUMBSResult.h"
#include "sbnobj/Common/Reco/OpT0FinderResult.h"
#include "sbnobj/Common/Reco/TPCPMTBarycenterMatch.h"
#include "sbnobj/Common/Reco/CorrectedOpFlashTiming.h"
#include "sbnobj/Common/CRT/CRTHit.hh"
#include "sbnobj/Common/CRT/CRTTrack.hh"
#include "sbnobj/SBND/CRT/CRTSpacePoint.hh"
#include "sbnobj/SBND/CRT/CRTCluster.hh"
#include "sbnobj/SBND/CRT/CRTTrack.hh"
#include "sbnobj/SBND/CRT/CRTVeto.hh"
#include "sbnobj/Common/CRT/CRTPMTMatching.hh"
#include "sbnobj/Common/CRT/CRTHitT0TaggingInfo.hh"
#include "sbnobj/Common/PMT/Data/PMTBeamSignal.hh"
#include "sbnobj/SBND/Timing/TimingInfo.hh"
#include "sbnobj/SBND/Timing/FrameShiftInfo.hh"
#include "nusimdata/SimulationBase/MCParticle.h"
#include "nusimdata/SimulationBase/MCTruth.h"
#include "sbnanaobj/StandardRecord/SRSlice.h"
#include "sbnanaobj/StandardRecord/StandardRecord.h"
namespace caf
{
void FillStubVars(const sbn::Stub &stub,
const art::Ptr<recob::PFParticle> stubpfp,
caf::SRStub &srstub,
bool allowEmpty = false);
void FillShowerVars(const recob::Shower& shower,
const recob::Vertex* vertex,
const std::vector<art::Ptr<recob::Hit>> &hits,
const geo::WireReadoutGeom& wireReadout,
unsigned producer,
caf::SRShower& srshower,
Det_t det,
bool allowEmpty = false);
void FillShowerRazzle(const art::Ptr<sbn::MVAPID> razzle,
caf::SRShower& srshower,
bool allowEmpty = false);
void FillShowerCosmicDist(const std::vector<art::Ptr<float> >& cosmicDistVec,
caf::SRShower& srshower);
void FillShowerResiduals(const std::vector<art::Ptr<float> >& residuals,
caf::SRShower& srshower);
void FillShowerTrackFit(const sbn::ShowerTrackFit& trackFit,
caf::SRShower& srshower);
void FillShowerDensityFit(const sbn::ShowerDensityFit& densityFit,
caf::SRShower& srshower);
void FillSliceVars(const recob::Slice& slice,
const recob::PFParticle *primary,
unsigned producer,
caf::SRSlice& srslice,
bool allowEmpty = false);
void FillSliceMetadata(const larpandoraobj::PFParticleMetadata *primary_meta,
caf::SRSlice &srslice,
bool allowEmpty = false);
void FillSliceVertex(const recob::Vertex *vertex,
caf::SRSlice& slice,
bool allowEmpty = false);
void FillSliceCRUMBS(const sbn::CRUMBSResult *crumbs,
caf::SRSlice& slice,
bool allowEmpty = false);
void FillSliceOpT0Finder(const std::vector<art::Ptr<sbn::OpT0Finder>> &opt0_v,
caf::SRSlice &slice);
void FillSliceBarycenter(const std::vector<art::Ptr<recob::Hit>> &inputHits,
const std::vector<art::Ptr<recob::SpacePoint>> &inputPoints,
caf::SRSlice &slice);
/**
* @brief Fills the results from NuGraph at slice level
* @param inputHits (pointers to) the hits associated to the slice
* @param sliceHitsMap maps position of hits in collection input to NuGraph (slice only) to the one input to Pandora (all gaus hits)
* @param ngFilterResult NuGraph filter result, for each hit
* @param ngSemanticResult NuGraph semnatic result, for each hit (MIP track, HIP, shower, Michel electron, diffuse activity)
* @param[out] slice the destination slice object
*
* Hits with filter value (`ngFilterResult`) lower than `ng_filter_cut` are counted as background.
*/
void FillSliceNuGraph(const std::vector<art::Ptr<recob::Hit>> &inputHits,
const std::vector<unsigned int> &sliceHitsMap,
const std::vector<art::Ptr<anab::FeatureVector<1>>> &ngFilterResult,
const std::vector<art::Ptr<anab::FeatureVector<5>>> &ngSemanticResult,
caf::SRSlice &slice);
bool SelectSlice(const caf::SRSlice &slice, bool cut_clear_cosmic);
void FillTrackVars(const recob::Track& track,
unsigned producer,
caf::SRTrack& srtrk,
bool allowEmpty = false);
void FillHitVars(const recob::Hit& hit,
unsigned producer,
const recob::SpacePoint& spacepoint,
const recob::PFParticle& particle,
caf::SRHit& srhit,
bool allowEmpty = false);
struct PFOCharLabelsStruct {
std::string EndFractionName;
std::string FractionalSpreadName;
std::string DiffStraightLineMeanName;
std::string LengthName;
std::string MaxFitGapLengthName;
std::string SlidingLinearFitRMSName;
std::string AngleDiffName;
std::string SecondaryPCARatioName;
std::string TertiaryPCARatioName;
std::string VertexDistanceName;
std::string HaloTotalRatioName;
std::string ConcentrationName;
std::string ConicalnessName;
};
void FillPFPVars(const recob::PFParticle &particle,
const recob::PFParticle *primary,
const larpandoraobj::PFParticleMetadata *pfpMeta,
const art::Ptr<anab::T0> t0,
caf::SRPFP& srpfp,
const PFOCharLabelsStruct& pfoCharLabels,
bool allowEmpty = false);
void FillCNNScores(const recob::PFParticle &particle,
const sbn::PFPCNNScore *cnnscore,
caf::SRPFP& srpfp,
bool allowEmpty = false);
/**
* @brief Fills the results from NuGraph at slice level
* @param sliceHitsMap maps position of hits in collection input to NuGraph (slice only) to the one input to Pandora (all gaus hits)
* @param ngFilterResult NuGraph filter result, for each hit
* @param ngSemanticResult NuGraph semnatic result, for each hit (MIP track, HIP, shower, Michel electron, diffuse activity)
* @param pfpHits Vector of hits associated to the PFParticle
* @param[out] srpfp the destination PFParticle object
*
* Hits with filter value (`ngFilterResult`) lower than `ng_filter_cut` are counted as background.
*/
void FillPFPNuGraph(const std::vector<unsigned int> &sliceHitsMap,
const std::vector<art::Ptr<anab::FeatureVector<1>>> &ngFilterResult,
const std::vector<art::Ptr<anab::FeatureVector<5>>> &ngSemanticResult,
const std::vector<art::Ptr<recob::Hit>> &pfpHits,
caf::SRPFP& srpfp,
bool allowEmpty= false);
void FillTrackCRTHit(const std::vector<art::Ptr<anab::T0>> &t0match,
const std::vector<art::Ptr<sbn::crt::CRTHit>> &hitmatch,
const std::vector<art::Ptr<sbn::crt::CRTHitT0TaggingInfo>> &hitmatchinfo,
bool use_ts0,
int64_t CRT_T0_reference_time, // ns, signed
double CRT_T1_reference_time, // us
const std::map<std::pair<int, int>, sim::AuxDetSimChannel> &crtsimchanmap,
caf::SRTrack &srtrack,
bool allowEmpty = false);
void FillTrackCRTTrack(const std::vector<art::Ptr<anab::T0>> &t0match,
caf::SRTrack &srtrack,
bool allowEmpty = false);
void FillTrackCRTSpacePoint(const anab::T0 &t0match,
const art::Ptr<sbnd::crt::CRTSpacePoint> &spacepointmatch,
const art::Ptr<sbnd::crt::CRTCluster> &cluster,
caf::SRTrack &srtrack,
bool allowEmpty = false);
void FillTrackSBNDCRTTrack(const anab::T0 &t0match,
const art::Ptr<sbnd::crt::CRTTrack> &trackmatch,
caf::SRTrack &srtrack,
bool allowEmpty = false);
void FillTrackMCS(const recob::Track& track,
const std::array<std::vector<art::Ptr<recob::MCSFitResult>>, 4> &mcs_results,
caf::SRTrack& srtrack,
bool allowEmpty = false);
void FillTrackRangeP(const recob::Track& track,
const std::array<std::vector<art::Ptr<sbn::RangeP>>, 3> &range_results,
caf::SRTrack& srtrack,
bool allowEmpty = false);
void FillPlaneChi2PID(const anab::ParticleID &particle_id, caf::SRTrkChi2PID &srpid);
void FillTrackChi2PID(const std::vector<art::Ptr<anab::ParticleID>> particleIDs,
caf::SRTrack& srtrack,
bool allowEmpty = false);
void FillPlaneLikePID(const anab::ParticleID &particle_id, caf::SRTrkLikelihoodPID &srlikepid);
void FillTrackLikePID(const std::vector<art::Ptr<anab::ParticleID>>& particleIDs,
caf::SRTrack& srtrack,
bool allowEmpty = false);
void FillTrackPlaneCalo(const anab::Calorimetry &calo,
const std::vector<art::Ptr<recob::Hit>> &hits,
bool fill_calo_points, float fillhit_rrstart, float fillhit_rrend,
const detinfo::DetectorPropertiesData &dprop,
caf::SRTrackCalo &srcalo);
void FillTrackScatterClosestApproach(const art::Ptr<sbn::ScatterClosestApproach> closestapproach,
caf::SRTrack& srtrack,
bool allowEmpty = false);
void FillTrackStoppingChi2Fit(const art::Ptr<sbn::StoppingChi2Fit> stoppingChi2,
caf::SRTrack& srtrack,
bool allowEmpty = false);
void FillTrackDazzle(const art::Ptr<sbn::MVAPID> dazzle,
caf::SRTrack& srtrack,
bool allowEmpty = false);
void FillTrackCalo(const std::vector<art::Ptr<anab::Calorimetry>> &calos,
const std::vector<art::Ptr<recob::Hit>> &hits,
bool fill_calo_points, float fillhit_rrstart, float fillhit_rrend,
const detinfo::DetectorPropertiesData &dprop,
caf::SRTrack& srtrack,
bool allowEmpty = false);
void SetNuMuCCPrimary(std::vector<caf::StandardRecord> &recs,
std::vector<caf::SRTrueInteraction> &srneutrinos);
void ApplyNumuCCMatching(std::vector<caf::StandardRecord> &recs,
const std::vector<caf::SRTrueInteraction> &srneutrinos,
unsigned truth_ind);
void FillCRTHit(const sbn::crt::CRTHit &hit,
bool use_ts0,
int64_t CRT_T0_reference_time, // ns, signed
double CRT_T1_reference_time, // us
const std::map<std::pair<int, int>, sim::AuxDetSimChannel> &crtsimchanmap,
caf::SRCRTHit &srhit,
bool allowEmpty = false);
void FillCRTTrack(const sbn::crt::CRTTrack &track,
bool use_ts0,
caf::SRCRTTrack &srtrack,
bool allowEmpty = false);
void FillCRTSpacePoint(const sbnd::crt::CRTSpacePoint &spacepoint,
const art::Ptr<sbnd::crt::CRTCluster> &cluster,
caf::SRCRTSpacePoint &srspacepoint,
bool allowEmpty = false);
void FillSBNDCRTTrack(const sbnd::crt::CRTTrack &track,
caf::SRSBNDCRTTrack &srsbndcrttrack,
bool allowEmpty = false);
void FillSBNDCRTVeto(const sbnd::crt::CRTVeto &veto,
const std::vector<art::Ptr<sbnd::crt::CRTSpacePoint>> &points,
caf::SRSBNDCRTVeto &srsbndcrtveto,
bool allowEmpty = false);
void FillICARUSOpFlash(const recob::OpFlash &flash,
std::vector<recob::OpHit const*> const& hits,
int cryo,
std::vector<sbn::timing::PMTBeamSignal> RWMTimes,
caf::SROpFlash &srflash,
bool allowEmpty = false);
void FillSBNDOpFlash(const recob::OpFlash &flash,
std::vector<recob::OpHit const*> const& hits,
int tpc,
caf::SROpFlash &srflash,
bool allowEmpty = false);
void FillCRTPMTMatch(const sbn::crt::CRTPMTMatching &match,
caf::SRCRTPMTMatch &srmatch,
bool allowEmpty = false);
void FillTPCPMTBarycenterMatch(const sbn::TPCPMTBarycenterMatch *matchInfo,
caf::SRSlice& slice);
void FillCorrectedOpFlashTiming(const std::vector<art::Ptr<sbn::CorrectedOpFlashTiming>> &slcCorrectedOpFlash,
caf::SRSlice& slice);
void FillCVNScores(const lcvn::Result *cvnResult,
caf::SRSlice& slice);
void FillPFPRazzled(const art::Ptr<sbn::MVAPID> razzled,
caf::SRPFP& srpfp,
bool allowEmpty = false);
void FillSBNDFrameShiftInfo(const sbnd::timing::FrameShiftInfo &frame,
caf::SRSBNDFrameShiftInfo &srsbndframe,
bool allowEmpty = false);
void FillSBNDTimingInfo(const sbnd::timing::TimingInfo &timing,
caf::SRSBNDTimingInfo &srsbndtiming,
bool allowEmpty = false);
template<class T, class U>
void CopyPropertyIfSet( const std::map<std::string, T>& props, const std::string& search, U& value );
}
#endif