#include "TFile.h"
#include "TH1F.h"
#include "TTreeReader.h"
#include "TTreeReaderValue.h"
#include "Data.h"
Go to the source code of this file.
Definition at line 8 of file TrackReducer/example_macro.cc.
10 TFile f(
"./data.root");
16 TTreeReader myReader(
"sbnana", &f);
22 TTreeReaderValue<Tracks>
tracks(myReader,
"tracks");
24 TFile out(
"output.root",
"CREATE");
27 TH1F *muon_energy =
new TH1F(
"muon_energy",
"muon_energy", 50, 0, 5);
31 TH1F *start_distance =
new TH1F(
"start_distance",
"start_distance", 50, 0, 5);
35 while (myReader.Next()) {
37 if (max_event >= 0 && event_ind == max_event)
break;
53 int primary_index = -2;
54 for (
unsigned i = 0; i <
tracks->truth.size(); i++) {
56 if (particle.
process ==
"primary") {
58 muon_energy->Fill(particle.
energy);
68 TVector3 true_start = &
tracks->truth[primary_index].trajectory[0][0];
69 TVector3 track_start = &track.
trajectory[0][0];
70 start_distance->Fill((true_start - track_start).Mag());
79 start_distance->Write();
ClusterModuleLabel join with tracks
std::vector< std::array< float, 3 > > trajectory
The reconstructed trajectory [cm].
int truth_match
Match to true particle. -1 if no truth match exists. Otherwise, is the index into the truth list...
process_name use argoneut_mc_hitfinder track
float energy
Initial energy of the particle [GeV].
std::string process
Process which created this particle.
BEGIN_PROLOG could also be cout