All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PandoraIDPrinter.cc
Go to the documentation of this file.
1 /**
2  * \file PandoraIDPrinter.cc
3  *
4  *
5  * Author:
6  */
7 
8 #include <iostream>
9 #include <array>
10 
11 #include "canvas/Utilities/InputTag.h"
12 #include "core/SelectionBase.hh"
13 #include "core/Event.hh"
14 #include "core/Experiment.hh"
15 #include "core/ProviderManager.hh"
16 
22 #include "canvas/Persistency/Common/FindManyP.h"
23 #include "fhiclcpp/ParameterSet.h"
24 
25 #include "TH1D.h"
26 #include "TGraph.h"
27 
28 namespace ana {
29  namespace SBNOsc {
30 
31 /**
32  * \class PandoraIDPrinter
33  * \brief Electron neutrino event selection
34  */
36 public:
37  /** Constructor. */
39 
40  /**
41  * Initialization.
42  *
43  * \param config A configuration, as a FHiCL ParameterSet object
44  */
45  void Initialize(fhicl::ParameterSet* config=NULL) {
46  fPandoraTags = config ? config->get<std::vector<std::string>>("PandoraTags", {"pandora"}) : std::vector<std::string>(1,"pandora");
47  fPandoraTrackTags = config ? config->get<std::vector<std::string>>("PandoraTags", {"pandoraTrack"}) : std::vector<std::string>(1,"pandoraTrack");
48  event_ind = 0;
49  }
50 
51  /** Finalize and write objects to the output file. */
52  void Finalize() {
53  }
54 
55  /**
56  * Process one event.
57  *
58  * \param ev A single event, as a gallery::Event
59  * \param Reconstructed interactions
60  * \return True to keep event
61  */
62  bool ProcessEvent(const gallery::Event& ev, const std::vector<event::Interaction> &truth, std::vector<event::RecoInteraction>& reco) {
63  for (unsigned j = 0; j < fPandoraTags.size(); j++) {
64  auto const &tracks_handle = ev.getValidHandle<std::vector<recob::Track>>(fPandoraTrackTags[j]);;
65  art::FindManyP<recob::PFParticle, void> tracks_to_particles(tracks_handle, ev, fPandoraTrackTags[j]);
66  const std::vector<recob::Track> &tracks = *tracks_handle;
67  std::cout << "TAG: " << fPandoraTrackTags[j] << std::endl;
68  for (unsigned i = 0; i < tracks.size(); i++) {
69  unsigned pfp_id = tracks_to_particles.at(i).at(0)->Self();
70  std::cout << "Index: " << i << " track ID: " << tracks[i].ID() << " pfp id: " << pfp_id <<std::endl;
71  }
72  }
73  return false;
74  }
75 
76 protected:
77  std::vector<std::string> fPandoraTags;
78  std::vector<std::string> fPandoraTrackTags;
79  unsigned event_ind;
80 };
81 
82  } // namespace SBNOsc
83 } // namespace ana
85 
bool ProcessEvent(const gallery::Event &ev, const std::vector< event::Interaction > &truth, std::vector< event::RecoInteraction > &reco)
std::vector< std::string > fPandoraTags
ClusterModuleLabel join with tracks
Electron neutrino event selection.
process_name opflashCryoW ana
void Initialize(fhicl::ParameterSet *config=NULL)
process_name standard_reco_uboone reco
#define DECLARE_SBN_PROCESSOR(classname)
Base class for event selections.
Provides recob::Track data product.
std::vector< std::string > fPandoraTrackTags
BEGIN_PROLOG could also be cout