All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OpHitFinderICARUS_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: OpHitFinderICARUS
3 // Plugin Type: producer (art v2_09_06)
4 // File: OpHitFinderICARUS_module.cc
5 //
6 // Generated at Wed Feb 14 15:51:50 2018 by Andrea Falcone using cetskelgen
7 // from cetlib version v3_01_03.
8 ////////////////////////////////////////////////////////////////////////
9 
10 #include <sys/types.h>
11 #include <sys/stat.h>
12 
13 // LArSoft includes
30 
31 // Framework includes
32 #include "art/Framework/Core/EDProducer.h"
33 #include "art/Framework/Core/ModuleMacros.h"
34 #include "art/Utilities/make_tool.h"
35 #include "art/Framework/Principal/DataViewImpl.h"
36 #include "art/Framework/Principal/Event.h"
37 #include "art/Framework/Principal/Handle.h"
38 #include "art/Framework/Services/Registry/ServiceHandle.h"
39 #include "canvas/Utilities/Exception.h"
40 #include "art/Framework/Principal/Run.h"
41 #include "art/Framework/Principal/SubRun.h"
42 #include "canvas/Utilities/InputTag.h"
43 #include "fhiclcpp/ParameterSet.h"
44 #include "messagefacility/MessageLogger/MessageLogger.h"
45 
47 
48 //ROOT includes
49 #include "TF1.h"
50 #include "TGraph.h"
51 #include "TH1D.h"
52 #include "TFile.h"
53 #include "TTree.h"
54 #include "TMath.h"
55 
56 #include <memory>
57 #include <vector>
58 #include <cmath>
59 #include <string>
60 #include <map>
61 #include <sstream>
62 #include <fstream>
63 
64 namespace ophit{
65 
66 //class OpHitFinderICARUS;
67 
68 class OpHitFinderICARUS : public art::EDProducer
69 {
70 public:
71  explicit OpHitFinderICARUS(fhicl::ParameterSet const & p);
72  // The compiler-generated destructor is fine for non-base
73  // classes without bare pointers or other resource use.
74 
75  // Plugins should not be copied or assigned.
76  OpHitFinderICARUS(OpHitFinderICARUS const &) = delete;
80 
81  // Required functions.
82  void produce(art::Event & e) override;
83 
84 private:
85 
86  size_t fEvNumber;
87 
88  std::string fInputModuleName;
89 
90  std::unique_ptr<light::IOpHitFinder> fOpHitFinder;
91 };
92 
93 OpHitFinderICARUS::OpHitFinderICARUS(fhicl::ParameterSet const & p) : EDProducer{p}
94 {
95  produces<std::vector<recob::OpHit>>();
96 
97  fInputModuleName = p.get< std::string >("InputModule" );
98 
99  fOpHitFinder = art::make_tool<light::IOpHitFinder> (p.get<fhicl::ParameterSet>("OpHitFinder"));
100 }
101 
102 void OpHitFinderICARUS::produce(art::Event & e)
103 {
104  std::cout << "My module on event #" << e.id().event() << std::endl;
105 
106  //art::ServiceHandle<art::TFileService> tfs;
107  fEvNumber = e.id().event();
108 
109  std::unique_ptr<std::vector<recob::OpHit>> pulseVecPtr(std::make_unique<std::vector<recob::OpHit>>());
110 
111  art::Handle< std::vector< raw::OpDetWaveform > > wfHandle;
112  e.getByLabel(fInputModuleName, wfHandle);
113 
114  if(!wfHandle.isValid())
115  {
116  std::cout <<Form("Did not find any G4 photons from a producer: %s", "largeant") << std::endl;
117  }
118 
119  std::cout << "Dimensione primo " << wfHandle->size() << std::endl;
120 
121 // for(size_t wftime; wftime< wfHandle.size(); wftime++)
122  for(auto const& wvf : (*wfHandle))
123  {
124  light::OpHitVec opHitVec;
125 
126  fOpHitFinder->FindOpHits(wvf, opHitVec);
127 
128  for(auto& opHit : opHitVec)
129  pulseVecPtr->emplace_back(opHit);
130  }
131  // Store results into the event
132  e.put(std::move(pulseVecPtr));
133 }
134 
135 DEFINE_ART_MODULE(OpHitFinderICARUS)
136 
137 }
pdgs p
Definition: selectors.fcl:22
Class definition file of PedAlgoRollingMean.
Class definition file of AlgoCFD.
Class definition file of PedAlgoUB.
This provides an interface for tools which are tasked with finding the baselines in input waveforms...
OpHitFinderICARUS(fhicl::ParameterSet const &p)
std::unique_ptr< light::IOpHitFinder > fOpHitFinder
void produce(art::Event &e) override
Class definition file of AlgoFixedWindow.
BEGIN_PROLOG opflashCryoW opflashCryoW triggerfilterBNB triggerfilterNuMI triggerfilterOffbeamBNB triggerfilterOffbeamNuMI triggerfilterUnknown roifinder roifinder2d gaushitTPCEE gaushitTPCWE purityana1 ophit
Class definition file of AlgoSlidingWindow.
Class definition file of AlgoThreshold.
do i e
Class definition file of PMTPulseRecoBase.
Class definition file of PedAlgoEdges.
OpHitFinderICARUS & operator=(OpHitFinderICARUS const &)=delete
std::vector< recob::OpHit > OpHitVec
Definition: IOpHitFinder.h:26
art framework interface to geometry description
BEGIN_PROLOG could also be cout
Class definition file of PulseRecoManager.