All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SimPhotonPrinter.cc
Go to the documentation of this file.
1 /**
2  * \file SimPhotonPrinter.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 
20 #include "fhiclcpp/ParameterSet.h"
22 
23 #include "TH1D.h"
24 #include "TGraph.h"
25 
26 namespace ana {
27  namespace SBNOsc {
28 
29 /**
30  * \class SimPhotonPrinter
31  * \brief Electron neutrino event selection
32  */
34 public:
35  /** Constructor. */
37 
38  /**
39  * Initialization.
40  *
41  * \param config A configuration, as a FHiCL ParameterSet object
42  */
43  void Initialize(fhicl::ParameterSet* config=NULL) {
44  fSimPhotonTag = config ? config->get<std::string>("SimPhotonTag", "largeant") : "largeant";
45  event_ind = 0;
46  }
47 
48  /** Finalize and write objects to the output file. */
49  void Finalize() {
50  }
51 
52  /**
53  * Process one event.
54  *
55  * \param ev A single event, as a gallery::Event
56  * \param Reconstructed interactions
57  * \return True to keep event
58  */
59  bool ProcessEvent(const gallery::Event& ev, const std::vector<event::Interaction> &truth, std::vector<event::RecoInteraction>& reco) {
60  std::cout << "New Event!\n";
61  const std::vector<sim::SimPhotons> &sim_photons = *ev.getValidHandle<std::vector<sim::SimPhotons>>(fSimPhotonTag);
62  for (const sim::SimPhotons &photons: sim_photons) {
63  std::cout << "OpChannel: " << photons.OpChannel() << std::endl;
64  for (const sim::OnePhoton &photon: photons) {
65  std::cout << "Photon: " << photon.Time << " Mother: " << photon.MotherTrackID << std::endl;
66  }
67  }
68  return false;
69  }
70 
71 protected:
72  std::string fSimPhotonTag;
73  unsigned event_ind;
74 };
75 
76  } // namespace SBNOsc
77 } // namespace ana
79 
void Initialize(fhicl::ParameterSet *config=NULL)
process_name can override from command line with o or output photon
Definition: runPID.fcl:28
All information of a photon entering the sensitive optical detector volume.
Definition: SimPhotons.h:64
process_name opflashCryoW ana
Simulation objects for optical detectors.
process_name standard_reco_uboone reco
Electron neutrino event selection.
bool ProcessEvent(const gallery::Event &ev, const std::vector< event::Interaction > &truth, std::vector< event::RecoInteraction > &reco)
#define DECLARE_SBN_PROCESSOR(classname)
Base class for event selections.
Collection of photons which recorded on one channel.
Definition: SimPhotons.h:136
BEGIN_PROLOG could also be cout