All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
ana::SBNOsc::TrackHistos Struct Reference

#include <TrackHisto.h>

Inheritance diagram for ana::SBNOsc::TrackHistos:
ana::SBNOsc::HistoList

Public Member Functions

void Initialize (const std::string &postfix, const geo::BoxBoundedGeo &detector_volume, double max_length)
 
void Fill (const numu::RecoTrack &track, const std::map< size_t, numu::TrueParticle > &true_particles)
 
- Public Member Functions inherited from ana::SBNOsc::HistoList
void Scale (double scale)
 
void Add (const HistoList &other)
 
void Write ()
 
void StoreHisto (TH1 *histo)
 
void Merge (const HistoList &merge)
 

Public Attributes

TH1D * chi2_proton_diff
 
TH1D * chi2_muon_diff
 
TH1D * chi2_pion_diff
 
TH1D * chi2_kaon_diff
 
TH1D * chi2_proton
 
TH1D * chi2_muon
 
TH1D * chi2_pion
 
TH1D * chi2_kaon
 
TH1D * chi2_proton_m_muon
 
TH1D * range_p
 
TH1D * mcs_p
 
TH1D * range_p_minus_truth
 
TH1D * mcs_p_minus_truth
 
TH2D * lengh_munus_truth_length
 
TH2D * range_p_minus_truth_length
 
TH2D * mcs_p_minus_truth_length
 
TH1D * length
 
TH1D * artlength
 
TH1D * lengthdiff
 
TH1D * reco_momentum
 
TH1D * is_contained
 
TH1D * completion
 
TH2D * range_p_diff
 
TH2D * mcs_p_diff
 
TH2D * range_p_comp
 
TH2D * mcs_p_comp
 
TH2D * dQdx_length
 
TH1D * border_y
 
TH1D * border_z
 
TH1D * border_x
 
TH1D * true_start_time
 
TH1D * true_start_time_zoom
 
TH1D * wall_enter
 
TH1D * wall_exit
 
TH1D * has_crt_track_match
 
TH1D * has_crt_hit_match
 
TH1D * crt_hit_distance
 
TH1D * crt_track_angle
 
TH1D * crt_match_time
 
TH1D * stopping_chisq_start
 
TH1D * stopping_chisq_finish
 
TH1D * stopping_chisq
 
TH1D * flash_match_time
 
TH1D * crt_v_flash_match_time
 
TH2D * pid_confusion_tr
 
- Public Attributes inherited from ana::SBNOsc::HistoList
std::vector< TH1 * > fAllHistos
 
std::vector< TDirectory * > fLocations
 

Detailed Description

Histograms to be filled per track

Definition at line 20 of file TrackHisto.h.

Member Function Documentation

void TrackHistos::Fill ( const numu::RecoTrack track,
const std::map< size_t, numu::TrueParticle > &  true_particles 
)

Fill all of the histograms in this class with a track

Parameters
trackThe track to fill
true_tracksThe list of true particles in this event

Definition at line 90 of file TrackHisto.cc.

92  {
93 
94  // Primary track histos
95  if (track.min_chi2 > 0) {
96  chi2_proton_diff->Fill(track.chi2_proton - track.min_chi2);
97  chi2_muon_diff->Fill(track.chi2_muon - track.min_chi2);
98  chi2_pion_diff->Fill(track.chi2_pion - track.min_chi2);
99  chi2_kaon_diff->Fill(track.chi2_kaon - track.min_chi2);
100 
101  chi2_muon->Fill(track.chi2_muon/track.pid_n_dof);
102  chi2_kaon->Fill(track.chi2_kaon/track.pid_n_dof);
103  chi2_pion->Fill(track.chi2_pion/track.pid_n_dof);
104  chi2_proton->Fill(track.chi2_proton/track.pid_n_dof);
105 
106  chi2_proton_m_muon->Fill(track.chi2_proton - track.chi2_muon);
107 
108  bool is_proton_reco = track.chi2_proton < track.chi2_muon;
109  if (track.match.has_match) {
110  bool is_proton_true = abs(track.match.match_pdg) == 2212;
111  bool is_muon_true = abs(track.match.match_pdg) == 13;
112  if (is_proton_true || is_muon_true) {
113  pid_confusion_tr->Fill(is_proton_true, is_proton_reco);
114  }
115  }
116  }
117 
118  range_p->Fill(numu::RangeMomentum(track));
119  mcs_p->Fill(numu::MCSMomentum(track));
120 
121  length->Fill(track.length);
122 
123  reco_momentum->Fill(numu::TrackMomentum(track));
124  is_contained->Fill(track.is_contained);
125 
126  //dQdx_length->Fill(track.mean_trucated_dQdx, track.length);
127 
128  if (std::min(abs(track.start.Y() - border_y->GetBinLowEdge(1)),
129  abs(track.start.Y() - (border_y->GetBinLowEdge(border_y->GetNbinsX()) + border_y->GetBinWidth(border_y->GetNbinsX()))))
130  < std::min(abs(track.end.Y() - border_y->GetBinLowEdge(1)),
131  abs(track.end.Y() - (border_y->GetBinLowEdge(border_y->GetNbinsX()) + border_y->GetBinWidth(border_y->GetNbinsX()))))) {
132  border_y->Fill(track.start.Y());
133  }
134  else {
135  border_y->Fill(track.end.Y());
136  }
137 
138  if (std::min(abs(track.start.X() - border_x->GetBinLowEdge(1)),
139  abs(track.start.X() - (border_x->GetBinLowEdge(border_x->GetNbinsX()) + border_x->GetBinWidth(border_x->GetNbinsX()))))
140  < std::min(abs(track.end.X() - border_x->GetBinLowEdge(1)),
141  abs(track.end.X() - (border_x->GetBinLowEdge(border_x->GetNbinsX()) + border_x->GetBinWidth(border_x->GetNbinsX()))))) {
142  border_x->Fill(track.start.X());
143  }
144  else {
145  border_x->Fill(track.end.X());
146  }
147 
148  if (std::min(abs(track.start.Z() - border_z->GetBinLowEdge(1)),
149  abs(track.start.Z() - (border_z->GetBinLowEdge(border_z->GetNbinsX()) + border_z->GetBinWidth(border_z->GetNbinsX()))))
150  < std::min(abs(track.end.Z() - border_z->GetBinLowEdge(1)),
151  abs(track.end.Z() - (border_z->GetBinLowEdge(border_z->GetNbinsX()) + border_z->GetBinWidth(border_z->GetNbinsX()))))) {
152  border_z->Fill(track.start.Z());
153  }
154  else {
155  border_z->Fill(track.end.Z());
156  }
157 
160  if (track.crt_match.track.present) {
161  crt_match_time->Fill(track.crt_match.track.time);
162  crt_track_angle->Fill(track.crt_match.track.angle);
163  }
164  else if (track.crt_match.hit_match.present) {
165  crt_match_time->Fill(track.crt_match.hit_match.time);
167  }
168 
169  /*
170  has_flash_match->Fill(track.flash_match.present);
171  if (track.flash_match.present) {
172  const numu::FlashMatch &flash_match = track.flash_match;
173  double flash_time = flash_match.match_time_first;
174  flash_match_time->Fill(flash_time);
175  if (track.crt_match.track.present) {
176  crt_v_flash_match_time->Fill(track.crt_match.track.time - flash_time);
177  }
178  else if (track.crt_match.hit_match.present) {
179  crt_v_flash_match_time->Fill(track.crt_match.hit_match.time - flash_time);
180  }
181  }*/
182 
183  // check if truth match
184  if (track.match.has_match && track.match.mcparticle_id >= 0) {
185  const numu::TrueParticle &true_particle = true_particles.at(track.match.mcparticle_id);
186  range_p_minus_truth->Fill((numu::RangeMomentum(track) - true_particle.start_momentum.Mag()) / true_particle.start_momentum.Mag());
187  mcs_p_minus_truth->Fill((numu::MCSMomentum(track) - true_particle.start_momentum.Mag()) / true_particle.start_momentum.Mag());
188 
189  range_p_minus_truth_length->Fill(track.length, (numu::RangeMomentum(track) - true_particle.start_momentum.Mag()) / true_particle.start_momentum.Mag());
190  mcs_p_minus_truth_length->Fill(track.length, (numu::MCSMomentum(track) - true_particle.start_momentum.Mag()) / true_particle.start_momentum.Mag());
191  lengh_munus_truth_length->Fill(track.length, (track.length - true_particle.length) / true_particle.length);
192 
193  //range_p_diff->Fill(true_particle.start_momentum.Mag(), numu::RangeMomentum(track) - true_particle.start_momentum.Mag());
194  //mcs_p_diff->Fill(true_particle.start_momentum.Mag(), numu::MCSMomentum(track) - true_particle.start_momentum.Mag());
195 
196  range_p_comp->Fill(true_particle.start_momentum.Mag(), numu::RangeMomentum(track));
197  mcs_p_comp->Fill(true_particle.start_momentum.Mag(), numu::MCSMomentum(track));
198 
199  completion->Fill(track.match.completion);
200 
201  wall_enter->Fill(true_particle.wall_enter);
202  wall_exit->Fill(true_particle.wall_exit);
203  true_start_time->Fill(true_particle.start_time);
204  true_start_time_zoom->Fill(true_particle.start_time);
205  }
206  else {
207  completion->Fill(-0.5);
208  }
209 
212 
215 
216 }
Track track
CRT Track match.
Definition: CRTMatch.h:30
TVector3 start_momentum
Particle directional momentum for first trajectory point inside TPC AV [GeV].
Definition: TrueParticle.h:24
bool is_contained
is it contained in the &quot;containment volume&quot;?
Definition: RecoTrack.h:52
float chi2_muon
Chi2 of dE/dx to muon hypotheis. Combined agaisnt all planes.
Definition: RecoTrack.h:43
float chi2_kaon
Chi2 of dE/dx to kaon hypotheis. Combined against all planes.
Definition: RecoTrack.h:41
float distance
//!&lt; Distance from projected track to CRT Hit. Nonsense if present is false.
Definition: CRTMatch.h:26
CRTMatch crt_match
CRTMatch.
Definition: RecoTrack.h:59
bool present
Whether this CRTMatch has a matching track.
Definition: CRTMatch.h:16
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
float length
Length of track contained in any TPC active volume [cm].
Definition: TrueParticle.h:42
float stopping_chisq_finish
Chi2 fraction of stopping vs. not-stopping hypotheis to track end point.
Definition: RecoTrack.h:64
T abs(T value)
float TrackMomentum(const numu::RecoTrack &track)
Definition: TrackAlgo.cc:5
float RangeMomentum(const numu::RecoTrack &track)
Definition: TrackAlgo.cc:15
TVector3 start
start position of track
Definition: RecoTrack.h:54
float chi2_pion
Chi2 of dE/dx to pion hypotheis. Combined against all planes.
Definition: RecoTrack.h:42
float length
Length of track.
Definition: RecoTrack.h:48
float MCSMomentum(const numu::RecoTrack &track)
Definition: TrackAlgo.cc:20
bool present
Whether this CRTMatch has a matching hit.
Definition: CRTMatch.h:25
float completion
Fraction of energy deposits by true particle matched by this track.
float stopping_chisq_start
Chi2 fraction of stopping vs. not-stopping hypothesis to track start points.
Definition: RecoTrack.h:63
bool has_match
Whether a track match exists.
TH2D * range_p_minus_truth_length
Definition: TrackHisto.h:40
TrackTruthMatch match
Truth matching information.
Definition: RecoTrack.h:57
int pid_n_dof
Number of d.o.f. in chi2 fit.
Definition: RecoTrack.h:45
float angle
Angle between TPC track and CRT track.
Definition: CRTMatch.h:18
TVector3 end
end position of track
Definition: RecoTrack.h:55
int match_pdg
PDG of the MCParticle this track matches to.
Wall wall_enter
the face of the TPC that the particle crosses on enter
Definition: TrueParticle.h:35
Wall wall_exit
the face of the TPC that the particle crosses on exit
Definition: TrueParticle.h:36
HitMatch hit_match
CRT Hit match.
Definition: CRTMatch.h:31
float start_time
start time of track
Definition: TrueParticle.h:32
float time
Matching time [us] of track. T==0 is set to beam spill start time.
Definition: CRTMatch.h:17
float chi2_proton
Chi2 of dE/dx to proton hypothesis. Combined against all planes.
Definition: RecoTrack.h:40
void TrackHistos::Initialize ( const std::string &  postfix,
const geo::BoxBoundedGeo detector_volume,
double  max_length 
)

Initialize this set of histograms

Parameters
postfixThe postfix to add to all histogram names

Definition at line 11 of file TrackHisto.cc.

11  {
12 #define TRACK_HISTO(name, n_bins, lo, hi) name = new TH1D((#name + postfix).c_str(), #name, n_bins, lo, hi); StoreHisto(name)
13 #define TRACK_2DHISTO(name, binx, lo_x, hi_x, biny, lo_y, hi_y) name = new TH2D((#name + postfix).c_str(), #name, binx, lo_x, hi_x, biny, lo_y, hi_y); StoreHisto(name)
14 
15  TRACK_HISTO(chi2_muon_diff, 100, 0., 1000.);
16  TRACK_HISTO(chi2_proton_diff, 100, 0, 1000);
17  TRACK_HISTO(chi2_kaon_diff, 100, 0, 1000);
18  TRACK_HISTO(chi2_pion_diff, 100, 0, 1000);
19 
20  TRACK_HISTO(chi2_muon, 100, 0, 100);
21  TRACK_HISTO(chi2_pion, 100, 0, 100);
22  TRACK_HISTO(chi2_kaon, 100, 0, 100);
23  TRACK_HISTO(chi2_proton, 100, 0, 100);
24 
25  TRACK_HISTO(chi2_proton_m_muon, 200, -1000, 1000);
26 
27  TRACK_HISTO(range_p, 100, 0., 2.);
28  TRACK_HISTO(mcs_p, 100, 0., 2.);
29 
30  TRACK_HISTO(range_p_minus_truth, 100, -2., 2);
31  TRACK_HISTO(mcs_p_minus_truth, 100, -2., 2.);
32 
33  TRACK_2DHISTO(range_p_minus_truth_length, 60, 0., 600., 50, -1., 1);
34  TRACK_2DHISTO(mcs_p_minus_truth_length, 60, 0., 600., 50, -1., 1.);
35  TRACK_2DHISTO(lengh_munus_truth_length, 60, 0., 600., 50, -1., 1);
36 
37  TRACK_HISTO(length, 100, 0., 600.);
38 
39  TRACK_HISTO(reco_momentum, 100, 0., 5.);
40  TRACK_HISTO(is_contained, 2, -0.5, 1.5);
41 
42  //TRACK_2DHISTO(range_p_diff, 25, 0, 2.5, 40, -2., 2.);
43  //TRACK_2DHISTO(mcs_p_diff, 25, 0., 2.5, 40, -2., 2.);
44 
45  TRACK_2DHISTO(range_p_comp, 25, 0, 2.5, 25, 0., 2.5);
46  TRACK_2DHISTO(mcs_p_comp, 25, 0., 2.5, 25, 0., 2.5);
47 
48  //TRACK_2DHISTO(dQdx_length, 100, 0., 1000., 100, 0., max_length);
49 
50  TRACK_HISTO(border_y, 400, detector_volume.MinY(), detector_volume.MaxY());
51  TRACK_HISTO(border_x, 400, detector_volume.MinX(), detector_volume.MaxX());
52  TRACK_HISTO(border_z, 500, detector_volume.MinZ(), detector_volume.MaxZ());
53  TRACK_HISTO(true_start_time, 1400, -4000., 3000.);
54  TRACK_HISTO(true_start_time_zoom, 3000, -1., 2.);
55 
56  TRACK_HISTO(wall_enter, 7, -0.5, 6.5);
57  TRACK_HISTO(wall_exit, 7, -0.5, 6.5);
58 
59  // timing histos
60  TRACK_HISTO(has_crt_track_match, 3, -0.5, 1.5);
61  TRACK_HISTO(has_crt_hit_match, 3, -0.5, 1.5);
62  TRACK_HISTO(crt_hit_distance, 80, 0., 400.);
63  TRACK_HISTO(crt_track_angle, 150, 0., 3.);
64 
65  // TRACK_HISTO(flash_match_time, 2000, -0.2, 1.8);
66  // TRACK_HISTO(crt_v_flash_match_time, 2000, -4., 4.);
67 
68  double min_matchtime_t = -1640;
69  double max_matchtime_t = 3280;
70  int n_matchtime_bins = 1000;
71 
72  double min_comptime = -0.5;
73  double max_comptime = 0.5;
74  int n_comptime_bins = 1000;
75 
76  TRACK_HISTO(crt_match_time, n_matchtime_bins, min_matchtime_t, max_matchtime_t);
77 
78  TRACK_HISTO(completion, 200, -1, 1);
79 
80  TRACK_HISTO(stopping_chisq_start, 100, 0., 10.);
81  TRACK_HISTO(stopping_chisq_finish, 100, 0., 10.);
82  TRACK_HISTO(stopping_chisq, 100., 0., 10.);
83 
84  TRACK_2DHISTO(pid_confusion_tr, 2, -0.5, 1.5, 2, -0.5, 1.5);
85 
86 #undef TRACK_HISTO
87 #undef TRACK_2DHISTO
88 }
#define TRACK_2DHISTO(name, binx, lo_x, hi_x, biny, lo_y, hi_y)
double MinX() const
Returns the world x coordinate of the start of the box.
Definition: BoxBoundedGeo.h:88
double MaxX() const
Returns the world x coordinate of the end of the box.
Definition: BoxBoundedGeo.h:91
double MinZ() const
Returns the world z coordinate of the start of the box.
#define TRACK_HISTO(name, n_bins, lo, hi)
double MaxY() const
Returns the world y coordinate of the end of the box.
TH2D * range_p_minus_truth_length
Definition: TrackHisto.h:40
double MaxZ() const
Returns the world z coordinate of the end of the box.
double MinY() const
Returns the world y coordinate of the start of the box.

Member Data Documentation

TH1D* ana::SBNOsc::TrackHistos::artlength

Definition at line 45 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::border_x

Definition at line 61 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::border_y

Definition at line 59 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::border_z

Definition at line 60 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::chi2_kaon

Definition at line 29 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::chi2_kaon_diff

Definition at line 24 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::chi2_muon

Definition at line 27 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::chi2_muon_diff

Definition at line 22 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::chi2_pion

Definition at line 28 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::chi2_pion_diff

Definition at line 23 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::chi2_proton

Definition at line 26 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::chi2_proton_diff

Definition at line 21 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::chi2_proton_m_muon

Definition at line 31 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::completion

Definition at line 50 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::crt_hit_distance

Definition at line 70 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::crt_match_time

Definition at line 73 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::crt_track_angle

Definition at line 71 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::crt_v_flash_match_time

Definition at line 80 of file TrackHisto.h.

TH2D* ana::SBNOsc::TrackHistos::dQdx_length

Definition at line 58 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::flash_match_time

Definition at line 79 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::has_crt_hit_match

Definition at line 69 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::has_crt_track_match

Definition at line 68 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::is_contained

Definition at line 48 of file TrackHisto.h.

TH2D* ana::SBNOsc::TrackHistos::lengh_munus_truth_length

Definition at line 39 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::length

Definition at line 44 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::lengthdiff

Definition at line 46 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::mcs_p

Definition at line 34 of file TrackHisto.h.

TH2D* ana::SBNOsc::TrackHistos::mcs_p_comp

Definition at line 56 of file TrackHisto.h.

TH2D* ana::SBNOsc::TrackHistos::mcs_p_diff

Definition at line 53 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::mcs_p_minus_truth

Definition at line 37 of file TrackHisto.h.

TH2D* ana::SBNOsc::TrackHistos::mcs_p_minus_truth_length

Definition at line 41 of file TrackHisto.h.

TH2D* ana::SBNOsc::TrackHistos::pid_confusion_tr

Definition at line 82 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::range_p

Definition at line 33 of file TrackHisto.h.

TH2D* ana::SBNOsc::TrackHistos::range_p_comp

Definition at line 55 of file TrackHisto.h.

TH2D* ana::SBNOsc::TrackHistos::range_p_diff

Definition at line 52 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::range_p_minus_truth

Definition at line 36 of file TrackHisto.h.

TH2D* ana::SBNOsc::TrackHistos::range_p_minus_truth_length

Definition at line 40 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::reco_momentum

Definition at line 47 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::stopping_chisq

Definition at line 77 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::stopping_chisq_finish

Definition at line 76 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::stopping_chisq_start

Definition at line 75 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::true_start_time

Definition at line 62 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::true_start_time_zoom

Definition at line 63 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::wall_enter

Definition at line 65 of file TrackHisto.h.

TH1D* ana::SBNOsc::TrackHistos::wall_exit

Definition at line 66 of file TrackHisto.h.


The documentation for this struct was generated from the following files: