4 #include "nusimdata/SimulationBase/MCTruth.h"
7 #include "../Histograms/Derived.h"
8 #include "../RecoUtils/GeoUtil.h"
9 #include "../NumuReco/TruthMatch.h"
17 const std::vector<numu::TrackSelector> &selectors,
18 const std::vector<numu::TrackFunction> &xfunctions,
19 bool fill_all_tracks) {
37 if (fill_all_tracks) {
38 for (
const auto &track_pair: event.
tracks) {
40 for (
unsigned i = 0; i <
fAllTracks.size(); i++) {
42 bool select = selectors[i](
track, part,
event.type);
50 for (
unsigned i = 0; i <
event.reco.size(); i++) {
51 std::array<bool, Cuts::nCuts> cuts = cutmaker.
ProcessRecoCuts(event, i);
58 for (
unsigned cut_i = 0; cut_i <
Cuts::nCuts; cut_i++) {
67 bool select = selectors[i](
track, part,
event.type);
69 for (
unsigned cut_i = 0; cut_i <
Cuts::nCuts; cut_i++) {
72 for (
unsigned k = 0;
k < xfunctions.size();
k++) {
86 for (
size_t cut_i=0; cut_i <
Cuts::nCuts; cut_i++) {
99 for (
unsigned i = 0; i < core.
truth.size(); i++) {
100 std::array<bool, Cuts::nTruthCuts> cuts = cutmaker.
ProcessTruthCuts(event, core, i);
115 const std::string &prefix,
116 const std::vector<std::string> &track_histo_types,
117 const std::vector<std::string> &track_profile_types,
118 const std::vector<std::tuple<unsigned, float, float>> &track_profile_xranges) {
122 std::vector<double> tagger_volume = crt_geo.
CRTLimits();
124 std::cout <<
"Limits: " << tagger_volume[0] <<
" " << tagger_volume[3] <<
" " << tagger_volume[1] <<
" " << tagger_volume[4] <<
" " << tagger_volume[2] <<
" " << tagger_volume[5] << std::endl;
127 TDirectory *d_top = gDirectory->mkdir(
"histograms");
129 if (prefix.size() != 0) {
130 d_top = d_top->mkdir(prefix.c_str());
134 d_top->mkdir(
"cosmic");
136 d_top->mkdir(
"cosmic/outtime");
137 d_top->cd(
"cosmic/outtime");
138 fCosmic[0].Initialize(
"", detector);
141 d_top->mkdir(
"cosmic/outtime_trig");
142 d_top->cd(
"cosmic/outtime_trig");
143 fCosmic[1].Initialize(
"", detector);
146 d_top->mkdir(
"cosmic/intime");
147 d_top->cd(
"cosmic/intime");
148 fCosmic[2].Initialize(
"", detector);
151 d_top->mkdir(
"cosmic/intime_trig");
152 d_top->cd(
"cosmic/intime_trig");
153 fCosmic[3].Initialize(
"", detector);
159 d_top->mkdir(
"interaction");
162 std::string cut_name = (i < truth_cut_order.size()) ? truth_cut_order[i] : cut_order[i - truth_cut_order.size()];
163 std::string postfix =
mode2Str(
mode) + prefix + cut_name;
164 std::string dirname =
"interaction/" +
mode2Str(
mode) +
"/" + cut_name;
165 d_top->mkdir(dirname.c_str());
166 d_top->cd(dirname.c_str());
173 for (
unsigned cut_i = 0; cut_i <
Cuts::nCuts; cut_i++) {
174 std::string dirname =
"crt/" + cut_order[cut_i];
175 d_top->mkdir(dirname.c_str());
176 d_top->cd(dirname.c_str());
177 fCRTs[cut_i].Initialize(
"", tagger_volume);
184 d_top->mkdir(
"ptrack");
185 d_top->mkdir(
"alltrack");
186 for (
unsigned i = 0; i < track_histo_types.size(); i++) {
191 std::string dirname = track_histo_types[i];
192 std::string all_dirname =
"alltrack/" + dirname;
194 d_top->mkdir(all_dirname.c_str());
195 d_top->cd(all_dirname.c_str());
196 fAllTracks[i].Initialize(
"", detector, max_length);
199 std::string p_dirname =
"ptrack/" + dirname + cut_order[j];
200 d_top->mkdir(p_dirname.c_str());
201 d_top->cd(p_dirname.c_str());
205 for (
unsigned k = 0;
k < track_profile_types.size();
k++) {
209 std::tie(n_bin, xlo, xhi) = track_profile_xranges[
k];
210 std::string p_profile_dirname =
"ptrack/" + dirname + cut_order[j] +
"/profile_" + track_profile_types[
k];
211 d_top->mkdir(p_profile_dirname.c_str());
212 d_top->cd(p_profile_dirname.c_str());
221 for (
unsigned i = 0; i < 4; i++) {
234 for (
unsigned i = 0; i <
fAllTracks.size(); i++) {
238 for (
unsigned k = 0;
k < track_profile_types.size();
k++) {
InteractionMode mode
Mode of the interaction.
bool HasCRTHitMatch(const numu::RecoTrack &track) const
InteractionMode GetMode(const event::Interaction &truth)
std::array< bool, nTruthCuts > ProcessTruthCuts(const numu::RecoEvent &event, const event::Event &core, unsigned truth_vertex_index, bool SequentialCuts=true) const
const geo::GeometryCore * geometry
process_name opflash particleana ie x
static std::string mode2Str(const numu::InteractionMode &mode)
CRTMatch crt_match
CRTMatch.
std::vector< std::vector< std::array< TrackProfiles, Cuts::nCuts > > > fPrimaryTrackProfiles
Profile histograms for primary tracks.
std::array< CosmicHistos, 4 > fCosmic
TruthMatch match
Info for mathing to truth.
timings intime T_reco cut_order
std::array< CRTHistos, Cuts::nCuts > fCRTs
int mcparticle_id
MCParticle ID of the particle this track matches to (same as the ID of the RecoTrack of that particle...
int primary_track_index
Index of the primary track.
InteractionHistos fInteraction[nHistos][nModes]
all the interaction histograms
geo::BoxBoundedGeo DetectorVolume(const geo::GeometryCore *geometry)
std::array< bool, nCuts > ProcessRecoCuts(const numu::RecoEvent &event, unsigned reco_vertex_index, bool fSequentialCuts=true) const
process_name use argoneut_mc_hitfinder track
static const unsigned nHistos
std::map< size_t, TrueParticle > particles
Map of indices to True particle information.
double MaxLength(const geo::GeometryCore *geometry)
process_name opflashCryoW ana
std::vector< RecoInteraction > reco
List of reconstructed vertices.
timings intime truth_cut_order
const std::vector< std::string > & TruthCutOrder() const
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
static const unsigned nCuts
total number of cuts
std::map< size_t, RecoTrack > tracks
Map of track indices to Track information.
void Fill(const numu::RecoEvent &event, const event::Event &core, const Cuts &cutmaker, const std::vector< numu::TrackSelector > &selectors, const std::vector< numu::TrackFunction > &xfunctions, bool fill_all_tracks=true)
void Initialize(const std::string &prefix, const geo::BoxBoundedGeo &detector_volume, const std::vector< double > &tagger_volume)
static constexpr numu::InteractionMode allModes[nModes]
List of all interaction modes.
void Merge(const HistoList &merge)
Description of geometry of one entire detector.
bool PassFlashTrigger(const numu::RecoEvent &event) const
void Initialize(const geo::GeometryCore *geometry, const sbnd::CRTGeoAlg &crt_geo, const Cuts &cuts, const std::string &prefix, const std::vector< std::string > &track_histo_types, const std::vector< std::string > &track_profile_types, const std::vector< std::tuple< unsigned, float, float >> &track_profile_xranges)
bool has_match
Whether a track match exists.
std::vector< std::array< TrackHistos, Cuts::nCuts > > fPrimaryTracks
Track histograms for priamry tracks in a candidate neutrino interaction.
std::vector< TrackHistos > fAllTracks
Track histograms for all tracks.
The standard event data definition.
TrackTruthMatch match
Truth matching information.
static const unsigned nTruthCuts
Total number of truth cuts.
RecoSlice slice
Particle content of the interaction.
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
std::vector< double > CRTLimits() const
void Fill(const numu::RecoInteraction &vertex, const numu::RecoEvent &event, const std::vector< event::Interaction > &core_truth)
BEGIN_PROLOG could also be cout
const std::vector< std::string > & CutOrder() const
std::vector< Interaction > truth
All truth interactions.