RecoObjectsTutorial_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: RecoObjectsTutorial
3 // Module Type: analyzer
4 // File: RecoObjectsTutorial_module.cc
5 //
6 // Generated at Sat Oct 15 17:37:56 2016 by Justin Vasel using artmod
7 // from cetpkgsupport v1_10_02.
8 ////////////////////////////////////////////////////////////////////////
9 
10 // ART includes
18 #include "fhiclcpp/ParameterSet.h"
20 
21 // NOvA includes
22 #include "RecoBaseHit/CellHit.h"
23 #include "RecoBaseHit/RecoHit.h"
24 #include "RecoBase/Cluster.h"
25 #include "RecoBase/Track.h"
26 #include "RecoBase/Prong.h"
27 #include "RecoBase/Vertex.h"
28 
29 namespace tut {
30  namespace reco2016 {
31  class RecoObjectsTutorial;
32  }
33 }
34 
36 public:
37  explicit RecoObjectsTutorial(fhicl::ParameterSet const & p);
38 
39  RecoObjectsTutorial(RecoObjectsTutorial const &) = delete;
43 
44  // Required functions.
45  void analyze(art::Event const & e) override;
46 
47 private:
48 
49  std::string fCellHitLabel; ///< module label for CellHit
50  std::string fSliceLabel; ///< module label for Cluster
51  std::string fCosmicTrackLabel; ///< module label for Track
52  std::string fBreakpointTrackLabel; ///< module label for Track
53  std::string fVertexLabel; ///< module label for Vertex
54  std::string fProngLabel; ///< module label for Prong
55 
56 };
57 
58 
60  :
61  EDAnalyzer(p),
62  fCellHitLabel(p.get<std::string>("CellHitLabel")),
63  fSliceLabel(p.get<std::string>("SliceLabel")),
64  fCosmicTrackLabel(p.get<std::string>("CosmicTrackLabel")),
65  fBreakpointTrackLabel(p.get<std::string>("BreakpointTrackLabel")),
66  fVertexLabel(p.get<std::string>("VertexLabel")),
67  fProngLabel(p.get<std::string>("ProngLabel"))
68 {}
69 
71 {
72  // NOTE: First we start by getting the objects that we want from ART.
73 
74  // Grab the cell hits with module label fCellHitLabel ("calhit")
76  e.getByLabel(fCellHitLabel, cellHits);
77 
78  // Grab the clusters with module label fSliceLabel ("slicer")
80  e.getByLabel(fSliceLabel, slices);
81 
82  // Grab the tracks with module label fCosmicTrackLabel ("cosmictrack")
84  e.getByLabel(fCosmicTrackLabel, cosmicTracks);
85 
86  // Grab the tracks with module label fBreakpointTrackLabel ("breakpoint")
88  e.getByLabel(fBreakpointTrackLabel, bpTracks);
89 
90  // Grab the vertexs with module label fVertexLabel ("elasticarms")
92  e.getByLabel(fVertexLabel, verticies);
93 
94  // Grab the prongs with module label fProngLabel ("fuzzykvertex")
96  e.getByLabel(fProngLabel, prongs);
97 
98 
99  // NOTE: Now that we've received these objects from ART, we can do fun
100  // things with them. Thesis, here I come!
101 
102 
103  // NOTE: Maybe I just want to start by looking at the ADC spectrum in these
104  // events. This is a job for a CellHit.
105 
106  // I'm going to convert from art::Handle to std::vector to make things
107  // to read. This is mostly personal preference. (see more here:
108  // https://cdcvs.fnal.gov/redmine/projects/novaart/wiki/Using_the_Framework#artHandle)
109  const std::vector<rb::CellHit>& cellHitVector(*cellHits);
110 
111  // How many cell hits are there?
112  std::cout << "There are " << cellHitVector.size() << " cell hits in this event. ";
113 
114  // Loop over cell hits and fill this vector of ADC values
115  std::vector<int> adcValues;
116  for (rb::CellHit aCellHit : cellHitVector) {
117  adcValues.push_back(aCellHit.ADC());
118  }
119 
120  // Now find the max ADC value in the vector
121  int maxADC = *std::max_element(adcValues.begin(), adcValues.end());
122  std::cout << "The maximum ADC value is: " << maxADC << std::endl;
123 
124 }
125 
126 // Magic. Do not touch this
std::string fCosmicTrackLabel
module label for Track
void analyze(art::Event const &e) override
const char * p
Definition: xmltok.h:285
std::string fProngLabel
module label for Prong
std::string fSliceLabel
module label for Cluster
DEFINE_ART_MODULE(TestTMapFile)
std::string fBreakpointTrackLabel
module label for Track
RecoObjectsTutorial(fhicl::ParameterSet const &p)
TODO.
std::string fCellHitLabel
module label for CellHit
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
Vertex location in position and time.
OStream cout
Definition: OStream.cxx:6
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
std::string fVertexLabel
module label for Vertex
RecoObjectsTutorial & operator=(RecoObjectsTutorial const &)=delete
Float_t e
Definition: plot.C:35
enum BeamMode string