All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExampleSelection.h
Go to the documentation of this file.
1 #ifndef __sbnanalysis_ana_ExampleAnalysis_ExampleSelection__
2 #define __sbnanalysis_ana_ExampleAnalysis_ExampleSelection__
3 
4 /**
5  * \file ExampleSelection.h
6  *
7  * An example event selection processor.
8  *
9  * This is an implementation of the core::SelectionBase class. We define
10  * the methods called for initialization, finalization, and event-by-event
11  * processing.
12  *
13  * Author: A. Mastbaum <mastbaum@uchicago.edu>
14  */
15 
16 // Includes
17 #include <iostream>
18 #include "canvas/Utilities/InputTag.h"
19 #include "core/SelectionBase.hh"
20 #include "core/Event.hh"
21 
22 // Forward declarations
23 class TH2D;
24 
25 /** All analysis code is defined in namespace "ana" */
26 namespace ana {
27 
28  /** Code specific to the ExampleAnalysis. */
29  namespace ExampleAnalysis {
30 
31 /**
32  * \class ExampleSelection
33  * \brief An example selection analysis
34  *
35  * This selection analysis doesn't actually select events, it just
36  * demonstrates the framework!
37  */
39 public:
40  /** Constructor. */
42 
43  /**
44  * Initialization.
45  *
46  * Here we load configuration parameters, set up histograms for output, and
47  * add our own branches to the output tree.
48  *
49  * \param config A configuration, as FHiCL ParameterSet object
50  */
51  void Initialize(fhicl::ParameterSet* config=NULL);
52 
53  /** Finalize and write objects to the output file. */
54  void Finalize();
55 
56  /**
57  * Process one event.
58  *
59  * \param ev A single event, as a gallery::Event
60  * \param reco Reconstructed interactions
61  * \return True to keep event
62  */
63  bool ProcessEvent(const gallery::Event& ev,
64  const std::vector<event::Interaction>& truth,
65  std::vector<event::RecoInteraction>& reco);
66 
67 protected:
68  unsigned fEventCounter; //!< Count processed events
69 
70  /** Configuration parameters */
71  art::InputTag fTruthTag; //!< art tag for MCTruth information
72  int fMyParam; //!< A parameter from the configuration file
73 
74  /** Custom data branches */
75  int fNuCount; //!< Number of neutrino interactions in the event
76  int fMyVar; //!< Another variable of interest
77 
78  /** Histograms */
79  TH2D* fNuVertexXZHist; //!< Neutrino vertex XZ projection
80 };
81 
82  } // namespace ExampleAnalysis
83 } // namespace ana
84 
85 #endif // __sbnanalysis_ana_ExampleAnalysis_ExampleSelection__
86 
TH2D * fNuVertexXZHist
Neutrino vertex XZ projection.
void Initialize(fhicl::ParameterSet *config=NULL)
An example selection analysis.
process_name opflashCryoW ana
bool ProcessEvent(const gallery::Event &ev, const std::vector< event::Interaction > &truth, std::vector< event::RecoInteraction > &reco)
process_name standard_reco_uboone reco
Base class for event selections.
unsigned fEventCounter
Count processed events.
int fMyParam
A parameter from the configuration file.
int fNuCount
Number of neutrino interactions in the event.
int fMyVar
Another variable of interest.
art::InputTag fTruthTag
art tag for MCTruth information