LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
PMTAna_module.cc
Go to the documentation of this file.
1 
14 #ifndef PMTAna_H
15 #define PMTAna_H
16 
17 // ART includes
18 #include "fhiclcpp/ParameterSet.h"
30 
31 // LArSoft
32 //#include "OpticalDetectorData/FIFOChannel.h"
36 // STL
37 #include <set>
38 #include <vector>
39 #include <cmath>
40 #include <functional>
41 #include <numeric>
42 
43 
44 // ROOT
45 #include <TString.h>
46 #include <TTree.h>
47 // My modules
52 
53 namespace pmtana {
54 
59  class PMTAna : public art::EDAnalyzer{
60 
61  public:
62 
65 
67  virtual ~PMTAna();
68 
70  void beginJob(){}
71 
73  void beginSubRun(const art::SubRun& /*srun*/){}
74 
76  void analyze (const art::Event&);
77 
78  private:
79 
80 
82  void ClearEventData();
83 
84  std::string _fifo_mod_name;
85  TTree* _tree;
86 
91  };
92 
93 }
94 
95 #endif// PMTAna_H
96 
97 // PMTAna.cc
98 
99 // Framework includes
101 
102 namespace pmtana {
104 }
105 
106 namespace pmtana {
107 
108  //#######################################################################################################
110  EDAnalyzer(pset),
111  _preco_man(),
112  _th_algo(),
113  _fw_algo(),
114  _ped_algo()
115  //#######################################################################################################
116  {
117 
118  // Obtain module names for input data
119  _fifo_mod_name = pset.get<std::string>("fModName_FIFOChannel" );
120 
121  // Next we make storage data class objects for those data types specified in fcl files.
123 
124  // Create TTree
125  _tree = fileService->make<TTree>("pmt_tree","Analysis Tree");
126 
127  //
128  // Demonstration purpose ...
129  //
133 
134  }
135 
137 
138  //#######################################################################################################
140  //#######################################################################################################
141  {
142  }
143 
144 
145  //#######################################################################################################
146  void PMTAna::analyze(const art::Event& evt)
147  //#######################################################################################################
148  {
149 
150  //data_ptr->set_event(evt.id().event(), evt.run(), evt.subRun());
151 
152 // std::vector<const optdata::FIFOChannel*> pmtArray;
153  std::vector<const raw::OpDetWaveform*> pmtArray;
154  try{
155 
156  evt.getView(_fifo_mod_name,pmtArray);
157 
158  }catch (art::Exception const& e) {
159 
160  if (e.categoryCode() != art::errors::ProductNotFound ) throw;
161 
162  }
163 
164 
165 
166 
167  for(size_t i=0; i<pmtArray.size(); ++i) {
168 
169 // const optdata::FIFOChannel* fifo_ptr(pmtArray.at(i));
170  const raw::OpDetWaveform* fifo_ptr(pmtArray.at(i));
171 
172  _preco_man.Reconstruct(*fifo_ptr);
173 
174  //
175  // here I add code to store reco-ed pulse w/ channel number
176  // OR I may make a singleton storage manager...
177 
178  /*
179  data_ptr->add_pmtfifo(fifo_ptr->ChannelNumber(),
180  fifo_ptr->Category(),
181  fifo_ptr->Frame(),
182  fifo_ptr->TimeSlice(),
183  *fifo_ptr);
184  */
185 
186  //
187  //
188  //
189  }
190 
191 
192  }
193 
194 }
195  // end of PMTAna group
void ClearEventData()
Function to clear event-wise variables.
void beginSubRun(const art::SubRun &)
Function to be called per sub run.
AlgoFixedWindow _fw_algo
TTree * _tree
output data holder TTree
void AddRecoAlgo(pmtana::PMTPulseRecoBase *algo, PMTPedestalBase *ped_algo=nullptr)
A method to set pulse reconstruction algorithm.
virtual ~PMTAna()
Destructor.
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::vector< ELEMENT const * > &result) const
Definition: DataViewImpl.h:474
void analyze(const art::Event &)
Function to be called per event.
AlgoThreshold _th_algo
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:42
bool Reconstruct(const pmtana::Waveform_t &) const
Implementation of ana_base::analyze method.
T get(std::string const &key) const
Definition: ParameterSet.h:231
PedAlgoEdges _ped_algo
std::string _fifo_mod_name
Input FIFOChannel producer name.
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
PulseRecoManager _preco_man
PMTAna(const fhicl::ParameterSet &)
Constructor.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
Class definition file of AlgoFixedWindow.
Class definition file of AlgoThreshold.
void SetDefaultPedAlgo(pmtana::PMTPedestalBase *algo)
A method to set a choice of pedestal estimation method.
Class definition file of PedAlgoEdges.
void beginJob()
Function to be called before an event loop.
Float_t e
Definition: plot.C:34
art framework interface to geometry description
Class definition file of PulseRecoManager.