All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Profile.cc
Go to the documentation of this file.
1 #include "Profile.h"
2 #include "TH2D.h"
3 #include "TH3D.h"
4 
5 #include "../NumuReco/TrackAlgo.h"
6 
7 namespace ana {
8  namespace SBNOsc {
9 
10 void TrackProfiles::Initialize(const std::string &postfix, unsigned nbinsx, double xlo, double xhi) {
11 #define TRACK_PROFILE(name, nbinsy, ylo, yhi) name = new TH2D((#name + postfix).c_str(), #name, nbinsx, xlo, xhi, nbinsy, ylo, yhi); StoreHisto(name);
12 #define TRACK_PROFILE3D(name, nbinsy, ylo, yhi, nbinsz, zlo, zhi) name = new TH3D((#name + postfix).c_str(), #name, nbinsx, xlo, xhi, nbinsy, ylo, yhi, nbinsz, zlo, zhi); StoreHisto(name)
13  TRACK_PROFILE3D(range_v_true_mom, 50, 0., 2.5, 50, 0., 2.5);
14  TRACK_PROFILE3D(mcs_v_true_mom, 50, 0., 2.5, 50, 0., 2.5);
15 
16  TRACK_PROFILE3D(range_minus_true, 50, 0., 2.5, 50, -1., 1.);
17  TRACK_PROFILE3D(mcs_minus_true, 50, 0., 2.5, 50, -1., 1.);
18  TRACK_PROFILE3D(pid_confusion_tr, 2, -0.5, 1.5, 2, -0.5, 1.5);
19 #undef TRACK_PROFILE3D
20 #undef TRACK_PROFILE
21 }
22 
23 
24 void TrackProfiles::Fill(float val, const numu::RecoTrack &track, const numu::RecoEvent &event) {
25 
26  if (track.match.has_match) {
27  const numu::TrueParticle &true_particle = event.particles.at(track.match.mcparticle_id);
28 
29  range_v_true_mom->Fill(val, true_particle.start_momentum.Mag(), numu::RangeMomentum(track));
30  mcs_v_true_mom->Fill(val, true_particle.start_momentum.Mag(), numu::MCSMomentum(track));
31 
32  range_minus_true->Fill(val, true_particle.start_momentum.Mag(), (numu::RangeMomentum(track) - true_particle.start_momentum.Mag()) / true_particle.start_momentum.Mag());
33  mcs_minus_true->Fill(val, true_particle.start_momentum.Mag(), (numu::MCSMomentum(track) - true_particle.start_momentum.Mag()) / true_particle.start_momentum.Mag());
34  }
35  if (track.min_chi2 > 0) {
36  bool is_proton_reco = track.chi2_proton < track.chi2_muon;
37  if (track.match.has_match) {
38  bool is_proton_true = abs(track.match.match_pdg) == 2212;
39  bool is_muon_true = abs(track.match.match_pdg) == 13;
40  if (is_proton_true || is_muon_true) {
41  pid_confusion_tr->Fill(val, is_proton_true, is_proton_reco);
42  }
43  }
44  }
45 }
46 
47  } // end namespace SBNOsc
48 } // end namespace ana
49 
TVector3 start_momentum
Particle directional momentum for first trajectory point inside TPC AV [GeV].
Definition: TrueParticle.h:24
float chi2_muon
Chi2 of dE/dx to muon hypotheis. Combined agaisnt all planes.
Definition: RecoTrack.h:43
int mcparticle_id
MCParticle ID of the particle this track matches to (same as the ID of the RecoTrack of that particle...
float min_chi2
Minimum chi2 value across all hypotheses.
Definition: RecoTrack.h:44
process_name use argoneut_mc_hitfinder track
process_name opflashCryoW ana
#define TRACK_PROFILE3D(name, nbinsy, ylo, yhi, nbinsz, zlo, zhi)
T abs(T value)
float RangeMomentum(const numu::RecoTrack &track)
Definition: TrackAlgo.cc:15
float MCSMomentum(const numu::RecoTrack &track)
Definition: TrackAlgo.cc:20
bool has_match
Whether a track match exists.
TrackTruthMatch match
Truth matching information.
Definition: RecoTrack.h:57
void Initialize(const std::string &postfix, unsigned nbinsx, double xlo, double xhi)
Definition: Profile.cc:10
int match_pdg
PDG of the MCParticle this track matches to.
float chi2_proton
Chi2 of dE/dx to proton hypothesis. Combined against all planes.
Definition: RecoTrack.h:40
void Fill(float val, const numu::RecoTrack &track, const numu::RecoEvent &event)
Definition: Profile.cc:24