All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SetEvent.cc
Go to the documentation of this file.
1 #include "SetEvent.h"
2 #include "../NumuReco/PrimaryTrack.h"
3 #include "../NumuReco/TruthMatch.h"
4 
5 void ana::SBNOsc::SetEvent(numu::RecoEvent &event, const event::Event &core, const ana::SBNOsc::Cuts &cuts, numu::MCType file_type, bool use_calorimetry) {
6  // update each reco Interaction to a smarter primary track selector
7  unsigned i = 0;
8  while (i < event.reco.size()) {
9  for (size_t particle_ind: event.reco[i].slice.tracks) {
10  numu::RecoTrack &track = event.tracks.at(particle_ind);
11 
12  // set containment
13  if (cuts.InCalorimetricContainment(track.start) && cuts.InCalorimetricContainment(track.end)) {
14  track.is_contained = true;
15  }
16  else {
17  track.is_contained = false;
18  }
19  }
20 
21  int primary_track;
22  if (use_calorimetry) {
23  primary_track = numu::SelectLongestIDdMuon(event.tracks, event.reco[i].slice);
24  }
25  else {
26  primary_track = numu::SelectLongestTrack(event.tracks, event.reco[i].slice);
27  }
28 
29  // remove vertices without a good primary track
30  if (primary_track < 0) {
31  event.reco.erase(event.reco.begin() + i);
32  continue;
33  }
34 
35  event.reco[i].slice.primary_track_index = primary_track;
36 
37  // re-do truth matching
38  event.reco[i].match = numu::InteractionTruthMatch(core.truth, event.tracks, event.reco[i]);
39 
40  // if this is an in-time cosmic file, update the cosmic mode
41  if (file_type == numu::fIntimeCosmic) {
42  assert(event.reco[i].match.mode == numu::mCosmic || event.reco[i].match.mode == numu::mOther);
43  event.reco[i].match.mode = numu::mIntimeCosmic;
44  }
45 
46  i += 1;
47  }
48  // make sure no two vertices match to the same true neutrino interaction
49  numu::CorrectMultiMatches(event, event.reco);
50 
51  // re-do the truth matching one more time with the multi-matches fixed
52  for (unsigned i = 0; i < event.reco.size(); i++) {
53  event.reco[i].match = numu::InteractionTruthMatch(core.truth, event.tracks, event.reco[i]);
54  }
55 }
56 
bool is_contained
is it contained in the &quot;containment volume&quot;?
Definition: RecoTrack.h:52
process_name use argoneut_mc_hitfinder track
void CorrectMultiMatches(RecoEvent &event, std::vector< RecoInteraction > &recos)
Definition: TruthMatch.cc:110
std::vector< RecoInteraction > reco
List of reconstructed vertices.
Definition: RecoEvent.h:50
std::map< size_t, RecoTrack > tracks
Map of track indices to Track information.
Definition: RecoEvent.h:48
TVector3 start
start position of track
Definition: RecoTrack.h:54
TruthMatch InteractionTruthMatch(const std::vector< event::Interaction > &truth, const std::map< size_t, numu::RecoTrack > &reco_tracks, const numu::RecoInteraction &reco)
Definition: TruthMatch.cc:10
The standard event data definition.
Definition: Event.hh:228
int SelectLongestIDdMuon(const std::map< size_t, RecoTrack > &tracks, const RecoSlice &slice)
Definition: PrimaryTrack.cc:22
int SelectLongestTrack(const std::map< size_t, RecoTrack > &tracks, const RecoSlice &slice)
Definition: PrimaryTrack.cc:3
TVector3 end
end position of track
Definition: RecoTrack.h:55
void SetEvent(numu::RecoEvent &event, const event::Event &core, const ana::SBNOsc::Cuts &cuts, numu::MCType file_type, bool use_calorimetry=true)
Definition: SetEvent.cc:5
MCType
Definition: MCType.h:5
bool InCalorimetricContainment(const TVector3 &v) const
Definition: Cuts.cc:241
std::vector< Interaction > truth
All truth interactions.
Definition: Event.hh:232